Example #1
0
        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);

            bottomRight.SetText(2, chat.BottomRight1.Text);
            bottomRight.SetText(1, chat.BottomRight2.Text);
            bottomRight.SetText(0, chat.BottomRight3.Text);
            announcement.Set(chat.Announcement.Text, announcementFont);

            for (int i = 0; i < chat.ClientStatus.Length; i++)
            {
                clientStatus.SetText(i, chat.ClientStatus[i].Text);
            }

            if (chatInInputBuffer != null)
            {
                OpenInput(chatInInputBuffer);
                chatInInputBuffer = null;
            }
        }
Example #2
0
        protected override void ContextRecreated()
        {
            line1 = new TextWidget(game)
                    .SetLocation(Anchor.Min, Anchor.Min, 2, 2);
            line1.ReducePadding = true;
            string msg = statusBuffer.Length > 0 ? statusBuffer.ToString() : "FPS: no data yet";

            line1.Set(msg, font);

            posAtlas = new TextAtlas(game, 16);
            posAtlas.Pack("0123456789-, ()", font, "Position: ");
            posAtlas.tex.Y = (short)(line1.Height + 2);

            int yOffset = line1.Height + posAtlas.tex.Height + 2;

            line2 = new TextWidget(game)
                    .SetLocation(Anchor.Min, Anchor.Min, 2, yOffset);
            line2.ReducePadding = true;

            if (game.ClassicMode)
            {
                // Swap around so 0.30 version is at top
                line2.YOffset = 2;
                line1.YOffset = posAtlas.tex.Y;
                line2.Set("0.30", font);

                line1.Reposition();
                line2.Reposition();
            }
            else
            {
                UpdateHackState();
            }
        }
Example #3
0
        void UpdatePage()
        {
            int start = items, end = entries.Length - items;

            widgets[5].Disabled = currentIndex < start;
            widgets[6].Disabled = currentIndex >= end;
            if (game.ClassicMode)
            {
                return;
            }

            TextWidget page  = (TextWidget)widgets[9];
            int        num   = (currentIndex / items) + 1;
            int        pages = Utils.CeilDiv(entries.Length, items);

            if (pages == 0)
            {
                pages = 1;
            }
            page.Set("&7Page " + num + " of " + pages, font);
        }
Example #4
0
        void UpdateStatus(double delta)
        {
            frames++;
            accumulator += delta;
            if (accumulator < 1)
            {
                return;
            }

            int fps = (int)(frames / accumulator);

            statusBuffer.Clear().AppendNum(fps).Append(" fps, ");

            if (game.ClassicMode)
            {
                statusBuffer.AppendNum(game.ChunkUpdates).Append(" chunk updates");
            }
            else
            {
                if (game.ChunkUpdates > 0)
                {
                    statusBuffer.AppendNum(game.ChunkUpdates).Append(" chunks/s, ");
                }
                int indices = (game.Vertices >> 2) * 6;
                statusBuffer.AppendNum(indices).Append(" vertices");

                int ping = PingList.AveragePingMilliseconds();
                if (ping != 0)
                {
                    statusBuffer.Append(", ping ").AppendNum(ping).Append(" ms");
                }
            }

            line1.Set(statusBuffer.ToString(), font);
            accumulator       = 0;
            frames            = 0;
            game.ChunkUpdates = 0;
        }