/// <summary> /// Set contorls to custom as the user has changed them. /// </summary> public void SetToCustom() { currentListPosition = -1; PlayerPrefs.SetString(CurrentInputPlayerPrefName, Title); UIBasicMenu menu = gameObject.GetComponentInParent<UIBasicMenu>(); if (menu != null) menu.Refresh(); }
/// <summary> /// Do the action for when the user presses right. /// </summary> override public void DoRightAction() { currentListPosition++; if (currentListPosition >= inputs.Count) currentListPosition = 0; LoadInput(inputs[currentListPosition]); UIBasicMenu menu = gameObject.GetComponentInParent<UIBasicMenu>(); if (menu != null) menu.Refresh(); }
/// <summary> /// Unity Start hook. /// </summary> void Start() { switchInputMenuItem = transform.parent.GetComponentInChildren <UIMenuItem_SwitchInputType> (); menu = gameObject.GetComponentInParent <UIBasicMenu>(); if (input == null) { input = (Input)GameObject.FindObjectOfType(typeof(Input)); } escHandler = GameObject.FindObjectOfType <EscapeKeyHandler>(); }
/// <summary> /// Loads the given input file form a Unity resource. /// </summary> /// <param name="nameAndPref">Menu item anme and resource name.</param> protected void LoadInput(NameAndPref nameAndPref) { StandardInputData data = StandardInputData.LoadFromResource (nameAndPref.resourceName); if (data != null) { input.LoadInputData (data); input.SaveInputData (); PlayerPrefs.SetString(CurrentInputPlayerPrefName, nameAndPref.name); } else { Debug.LogError("Tried to load input from a resource but LoadFromResource() returned null"); } UIBasicMenu menu = gameObject.GetComponentInParent<UIBasicMenu>(); if (menu != null) menu.Refresh(); }
/// <summary> /// Unity Start hook. /// </summary> void Start() { menu = gameObject.GetComponentInParent <UIBasicMenu> (); }