Example #1
0
 void ConstructWidgets()
 {
     textInput         = new TextInputWidget(game, chatFont, chatBoldFont);
     textInput.YOffset = blockSize + 5;
     status            = new TextGroupWidget(game, 5, chatFont, chatUnderlineFont,
                                             Anchor.BottomOrRight, Anchor.LeftOrTop);
     status.Init();
     status.SetUsePlaceHolder(0, false);
     status.SetUsePlaceHolder(1, false);
     bottomRight = new TextGroupWidget(game, 3, chatFont, chatUnderlineFont,
                                       Anchor.BottomOrRight, Anchor.BottomOrRight);
     bottomRight.YOffset = blockSize * 3 / 2;
     bottomRight.Init();
     normalChat = new TextGroupWidget(game, chatLines, chatFont, chatUnderlineFont,
                                      Anchor.LeftOrTop, Anchor.BottomOrRight);
     normalChat.XOffset = 10;
     normalChat.YOffset = blockSize * 2 + 15;
     normalChat.Init();
     clientStatus = new TextGroupWidget(game, game.Chat.ClientStatus.Length, chatFont,
                                        chatUnderlineFont, Anchor.LeftOrTop, Anchor.BottomOrRight);
     clientStatus.XOffset = 10;
     clientStatus.YOffset = blockSize * 2 + 15;
     clientStatus.Init();
     announcement = ChatTextWidget.Create(game, 0, 0, null,
                                          Anchor.Centre, Anchor.Centre, announcementFont);
     announcement.YOffset = -game.Height / 4;
 }
Example #2
0
        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;
        }
Example #3
0
        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;
        }
Example #4
0
        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;
        }
Example #5
0
        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;
        }