コード例 #1
0
    private void SetDialogFromTSV()
    {
        StreamReader sr = new StreamReader(dialog.tsvDialogPath);

        if (File.Exists(dialog.tsvDialogPath))
        {
            List <string[]> lines = new List <string[]>();
            while (!sr.EndOfStream)
            {
                string[] Line = sr.ReadLine().Split('\t');
                lines.Add(Line);
            }

            string[][] dialogInfo = lines.ToArray();

            dialog.sentences = new List <Dialog.Sentence>();
            for (int i = 0; i < dialogInfo.Length; i++)
            {
                Dialog.Sentence newSentence = new Dialog.Sentence();
                newSentence.characterName = dialogInfo[i][0];
                newSentence.sentence      = dialogInfo[i][1];
                newSentence.seikiReaction = (DialogManager.SeikiEmote)Enum.Parse(typeof(DialogManager.SeikiEmote), dialogInfo[i][2]);
                newSentence.speakingSpeed = float.Parse(dialogInfo[i][3]);
                dialog.sentences.Add(newSentence);
            }
        }
        else
        {
            Debug.LogWarning("Invalid file path to load tsv file");
        }
    }
コード例 #2
0
    public bool DisplayNextSentence()
    {
        //HACK AND DIRTY AND TODO
        Dictionary <string, int> faces = new Dictionary <string, int>();

        faces.Add("linda", 1);
        faces.Add("cindy", 2);
        faces.Add("carl", 3);
        faces.Add("tom", 4);
        faces.Add("bob", 5);
        faces.Add("ship", 5);

        if (m_Sentences.Count == 0)
        {
            EndDialogue();
            return(true);
        }
        StopAllCoroutines();
        Dialog.Sentence sentence = m_Sentences.Dequeue();
        string          name     = sentence.name.ToLower().Substring(1);
        int             faceId   = faces.ContainsKey(name) ? faces[name] : 0;

        m_Renderer.sprite = RessourceManager.instance.LoadSprite("Game/faces", faceId);
        m_NameText.text   = sentence.name;
        StartCoroutine(TypeSentence(sentence.sentence));

        return(false);
    }