void SetInitialMessages() { Chat chat = game.Chat; chatIndex = chat.Log.Count - chatLines; ResetChat(); status.SetText(2, chat.Status1.Text); status.SetText(3, chat.Status2.Text); status.SetText(4, chat.Status3.Text); if (game.ShowClock) { status.SetText(0, chat.ClientClock.Text); } bottomRight.SetText(2, chat.BottomRight1.Text); bottomRight.SetText(1, chat.BottomRight2.Text); bottomRight.SetText(0, chat.BottomRight3.Text); announcement.SetText(chat.Announcement.Text); for (int i = 0; i < chat.ClientStatus.Length; i++) { clientStatus.SetText(i, chat.ClientStatus[i].Text); } if (game.chatInInputBuffer != null) { OpenTextInputBar(game.chatInInputBuffer); game.chatInInputBuffer = null; } }
public override void Init() { int fontSize = (int)(12 * game.GuiChatScale); Utils.Clamp(ref fontSize, 8, 60); chatFont = new Font("Arial", fontSize); chatInputFont = new Font("Arial", fontSize, FontStyle.Bold); chatUnderlineFont = new Font("Arial", fontSize, FontStyle.Underline); fontSize = (int)(14 * game.GuiChatScale); Utils.Clamp(ref fontSize, 8, 60); announcementFont = new Font("Arial", fontSize); blockSize = (int)(23 * 2 * game.GuiScale); textInput = new TextInputWidget(game, chatFont, chatInputFont); textInput.YOffset = blockSize + 5; status = new TextGroupWidget(game, 3, chatFont, chatUnderlineFont); status.VerticalAnchor = Anchor.LeftOrTop; status.HorizontalAnchor = Anchor.BottomOrRight; status.Init(); bottomRight = new TextGroupWidget(game, 3, chatFont, chatUnderlineFont); bottomRight.VerticalAnchor = Anchor.BottomOrRight; bottomRight.HorizontalAnchor = Anchor.BottomOrRight; bottomRight.YOffset = blockSize * 3 / 2; bottomRight.Init(); normalChat = new TextGroupWidget(game, chatLines, chatFont, chatUnderlineFont); normalChat.XOffset = 10; normalChat.YOffset = blockSize * 2 + 15; normalChat.HorizontalAnchor = Anchor.LeftOrTop; normalChat.VerticalAnchor = Anchor.BottomOrRight; normalChat.Init(); int[] indices = new int[chatLines]; for (int i = 0; i < indices.Length; i++) { indices[i] = -1; } Metadata = indices; ChatLog chat = game.Chat; chatIndex = chat.Log.Count - chatLines; ResetChat(); status.SetText(0, chat.Status1.Text); status.SetText(1, chat.Status2.Text); status.SetText(2, chat.Status3.Text); bottomRight.SetText(2, chat.BottomRight1.Text); bottomRight.SetText(1, chat.BottomRight2.Text); bottomRight.SetText(0, chat.BottomRight3.Text); UpdateAnnouncement(chat.Announcement.Text); if (game.chatInInputBuffer != null) { OpenTextInputBar(game.chatInInputBuffer); game.chatInInputBuffer = null; } game.Events.ChatReceived += ChatReceived; game.Events.ChatFontChanged += ChatFontChanged; }
void ChatReceived(object sender, ChatEventArgs e) { CpeMessage type = e.Type; if (type == CpeMessage.Normal) { chatIndex++; 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 >= CpeMessage.Status1 && type <= CpeMessage.Status3) { status.SetText((int)(type - CpeMessage.Status1), e.Text); } else if (type >= CpeMessage.BottomRight1 && type <= CpeMessage.BottomRight3) { bottomRight.SetText(2 - (int)(type - CpeMessage.BottomRight1), e.Text); } else if (type == CpeMessage.Announcement) { UpdateAnnouncement(e.Text); } }
public override void Init() { chatFont = new Font( "Arial", game.Chat.FontSize ); chatInputFont = new Font( "Arial", game.Chat.FontSize, FontStyle.Bold ); announcementFont = new Font( "Arial", 14 ); const int blockSize = 40; textInput = new TextInputWidget( game, chatFont, chatInputFont ); textInput.YOffset = blockSize + blockSize / 2; status = new TextGroupWidget( game, 3, chatFont ); status.VerticalAnchor = Anchor.LeftOrTop; status.HorizontalAnchor = Anchor.BottomOrRight; status.Init(); bottomRight = new TextGroupWidget( game, 3, chatFont ); bottomRight.VerticalAnchor = Anchor.BottomOrRight; bottomRight.HorizontalAnchor = Anchor.BottomOrRight; bottomRight.YOffset = blockSize + blockSize / 2; bottomRight.Init(); normalChat = new TextGroupWidget( game, chatLines, chatFont ); normalChat.XOffset = 10; normalChat.YOffset = blockSize * 2; normalChat.HorizontalAnchor = Anchor.LeftOrTop; normalChat.VerticalAnchor = Anchor.BottomOrRight; normalChat.Init(); int[] indices = new int[chatLines]; for( int i = 0; i < indices.Length; i++ ) indices[i] = -1; Metadata = indices; ChatLog chat = game.Chat; chatIndex = chat.Log.Count - chatLines; ResetChat(); status.SetText( 0, chat.Status1.Text ); status.SetText( 1, chat.Status2.Text ); status.SetText( 2, chat.Status3.Text ); bottomRight.SetText( 2, chat.BottomRight1.Text ); bottomRight.SetText( 1, chat.BottomRight2.Text ); bottomRight.SetText( 0,chat.BottomRight3.Text ); UpdateAnnouncement( chat.Announcement.Text ); if( !String.IsNullOrEmpty( game.chatInInputBuffer ) ) { OpenTextInputBar( game.chatInInputBuffer ); game.chatInInputBuffer = null; } game.Events.ChatReceived += ChatReceived; }
public override void Init() { chatFont = new Font( "Arial", game.Chat.FontSize ); chatBoldFont = new Font( "Arial", game.Chat.FontSize, FontStyle.Bold ); announcementFont = new Font( "Arial", 14 ); historyFont = new Font( "Arial", 12, FontStyle.Italic ); textInput = new TextInputWidget( game, chatFont, chatBoldFont ); textInput.ChatInputYOffset = ChatInputYOffset; status = new TextGroupWidget( game, 3, chatFont ); status.VerticalDocking = Docking.LeftOrTop; status.HorizontalDocking = Docking.BottomOrRight; status.Init(); bottomRight = new TextGroupWidget( game, 3, chatFont ); bottomRight.VerticalDocking = Docking.BottomOrRight; bottomRight.HorizontalDocking = Docking.BottomOrRight; bottomRight.YOffset = ChatInputYOffset; bottomRight.Init(); normalChat = new TextGroupWidget( game, chatLines, chatFont ); normalChat.XOffset = 10; normalChat.YOffset = ChatLogYOffset; normalChat.HorizontalDocking = Docking.LeftOrTop; normalChat.VerticalDocking = Docking.BottomOrRight; normalChat.Init(); ChatLog chat = game.Chat; chatIndex = chat.Log.Count - chatLines; ResetChat(); status.SetText( 0, chat.Status1 ); status.SetText( 1, chat.Status2 ); status.SetText( 2, chat.Status3 ); bottomRight.SetText( 2, chat.BottomRight1 ); bottomRight.SetText( 1, chat.BottomRight2 ); bottomRight.SetText( 0,chat.BottomRight3 ); UpdateAnnouncement( chat.Announcement ); if( !String.IsNullOrEmpty( game.chatInInputBuffer ) ) { OpenTextInputBar( game.chatInInputBuffer ); game.chatInInputBuffer = null; } game.Events.ChatReceived += ChatReceived; }
public override void Init() { int fontSize = (int)(14 * game.GuiScale()); Utils.Clamp( ref fontSize, 8, 40 ); chatFont = new Font( "Arial", fontSize ); chatInputFont = new Font( "Arial", fontSize, FontStyle.Bold ); chatUnderlineFont = new Font( "Arial", fontSize, FontStyle.Underline ); announcementFont = new Font( "Arial", 14 ); blockSize = (int)(40 * game.GuiScale()); textInput = new TextInputWidget( game, chatFont, chatInputFont ); textInput.YOffset = blockSize + 5; status = new TextGroupWidget( game, 3, chatFont, chatUnderlineFont ); status.VerticalAnchor = Anchor.LeftOrTop; status.HorizontalAnchor = Anchor.BottomOrRight; status.Init(); bottomRight = new TextGroupWidget( game, 3, chatFont, chatUnderlineFont ); bottomRight.VerticalAnchor = Anchor.BottomOrRight; bottomRight.HorizontalAnchor = Anchor.BottomOrRight; bottomRight.YOffset = blockSize * 3 / 2; bottomRight.Init(); normalChat = new TextGroupWidget( game, chatLines, chatFont, chatUnderlineFont ); normalChat.XOffset = 10; normalChat.YOffset = blockSize * 2 + 15; normalChat.HorizontalAnchor = Anchor.LeftOrTop; normalChat.VerticalAnchor = Anchor.BottomOrRight; normalChat.Init(); int[] indices = new int[chatLines]; for( int i = 0; i < indices.Length; i++ ) indices[i] = -1; Metadata = indices; ChatLog chat = game.Chat; chatIndex = chat.Log.Count - chatLines; ResetChat(); status.SetText( 0, chat.Status1.Text ); status.SetText( 1, chat.Status2.Text ); status.SetText( 2, chat.Status3.Text ); bottomRight.SetText( 2, chat.BottomRight1.Text ); bottomRight.SetText( 1, chat.BottomRight2.Text ); bottomRight.SetText( 0,chat.BottomRight3.Text ); UpdateAnnouncement( chat.Announcement.Text ); if( game.chatInInputBuffer != null ) { OpenTextInputBar( game.chatInInputBuffer ); game.chatInInputBuffer = null; } game.Events.ChatReceived += ChatReceived; game.Events.ChatFontChanged += ChatFontChanged; }