diff --git a/README.md b/README.md index def2232..e6581d4 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ - 撤销:撤销上一次操作,无限次数 - 洗牌:哗啦哗啦,无限次数 - 关卡:50 关玩到爽,可直接跳 -- 主题:金轮、ikun 主题等(露出黑脚) +- 主题:金轮、骚猪、ikun 主题等(露出黑脚) 开心就好 😄 diff --git a/public/sound-disco.mp3 b/public/sound-disco.mp3 index 492e392..383c1b9 100644 Binary files a/public/sound-disco.mp3 and b/public/sound-disco.mp3 differ diff --git a/src/App.tsx b/src/App.tsx index a9fd320..d1cc4bd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -14,10 +14,11 @@ import { Icon, Theme } from './themes/interface'; import { fishermanTheme } from './themes/fisherman'; import { jinlunTheme } from './themes/jinlun'; import { ikunTheme } from './themes/ikun'; +import { pddTheme } from './themes/pdd'; import { BeiAn } from './themes/BeiAn'; // 主题 -const themes = [defaultTheme, fishermanTheme, jinlunTheme, ikunTheme]; +const themes = [defaultTheme, fishermanTheme, jinlunTheme, ikunTheme, pddTheme]; // 最大关卡 const maxLevel = 50; @@ -266,6 +267,11 @@ const App: FC = () => { find.x = 100 * Math.floor(8 * Math.random()); find.y = 700; checkCover(scene); + // 音效 + if (soundRefMap.current?.['sound-shift']) { + soundRefMap.current['sound-shift'].currentTime = 0; + soundRefMap.current['sound-shift'].play(); + } } }; @@ -280,12 +286,22 @@ const App: FC = () => { setQueue(updateQueue); find.status = 0; checkCover(scene); + // 音效 + if (soundRefMap.current?.['sound-undo']) { + soundRefMap.current['sound-undo'].currentTime = 0; + soundRefMap.current['sound-undo'].play(); + } } }; // 洗牌 const wash = () => { checkCover(washScene(level, scene)); + // 音效 + if (soundRefMap.current?.['sound-wash']) { + soundRefMap.current['sound-wash'].currentTime = 0; + soundRefMap.current['sound-wash'].play(); + } }; // 加大难度 @@ -323,7 +339,6 @@ const App: FC = () => { // 点击音效 if (soundRefMap.current) { - console.log(soundRefMap.current, symbol.icon); soundRefMap.current[symbol.icon.clickSound].currentTime = 0; soundRefMap.current[symbol.icon.clickSound].play(); } @@ -384,7 +399,7 @@ const App: FC = () => { return ( <> -

有解的羊了个羊(DEMO)

+

{curTheme.title}

