File tree Expand file tree Collapse file tree 7 files changed +39
-63
lines changed
Expand file tree Collapse file tree 7 files changed +39
-63
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,9 @@ export const autoNextSentence = () => {
5858 * 自动播放的执行函数
5959 */
6060const 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 ;
6364 let isBlockingAuto = false ;
6465 WebGAL . gameplay . performController . performList . forEach ( ( e ) => {
6566 if ( e . blockingAuto ( ) )
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { IPerform } from '@/Core/Modules/perform/performInterface';
33import { playVocal } from './vocal' ;
44import { webgalStore } from '@/store/store' ;
55import { setStage } from '@/store/stageReducer' ;
6- import { useTextDelay } from '@/hooks/useTextOptions' ;
6+ import { useTextAnimationDuration , useTextDelay } from '@/hooks/useTextOptions' ;
77import { getRandomPerformName , PerformController } from '@/Core/Modules/perform/performController' ;
88import { getSentenceArgByKey } from '@/Core/util/getSentenceArg' ;
99import { textSize , voiceOption } from '@/store/userDataInterface' ;
@@ -148,7 +148,7 @@ export const say = (sentence: ISentence): IPerform => {
148148 }
149149
150150 const performInitName : string = getRandomPerformName ( ) ;
151- let endDelay = 750 - userDataState . optionData . textSpeed * 250 ;
151+ let endDelay = useTextAnimationDuration ( userDataState . optionData . textSpeed ) / 2 ;
152152 // 如果有 notend 参数,那么就不需要等待
153153 if ( isNotend ) {
154154 endDelay = 0 ;
Original file line number Diff line number Diff line change @@ -33,26 +33,6 @@ export function Display() {
3333 currentChecked = { userDataState . optionData . fullScreen }
3434 />
3535 </ NormalOption >
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 }
54- />
55- </ NormalOption >
5636 < NormalOption key = "textSize" title = { t ( 'textSize.title' ) } >
5737 < NormalButton
5838 textList = { t ( 'textSize.options.small' , 'textSize.options.medium' , 'textSize.options.large' ) }
@@ -93,6 +73,17 @@ export function Display() {
9373 currentChecked = { userDataState . optionData . textboxFont }
9474 />
9575 </ NormalOption >
76+ < NormalOption key = "textSpeed" title = { t ( 'textSpeed.title' ) } >
77+ < OptionSlider
78+ initValue = { userDataState . optionData . textSpeed }
79+ uniqueID = { t ( 'textSpeed.title' ) }
80+ onChange = { ( event ) => {
81+ const newValue = event . target . value ;
82+ dispatch ( setOptionData ( { key : 'textSpeed' , value : Number ( newValue ) } ) ) ;
83+ setStorage ( ) ;
84+ } }
85+ />
86+ </ NormalOption >
9687 < NormalOption key = "textboxOpacity" title = { t ( 'textboxOpacity.title' ) } >
9788 < OptionSlider
9889 initValue = { userDataState . optionData . textboxOpacity }
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { WebGAL } from '@/Core/WebGAL';
1818import useSoundEffect from '@/hooks/useSoundEffect' ;
1919import savesReducer , { ISavesData , saveActions } from '@/store/savesReducer' ;
2020import { dumpFastSaveToStorage , dumpSavesToStorage } from '@/Core/controller/storage/savesController' ;
21+ import { OptionSlider } from '@/UI/Menu/Options/OptionSlider' ;
2122
2223interface IExportGameData {
2324 userData : IUserData ;
@@ -104,23 +105,14 @@ export function System() {
104105 { ! showAbout && (
105106 < >
106107 < 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+ } }
124116 />
125117 </ NormalOption >
126118 < NormalOption key = "option7" title = { t ( 'language.title' ) } >
Original file line number Diff line number Diff line change 11import { playSpeed } from '@/store/userDataInterface' ;
22
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 ;
128}
139
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 ;
2315}
Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ export enum fullScreenOption {
3939 */
4040export interface IOptionData {
4141 volumeMain : number ; // 主音量
42- textSpeed : playSpeed ; // 文字速度
43- autoSpeed : playSpeed ; // 自动播放速度
42+ textSpeed : number ; // 文字速度
43+ autoSpeed : number ; // 自动播放速度
4444 textSize : textSize ;
4545 vocalVolume : number ; // 语音音量
4646 bgmVolume : number ; // 背景音乐音量
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ import { ISetGameVar } from './stageInterface';
2424const initialOptionSet : IOptionData = {
2525 slPage : 1 ,
2626 volumeMain : 100 , // 主音量
27- textSpeed : playSpeed . normal , // 文字速度
28- autoSpeed : playSpeed . normal , // 自动播放速度
27+ textSpeed : 50 , // 文字速度
28+ autoSpeed : 50 , // 自动播放速度
2929 textSize : textSize . medium ,
3030 vocalVolume : 100 , // 语音音量
3131 bgmVolume : 25 , // 背景音乐音量
You can’t perform that action at this time.
0 commit comments