示例#1
0
		/// <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();
		}
示例#2
0
		/// <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>();
 }
示例#4
0
		/// <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();
		}
示例#5
0
 /// <summary>
 /// Unity Start hook.
 /// </summary>
 void Start()
 {
     menu = gameObject.GetComponentInParent <UIBasicMenu> ();
 }