@@ -404,6 +419,8 @@ const App: FC = () => { Level: {level} + {curTheme.desc} +
diff --git a/src/themes/default/index.ts b/src/themes/default/index.ts index 83ec3f6..5a0e86a 100644 --- a/src/themes/default/index.ts +++ b/src/themes/default/index.ts @@ -29,6 +29,7 @@ export const defaultSounds: Theme['sounds'] = [ ]; export const defaultTheme: Theme = { + title: '有解的羊了个羊(DEMO)', name: '默认', icons: icons.map((icon) => ({ name: icon, diff --git a/src/themes/fisherman/index.tsx b/src/themes/fisherman/index.tsx index caca800..2185bd7 100644 --- a/src/themes/fisherman/index.tsx +++ b/src/themes/fisherman/index.tsx @@ -16,6 +16,7 @@ const fishes = Object.entries(imagesUrls).map(([key, value]) => ({ })); export const fishermanTheme: Theme = { + title: '🐟鱼了个鱼🐟', name: '钓鱼佬', icons: fishes.map(({ name, content }) => ({ name, diff --git a/src/themes/ikun/index.tsx b/src/themes/ikun/index.tsx index 5df2b02..5747922 100644 --- a/src/themes/ikun/index.tsx +++ b/src/themes/ikun/index.tsx @@ -52,6 +52,7 @@ const icons = Object.entries(imagesUrls).map(([key, value]) => ({ })); export const ikunTheme: Theme = { + title: '🐔鸡了个鸡🐔', name: 'iKun', bgm, icons: icons.map(({ name, content }) => ({ diff --git a/src/themes/interface.ts b/src/themes/interface.ts index 642e9bd..f933753 100644 --- a/src/themes/interface.ts +++ b/src/themes/interface.ts @@ -12,9 +12,14 @@ interface Sound { src: string; } +type Operation = 'shift' | 'undo' | 'wash'; + export interface Theme { + title: string; + desc?: ReactNode; name: string; bgm?: string; icons: Icon[]; sounds: Sound[]; + operateSoundMap?: Record; } diff --git a/src/themes/jinlun/index.tsx b/src/themes/jinlun/index.tsx index ca35e08..78ab71c 100644 --- a/src/themes/jinlun/index.tsx +++ b/src/themes/jinlun/index.tsx @@ -24,6 +24,7 @@ const icons = Object.entries(imagesUrls).map(([key, value]) => ({ })); export const jinlunTheme: Theme = { + title: '🐎马了个马🐎', name: '金轮', icons: icons.map(({ name, content }) => ({ name, diff --git a/src/themes/pdd/images/1.png b/src/themes/pdd/images/1.png new file mode 100644 index 0000000..ef7b58b Binary files /dev/null and b/src/themes/pdd/images/1.png differ diff --git a/src/themes/pdd/images/10.png b/src/themes/pdd/images/10.png new file mode 100644 index 0000000..f85515f Binary files /dev/null and b/src/themes/pdd/images/10.png differ diff --git a/src/themes/pdd/images/2.png b/src/themes/pdd/images/2.png new file mode 100644 index 0000000..4ca5fac Binary files /dev/null and b/src/themes/pdd/images/2.png differ diff --git a/src/themes/pdd/images/3.png b/src/themes/pdd/images/3.png new file mode 100644 index 0000000..ac101fb Binary files /dev/null and b/src/themes/pdd/images/3.png differ diff --git a/src/themes/pdd/images/4.png b/src/themes/pdd/images/4.png new file mode 100644 index 0000000..e8fcc41 Binary files /dev/null and b/src/themes/pdd/images/4.png differ diff --git a/src/themes/pdd/images/5.png b/src/themes/pdd/images/5.png new file mode 100644 index 0000000..084a110 Binary files /dev/null and b/src/themes/pdd/images/5.png differ diff --git a/src/themes/pdd/images/6.png b/src/themes/pdd/images/6.png new file mode 100644 index 0000000..73a250d Binary files /dev/null and b/src/themes/pdd/images/6.png differ diff --git a/src/themes/pdd/images/7.png b/src/themes/pdd/images/7.png new file mode 100644 index 0000000..925543e Binary files /dev/null and b/src/themes/pdd/images/7.png differ diff --git a/src/themes/pdd/images/8.png b/src/themes/pdd/images/8.png new file mode 100644 index 0000000..2aec668 Binary files /dev/null and b/src/themes/pdd/images/8.png differ diff --git a/src/themes/pdd/images/9.png b/src/themes/pdd/images/9.png new file mode 100644 index 0000000..7b17779 Binary files /dev/null and b/src/themes/pdd/images/9.png differ diff --git a/src/themes/pdd/index.tsx b/src/themes/pdd/index.tsx new file mode 100644 index 0000000..231a5b0 --- /dev/null +++ b/src/themes/pdd/index.tsx @@ -0,0 +1,53 @@ +// 骚猪主题 +import React from 'react'; +import { Theme } from '../interface'; +import { defaultSounds } from '../default'; +import bgm from './sounds/bgm.mp3'; + +const soundUrls = import.meta.glob('./sounds/*.mp3', { + import: 'default', + eager: true, +}); + +const sounds = Object.entries(soundUrls).map(([key, value]) => ({ + name: key.slice(9, -4), + src: value, +})) as Theme['sounds']; + +const imagesUrls = import.meta.glob('./images/*.png', { + import: 'default', + eager: true, +}); + +const images = Object.entries(imagesUrls).map(([key, value]) => ({ + name: key.slice(9, -4), + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + content: , +})); + +export const pddTheme: Theme = { + title: '🐷猪了个猪🐷', + desc: ( +

+ 感谢 + + 猪酱的日常 + + 提供素材 +

+ ), + name: '骚猪', + bgm: bgm, + icons: images.map(({ name, content }) => ({ + name, + content, + clickSound: 'button-click', + tripleSound: name, + })), + sounds: [defaultSounds[0], ...sounds], +}; diff --git a/src/themes/pdd/sounds/1.mp3 b/src/themes/pdd/sounds/1.mp3 new file mode 100644 index 0000000..85cd474 Binary files /dev/null and b/src/themes/pdd/sounds/1.mp3 differ diff --git a/src/themes/pdd/sounds/10.mp3 b/src/themes/pdd/sounds/10.mp3 new file mode 100644 index 0000000..d8dec5c Binary files /dev/null and b/src/themes/pdd/sounds/10.mp3 differ diff --git a/src/themes/pdd/sounds/2.mp3 b/src/themes/pdd/sounds/2.mp3 new file mode 100644 index 0000000..08c229f Binary files /dev/null and b/src/themes/pdd/sounds/2.mp3 differ diff --git a/src/themes/pdd/sounds/3.mp3 b/src/themes/pdd/sounds/3.mp3 new file mode 100644 index 0000000..61e7696 Binary files /dev/null and b/src/themes/pdd/sounds/3.mp3 differ diff --git a/src/themes/pdd/sounds/4.mp3 b/src/themes/pdd/sounds/4.mp3 new file mode 100644 index 0000000..cb5601d Binary files /dev/null and b/src/themes/pdd/sounds/4.mp3 differ diff --git a/src/themes/pdd/sounds/5.mp3 b/src/themes/pdd/sounds/5.mp3 new file mode 100644 index 0000000..a0d51b0 Binary files /dev/null and b/src/themes/pdd/sounds/5.mp3 differ diff --git a/src/themes/pdd/sounds/6.mp3 b/src/themes/pdd/sounds/6.mp3 new file mode 100644 index 0000000..407e668 Binary files /dev/null and b/src/themes/pdd/sounds/6.mp3 differ diff --git a/src/themes/pdd/sounds/7.mp3 b/src/themes/pdd/sounds/7.mp3 new file mode 100644 index 0000000..43615dd Binary files /dev/null and b/src/themes/pdd/sounds/7.mp3 differ diff --git a/src/themes/pdd/sounds/8.mp3 b/src/themes/pdd/sounds/8.mp3 new file mode 100644 index 0000000..717d443 Binary files /dev/null and b/src/themes/pdd/sounds/8.mp3 differ diff --git a/src/themes/pdd/sounds/9.mp3 b/src/themes/pdd/sounds/9.mp3 new file mode 100644 index 0000000..b372d4c Binary files /dev/null and b/src/themes/pdd/sounds/9.mp3 differ diff --git a/src/themes/pdd/sounds/bgm.mp3 b/src/themes/pdd/sounds/bgm.mp3 new file mode 100644 index 0000000..64c88de Binary files /dev/null and b/src/themes/pdd/sounds/bgm.mp3 differ diff --git a/src/themes/pdd/sounds/sound-shift.mp3 b/src/themes/pdd/sounds/sound-shift.mp3 new file mode 100644 index 0000000..33ddb1f Binary files /dev/null and b/src/themes/pdd/sounds/sound-shift.mp3 differ diff --git a/src/themes/pdd/sounds/sound-undo.mp3 b/src/themes/pdd/sounds/sound-undo.mp3 new file mode 100644 index 0000000..fa20d12 Binary files /dev/null and b/src/themes/pdd/sounds/sound-undo.mp3 differ diff --git a/src/themes/pdd/sounds/sound-wash.mp3 b/src/themes/pdd/sounds/sound-wash.mp3 new file mode 100644 index 0000000..2880f82 Binary files /dev/null and b/src/themes/pdd/sounds/sound-wash.mp3 differ