示例#1
0
        void ChatReceived(object sender, ChatEventArgs e)
        {
            MessageType type = e.Type;

            if (type == MessageType.Normal)
            {
                chatIndex++;
                if (game.ChatLines == 0)
                {
                    return;
                }
                List <ChatLine> chat = game.Chat.Log;
                normalChat.PushUpAndReplaceLast(chat[chatIndex + chatLines - 1].Text);

                int[] metadata = (int[])Metadata;
                for (int i = 0; i < chatLines - 1; i++)
                {
                    metadata[i] = metadata[i + 1];
                }
                metadata[chatLines - 1] = chatIndex + chatLines - 1;
            }
            else if (type >= MessageType.Status1 && type <= MessageType.Status3)
            {
                status.SetText(2 + (int)(type - MessageType.Status1), e.Text);
            }
            else if (type >= MessageType.BottomRight1 && type <= MessageType.BottomRight3)
            {
                bottomRight.SetText(2 - (int)(type - MessageType.BottomRight1), e.Text);
            }
            else if (type == MessageType.Announcement)
            {
                announcement.SetText(e.Text);
            }
            else if (type >= MessageType.ClientStatus1 && type <= MessageType.ClientStatus6)
            {
                clientStatus.SetText((int)(type - MessageType.ClientStatus1), e.Text);
                UpdateChatYOffset(true);
            }
            else if (type == MessageType.ClientClock && game.ShowClock)
            {
                status.SetText(0, e.Text);
            }
        }