mirror of
https://ghproxy.com/https://github.com/StreakingMan/solvable-sheep-game
synced 2025-07-08 05:46:07 +08:00
feat(themes): 骚猪主题音效
This commit is contained in:
parent
a5e1ea1004
commit
c578b89703
18
src/App.tsx
18
src/App.tsx
|
@ -267,6 +267,11 @@ const App: FC = () => {
|
||||||
find.x = 100 * Math.floor(8 * Math.random());
|
find.x = 100 * Math.floor(8 * Math.random());
|
||||||
find.y = 700;
|
find.y = 700;
|
||||||
checkCover(scene);
|
checkCover(scene);
|
||||||
|
// 音效
|
||||||
|
if (soundRefMap.current?.['sound-shift']) {
|
||||||
|
soundRefMap.current['sound-shift'].currentTime = 0;
|
||||||
|
soundRefMap.current['sound-shift'].play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -281,12 +286,22 @@ const App: FC = () => {
|
||||||
setQueue(updateQueue);
|
setQueue(updateQueue);
|
||||||
find.status = 0;
|
find.status = 0;
|
||||||
checkCover(scene);
|
checkCover(scene);
|
||||||
|
// 音效
|
||||||
|
if (soundRefMap.current?.['sound-undo']) {
|
||||||
|
soundRefMap.current['sound-undo'].currentTime = 0;
|
||||||
|
soundRefMap.current['sound-undo'].play();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 洗牌
|
// 洗牌
|
||||||
const wash = () => {
|
const wash = () => {
|
||||||
checkCover(washScene(level, scene));
|
checkCover(washScene(level, scene));
|
||||||
|
// 音效
|
||||||
|
if (soundRefMap.current?.['sound-wash']) {
|
||||||
|
soundRefMap.current['sound-wash'].currentTime = 0;
|
||||||
|
soundRefMap.current['sound-wash'].play();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 加大难度
|
// 加大难度
|
||||||
|
@ -324,7 +339,6 @@ const App: FC = () => {
|
||||||
|
|
||||||
// 点击音效
|
// 点击音效
|
||||||
if (soundRefMap.current) {
|
if (soundRefMap.current) {
|
||||||
console.log(soundRefMap.current, symbol.icon);
|
|
||||||
soundRefMap.current[symbol.icon.clickSound].currentTime = 0;
|
soundRefMap.current[symbol.icon.clickSound].currentTime = 0;
|
||||||
soundRefMap.current[symbol.icon.clickSound].play();
|
soundRefMap.current[symbol.icon.clickSound].play();
|
||||||
}
|
}
|
||||||
|
@ -405,6 +419,8 @@ const App: FC = () => {
|
||||||
Level: {level}
|
Level: {level}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
|
{curTheme.desc}
|
||||||
|
|
||||||
<div className="app">
|
<div className="app">
|
||||||
<div className="scene-container">
|
<div className="scene-container">
|
||||||
<div className="scene-inner">
|
<div className="scene-inner">
|
||||||
|
|
|
@ -12,10 +12,14 @@ interface Sound<T = string> {
|
||||||
src: string;
|
src: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Operation = 'shift' | 'undo' | 'wash';
|
||||||
|
|
||||||
export interface Theme<SoundNames> {
|
export interface Theme<SoundNames> {
|
||||||
title: string;
|
title: string;
|
||||||
|
desc?: ReactNode;
|
||||||
name: string;
|
name: string;
|
||||||
bgm?: string;
|
bgm?: string;
|
||||||
icons: Icon<SoundNames>[];
|
icons: Icon<SoundNames>[];
|
||||||
sounds: Sound<SoundNames>[];
|
sounds: Sound<SoundNames>[];
|
||||||
|
operateSoundMap?: Record<Operation, SoundNames>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
// 骚猪主题
|
// 骚猪主题
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Theme } from '../interface';
|
import { Theme } from '../interface';
|
||||||
import { DefaultSoundNames, defaultSounds } from '../default';
|
import { defaultSounds } from '../default';
|
||||||
import bgm from './sounds/bgm.mp3';
|
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<string>['sounds'];
|
||||||
|
|
||||||
const imagesUrls = import.meta.glob('./images/*.png', {
|
const imagesUrls = import.meta.glob('./images/*.png', {
|
||||||
import: 'default',
|
import: 'default',
|
||||||
eager: true,
|
eager: true,
|
||||||
|
@ -16,15 +26,28 @@ const images = Object.entries(imagesUrls).map(([key, value]) => ({
|
||||||
content: <img src={value} alt="" />,
|
content: <img src={value} alt="" />,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const pddTheme: Theme<DefaultSoundNames> = {
|
export const pddTheme: Theme<string> = {
|
||||||
title: '🐷猪了个猪🐷',
|
title: '🐷猪了个猪🐷',
|
||||||
|
desc: (
|
||||||
|
<p>
|
||||||
|
感谢
|
||||||
|
<a
|
||||||
|
href="https://space.bilibili.com/81966051"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
|
猪酱的日常
|
||||||
|
</a>
|
||||||
|
提供素材
|
||||||
|
</p>
|
||||||
|
),
|
||||||
name: '骚猪',
|
name: '骚猪',
|
||||||
bgm: 'https://m10.music.126.net/20220922020823/e92de2ba173e404bab61a4719b8d624b/ymusic/0759/010e/0e5d/03e18aa0e96daf33193797e61f6a314d.mp3',
|
bgm: bgm,
|
||||||
icons: images.map(({ name, content }) => ({
|
icons: images.map(({ name, content }) => ({
|
||||||
name,
|
name,
|
||||||
content,
|
content,
|
||||||
clickSound: 'button-click',
|
clickSound: 'button-click',
|
||||||
tripleSound: 'triple',
|
tripleSound: name,
|
||||||
})),
|
})),
|
||||||
sounds: defaultSounds,
|
sounds: [defaultSounds[0], ...sounds],
|
||||||
};
|
};
|
||||||
|
|
BIN
src/themes/pdd/sounds/1.mp3
Normal file
BIN
src/themes/pdd/sounds/1.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/10.mp3
Normal file
BIN
src/themes/pdd/sounds/10.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/2.mp3
Normal file
BIN
src/themes/pdd/sounds/2.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/3.mp3
Normal file
BIN
src/themes/pdd/sounds/3.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/4.mp3
Normal file
BIN
src/themes/pdd/sounds/4.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/5.mp3
Normal file
BIN
src/themes/pdd/sounds/5.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/6.mp3
Normal file
BIN
src/themes/pdd/sounds/6.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/7.mp3
Normal file
BIN
src/themes/pdd/sounds/7.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/8.mp3
Normal file
BIN
src/themes/pdd/sounds/8.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/9.mp3
Normal file
BIN
src/themes/pdd/sounds/9.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/sound-shift.mp3
Normal file
BIN
src/themes/pdd/sounds/sound-shift.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/sound-undo.mp3
Normal file
BIN
src/themes/pdd/sounds/sound-undo.mp3
Normal file
Binary file not shown.
BIN
src/themes/pdd/sounds/sound-wash.mp3
Normal file
BIN
src/themes/pdd/sounds/sound-wash.mp3
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user