feat(themes): 金轮主题
|
@ -34,6 +34,7 @@
|
||||||
transition: 150ms;
|
transition: 150ms;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.symbol-inner {
|
.symbol-inner {
|
||||||
|
|
18
src/App.tsx
|
@ -1,5 +1,4 @@
|
||||||
import React, {
|
import React, {
|
||||||
ChangeEventHandler,
|
|
||||||
FC,
|
FC,
|
||||||
MouseEventHandler,
|
MouseEventHandler,
|
||||||
useEffect,
|
useEffect,
|
||||||
|
@ -10,11 +9,13 @@ import React, {
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import { GithubIcon } from './GithubIcon';
|
import { GithubIcon } from './GithubIcon';
|
||||||
import { randomString, waitTimeout } from './utils';
|
import { randomString, waitTimeout } from './utils';
|
||||||
import { DefaultSoundNames, defaultTheme } from './themes/default';
|
import { defaultTheme } from './themes/default';
|
||||||
import { Icon, Theme } from './themes/interface';
|
import { Icon, Theme } from './themes/interface';
|
||||||
import { fishermanTheme } from './themes/fisherman';
|
import { fishermanTheme } from './themes/fisherman';
|
||||||
|
import { jinlunTheme } from './themes/jinlun';
|
||||||
|
|
||||||
const themes = [defaultTheme, fishermanTheme];
|
// 主题
|
||||||
|
const themes = [defaultTheme, fishermanTheme, jinlunTheme];
|
||||||
|
|
||||||
// 最大关卡
|
// 最大关卡
|
||||||
const maxLevel = 50;
|
const maxLevel = 50;
|
||||||
|
@ -123,13 +124,14 @@ const Symbol: FC<SymbolProps> = ({ x, y, icon, isCover, status, onClick }) => {
|
||||||
className="symbol"
|
className="symbol"
|
||||||
style={{
|
style={{
|
||||||
transform: `translateX(${x}%) translateY(${y}%)`,
|
transform: `translateX(${x}%) translateY(${y}%)`,
|
||||||
|
backgroundColor: isCover ? '#999' : 'white',
|
||||||
opacity: status < 2 ? 1 : 0,
|
opacity: status < 2 ? 1 : 0,
|
||||||
}}
|
}}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="symbol-inner"
|
className="symbol-inner"
|
||||||
style={{ backgroundColor: isCover ? '#999' : 'white' }}
|
style={{ opacity: isCover ? 0.5 : 1 }}
|
||||||
>
|
>
|
||||||
{typeof icon.content === 'string' ? (
|
{typeof icon.content === 'string' ? (
|
||||||
<i>{icon.content}</i>
|
<i>{icon.content}</i>
|
||||||
|
@ -142,8 +144,7 @@ const Symbol: FC<SymbolProps> = ({ x, y, icon, isCover, status, onClick }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const App: FC = () => {
|
const App: FC = () => {
|
||||||
const [curTheme, setCurTheme] =
|
const [curTheme, setCurTheme] = useState<Theme<any>>(defaultTheme);
|
||||||
useState<Theme<DefaultSoundNames>>(defaultTheme);
|
|
||||||
const [scene, setScene] = useState<Scene>(makeScene(1, curTheme.icons));
|
const [scene, setScene] = useState<Scene>(makeScene(1, curTheme.icons));
|
||||||
const [level, setLevel] = useState<number>(1);
|
const [level, setLevel] = useState<number>(1);
|
||||||
const [queue, setQueue] = useState<MySymbol[]>([]);
|
const [queue, setQueue] = useState<MySymbol[]>([]);
|
||||||
|
@ -162,8 +163,10 @@ const App: FC = () => {
|
||||||
const [bgmOn, setBgmOn] = useState<boolean>(false);
|
const [bgmOn, setBgmOn] = useState<boolean>(false);
|
||||||
const [once, setOnce] = useState<boolean>(false);
|
const [once, setOnce] = useState<boolean>(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!bgmRef.current) return;
|
||||||
if (bgmOn) {
|
if (bgmOn) {
|
||||||
bgmRef.current?.play();
|
bgmRef.current.volume = 0.15;
|
||||||
|
bgmRef.current.play();
|
||||||
} else {
|
} else {
|
||||||
bgmRef.current?.pause();
|
bgmRef.current?.pause();
|
||||||
}
|
}
|
||||||
|
@ -301,6 +304,7 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
BIN
src/themes/jinlun/images/中指.png
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
src/themes/jinlun/images/我黑切呢.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
src/themes/jinlun/images/笑1.png
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
src/themes/jinlun/images/笑2.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
src/themes/jinlun/images/笑3.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
src/themes/jinlun/images/笑4.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
src/themes/jinlun/images/肌肉金轮1.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
src/themes/jinlun/images/肌肉金轮2.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
src/themes/jinlun/images/肌肉金轮3.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src/themes/jinlun/images/韩委员.png
Normal file
After Width: | Height: | Size: 38 KiB |
35
src/themes/jinlun/index.tsx
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import { Theme } from '../interface';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
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', {
|
||||||
|
import: 'default',
|
||||||
|
eager: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const icons = Object.entries(imagesUrls).map(([key, value]) => ({
|
||||||
|
name: key.slice(9, -4),
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
content: <img src={value} alt="" />,
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const jinlunTheme: Theme<string> = {
|
||||||
|
name: '金轮',
|
||||||
|
icons: icons.map(({ name, content }) => ({
|
||||||
|
name,
|
||||||
|
content,
|
||||||
|
clickSound: name,
|
||||||
|
tripleSound: '起飞啦',
|
||||||
|
})),
|
||||||
|
sounds,
|
||||||
|
};
|