////////////////

        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
//Services.DataStore.DataStore.Add( DebugHelpers.GetCurrentContext()+"_A", 1 );
            if (this.LoadHelpers != null && !LoadHelpers.IsWorldBeingPlayed())
            {
                return;
            }

            int idx = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));

            if (idx == -1)
            {
                return;
            }

            GameInterfaceDrawMethod debugDrawCallback = () => {
                var sb = Main.spriteBatch;

                try {
                    this.PlayerMessages.Draw(sb);
                    SimpleMessage.DrawMessage(sb);

                    DebugHelpers.PrintAll(sb);
                    DebugHelpers.Once = false;
                    DebugHelpers.OnceInAWhile--;
                } catch (Exception e) {
                    LogHelpers.Warn("debugLayerDraw - " + e.ToString());
                }
                return(true);
            };

            GameInterfaceDrawMethod cpDrawCallback = () => {
                var sb = Main.spriteBatch;

                try {
                    if (!this.Config.DisableControlPanel)
                    {
                        this.ControlPanel.UpdateToggler();
                        this.ControlPanel.DrawToggler(sb);
                    }
                    if (this.LastSeenCPScreenWidth != Main.screenWidth || this.LastSeenCPScreenHeight != Main.screenHeight)
                    {
                        this.LastSeenCPScreenWidth  = Main.screenWidth;
                        this.LastSeenCPScreenHeight = Main.screenHeight;
                        this.ControlPanel.RecalculateMe();
                    }

                    this.Inbox.Draw(sb);
                } catch (Exception e) {
                    LogHelpers.Warn("cpLayerDraw - " + e.ToString());
                }

//sb.DrawString( Main.fontDeathText, "ALERT", new Vector2(128, 128), this.AnimatedColors.Alert.CurrentColor );
//sb.DrawString( Main.fontDeathText, "STROBE", new Vector2(128, 256), this.AnimatedColors.Strobe.CurrentColor );
//sb.DrawString( Main.fontDeathText, "FIRE", new Vector2(128, 320), this.AnimatedColors.Fire.CurrentColor );
//sb.DrawString( Main.fontDeathText, "WATER", new Vector2(128, 384), this.AnimatedColors.Water.CurrentColor );
//sb.DrawString( Main.fontDeathText, "AIR", new Vector2(128, 448), this.AnimatedColors.Air.CurrentColor );
                return(true);
            };

            GameInterfaceDrawMethod modlockDrawCallback = delegate {
                try {
                    this.ModLock.DrawWarning(Main.spriteBatch);
                } catch (Exception e) {
                    LogHelpers.Warn("modlockLayerDraw - " + e.ToString());
                }
                return(true);
            };

            ////

            var debugLayer = new LegacyGameInterfaceLayer("ModHelpers: Debug Display",
                                                          debugDrawCallback, InterfaceScaleType.UI);

            layers.Insert(idx, debugLayer);

            var modlockLayer = new LegacyGameInterfaceLayer("ModHelpers: Mod Lock",
                                                            modlockDrawCallback, InterfaceScaleType.UI);

            layers.Insert(idx, modlockLayer);

            if (!this.Config.DisableControlPanel)
            {
                var cpLayer = new LegacyGameInterfaceLayer("ModHelpers: Control Panel",
                                                           cpDrawCallback, InterfaceScaleType.UI);
                layers.Insert(idx, cpLayer);
            }
//Services.DataStore.DataStore.Add( DebugHelpers.GetCurrentContext()+"_B", 1 );
        }
Beispiel #2
0
        public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers)
        {
            if (this.LoadHelpers != null && !TmlHelpers.LoadHelpers.IsWorldBeingPlayed())
            {
                return;
            }

            int idx = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));

            if (idx == -1)
            {
                return;
            }

            GameInterfaceDrawMethod debug_layer_draw = delegate {
                var sb = Main.spriteBatch;

                this.PlayerMessages.Draw(sb);
                SimpleMessage.DrawMessage(sb);

                DebugHelpers.DebugHelpers.PrintToBatch(sb);
                DebugHelpers.DebugHelpers.Once = false;
                DebugHelpers.DebugHelpers.OnceInAWhile--;
                return(true);
            };

            GameInterfaceDrawMethod cp_layer_draw = delegate {
                var sb = Main.spriteBatch;

                if (!this.Config.DisableControlPanel)
                {
                    this.ControlPanel.UpdateToggler();
                    this.ControlPanel.DrawToggler(sb);
                }
                if (this.LastSeenCPScreenWidth != Main.screenWidth || this.LastSeenCPScreenHeight != Main.screenHeight)
                {
                    this.LastSeenCPScreenWidth  = Main.screenWidth;
                    this.LastSeenCPScreenHeight = Main.screenHeight;
                    this.ControlPanel.RecalculateMe();
                }

                this.Inbox.Draw(sb);

//sb.DrawString( Main.fontDeathText, "ALERT", new Vector2(128, 128), this.AnimatedColors.Alert.CurrentColor );
//sb.DrawString( Main.fontDeathText, "STROBE", new Vector2(128, 256), this.AnimatedColors.Strobe.CurrentColor );
//sb.DrawString( Main.fontDeathText, "FIRE", new Vector2(128, 320), this.AnimatedColors.Fire.CurrentColor );
//sb.DrawString( Main.fontDeathText, "WATER", new Vector2(128, 384), this.AnimatedColors.Water.CurrentColor );
//sb.DrawString( Main.fontDeathText, "AIR", new Vector2(128, 448), this.AnimatedColors.Air.CurrentColor );
                return(true);
            };

            GameInterfaceDrawMethod modlock_layer_draw = delegate {
                this.ModLockHelpers.DrawWarning(Main.spriteBatch);
                return(true);
            };


            var debug_layer = new LegacyGameInterfaceLayer("HamstarHelpers: Debug Display",
                                                           debug_layer_draw, InterfaceScaleType.UI);

            layers.Insert(idx, debug_layer);

            var modlock_layer = new LegacyGameInterfaceLayer("HamstarHelpers: Mod Lock",
                                                             modlock_layer_draw, InterfaceScaleType.UI);

            layers.Insert(idx, modlock_layer);

            if (!this.Config.DisableControlPanel)
            {
                var cp_layer = new LegacyGameInterfaceLayer("HamstarHelpers: Control Panel",
                                                            cp_layer_draw, InterfaceScaleType.UI);
                layers.Insert(idx, cp_layer);
            }
        }