1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
- //using TMPro;
5
4
using UnityEngine ;
6
5
using UnityEngine . UI ;
7
6
using UnityExplorer . Config ;
@@ -19,6 +18,7 @@ public class OptionsPage : MainMenu.Page
19
18
private Toggle m_unlockMouseToggle ;
20
19
private InputField m_pageLimitInput ;
21
20
private InputField m_defaultOutputInput ;
21
+ private Toggle m_hideOnStartupToggle ;
22
22
23
23
public override void Init ( )
24
24
{
@@ -27,26 +27,21 @@ public override void Init()
27
27
28
28
public override void Update ( )
29
29
{
30
- // not needed?
31
30
}
32
31
33
32
internal void OnApply ( )
34
33
{
35
34
if ( ! string . IsNullOrEmpty ( m_keycodeInput . text ) && Enum . Parse ( typeof ( KeyCode ) , m_keycodeInput . text ) is KeyCode keyCode )
36
- {
37
35
ModConfig . Instance . Main_Menu_Toggle = keyCode ;
38
- }
39
36
40
37
ModConfig . Instance . Force_Unlock_Mouse = m_unlockMouseToggle . isOn ;
41
38
42
39
if ( ! string . IsNullOrEmpty ( m_pageLimitInput . text ) && int . TryParse ( m_pageLimitInput . text , out int lim ) )
43
- {
44
40
ModConfig . Instance . Default_Page_Limit = lim ;
45
- }
46
41
47
42
ModConfig . Instance . Default_Output_Path = m_defaultOutputInput . text ;
48
43
49
- // todo default output path
44
+ ModConfig . Instance . Hide_On_Startup = m_hideOnStartupToggle . isOn ;
50
45
51
46
ModConfig . SaveSettings ( ) ;
52
47
ModConfig . InvokeConfigChanged ( ) ;
@@ -98,6 +93,7 @@ internal void ConstructUI()
98
93
ConstructMouseUnlockOpt ( optionsGroupObj ) ;
99
94
ConstructPageLimitOpt ( optionsGroupObj ) ;
100
95
ConstructOutputPathOpt ( optionsGroupObj ) ;
96
+ ConstructHideOnStartupOpt ( optionsGroupObj ) ;
101
97
102
98
var applyBtnObj = UIFactory . CreateButton ( Content , new Color ( 0.2f , 0.2f , 0.2f ) ) ;
103
99
var applyText = applyBtnObj . GetComponentInChildren < Text > ( ) ;
@@ -113,10 +109,34 @@ internal void ConstructUI()
113
109
applyBtn . onClick . AddListener ( OnApply ) ;
114
110
}
115
111
116
- internal void ConstructKeycodeOpt ( GameObject parent )
112
+ private void ConstructHideOnStartupOpt ( GameObject optionsGroupObj )
117
113
{
118
- //public KeyCode Main_Menu_Toggle = KeyCode.F7;
114
+ var rowObj = UIFactory . CreateHorizontalGroup ( optionsGroupObj , new Color ( 1 , 1 , 1 , 0 ) ) ;
115
+ var rowGroup = rowObj . GetComponent < HorizontalLayoutGroup > ( ) ;
116
+ rowGroup . childControlWidth = true ;
117
+ rowGroup . childForceExpandWidth = false ;
118
+ rowGroup . childControlHeight = true ;
119
+ rowGroup . childForceExpandHeight = true ;
120
+ var groupLayout = rowObj . AddComponent < LayoutElement > ( ) ;
121
+ groupLayout . minHeight = 25 ;
122
+ groupLayout . flexibleHeight = 0 ;
123
+ groupLayout . minWidth = 200 ;
124
+ groupLayout . flexibleWidth = 1000 ;
119
125
126
+ var labelObj = UIFactory . CreateLabel ( rowObj , TextAnchor . MiddleLeft ) ;
127
+ var labelText = labelObj . GetComponent < Text > ( ) ;
128
+ labelText . text = "Hide UI on startup:" ;
129
+ var labelLayout = labelObj . AddComponent < LayoutElement > ( ) ;
130
+ labelLayout . minWidth = 150 ;
131
+ labelLayout . minHeight = 25 ;
132
+
133
+ UIFactory . CreateToggle ( rowObj , out m_hideOnStartupToggle , out Text toggleText ) ;
134
+ m_hideOnStartupToggle . isOn = ModConfig . Instance . Hide_On_Startup ;
135
+ toggleText . text = "" ;
136
+ }
137
+
138
+ internal void ConstructKeycodeOpt ( GameObject parent )
139
+ {
120
140
var rowObj = UIFactory . CreateHorizontalGroup ( parent , new Color ( 1 , 1 , 1 , 0 ) ) ;
121
141
var rowGroup = rowObj . GetComponent < HorizontalLayoutGroup > ( ) ;
122
142
rowGroup . childControlWidth = true ;
@@ -146,8 +166,6 @@ internal void ConstructKeycodeOpt(GameObject parent)
146
166
147
167
internal void ConstructMouseUnlockOpt ( GameObject parent )
148
168
{
149
- //public bool Force_Unlock_Mouse = true;
150
-
151
169
var rowObj = UIFactory . CreateHorizontalGroup ( parent , new Color ( 1 , 1 , 1 , 0 ) ) ;
152
170
var rowGroup = rowObj . GetComponent < HorizontalLayoutGroup > ( ) ;
153
171
rowGroup . childControlWidth = true ;
0 commit comments