File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import PixiStage from '@/Core/controller/stage/pixi/PixiController' ;
22import { PerformController } from '@/Core/Modules/perform/performController' ;
3+ import { setFastButton } from '../controller/gamePlay/fastSkip' ;
4+ import { setAutoButton } from '../controller/gamePlay/autoPlay' ;
35
46/**
57 * 游戏运行时变量
68 */
79export class Gameplay {
8- public isAuto = false ;
9- public isFast = false ;
1010 public autoInterval : ReturnType < typeof setInterval > | null = null ;
1111 public fastInterval : ReturnType < typeof setInterval > | null = null ;
1212 public autoTimeout : ReturnType < typeof setTimeout > | null = null ;
1313 public pixiStage : PixiStage | null = null ;
1414 public performController = new PerformController ( ) ;
15+
16+ /* 有图标状态需求 */
17+ private _isAuto = false ;
18+ public get isAuto ( ) {
19+ return this . _isAuto ;
20+ }
21+ public set isAuto ( value : boolean ) {
22+ this . _isAuto = value ;
23+ setAutoButton ( value ) ;
24+ }
25+ private _isFast = false ;
26+ public get isFast ( ) {
27+ return this . _isFast ;
28+ }
29+ public set isFast ( value : boolean ) {
30+ this . _isFast = value ;
31+ setFastButton ( value ) ;
32+ }
33+
1534 public resetGamePlay ( ) {
1635 this . isAuto = false ;
1736 this . isFast = false ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { WebGAL } from '@/Core/WebGAL';
99 * 设置 autoplay 按钮的激活与否
1010 * @param on
1111 */
12- const setButton = ( on : boolean ) => {
12+ export const setAutoButton = ( on : boolean ) => {
1313 const autoIcon = document . getElementById ( 'Button_ControlPanel_auto' ) ;
1414 if ( autoIcon ) {
1515 if ( on ) {
@@ -23,7 +23,6 @@ const setButton = (on: boolean) => {
2323 */
2424export const stopAuto = ( ) => {
2525 WebGAL . gameplay . isAuto = false ;
26- setButton ( false ) ;
2726 if ( WebGAL . gameplay . autoInterval !== null ) {
2827 clearInterval ( WebGAL . gameplay . autoInterval ) ;
2928 WebGAL . gameplay . autoInterval = null ;
@@ -44,7 +43,6 @@ export const switchAuto = () => {
4443 } else {
4544 // 当前不在自动播放
4645 WebGAL . gameplay . isAuto = true ;
47- setButton ( true ) ;
4846 WebGAL . gameplay . autoInterval = setInterval ( autoPlay , 100 ) ;
4947 }
5048} ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { SYSTEM_CONFIG } from '@/config';
1010 * 设置 fast 按钮的激活与否
1111 * @param on
1212 */
13- const setButton = ( on : boolean ) => {
13+ export const setFastButton = ( on : boolean ) => {
1414 const autoIcon = document . getElementById ( 'Button_ControlPanel_fast' ) ;
1515 if ( autoIcon ) {
1616 if ( on ) {
@@ -19,8 +19,6 @@ const setButton = (on: boolean) => {
1919 }
2020} ;
2121
22- export { setButton as setFastButton } ;
23-
2422/**
2523 * 停止快进模式
2624 */
@@ -29,7 +27,6 @@ export const stopFast = () => {
2927 return ;
3028 }
3129 WebGAL . gameplay . isFast = false ;
32- setButton ( false ) ;
3330 if ( WebGAL . gameplay . fastInterval !== null ) {
3431 clearInterval ( WebGAL . gameplay . fastInterval ) ;
3532 WebGAL . gameplay . fastInterval = null ;
@@ -44,7 +41,6 @@ export const startFast = () => {
4441 return ;
4542 }
4643 WebGAL . gameplay . isFast = true ;
47- setButton ( true ) ;
4844 WebGAL . gameplay . fastInterval = setInterval ( ( ) => {
4945 nextSentence ( ) ;
5046 } , SYSTEM_CONFIG . fast_timeout ) ;
Original file line number Diff line number Diff line change @@ -143,14 +143,13 @@ export function useMouseWheel() {
143143 if ( WebGAL . gameplay . isFast ) stopFast ( ) ;
144144 WebGAL . gameplay . isFast = true ;
145145 // 滚轮视作快进
146- setFastButton ( true ) ;
147146 setTimeout ( ( ) => {
148147 WebGAL . gameplay . isFast = false ;
149- setFastButton ( false ) ;
150148 } , 150 ) ;
151149 next ( ) ;
152150 }
153151 } , [ ] ) ;
152+
154153 useMounted ( ( ) => {
155154 document . addEventListener ( 'wheel' , handleMouseWheel ) ;
156155 } ) ;
You can’t perform that action at this time.
0 commit comments