Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
MakinoharaShoko committed Oct 10, 2023
2 parents 875378c + bb31636 commit b0ce003
Show file tree
Hide file tree
Showing 42 changed files with 126 additions and 58 deletions.
4 changes: 3 additions & 1 deletion packages/webgal/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<html lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<link rel="icon" type="image/x-icon" href="/src/favicon.ico"/>
<link rel="icon" type="image/x-icon" href="./icons/favicon.ico" />
<link rel="apple-touch-icon" href="./icons/apple-touch-icon.png">
<link rel="manifest" href="./manifest.json" />
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>-->
<title>WebGAL</title>
<meta name="viewport"
Expand Down
Binary file added packages/webgal/public/icons/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/webgal/public/icons/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/webgal/public/icons/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions packages/webgal/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "WebGAL",
"short_name": "WebGAL",
"start_url": ".",
"display": "fullscreen",
"description": "WebGAL DEMO",
"dir": "auto",
"orientation": "landscape",
"icons": [
{
"src": "./icons/icon-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "./icons/icon-512.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "./icons/icon-192-maskable.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "./icons/icon-512-maskable.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import { useSelector } from 'react-redux';
import { RootState, webgalStore } from '@/store/store';
import { setVisibility } from '@/store/GUIReducer';
import useSoundEffect from '@/hooks/useSoundEffect';
import { useSEByWebgalStore } from '@/hooks/useSoundEffect';

export default function GlobalDialog() {
const isGlobalDialogShow = useSelector((state: RootState) => state.GUI.showGlobalDialog);
Expand All @@ -19,7 +19,7 @@ interface IShowGlobalDialogProps {
}

export function showGlogalDialog(props: IShowGlobalDialogProps) {
const { playSeClickDialogButton, playSeEnterDialogButton } = useSoundEffect();
const { playSeClickDialogButton, playSeEnterDialogButton } = useSEByWebgalStore();
webgalStore.dispatch(setVisibility({ component: 'showGlobalDialog', visibility: true }));
const handleLeft = () => {
playSeClickDialogButton();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { IPerform, IRunPerform } from '@/Core/Modules/perform/performInterface';
import { IPerform } from '@/Core/Modules/perform/performInterface';
import { ISentence } from '@/Core/controller/scene/sceneInterface';
import { webgalStore } from '@/store/store';
import cloneDeep from 'lodash/cloneDeep';
import { resetStageState } from '@/store/stageReducer';
import { nextSentence } from '@/Core/controller/gamePlay/nextSentence';
import { IRunPerform } from '@/store/stageInterface';

/**
* 获取随机演出名称
Expand Down
12 changes: 0 additions & 12 deletions packages/webgal/src/Core/Modules/perform/performInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ISentence } from '../../controller/scene/sceneInterface';

/**
* 描述演出的接口,主要用于控制演出,而不是执行(在演出开始时被调用演出的执行器返回)
* @interface IPerform
Expand Down Expand Up @@ -31,16 +29,6 @@ export interface IPerform {
// 被打断或执行完毕的演出会移出演出列表
// 只有所有演出都完成,或者仅存在不阻塞auto的演出,才允许auto

/**
* 启动演出接口
* @interface IRunPerform
*/
export interface IRunPerform {
id: string;
isHoldOn: boolean; // 演出类型
script: ISentence; // 演出脚本
}

/**
* 初始化的演出
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { scriptExecutor } from './scriptExecutor';
import { IRunPerform } from '@/Core/Modules/perform/performInterface';
import { logger } from '../../util/etc/logger';
import { webgalStore } from '@/store/store';
import { resetStageState } from '@/store/stageReducer';
Expand All @@ -8,6 +7,7 @@ import { IBacklogItem } from '@/Core/Modules/backlog';

import { SYSTEM_CONFIG } from '@/Core/config/config';
import { WebGAL } from '@/Core/WebGAL';
import { IRunPerform } from '@/store/stageInterface';

/**
* 进行下一句
Expand Down
3 changes: 2 additions & 1 deletion packages/webgal/src/Core/gameScripts/pixiInit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { commandType, ISentence } from '@/Core/controller/scene/sceneInterface';
import { IPerform, IRunPerform } from '@/Core/Modules/perform/performInterface';
import { IPerform } from '@/Core/Modules/perform/performInterface';
import { logger } from '@/Core/util/etc/logger';
import { webgalStore } from '@/store/store';
import { resetStageState } from '@/store/stageReducer';
import cloneDeep from 'lodash/cloneDeep';

import { WebGAL } from '@/Core/WebGAL';
import { IRunPerform } from '@/store/stageInterface';

/**
* 初始化pixi
Expand Down
11 changes: 4 additions & 7 deletions packages/webgal/src/Core/util/syncWithEditor/syncWithOrigine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@ import { nextSentence } from '@/Core/controller/gamePlay/nextSentence';

import { WebGAL } from '@/Core/WebGAL';

export const syncWithOrigine = (str: string) => {
const strLst = str.split(' ');
const scene = strLst[1].replace(/json/g, 'txt');
const sentenceID = parseInt(strLst[2], 10);
logger.warn('正在跳转到' + scene + ':' + sentenceID);
export const syncWithOrigine = (sceneName: string, sentenceId: number) => {
logger.warn('正在跳转到' + sceneName + ':' + sentenceId);
const dispatch = webgalStore.dispatch;
dispatch(setVisibility({ component: 'showTitle', visibility: false }));
dispatch(setVisibility({ component: 'showMenuPanel', visibility: false }));
resetStage(true);
// 重新获取初始场景
const sceneUrl: string = assetSetter(scene, fileType.scene);
const sceneUrl: string = assetSetter(sceneName, fileType.scene);
// 场景写入到运行时
sceneFetcher(sceneUrl).then((rawScene) => {
WebGAL.sceneManager.sceneData.currentScene = sceneParser(rawScene, 'start.txt', sceneUrl);
// 开始快进到指定语句
const currentSceneName = WebGAL.sceneManager.sceneData.currentScene.sceneName;
WebGAL.gameplay.isFast = true;
syncFast(sentenceID, currentSceneName);
syncFast(sentenceId, currentSceneName);
});
};

Expand Down
23 changes: 20 additions & 3 deletions packages/webgal/src/Core/util/syncWithEditor/webSocketFunc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { logger } from '../etc/logger';
import { syncWithOrigine } from '@/Core/util/syncWithEditor/syncWithOrigine';
import { DebugCommand, IDebugMessage } from '@/types/debugProtocol';
import { WebGAL } from '@/Core/WebGAL';
import { webgalStore } from '@/store/store';

export const webSocketFunc = () => {
const loc: string = window.location.hostname;
Expand All @@ -15,13 +18,27 @@ export const webSocketFunc = () => {
const socket = new WebSocket(wsUrl);
socket.onopen = () => {
logger.info('socket已连接');
socket.send(' WebGAL 已和 Terre 建立连接。');
function sendStageSyncMessage() {
const message: IDebugMessage = {
command: DebugCommand.SYNCFC,
sceneMsg: {
scene: WebGAL.sceneManager.sceneData.currentScene.sceneName,
sentence: WebGAL.sceneManager.sceneData.currentSentenceId,
},
stageSyncMsg: webgalStore.getState().stage,
};
socket.send(JSON.stringify(message));
logger.debug('传送信息', message);
setTimeout(sendStageSyncMessage, 1000);
}
sendStageSyncMessage();
};
socket.onmessage = (e) => {
logger.info('收到信息', e.data);
const str: string = e.data;
if (str.match('jmp')) {
syncWithOrigine(str);
const message: IDebugMessage = JSON.parse(str);
if (message.command === DebugCommand.JUMP) {
syncWithOrigine(message.sceneMsg.scene, message.sceneMsg.sentence);
}
};
socket.onerror = (e) => {
Expand Down
Binary file added packages/webgal/src/assets/se/Book_Page_Flip.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/Book_Page_Flip.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/button-16.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/button-16.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/button-20.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/button-20.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/button-50.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/button-50.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/click_soft_02.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/click_soft_02.wav
Binary file not shown.
18 changes: 9 additions & 9 deletions packages/webgal/src/assets/se/license.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Book_Page_Flip.wav
Book_Page_Flip.mp3
『书页翻页』 CC-BY许可 作者:菲利普湾 来源:https://www.ear0.com/sound/17890 (信息来自淘声网)

s-cheremisinov-Click-03.wav
s-cheremisinov-Click-03.mp3
『s-cheremisinov Free Sound Pack » Click 03』 CC0许可 作者:s-cheremisinov 来源:https://freesound.org/s/401103/ (信息来自淘声网)

taoshen-01.wav
taoshen-01.mp3
『波的一声』 CC-BY许可 作者:IUiuiuiu 来源:https://www.ear0.com/sound/38724 (信息来自淘声网)

mouseEnter.mp3
button-16.wav
button-20.wav
button-50.wav
button-16.mp3
button-20.mp3
button-50.mp3
aigei-se-01.mp3
aigei-se-02.mp3
aigei-se-03.mp3
zhanZhang-y1970.mp3
no license.

click_soft_02.wav
click_soft_02.mp3
Attribution 4.0 International (CC BY 4.0)

maou_se_system22.mp3
Expand All @@ -41,7 +41,7 @@ maou_se_system48.mp3
Motion-Pop03-4.mp3
「OtoLogic」

page-flip-1.wav
page-flip-1.mp3
switch-1.wav
This work has been identified as being free of known restrictions under copyright law, including all related and neighboring rights.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
Expand All @@ -50,6 +50,6 @@ pause.mp3
CC0 1.0 Universal (CC0 1.0)
Public Domain Dedication

pausestart.wav
pausestart.mp3
CC0 1.0 Universal (CC0 1.0)
Public Domain Dedication
Binary file added packages/webgal/src/assets/se/page-flip-1.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/page-flip-1.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/pausestart.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/pausestart.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added packages/webgal/src/assets/se/switch-1.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/switch-1.wav
Binary file not shown.
Binary file added packages/webgal/src/assets/se/taoshen-01.mp3
Binary file not shown.
Binary file removed packages/webgal/src/assets/se/taoshen-01.wav
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.4.5',
version: 'WebGAL 4.4.5.3',
contributors: [
{ username: 'Mahiru', link: 'https://github.com/MakinoharaShoko' },
{ username: 'Hoshinokinya', link: 'https://github.com/hshqwq' },
Expand Down
38 changes: 19 additions & 19 deletions packages/webgal/src/hooks/useSoundEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import maou_se_system40 from '@/assets/se/maou_se_system40.mp3';
import maou_se_system41 from '@/assets/se/maou_se_system41.mp3';
import maou_se_system48 from '@/assets/se/maou_se_system48.mp3';
import Motion_Pop03_4 from '@/assets/se/Motion-Pop03-4.mp3';
import button_16 from '@/assets/se/button-16.wav';
import button_20 from '@/assets/se/button-20.wav';
import button_50 from '@/assets/se/button-50.wav';
import click_soft_02 from '@/assets/se/click_soft_02.wav';
import Book_Page_Flip from '@/assets/se/Book_Page_Flip.wav';
import page_flip_1 from '@/assets/se/page-flip-1.wav';
import button_16 from '@/assets/se/button-16.mp3';
import button_20 from '@/assets/se/button-20.mp3';
import button_50 from '@/assets/se/button-50.mp3';
import click_soft_02 from '@/assets/se/click_soft_02.mp3';
import Book_Page_Flip from '@/assets/se/Book_Page_Flip.mp3';
import page_flip_1 from '@/assets/se/page-flip-1.mp3';
import pause from '@/assets/se/pause.mp3';
import pausestart from '@/assets/se/pausestart.wav';
import s_cheremisinov_Click_03 from '@/assets/se/s-cheremisinov-Click-03.wav';
import switch_1 from '@/assets/se/switch-1.wav';
import water_drop_sound from '@/assets/se/water-drop-sound.wav';
import pausestart from '@/assets/se/pausestart.mp3';
import s_cheremisinov_Click_03 from '@/assets/se/s-cheremisinov-Click-03.mp3';
import switch_1 from '@/assets/se/switch-1.mp3';
import water_drop_sound from '@/assets/se/water-drop-sound.mp3';
import aigei_se_01 from '@/assets/se/aigei-se-01.mp3';
import aigei_se_02 from '@/assets/se/aigei-se-02.mp3';
import aigei_se_03 from '@/assets/se/aigei-se-03.mp3';
import zhanZhang_y1970 from '@/assets/se/zhanZhang-y1970.mp3';
import taoshen_01 from '@/assets/se/taoshen-01.wav';
import taoshen_01 from '@/assets/se/taoshen-01.mp3';
import { useDispatch } from 'react-redux';
import { webgalStore } from '@/store/store';

Expand Down Expand Up @@ -61,9 +61,6 @@ const useSoundEffect = () => {
const playSeEnterCloseButton = () => {
dispatch(setStage({ key: 'uiSe', value: aigei_se_03 }));
};
const playSeEnterDialogButton = () => {
dispatch(setStage({ key: 'uiSe', value: Motion_Pop03_4 }));
};
const playSeEnterOptionSlider = () => {
dispatch(setStage({ key: 'uiSe', value: water_drop_sound }));
};
Expand Down Expand Up @@ -97,9 +94,6 @@ const useSoundEffect = () => {
const playSeClickLoadElement = () => {
dispatch(setStage({ key: 'uiSe', value: maou_se_system48 }));
};
const playSeClickDialogButton = () => {
dispatch(setStage({ key: 'uiSe', value: maou_se_system35 }));
};
const playSeClickToNextBgmButton = () => {
dispatch(setStage({ key: 'uiSe', value: switch_1 }));
};
Expand Down Expand Up @@ -133,7 +127,6 @@ const useSoundEffect = () => {
playSeEnterExtraElement, // 鼠标进入鉴赏元素
playSeEnterExtraBGMButton, // 鼠标进入鉴赏页BGM按钮
playSeEnterCloseButton, // 鼠标进入关闭按钮
playSeEnterDialogButton, // 鼠标进入提示框按钮
playSeEnterOptionSlider, // 鼠标进入滑块选项
playSeClick, // 鼠标点击
playSeClickTitleButton, // 鼠标点击标题按钮
Expand All @@ -145,7 +138,6 @@ const useSoundEffect = () => {
playSeClickSavePanelSelect, // 鼠标点击存档页切换按钮
playSeClickSaveElement, // 鼠标点击存档元素
playSeClickLoadElement, // 鼠标点击读档元素
playSeClickDialogButton, // 鼠标点击提示框按钮
playSeClickToNextBgmButton, // 鼠标点击下一首BGM按钮
playSeClickToLastBgmButton, // 鼠标点击上一首BGM按钮
playSeClickBeginBgmButton, // 鼠标点击开始播放BGM按钮
Expand All @@ -166,9 +158,17 @@ export const useSEByWebgalStore = () => {
const playSeClickChoose = () => {
webgalStore.dispatch(setStage({ key: 'uiSe', value: maou_se_system41 }));
};
const playSeEnterDialogButton = () => {
webgalStore.dispatch(setStage({ key: 'uiSe', value: Motion_Pop03_4 }));
};
const playSeClickDialogButton = () => {
webgalStore.dispatch(setStage({ key: 'uiSe', value: maou_se_system35 }));
};
return {
playSeEnterChoose, // 鼠标进入分支选择
playSeClickChoose, // 鼠标点击分支选择
playSeClickDialogButton, // 鼠标点击提示框按钮
playSeEnterDialogButton, // 鼠标进入提示框按钮
};
};

Expand Down
12 changes: 11 additions & 1 deletion packages/webgal/src/store/stageInterface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IRunPerform } from '@/Core/Modules/perform/performInterface';
import { ISentence } from '@/Core/controller/scene/sceneInterface';

/**
* 游戏内变量
Expand Down Expand Up @@ -95,6 +95,16 @@ export interface IEyesAnimationFile {
close: string;
}

/**
* 启动演出接口
* @interface IRunPerform
*/
export interface IRunPerform {
id: string;
isHoldOn: boolean; // 演出类型
script: ISentence; // 演出脚本
}

/**
* @interface IStageState 游戏舞台数据接口
*/
Expand Down
19 changes: 19 additions & 0 deletions packages/webgal/src/types/debugProtocol.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { IStageState } from '@/store/stageInterface';

export enum DebugCommand {
// 跳转
JUMP,
// 同步自客户端
SYNCFC,
// 同步自编辑器
SYNCFE,
}

export interface IDebugMessage {
command: DebugCommand;
sceneMsg: {
sentence: number;
scene: string;
};
stageSyncMsg: IStageState;
}

0 comments on commit b0ce003

Please sign in to comment.