Skip to content

Commit

Permalink
Merge pull request OpenWebGAL#494 from OpenWebGAL/dev
Browse files Browse the repository at this point in the history
4.5.1
  • Loading branch information
MakinoharaShoko authored May 19, 2024
2 parents 31ced10 + c1d9ea6 commit 055fb81
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 50 deletions.
2 changes: 1 addition & 1 deletion packages/webgal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webgal",
"private": true,
"version": "4.5.0",
"version": "4.5.1",
"scripts": {
"dev": "vite --host --port 3000",
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
Expand Down
2 changes: 1 addition & 1 deletion packages/webgal/public/game/template/template.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name":"Default Template",
"webgal-version":"4.5.0"
"webgal-version":"4.5.1"
}
15 changes: 13 additions & 2 deletions packages/webgal/src/Core/controller/stage/pixi/PixiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default class PixiStage {
const target = this.getStageObjByKey(thisTickerFunc.targetKey);
if (target) {
const targetTransform = {
alpha: target.pixiContainer.alpha,
alpha: target.pixiContainer.alphaFilterVal,
scale: {
x: target.pixiContainer.scale.x,
y: target.pixiContainer.scale.y,
Expand Down Expand Up @@ -657,6 +657,8 @@ export default class PixiStage {
// key: key,
// pixiContainer: thisFigureContainer,
// sourceUrl: jsonPath,
// sourceType: 'live2d',
// sourceExt: 'json',
// });
// // eslint-disable-next-line @typescript-eslint/no-this-alias
// const instance = this;
Expand Down Expand Up @@ -707,9 +709,18 @@ export default class PixiStage {
// }
// instance.updateL2dExpressionByKey(key, expressionToSet);
// model.expression(expressionToSet);
// // @ts-ignore
// if (model.internalModel.eyeBlink) {
// // @ts-ignore
// model.internalModel.eyeBlink.blinkInterval = 1000 * 60 * 60 * 24; // @ts-ignore
// model.internalModel.eyeBlink.nextBlinkTimeLeft = 1000 * 60 * 60 * 24;
// }
//
// // lip-sync is still a problem and you can not.
// SoundManager.volume = 0;
// SoundManager.volume = 0; // @ts-ignore
// if (model.internalModel.angleXParamIndex !== undefined) model.internalModel.angleXParamIndex = 999; // @ts-ignore
// if (model.internalModel.angleYParamIndex !== undefined) model.internalModel.angleYParamIndex = 999; // @ts-ignore
// if (model.internalModel.angleZParamIndex !== undefined) model.internalModel.angleZParamIndex = 999;
// thisFigureContainer.addChild(model);
// });
// })();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,19 @@ export class WebGALPixiContainer extends PIXI.Container {
private baseX = 0;
private baseY = 0;

private alphaFilter = new PIXI.filters.AlphaFilter(1);

public constructor() {
super();
this.addFilter(this.alphaFilter);
}

public get alphaFilterVal() {
return this.alphaFilter.alpha;
}

public set alphaFilterVal(value: number) {
this.alphaFilter.alpha = value;
}

public addFilter(filter: PIXI.Filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export function generateTimelineObj(
targetKey: string,
duration: number,
) {
for (const segment of timeline) {
// 处理 alphaL
// @ts-ignore
segment['alphaFilterVal'] = segment.alpha;
segment.alpha = 1;
}
const target = WebGAL.gameplay.pixiStage!.getStageObjByKey(targetKey);
let currentDelay = 0;
const values = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function generateUniversalSoftInAnimationObj(targetKey: string, duration:
*/
function setStartState() {
if (target) {
target.pixiContainer.alpha = 0;
target.pixiContainer.alphaFilterVal = 0;
}
}

Expand All @@ -21,7 +21,7 @@ export function generateUniversalSoftInAnimationObj(targetKey: string, duration:
*/
function setEndState() {
if (target) {
target.pixiContainer.alpha = 1;
target.pixiContainer.alphaFilterVal = 1;
}
}

Expand All @@ -36,7 +36,7 @@ export function generateUniversalSoftInAnimationObj(targetKey: string, duration:
const currentAddOplityDelta = (duration / baseDuration) * delta;
const increasement = 1 / currentAddOplityDelta;
// const decreasement = 5 / currentAddOplityDelta;
if (sprite.alpha < 1) {
if (sprite.alphaFilterVal < 1) {
sprite.alpha += increasement;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function generateUniversalSoftOffAnimationObj(targetKey: string, duration
* 在此书写为动画设置终态的操作
*/
function setEndState() {
if (target) target.pixiContainer.alpha = 0;
if (target) target.pixiContainer.alphaFilterVal = 0;
}

/**
Expand All @@ -23,12 +23,12 @@ export function generateUniversalSoftOffAnimationObj(targetKey: string, duration
*/
function tickerFunc(delta: number) {
if (target) {
const sprite = target.pixiContainer;
const targetContainer = target.pixiContainer;
const baseDuration = WebGAL.gameplay.pixiStage!.frameDuration;
const currentAddOplityDelta = (duration / baseDuration) * delta;
const decreasement = 1 / currentAddOplityDelta;
if (sprite.alpha > 0) {
sprite.alpha -= decreasement;
if (targetContainer.alphaFilterVal > 0) {
targetContainer.alphaFilterVal -= decreasement;
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions packages/webgal/src/Core/util/prefetcher/assetsPrefetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ import { WebGAL } from '@/Core/WebGAL';
*/
export const assetsPrefetcher = (assetList: Array<IAsset>) => {
for (const asset of assetList) {
// 是否要插入这个标签
let isInsert = true;
// 判断是否已经存在
WebGAL.sceneManager.settledAssets.forEach((settledAssetUrl) => {
if (settledAssetUrl === asset.url) {
isInsert = false;
}
});
if (!isInsert) {
const hasPrefetch = WebGAL.sceneManager.settledAssets.includes(asset.url);
if (hasPrefetch) {
logger.warn('该资源已在预加载列表中,无需重复加载');
} else {
const newLink = document.createElement('link');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const syncWithOrigine = (sceneName: string, sentenceId: number) => {
const sceneUrl: string = assetSetter(sceneName, fileType.scene);
// 场景写入到运行时
sceneFetcher(sceneUrl).then((rawScene) => {
WebGAL.sceneManager.sceneData.currentScene = sceneParser(rawScene, 'start.txt', sceneUrl);
WebGAL.sceneManager.sceneData.currentScene = sceneParser(rawScene, sceneName, sceneUrl);
// 开始快进到指定语句
const currentSceneName = WebGAL.sceneManager.sceneData.currentScene.sceneName;
WebGAL.gameplay.isFast = true;
Expand Down
4 changes: 2 additions & 2 deletions packages/webgal/src/Stage/MainStage/useSetEffects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ function convertTransform(transform: ITransform | undefined) {
if (!transform) {
return {};
}
const { position, ...rest } = transform;
return { ...rest, x: position.x, y: position.y };
const { position, alpha, ...rest } = transform;
return { ...rest, x: position.x, y: position.y, alphaFilterVal: alpha };
}
2 changes: 1 addition & 1 deletion packages/webgal/src/config/info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const __INFO = {
version: 'WebGAL 4.5.0',
version: 'WebGAL 4.5.1',
contributors: [
{ username: 'Mahiru', link: 'https://github.com/MakinoharaShoko' },
{ username: 'Hoshinokinya', link: 'https://github.com/hshqwq' },
Expand Down
44 changes: 17 additions & 27 deletions releasenote.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@

#### 新功能

引入标题和文本框的 UI 自定义功能

添加了一个新的水波纹进入特效
Pixi Container 使用 AlphaFilter 代替 alpha 属性,更好地兼容 Live2D

#### 修复

WebGAL Parser 的部分问题
WebGAL 与编辑器同步的部分问题

WebSocket 连接问题
提高资源预加载效率

iOS 下字体重叠的问题
修复 moc3 Live2D 加载问题

<!-- English Translation -->
## Release Notes
Expand All @@ -31,18 +29,15 @@ iOS 下字体重叠的问题

#### New Features

Introduced UI customization for title and textbox

Added a new ripple entrance effect
Pixi Container uses AlphaFilter instead of alpha property for better Live2D compatibility

#### Fixes

Some issues in WebGAL Parser

WebSocket connection issues
Some issues with WebGAL syncing with the editor

Font overlapping issue on iOS
Improved resource preloading efficiency

Fixed moc3 Live2D loading issues

<!-- Japanese Translation -->
## リリースノート
Expand All @@ -55,18 +50,15 @@ Font overlapping issue on iOS

#### 新機能

タイトルとテキストボックスの UI カスタマイズ機能を導入

新しい波紋エフェクトを追加
Pixi Containerがalpha属性の代わりにAlphaFilterを使用するようになり、Live2Dとの互換性が向上しました。

#### 修正

WebGAL パーサーの一部問題

WebSocket 接続の問題
WebGALとエディターの同期に関するいくつかの問題を修正しました。

iOS でのフォントの重なり問題
リソースのプリロード効率を向上させました。

moc3 Live2Dのロードに関する問題を修正しました。

<!-- French Translation -->
## Notes de version
Expand All @@ -79,15 +71,13 @@ iOS でのフォントの重なり問題

#### Nouvelles fonctionnalités

Ajout de la personnalisation de l'interface utilisateur des titres et des zones de texte

Ajout d'un nouvel effet d'entrée d'ondulation
Pixi Container utilise AlphaFilter à la place de la propriété alpha, pour une meilleure compatibilité avec Live2D

#### Corrections
#### Correctifs

Quelques problèmes avec WebGAL Parser
Certains problèmes de synchronisation entre WebGAL et l'éditeur

Problèmes de connexion WebSocket
Amélioration de l'efficacité du préchargement des ressources

Problème de chevauchement des polices sous iOS
Correction du problème de chargement de Live2D moc3

0 comments on commit 055fb81

Please sign in to comment.