Skip to content

Commit

Permalink
feat: 暗角特效 BG_Filter_Gray_BG, close #258
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Oct 17, 2024
1 parent 58f40d7 commit 691e956
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 3 deletions.
31 changes: 31 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const bgEffectHandlerOptions: BGEffectHandlerOptions = {
BG_Fireworks_L_BGOff_01: {},
"BG_ScrollR_1.0": {},
BG_TvNoise_Sound: {},
BG_Filter_Gray_BG: {},
};

export const bgEffectHandlers: Record<
Expand Down Expand Up @@ -112,6 +113,7 @@ const bgEffects = [
"BG_Fireworks_L_BGOff_01",
"BG_ScrollR_1.0",
"BG_TvNoise_Sound",
"BG_Filter_Gray_BG",
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { usePlayerStore } from "@/stores";
import { Sprite } from "pixi.js";

export default async function BG_Filter_Gray_BG(resources: Sprite[]) {
// 两种思路,一种是用社区的老电影滤镜,可定制程度更高
// 另一种是参考 BG_Shining_L_BGOff 实现,给背景遮罩asset换色,不用带脑子
// 虽然两种都很简单,但后者更符合游戏内表现并且不用引入新依赖和新asset,暂时使用后者
const { app } = usePlayerStore();
const appWidth = app.view.width;
const appHeight = app.view.height;

// 加载资源,加入 tinting
const graySprite = resources[0];
graySprite.width = appWidth;
graySprite.height = appHeight;

graySprite.tint = 0x000000;
graySprite.alpha = 0.8;
// 挂载
app.stage.addChild(graySprite);

// 提供销毁特效的回调函数
return async () => {
app.stage.removeChild(graySprite);
};
}
2 changes: 2 additions & 0 deletions lib/ba-story-player/lib/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ const bgEffectImgTable: BGEffectImgTable = {
BG_Snow_L: [],
BG_Fireworks_L_BGOff_01: [],
"BG_ScrollR_1.0": [],
BG_TvNoise_Sound: [],
BG_Filter_Gray_BG: ["Gacha/FX_TEX_GT_Circle_Blur_inv.png"],
};

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
1 change: 1 addition & 0 deletions lib/ba-story-player/lib/types/effectLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export interface BGEffectHandlerOptions {
BG_Fireworks_L_BGOff_01: {};
"BG_ScrollR_1.0": {};
BG_TvNoise_Sound: {};
BG_Filter_Gray_BG: {};
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/ba-story-player/lib/types/excels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export type BGEffectType =
| "BG_Snow_L"
| "BG_Fireworks_L_BGOff_01"
| "BG_ScrollR_1.0"
| "BG_TvNoise_Sound";
| "BG_TvNoise_Sound"
| "BG_Filter_Gray_BG";

export enum Nation {
None = 0,
Expand Down
3 changes: 2 additions & 1 deletion lib/ba-story-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"type-fest": "~4.2.0",
"uuid": "~9.0.0",
"@types/uuid": "~9.0.2",
"element-plus": "^2.7.3"
"element-plus": "^2.7.3",
"vite-plugin-vue-devtools": "^7.4.6"
},
"devDependencies": {
"@types/node": "^20.12.12",
Expand Down
3 changes: 2 additions & 1 deletion lib/ba-story-player/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { resolve } from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import dts from "vite-plugin-dts";
import vueDevTools from "vite-plugin-vue-devtools";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
Expand All @@ -11,7 +12,7 @@ export default defineConfig(({ mode }) => {
"@": resolve(__dirname, "./lib"),
},
},
plugins: [vue(), dts()],
plugins: [vue(), dts(), vueDevTools()],
esbuild: {
drop: mode === "production" ? ["debugger"] : [],
pure: mode === "production" ? ["console.log"] : [],
Expand Down

0 comments on commit 691e956

Please sign in to comment.