Browse Source

Menu is controller compatible

master
NickFowler 4 years ago
parent
commit
f050eee9a3
3 changed files with 132 additions and 13 deletions
  1. +112
    -11
      Assets/Scenes/MainMenu.unity
  2. +18
    -0
      Assets/Scripts/MainMenu.cs
  3. BIN
      ProjectSettings/EditorBuildSettings.asset

+ 112
- 11
Assets/Scenes/MainMenu.unity View File

@ -181,9 +181,9 @@ MonoBehaviour:
m_Transition: 1 m_Transition: 1
m_Colors: m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 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_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1 m_ColorMultiplier: 1
m_FadeDuration: 0.1 m_FadeDuration: 0.1
@ -302,7 +302,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Navigation: m_Navigation:
m_Mode: 3
m_Mode: -1
m_SelectOnUp: {fileID: 0} m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0} m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0} m_SelectOnLeft: {fileID: 0}
@ -310,9 +310,9 @@ MonoBehaviour:
m_Transition: 1 m_Transition: 1
m_Colors: m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 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_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1 m_ColorMultiplier: 1
m_FadeDuration: 0.1 m_FadeDuration: 0.1
@ -379,6 +379,105 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 267872473} m_GameObject: {fileID: 267872473}
m_CullTransparentMesh: 0 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 --- !u!1 &354978088
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5201,7 +5300,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_FirstSelected: {fileID: 28924393}
m_sendNavigationEvents: 1 m_sendNavigationEvents: 1
m_DragThreshold: 10 m_DragThreshold: 10
--- !u!4 &490968328 --- !u!4 &490968328
@ -6612,6 +6711,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
menu: {fileID: 1626799337} menu: {fileID: 1626799337}
credits: {fileID: 1901608153} credits: {fileID: 1901608153}
menuBtn: {fileID: 28924395}
creditsBtn: {fileID: 267872475}
--- !u!1 &2067882347 --- !u!1 &2067882347
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6672,9 +6773,9 @@ MonoBehaviour:
m_Transition: 1 m_Transition: 1
m_Colors: m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 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_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1 m_ColorMultiplier: 1
m_FadeDuration: 0.1 m_FadeDuration: 0.1

+ 18
- 0
Assets/Scripts/MainMenu.cs View File

@ -1,12 +1,16 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem.HID;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class MainMenu : MonoBehaviour public class MainMenu : MonoBehaviour
{ {
public GameObject menu; public GameObject menu;
public GameObject credits; public GameObject credits;
public Button menuBtn;
public Button creditsBtn;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -19,6 +23,20 @@ public class MainMenu : MonoBehaviour
{ {
menu.SetActive(!menu.activeSelf); menu.SetActive(!menu.activeSelf);
credits.SetActive(!credits.activeSelf); credits.SetActive(!credits.activeSelf);
SwapButtons(menu.activeSelf);
}
public void SwapButtons(bool isActive)
{
if (isActive)
{
menuBtn.Select();
}
else
{
creditsBtn.Select();
}
} }
public void StartGame() public void StartGame()

BIN
ProjectSettings/EditorBuildSettings.asset (Stored with Git LFS) View File

size 160
oid sha256:488996ee11fc651af98aeb4d4498c9d7560dfc7816738f66c324ff7555eec8c9
size 352

Loading…
Cancel
Save