Пример #1
0
 private void ResetCommands()
 {
     hasPerms      = false;
     activeChar    = charA = charB = string.Empty;
     charAEmotions = charBEmotions = DefaultEmotion;
     format        = ConversationFormat.Type1;
 }
Пример #2
0
        private void UpdateCommands(IEnumerable <Command> commands)
        {
            foreach (Command c in commands)
            {
                switch (c.Type)
                {
                case CommandType.Emotion:
                    string[] emotions = c.Parameters[0].Split(',');
                    var      emotes   = new Emote[emotions.Length];
                    for (int i = 0; i < emotes.Length; i++)
                    {
                        emotes[i] = CharacterData.EmoteLookup.FirstOrDefault(x => x.Value == emotions[i]).Key;
                    }

                    if (activeChar != string.Empty && activeChar == charB)
                    {
                        charBEmotions = emotes;
                    }
                    else
                    {
                        charAEmotions = emotes;
                    }
                    break;

                case CommandType.Speaker:
                    activeChar = c.Parameters[0];
                    break;

                case CommandType.Portrait:
                    int newPosition = Convert.ToInt32(c.Parameters[1]);

                    if (format == ConversationFormat.Type1)
                    {
                        if (newPosition == 3)
                        {
                            charA         = c.Parameters[0];
                            charAEmotions = DefaultEmotion;
                        }
                        else if (newPosition == 7)
                        {
                            charB         = c.Parameters[0];
                            charBEmotions = DefaultEmotion;
                        }

                        break;
                    }

                    if (newPosition == 0 || newPosition == 2)
                    {
                        charA         = c.Parameters[0];
                        charAEmotions = DefaultEmotion;
                    }
                    else if (newPosition == 6)
                    {
                        charB         = c.Parameters[0];
                        charBEmotions = DefaultEmotion;
                    }

                    break;

                case CommandType.CharExit:
                    if (activeChar == charB)
                    {
                        activeChar = charA;
                        charB      = string.Empty;
                        break;
                    }

                    charA = string.Empty;
                    break;

                case CommandType.NamePerms:
                    hasPerms = true;
                    break;

                case CommandType.Format:
                    format = c.Symbol == "$t0" ? ConversationFormat.Type0 : ConversationFormat.Type1;
                    break;
                }
            }
        }