protected override void AfterInit()
        {
            HudMain.Init();
            RebindDialog.Init();
            RichHudDebug.Init();
            InitSettingsMenu();

            RegisterClientHandler();
            CheckClientQueue();

            if (MenuUtilities.CanAddElements)
            {
                MenuUtilities.AddMenuElements(GetModMenuButton());
            }
        }
Ejemplo n.º 2
0
        private RichHudDebug() : base(false, true)
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                throw new Exception($"Only one instance of {GetType().Name} can exist at any given time.");
            }

            statsText = new TextPage()
            {
                Name          = "Statistics",
                HeaderText    = "Debug Statistics",
                SubHeaderText = "Update Times and API Usage",
            };

            statsText.TextBuilder.BuilderMode = TextBuilderModes.Lined;
            statsBuilder = new StringBuilder();
            updateTimer  = new Stopwatch();
            updateTimer.Start();

            stats = new UpdateStats();

            overlayPos    = new Vector2(0.5f, 0.5f);
            enableOverlay = false;
            EnableDebug   = false;

            overlay = new TextBoard()
            {
                AutoResize  = true,
                BuilderMode = TextBuilderModes.Lined,
                Scale       = 0.8f,
                Format      = new GlyphFormat(new Color(255, 191, 0))
            };

            pageCategory = new TerminalPageCategory()
            {
                Name          = "Debug",
                Enabled       = false,
                PageContainer =
                {
                    new DemoPage()
                    {
                        Name = "Demo",
                    },

                    statsText,

                    new ControlPage()
                    {
                        Name = "Settings",
                        CategoryContainer =
                        {
                            new ControlCategory()
                            {
                                HeaderText    = "Debug Settings",
                                SubheaderText = "",
                                TileContainer =
                                {
                                    new ControlTile()
                                    {
                                        new TerminalCheckbox()
                                        {
                                            Name  = "Enable Overlay",
                                            Value = enableOverlay,
                                            ControlChangedHandler = (obj, args) =>
                                            {
                                                var element = obj as TerminalCheckbox;
                                                enableOverlay = element.Value;
                                            }
                                        },
                                        new TerminalDragBox()
                                        {
                                            Name                  = "Set Overlay Pos",
                                            Value                 = overlayPos,
                                            AlignToEdge           = true,
                                            ControlChangedHandler = (obj, args) =>
                                            {
                                                var element = obj as TerminalDragBox;
                                                overlayPos = element.Value;
                                            }
                                        }
                                    },
                                }
                            }
                        }
                    }
                }
            };

            RichHudTerminal.Root.Add(pageCategory);
        }
Ejemplo n.º 3
0
 public override void Close()
 {
     instance = null;
 }