コード例 #1
0
ファイル: Scripting.cs プロジェクト: JoeyTheAsian/Encoded
    //.txt not necessary as part of input
    public void Load(string fileName)
    {
        programCounter = 0;
        choiceData.Clear();

        using (StreamReader sr = new StreamReader(fileName + ".txt"))
            using (StreamWriter lvsv = new StreamWriter(new FileStream("liveSave.txt", FileMode.Create))) {
                string line;
                while (!sr.EndOfStream)
                {
                    line = sr.ReadLine();
                    int choice = 0;

                    string[] splitLine = line.Split(' ');
                    if (splitLine.Length > 1)
                    {
                        int.TryParse(splitLine[1], out choice);
                        if (choice != 0 && choice <= 4)
                        {
                            choiceData.Add(choice + "");
                            lvsv.WriteLine(line);
                        }
                    }

                    if (sr.Peek() == -1)
                    {
                        programCounter = int.Parse(line) - 1;
                    }
                }
                lvsv.Close();
                sr.Close();
            }

        /*foreach (string key in labels.Keys) {
         *  Debug.Log(key + " = " + labels[key] + ": " + commands[labels[key]]);
         * }*/
        while (!labels.ContainsValue(programCounter))
        {
            programCounter--;
        }
        dialogueManager.ResetChoice();
        dialogueManager.ClearText();
        characterManager.GetComponent <CharacterManager>().RemoveCharacter("All");
        Next();
    }
コード例 #2
0
    public void ParseOption()
    {
        string command         = option.Split(',')[0];
        string commandModifier = option.Split(',')[1];

        if (command == "line")
        {
            box.ClearText();
            box.lineNum = int.Parse(commandModifier);
            box.ShowDialogue();
            box.lineNum++;
        }
        else if (command == "scene")
        {
            SceneManager.LoadScene("Scene" + commandModifier);
        }
    }
コード例 #3
0
    IEnumerator InitiateDialogue()
    {
        /* Halt Player Control */
        player.isControllable = false;

        /* Play Sound */
        SoundManager.instance.PlaySound("Blip");

        /* Execute Dialogue */
        dialouge.printDelay = 0.02f;
        dialouge.SetColor(Color.black);
        dialouge.ClearText();
        dialouge.SetTextVisibility(true);
        yield return(StartCoroutine(dialouge.PrintText(text)));

        /* Wait For User To Continue */
        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Z)));

        /* Return Control to Player */
        dialouge.SetTextVisibility(false);
        player.isControllable = true;
    }
コード例 #4
0
 /// <summary>
 /// Clears displayed text and begins the sequence
 /// </summary>
 public override void SequenceStart()
 {
     active = true;
     manager.ClearText();
 }