@@ -24,15 +24,18 @@ public class SampleLoader : MonoBehaviour
2424 public GameObject DemoModeProgressBG ;
2525 public RectTransform DemoModeProgressBar ;
2626
27- [ Header ( "Options Menu" ) ]
27+ [ Header ( "Menu" ) ]
2828 public KeyCode MenuToggleKey = KeyCode . Escape ;
29- public RectTransform OptionsMenuTransform ;
29+ public RectTransform MenuTransform ;
3030 public Button OpenMenuButton ;
3131 public Button CloseMenuButton ;
3232
3333 [ Header ( "Load Scene Window" ) ]
3434 public GameObject LoadSceneWindowRoot ;
3535
36+ [ Header ( "Options Window" ) ]
37+ public GameObject OptionsWindowRoot ;
38+
3639 [ Header ( "FPS Counter" ) ]
3740 public GameObject DebugRoot ;
3841 public Text FramerateText ;
@@ -59,6 +62,7 @@ void Start()
5962 SetFPSVisible ( false ) ;
6063 SetMenuVisible ( false ) ;
6164 SetLoadSceneWindowVisible ( false ) ;
65+ SetOptionsWindowVisible ( false ) ;
6266 SetDemoMode ( true ) ;
6367
6468 instance = this ;
@@ -113,7 +117,7 @@ public void MenuToggleFPSCounter()
113117
114118 #endregion
115119
116- #region OPTIONS MENU
120+ #region MENU
117121
118122 bool m_MenuVisible = false ;
119123
@@ -124,13 +128,16 @@ public void SetMenuVisible(bool visible)
124128 if ( m_LoadSceneWindowVisible )
125129 SetLoadSceneWindowVisible ( false ) ;
126130
131+ if ( m_OptionsWindowVisible )
132+ SetOptionsWindowVisible ( false ) ;
133+
127134 OpenMenuButton . gameObject . SetActive ( false ) ;
128- OptionsMenuTransform . anchoredPosition = new Vector3 ( 0 , 0 , 0 ) ;
135+ MenuTransform . anchoredPosition = new Vector3 ( 0 , 0 , 0 ) ;
129136 }
130137 else
131138 {
132139 OpenMenuButton . gameObject . SetActive ( true ) ;
133- OptionsMenuTransform . anchoredPosition = new Vector3 ( OptionsMenuTransform . sizeDelta . x , 0 , 0 ) ;
140+ MenuTransform . anchoredPosition = new Vector3 ( MenuTransform . sizeDelta . x , 0 , 0 ) ;
134141 }
135142
136143 if ( m_MenuVisible != visible )
@@ -195,7 +202,11 @@ public void SetLoadSceneWindowVisible(bool value)
195202 if ( m_LoadSceneWindowVisible != value )
196203 {
197204 if ( value )
205+ {
206+ SetOptionsWindowVisible ( false ) ;
198207 SetMenuVisible ( false ) ;
208+ }
209+
199210
200211 LoadSceneWindowRoot . SetActive ( value ) ;
201212
@@ -215,6 +226,31 @@ public void MenuLoadScene(int index)
215226
216227 #endregion
217228
229+ #region OPTIONS WINDOW
230+
231+ bool m_OptionsWindowVisible = true ;
232+
233+ public void SetOptionsWindowVisible ( bool value )
234+ {
235+ if ( m_OptionsWindowVisible != value )
236+ {
237+ if ( value )
238+ {
239+ SetMenuVisible ( false ) ;
240+ SetLoadSceneWindowVisible ( false ) ;
241+ }
242+
243+
244+ OptionsWindowRoot . SetActive ( value ) ;
245+
246+ m_OptionsWindowVisible = value ;
247+
248+ if ( onMenuToggle != null )
249+ onMenuToggle . Invoke ( value ) ;
250+ }
251+ }
252+
253+ #endregion
218254 void Update ( )
219255 {
220256 if ( Input . GetKeyDown ( MenuToggleKey ) )
0 commit comments