File tree Expand file tree Collapse file tree 7 files changed +36
-60
lines changed Expand file tree Collapse file tree 7 files changed +36
-60
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,9 @@ export const autoNextSentence = () => {
58
58
* 自动播放的执行函数
59
59
*/
60
60
const autoPlay = ( ) => {
61
- const delay = webgalStore . getState ( ) . userData . optionData . autoSpeed ;
62
- const autoPlayDelay = 750 - 250 * delay ;
61
+ const data = webgalStore . getState ( ) . userData . optionData . autoSpeed ;
62
+ // 范围为 [250, 1750]
63
+ const autoPlayDelay = 250 + ( 100 - data ) * 15 ;
63
64
let isBlockingAuto = false ;
64
65
WebGAL . gameplay . performController . performList . forEach ( ( e ) => {
65
66
if ( e . blockingAuto ( ) )
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { IPerform } from '@/Core/Modules/perform/performInterface';
3
3
import { playVocal } from './vocal' ;
4
4
import { webgalStore } from '@/store/store' ;
5
5
import { setStage } from '@/store/stageReducer' ;
6
- import { useTextDelay } from '@/hooks/useTextOptions' ;
6
+ import { useTextAnimationDuration , useTextDelay } from '@/hooks/useTextOptions' ;
7
7
import { getRandomPerformName , PerformController } from '@/Core/Modules/perform/performController' ;
8
8
import { getSentenceArgByKey } from '@/Core/util/getSentenceArg' ;
9
9
import { textSize , voiceOption } from '@/store/userDataInterface' ;
@@ -148,7 +148,7 @@ export const say = (sentence: ISentence): IPerform => {
148
148
}
149
149
150
150
const performInitName : string = getRandomPerformName ( ) ;
151
- let endDelay = 750 - userDataState . optionData . textSpeed * 250 ;
151
+ let endDelay = useTextAnimationDuration ( userDataState . optionData . textSpeed ) / 2 ;
152
152
// 如果有 notend 参数,那么就不需要等待
153
153
if ( isNotend ) {
154
154
endDelay = 0 ;
Original file line number Diff line number Diff line change @@ -34,23 +34,14 @@ export function Display() {
34
34
/>
35
35
</ NormalOption >
36
36
< NormalOption key = "textSpeed" title = { t ( 'textSpeed.title' ) } >
37
- < NormalButton
38
- textList = { t ( 'textSpeed.options.slow' , 'textSpeed.options.medium' , 'textSpeed.options.fast' ) }
39
- functionList = { [
40
- ( ) => {
41
- dispatch ( setOptionData ( { key : 'textSpeed' , value : playSpeed . slow } ) ) ;
42
- setStorage ( ) ;
43
- } ,
44
- ( ) => {
45
- dispatch ( setOptionData ( { key : 'textSpeed' , value : playSpeed . normal } ) ) ;
46
- setStorage ( ) ;
47
- } ,
48
- ( ) => {
49
- dispatch ( setOptionData ( { key : 'textSpeed' , value : playSpeed . fast } ) ) ;
50
- setStorage ( ) ;
51
- } ,
52
- ] }
53
- currentChecked = { userDataState . optionData . textSpeed }
37
+ < OptionSlider
38
+ initValue = { userDataState . optionData . textSpeed }
39
+ uniqueID = { t ( 'textSpeed.title' ) }
40
+ onChange = { ( event ) => {
41
+ const newValue = event . target . value ;
42
+ dispatch ( setOptionData ( { key : 'textSpeed' , value : Number ( newValue ) } ) ) ;
43
+ setStorage ( ) ;
44
+ } }
54
45
/>
55
46
</ NormalOption >
56
47
< NormalOption key = "textSize" title = { t ( 'textSize.title' ) } >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { WebGAL } from '@/Core/WebGAL';
18
18
import useSoundEffect from '@/hooks/useSoundEffect' ;
19
19
import savesReducer , { ISavesData , saveActions } from '@/store/savesReducer' ;
20
20
import { dumpFastSaveToStorage , dumpSavesToStorage } from '@/Core/controller/storage/savesController' ;
21
+ import { OptionSlider } from '@/UI/Menu/Options/OptionSlider' ;
21
22
22
23
interface IExportGameData {
23
24
userData : IUserData ;
@@ -104,23 +105,14 @@ export function System() {
104
105
{ ! showAbout && (
105
106
< >
106
107
< NormalOption key = "option1" title = { t ( 'autoSpeed.title' ) } >
107
- < NormalButton
108
- textList = { t ( 'autoSpeed.options.slow' , 'autoSpeed.options.medium' , 'autoSpeed.options.fast' ) }
109
- functionList = { [
110
- ( ) => {
111
- dispatch ( setOptionData ( { key : 'autoSpeed' , value : playSpeed . slow } ) ) ;
112
- setStorage ( ) ;
113
- } ,
114
- ( ) => {
115
- dispatch ( setOptionData ( { key : 'autoSpeed' , value : playSpeed . normal } ) ) ;
116
- setStorage ( ) ;
117
- } ,
118
- ( ) => {
119
- dispatch ( setOptionData ( { key : 'autoSpeed' , value : playSpeed . fast } ) ) ;
120
- setStorage ( ) ;
121
- } ,
122
- ] }
123
- currentChecked = { userDataState . optionData . autoSpeed }
108
+ < OptionSlider
109
+ initValue = { userDataState . optionData . autoSpeed }
110
+ uniqueID = { t ( 'autoSpeed.title' ) }
111
+ onChange = { ( event ) => {
112
+ const newValue = event . target . value ;
113
+ dispatch ( setOptionData ( { key : 'autoSpeed' , value : Number ( newValue ) } ) ) ;
114
+ setStorage ( ) ;
115
+ } }
124
116
/>
125
117
</ NormalOption >
126
118
< NormalOption key = "option7" title = { t ( 'language.title' ) } >
Original file line number Diff line number Diff line change 1
1
import { playSpeed } from '@/store/userDataInterface' ;
2
2
3
- export function useTextDelay ( type : playSpeed ) {
4
- switch ( type ) {
5
- case playSpeed . slow :
6
- return 80 ;
7
- case playSpeed . normal :
8
- return 35 ;
9
- case playSpeed . fast :
10
- return 3 ;
11
- }
3
+ // 范围为 [startRange, step * 100 + startRange]
4
+ export function useTextDelay ( data : number ) {
5
+ const startRange = 3 ;
6
+ const step = 1.5 ;
7
+ return startRange + ( 100 - data ) * step ;
12
8
}
13
9
14
- export function useTextAnimationDuration ( type : playSpeed ) {
15
- switch ( type ) {
16
- case playSpeed . slow :
17
- return 800 ;
18
- case playSpeed . normal :
19
- return 350 ;
20
- case playSpeed . fast :
21
- return 200 ;
22
- }
10
+ // 范围为 [startRange, step * 100 + startRange]
11
+ export function useTextAnimationDuration ( data : number ) {
12
+ const startRange = 200 ;
13
+ const step = 15 ;
14
+ return startRange + ( 100 - data ) * step ;
23
15
}
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ export enum fullScreenOption {
39
39
*/
40
40
export interface IOptionData {
41
41
volumeMain : number ; // 主音量
42
- textSpeed : playSpeed ; // 文字速度
43
- autoSpeed : playSpeed ; // 自动播放速度
42
+ textSpeed : number ; // 文字速度
43
+ autoSpeed : number ; // 自动播放速度
44
44
textSize : textSize ;
45
45
vocalVolume : number ; // 语音音量
46
46
bgmVolume : number ; // 背景音乐音量
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ import { ISetGameVar } from './stageInterface';
24
24
const initialOptionSet : IOptionData = {
25
25
slPage : 1 ,
26
26
volumeMain : 100 , // 主音量
27
- textSpeed : playSpeed . normal , // 文字速度
28
- autoSpeed : playSpeed . normal , // 自动播放速度
27
+ textSpeed : 50 , // 文字速度
28
+ autoSpeed : 50 , // 自动播放速度
29
29
textSize : textSize . medium ,
30
30
vocalVolume : 100 , // 语音音量
31
31
bgmVolume : 25 , // 背景音乐音量
You can’t perform that action at this time.
0 commit comments