示例#1
0
 void Update()
 {
     if (Input.GetKeyUp(KeyCode.Return))
     {
         if (GameTurnController.CurrentState == GameTurnController.PlayerState.EnemyCombatTurn ||
             GameTurnController.CurrentState == GameTurnController.PlayerState.CommandChain ||
             GameTurnController.CurrentState == GameTurnController.PlayerState.EnemyTurn)
         {
             DialogueScript.ErrorText("Can't do anything now.");
             InterfaceScript.DeActivateInput();
         }
         else if (GameTurnController.CurrentState == GameTurnController.PlayerState.Combat ||
                  GameTurnController.CurrentState == GameTurnController.PlayerState.PlayerTurn)
         {
             if (InterfaceScript.CommandInputField.text == "")
             {
                 DialogueScript.ErrorText("Nothing saved.");
                 InterfaceScript.ActivateInput();
                 return;
             }
             InterfaceScript.PlayerInput();
         }
     }
     //Make sure that if people hit their mouse buttons or escape, the input is still active
     if (Input.GetKeyUp(KeyCode.Mouse0) || Input.GetKeyUp(KeyCode.Mouse1) || Input.GetKeyUp(KeyCode.Escape))
     {
         InterfaceScript.ActivateInput();
     }
     //If Player hit the up-arrow, the last thing they wrote will be placed back into the input field
     if (Input.GetKeyUp(KeyCode.UpArrow) && (GameTurnController.CurrentState == GameTurnController.PlayerState.PlayerTurn ||
                                             GameTurnController.CurrentState == GameTurnController.PlayerState.Combat))
     {
         if (InterfaceScript.LastCommands == null)
         {
             return;
         }
         InterfaceScript.ActivateInput();
         InterfaceScript.CommandInputField.text = InterfaceScript.LastCommands;
         InterfaceScript.CommandInputField.MoveTextEnd(true);
         InterfaceScript.LastCommands = null;
     }
 }