@@ -20,9 +20,43 @@ export interface EnhancedNode {
2020}
2121
2222export const TextBox = ( ) => {
23+ const stageState = useSelector ( ( state : RootState ) => state . stage ) ;
24+ const guiState = useSelector ( ( state : RootState ) => state . GUI ) ;
25+ const userDataState = useSelector ( ( state : RootState ) => state . userData ) ;
26+ const textDelay = useTextDelay ( userDataState . optionData . textSpeed ) ;
27+ const textDuration = useTextAnimationDuration ( userDataState . optionData . textSpeed ) ;
28+ let size = getTextSize ( userDataState . optionData . textSize ) + '%' ;
29+ const font = useFontFamily ( ) ;
30+ const isText = stageState . showText !== '' || stageState . showName !== '' ;
31+ let textSizeState = userDataState . optionData . textSize ;
32+ if ( isText && stageState . showTextSize !== - 1 ) {
33+ size = getTextSize ( stageState . showTextSize ) + '%' ;
34+ textSizeState = stageState . showTextSize ;
35+ }
36+ const lineLimit = match ( textSizeState )
37+ . with ( textSize . small , ( ) => 3 )
38+ . with ( textSize . medium , ( ) => 2 )
39+ . with ( textSize . large , ( ) => 2 )
40+ . default ( ( ) => 2 ) ;
41+ // 拆字
42+ const textArray = compileSentence ( stageState . showText , lineLimit ) ;
43+ const isHasName = stageState . showName !== '' ;
44+ const showName = compileSentence ( stageState . showName , lineLimit ) ;
45+ const currentConcatDialogPrev = stageState . currentConcatDialogPrev ;
46+ const currentDialogKey = stageState . currentDialogKey ;
47+ const miniAvatar = stageState . miniAvatar ;
48+ const textboxOpacity = userDataState . optionData . textboxOpacity ;
49+ const Textbox = IMSSTextbox ;
50+ const fontOptimization = guiState . fontOptimization ;
51+
2352 const [ isShowStroke , setIsShowStroke ] = useState ( true ) ;
2453
2554 useEffect ( ( ) => {
55+ if ( ! fontOptimization ) {
56+ setIsShowStroke ( true ) ;
57+ return ;
58+ }
59+
2660 const handleResize = ( ) => {
2761 const targetHeight = SCREEN_CONSTANTS . height ;
2862 const targetWidth = SCREEN_CONSTANTS . width ;
@@ -46,34 +80,8 @@ export const TextBox = () => {
4680 return ( ) => {
4781 window . removeEventListener ( 'resize' , handleResize ) ;
4882 } ;
49- } , [ ] ) ;
83+ } , [ fontOptimization ] ) ;
5084
51- const stageState = useSelector ( ( state : RootState ) => state . stage ) ;
52- const userDataState = useSelector ( ( state : RootState ) => state . userData ) ;
53- const textDelay = useTextDelay ( userDataState . optionData . textSpeed ) ;
54- const textDuration = useTextAnimationDuration ( userDataState . optionData . textSpeed ) ;
55- let size = getTextSize ( userDataState . optionData . textSize ) + '%' ;
56- const font = useFontFamily ( ) ;
57- const isText = stageState . showText !== '' || stageState . showName !== '' ;
58- let textSizeState = userDataState . optionData . textSize ;
59- if ( isText && stageState . showTextSize !== - 1 ) {
60- size = getTextSize ( stageState . showTextSize ) + '%' ;
61- textSizeState = stageState . showTextSize ;
62- }
63- const lineLimit = match ( textSizeState )
64- . with ( textSize . small , ( ) => 3 )
65- . with ( textSize . medium , ( ) => 2 )
66- . with ( textSize . large , ( ) => 2 )
67- . default ( ( ) => 2 ) ;
68- // 拆字
69- const textArray = compileSentence ( stageState . showText , lineLimit ) ;
70- const isHasName = stageState . showName !== '' ;
71- const showName = compileSentence ( stageState . showName , lineLimit ) ;
72- const currentConcatDialogPrev = stageState . currentConcatDialogPrev ;
73- const currentDialogKey = stageState . currentDialogKey ;
74- const miniAvatar = stageState . miniAvatar ;
75- const textboxOpacity = userDataState . optionData . textboxOpacity ;
76- const Textbox = IMSSTextbox ;
7785 return (
7886 < Textbox
7987 textArray = { textArray }
0 commit comments