Large diffs are not rendered by default.

@@ -68,13 +68,12 @@ public class MainMenuController : MonoBehaviour {
}

public void MoveButtons() {
// TODO: Use Jonathan's Custom Input - Werid issues breaking CustomInput.Bool. Maybe related to EventTriggers

Debug.Log(Input.GetAxis("Vertical"));
// TODO: function that lets me not have all this pointer switching stuff be hard coded twice.
// to lazy to fix right now and don't think it'll matter.

// Reassign all button references to proper place after navigation, then cards if applicable
if(Input.GetAxis("Vertical") < 0.0) {
if(Input.GetKeyDown(KeyCode.DownArrow)) {
GameObject temp = buttons[0];
for (int i = 1; i < buttons.Length; i++) {
buttons[i-1] = buttons[i];
@@ -92,7 +91,7 @@ public class MainMenuController : MonoBehaviour {
cards[cards.Length-1] = tempCard;
}
}
else if(Input.GetAxis("Vertical") > 0.0) {
else if(Input.GetKeyDown(KeyCode.UpArrow)) {
GameObject temp = buttons[buttons.Length-1];
for (int i = buttons.Length-2; i >= 0; i--) {
buttons[i+1] = buttons[i];
@@ -1,19 +1,101 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Assets.Scripts.Util;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class MenusController : MonoBehaviour {

public Stack<GameObject> MenuStack = new Stack<GameObject>();
public GameObject InitialMenu;

public UIHideBehaviour MainMenu1;
public UIHideBehaviour MainMenu2;
public GameObject MenuSelected;

public UIHideBehaviour Settings;
public GameObject SettingsSelected;

public UIHideBehaviour LevelSelect1;
public UIHideBehaviour LevelSelect2;
public GameObject LevelSelected;


// Use this for initialization
void Start () {
this.MenuStack.Push(InitialMenu);

}

// Update is called once per frame
void Update () {

if(Input.GetKeyDown(KeyCode.B) && (Settings.OnScreen || LevelSelect1.OnScreen)) {
GoToMainMenu();
}

Debug.Log(Input.GetKeyDown(KeyCode.DownArrow));
if (Input.GetKeyDown(KeyCode.UpArrow)) Navigate(CustomInput.UserInput.Up);
if (Input.GetKeyDown(KeyCode.DownArrow)) Navigate(CustomInput.UserInput.Down);
if (Input.GetKeyDown(KeyCode.RightArrow)) Navigate(CustomInput.UserInput.Right);
if (Input.GetKeyDown(KeyCode.LeftArrow)) Navigate(CustomInput.UserInput.Left);
}


public void GoToSettings() {
if (MainMenu1.OnScreen) MenuSelected = EventSystem.current.currentSelectedGameObject;
MainMenu1.OnScreen = false;
MainMenu2.OnScreen = false;

LevelSelect1.OnScreen = false;
LevelSelect2.OnScreen = false;

Settings.OnScreen = true;
EventSystem.current.SetSelectedGameObject(SettingsSelected);
}

public void GoToMainMenu() {
if (LevelSelect1.OnScreen) LevelSelected = EventSystem.current.currentSelectedGameObject;
Settings.OnScreen = false;

LevelSelect1.OnScreen = false;
LevelSelect2.OnScreen = false;

MainMenu1.OnScreen = true;
MainMenu2.OnScreen = true;
EventSystem.current.SetSelectedGameObject(MenuSelected);
}

public void GoToLevelSelect() {
if (MainMenu1.OnScreen) MenuSelected = EventSystem.current.currentSelectedGameObject;
Settings.OnScreen = false;

MainMenu1.OnScreen = false;
MainMenu2.OnScreen = false;

LevelSelect1.OnScreen = true;
LevelSelect2.OnScreen = true;
EventSystem.current.SetSelectedGameObject(LevelSelected);
}

#region NAVIGATION
private void Navigate(CustomInput.UserInput direction)
{
GameObject next = EventSystem.current.currentSelectedGameObject;

switch(direction)
{
case CustomInput.UserInput.Up:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnUp().gameObject;
break;
case CustomInput.UserInput.Down:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown().gameObject;
break;
case CustomInput.UserInput.Left:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnLeft().gameObject;
break;
case CustomInput.UserInput.Right:
next = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnRight().gameObject;
break;
}
EventSystem.current.SetSelectedGameObject(next);
}
#endregion
}
@@ -9,8 +9,13 @@ public class SettingsMenuController : MonoBehaviour {
public UIHideBehaviour subtitleHide;

public GameObject Video;
public GameObject VideoSelect;

public GameObject Audio;
public GameObject AudioSelect;

public GameObject Settings;
public GameObject SettingsSelect;

public EventSystem es;

@@ -30,6 +35,8 @@ public class SettingsMenuController : MonoBehaviour {

Settings.SetActive(false);
Video.SetActive(true);

es.SetSelectedGameObject(VideoSelect);
}

public void ChangeToAudio() {
@@ -38,6 +45,8 @@ public class SettingsMenuController : MonoBehaviour {

Settings.SetActive(false);
Audio.SetActive(true);

es.SetSelectedGameObject(AudioSelect);
}

public void ChangeToSettings() {
@@ -48,6 +57,6 @@ public class SettingsMenuController : MonoBehaviour {
Audio.SetActive(false);
Settings.SetActive(true);

es.UpdateModules();
es.SetSelectedGameObject(SettingsSelect);
}
}
@@ -16,10 +16,10 @@ public class UIHideBehaviour : MonoBehaviour {
// Update is called once per frame
void Update () {
if (OnScreen) {
this.transform.position = Vector3.MoveTowards(this.transform.position, this.OnScreenPos.position, 100*Time.deltaTime);
this.transform.position = Vector3.MoveTowards(this.transform.position, this.OnScreenPos.position, 1000*Time.deltaTime);
}
else {
this.transform.position = Vector3.MoveTowards(this.transform.position, this.OffScreenPos.position, 100*Time.deltaTime);
this.transform.position = Vector3.MoveTowards(this.transform.position, this.OffScreenPos.position, 1000*Time.deltaTime);
}
}
}