Exemplo n.º 1
0
    private Dialogue GetMessagesFromFile(StreamReader file)
    {
        Dialogue dialogue = new Dialogue();

        char[] delim = { ' ', ',' };

        while (true)
        {
            string    line   = file.ReadLine();
            string [] values = line.Split(delim, 6, StringSplitOptions.RemoveEmptyEntries);

            if (values[0].Contains("<<<"))  // end trigger
            {
                break;
            }

            // read the message
            float           duration = float.Parse(values[0]);
            SpeakerState    state    = EnumUtil.FromString <SpeakerState>(values[1]);
            string          speaker  = values[2];
            SpeakerLocation location = EnumUtil.FromString <SpeakerLocation>(values[3]);
            // ignore the literal "---"
            string message = values[5];

            dialogue.AddMessage(duration, state, speaker, location, message);
        }

        return(dialogue);
    }
 public Sprite GetSprite(SpeakerState state)
 {
     if (mSprites.ContainsKey(state))
         return mSprites[state];
     else
         return mSprites[SpeakerState.Normal];
 }
Exemplo n.º 3
0
 public Sprite GetSprite(SpeakerState state)
 {
     if (mSprites.ContainsKey(state))
     {
         return(mSprites[state]);
     }
     else
     {
         return(mSprites[SpeakerState.Normal]);
     }
 }
    // when, how, who, where, what
    // ex. for <5> seconds, <Nervous> <King> (<Left> side), says <"Hello world!">,
    //     for <3.2> seconds, <Normal> <Peasant> (<Right> side), says <"....blargh.">
    public void AddMessage(float duration, SpeakerState state, string speaker, SpeakerLocation location, string text)
    {
        Message message = new Message ();
        message.Duration = duration;
        message.Who = speaker;
        message.Text = text;
        message.Location = location;
        message.State = state;

        mMessages.Enqueue (message);
    }
Exemplo n.º 5
0
    // when, how, who, where, what
    // ex. for <5> seconds, <Nervous> <King> (<Left> side), says <"Hello world!">,
    //     for <3.2> seconds, <Normal> <Peasant> (<Right> side), says <"....blargh.">
    public void AddMessage(float duration, SpeakerState state, string speaker, SpeakerLocation location, string text)
    {
        Message message = new Message();

        message.Duration = duration;
        message.Who      = speaker;
        message.Text     = text;
        message.Location = location;
        message.State    = state;

        mMessages.Enqueue(message);
    }
Exemplo n.º 6
0
 public void Activate(SpeakerState state)
 {
     mRenderer.sprite  = GetSprite(state);
     mRenderer.enabled = true;
 }
 public void Activate(SpeakerState state)
 {
     mRenderer.sprite = GetSprite(state);
     mRenderer.enabled = true;
 }