From f050eee9a3bdb75147b952d1f6f8115dfa4bd4ce Mon Sep 17 00:00:00 2001 From: NickFowler Date: Sun, 2 Feb 2020 14:21:33 +1100 Subject: [PATCH] Menu is controller compatible --- Assets/Scenes/MainMenu.unity | 123 ++++++++++++++++++++-- Assets/Scripts/MainMenu.cs | 18 ++++ ProjectSettings/EditorBuildSettings.asset | 4 +- 3 files changed, 132 insertions(+), 13 deletions(-) diff --git a/Assets/Scenes/MainMenu.unity b/Assets/Scenes/MainMenu.unity index e5ad36e..cc789d7 100644 --- a/Assets/Scenes/MainMenu.unity +++ b/Assets/Scenes/MainMenu.unity @@ -181,9 +181,9 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_HighlightedColor: {r: 1, g: 0.48584908, b: 0.71704775, a: 1} + m_PressedColor: {r: 0.7294118, g: 0.21960784, b: 0.654902, a: 1} + m_SelectedColor: {r: 1, g: 0.4862745, b: 0.7176471, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 @@ -302,7 +302,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Navigation: - m_Mode: 3 + m_Mode: -1 m_SelectOnUp: {fileID: 0} m_SelectOnDown: {fileID: 0} m_SelectOnLeft: {fileID: 0} @@ -310,9 +310,9 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.7735849, g: 0.22988607, b: 0.43835056, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_HighlightedColor: {r: 1, g: 0.4862745, b: 0.7176471, a: 1} + m_PressedColor: {r: 0.7264151, g: 0.21586864, b: 0.65347993, a: 1} + m_SelectedColor: {r: 1, g: 0.4862745, b: 0.7176471, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 @@ -379,6 +379,105 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 267872473} m_CullTransparentMesh: 0 +--- !u!1001 &346929098 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4035834407651339496, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: audioPosition + value: + objectReference: {fileID: 1556374244} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[1] + value: 0.6 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: volumes.Array.data[0] + value: 0.35 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339497, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: waitTime + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339498, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339499, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4035834407651339503, guid: 6ad2be9300e66ea46bc90805f007dd81, + type: 3} + propertyPath: m_Name + value: AudioManager + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6ad2be9300e66ea46bc90805f007dd81, type: 3} --- !u!1 &354978088 GameObject: m_ObjectHideFlags: 0 @@ -5201,7 +5300,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Name: m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} + m_FirstSelected: {fileID: 28924393} m_sendNavigationEvents: 1 m_DragThreshold: 10 --- !u!4 &490968328 @@ -6612,6 +6711,8 @@ MonoBehaviour: m_EditorClassIdentifier: menu: {fileID: 1626799337} credits: {fileID: 1901608153} + menuBtn: {fileID: 28924395} + creditsBtn: {fileID: 267872475} --- !u!1 &2067882347 GameObject: m_ObjectHideFlags: 0 @@ -6672,9 +6773,9 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} - m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} - m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_HighlightedColor: {r: 1, g: 0.4862745, b: 0.7176471, a: 1} + m_PressedColor: {r: 0.7294118, g: 0.21960784, b: 0.654902, a: 1} + m_SelectedColor: {r: 1, g: 0.4862745, b: 0.7176471, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 m_FadeDuration: 0.1 diff --git a/Assets/Scripts/MainMenu.cs b/Assets/Scripts/MainMenu.cs index 2ae8bbe..bbdf1ae 100644 --- a/Assets/Scripts/MainMenu.cs +++ b/Assets/Scripts/MainMenu.cs @@ -1,12 +1,16 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.InputSystem.HID; using UnityEngine.SceneManagement; +using UnityEngine.UI; public class MainMenu : MonoBehaviour { public GameObject menu; public GameObject credits; + public Button menuBtn; + public Button creditsBtn; // Start is called before the first frame update void Start() @@ -19,6 +23,20 @@ public class MainMenu : MonoBehaviour { menu.SetActive(!menu.activeSelf); credits.SetActive(!credits.activeSelf); + SwapButtons(menu.activeSelf); + + } + + public void SwapButtons(bool isActive) + { + if (isActive) + { + menuBtn.Select(); + } + else + { + creditsBtn.Select(); + } } public void StartGame() diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 19f97fc..82fddf6 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1942c088ddfeeef348fdf12390e2a2d6da51056e197458d67969d44e7b2cbbd3 -size 160 +oid sha256:488996ee11fc651af98aeb4d4498c9d7560dfc7816738f66c324ff7555eec8c9 +size 352