Fullscreen mode dropdown
This commit is contained in:
parent
c7c2d51262
commit
081f9ff086
File diff suppressed because it is too large
Load Diff
@ -541,6 +541,14 @@ PrefabInstance:
|
||||
propertyPath: eventSystem
|
||||
value:
|
||||
objectReference: {fileID: 775644865}
|
||||
- target: {fileID: 2702070852302166608, guid: 7671830e57aa4bd4cab63b8399c6f825, type: 3}
|
||||
propertyPath: m_text
|
||||
value: Windowed
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3281526541317417273, guid: 7671830e57aa4bd4cab63b8399c6f825, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4394421820928219480, guid: 7671830e57aa4bd4cab63b8399c6f825, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: MainMenu
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using NaughtyAttributes;
|
||||
using TMPro;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class MainMenuManager : MonoBehaviour {
|
||||
@ -12,22 +14,32 @@ public class MainMenuManager : MonoBehaviour {
|
||||
PauseMenu,
|
||||
Options,
|
||||
}
|
||||
|
||||
|
||||
[SerializeField] [Required]
|
||||
TMP_Text titleLabel;
|
||||
|
||||
[SerializeField] string[] titleOptions;
|
||||
|
||||
[SerializeField] [Required]
|
||||
Transform startMenuParent;
|
||||
|
||||
[SerializeField] [Required]
|
||||
Transform pauseParent;
|
||||
|
||||
[SerializeField] [Required]
|
||||
Transform optionsParent;
|
||||
|
||||
[SerializeField] [Required]
|
||||
GameTimer gameTimer;
|
||||
|
||||
[SerializeField] [Required]
|
||||
EventSystem eventSystem;
|
||||
|
||||
[SerializeField] [Required]
|
||||
TMP_Dropdown displayModeDropdown;
|
||||
|
||||
MenuMode mode;
|
||||
MenuMode? preOptionsMode;
|
||||
MenuMode? preOptionsMode;
|
||||
|
||||
void Awake() => SetMenuMode(MenuMode.MainMenu);
|
||||
|
||||
@ -36,7 +48,7 @@ public class MainMenuManager : MonoBehaviour {
|
||||
Debug.LogWarning("No titles listed.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (PlayerPrefs.HasKey(GameTimer.HIGH_SCORE_KEY) && PlayerPrefs.GetFloat(GameTimer.HIGH_SCORE_KEY) > 0f)
|
||||
titleLabel.text = titleOptions[Random.Range(0, titleOptions.Length)];
|
||||
else
|
||||
@ -55,7 +67,7 @@ public class MainMenuManager : MonoBehaviour {
|
||||
} else {
|
||||
preOptionsMode = null;
|
||||
}
|
||||
|
||||
|
||||
this.mode = mode;
|
||||
ResetMenuState();
|
||||
}
|
||||
@ -77,10 +89,19 @@ public class MainMenuManager : MonoBehaviour {
|
||||
eventSystem.firstSelectedGameObject = selected;
|
||||
eventSystem.SetSelectedGameObject(selected);
|
||||
}
|
||||
|
||||
|
||||
public void GoToScene(int sceneNb) => SceneManager.LoadScene(sceneNb);
|
||||
|
||||
public void QuitGame() => Application.Quit(0);
|
||||
|
||||
public void ResetHighScore() => gameTimer.ResetHighScore();
|
||||
}
|
||||
|
||||
public void DisplayModeChange() {
|
||||
Screen.fullScreenMode = displayModeDropdown.value switch {
|
||||
0 => FullScreenMode.Windowed,
|
||||
1 => FullScreenMode.ExclusiveFullScreen,
|
||||
2 => FullScreenMode.FullScreenWindow,
|
||||
_ => Screen.fullScreenMode
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user