Пример #1
0
    IEnumerator HandlingInputLine(string line)
    {
        string title = line.Split('"')[1];

        InputScreen.Show(title);

        while (InputScreen.isWaitingForUserInput)
        {
            yield return(new WaitForEndOfFrame());
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         InputScreen.Show(displayTitle);
     }
     if (Input.GetKeyDown(KeyCode.Return) && InputScreen.isWaitingForUserInput)
     {
         InputScreen.instance.Accept();
         print("You entered the value of " + InputScreen.currentInput);
     }
 }
Пример #3
0
    IEnumerator HandlingInputLine(string line)
    {
        string title = line.Split('"')[1];

        //get the one or more commands to execute when this input is done and accepted.
        string[]      parts          = line.Split(' ');
        List <string> endingCommands = new List <string>();

        if (parts.Length >= 3)
        {
            for (int i = 2; i < parts.Length; i++)
            {
                endingCommands.Add(parts[i]);
            }
        }

        //we have the title and the ending commands to execute. Now we need to bring up the input screen.
        InputScreen.Show(title);
        while (InputScreen.isShowingInputField || InputScreen.isRevealing)
        {
            //wait for the input screen to finish revealing before being able to accept input.
            if (Input.GetKey(KeyCode.Return) && !InputScreen.isRevealing)
            {
                //if the input is not empty, accept it.
                if (InputScreen.currentInput != "")
                {
                    InputScreen.instance.Accept();
                }
            }

            yield return(new WaitForEndOfFrame());
        }

        //the input has been accepted, now it is time to execute the commands that follow.
        for (int i = 0; i < endingCommands.Count; i++)
        {
            string command = endingCommands[i];
            HandleAction(command);
        }
    }