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

        public override void OnInitializeMe()
        {
            this.RandomSupportTextIdx = Main.rand.Next(UIModControlPanelTab.SupportMessages.Count);

            this.InitializeComponents();

            LoadHooks.AddWorldUnloadEachHook(() => {
                this.RandomSupportTextIdx = Main.rand.Next(UIModControlPanelTab.SupportMessages.Count);
                this.SupportUrl?.SetText(UIModControlPanelTab.SupportMessages[this.RandomSupportTextIdx]);
            });
        }
        ////

        public void OnPostModsLoad()
        {
            if (!Main.dedServ)
            {
                LoadHooks.AddWorldUnloadEachHook(() => {
                    this.Animations.Clear();
                });
                LoadHooks.AddModUnloadHook(() => {
                    Main.OnTick -= AnimatedTextureManager._Update;
                });
            }
        }
Ejemplo n.º 3
0
        ////////////////

        public PaintLayer()
        {
            this.Colors = new Dictionary <ushort, IDictionary <ushort, Color> >();
            this.Glows  = new Dictionary <ushort, IDictionary <ushort, byte> >();

            LoadHooks.AddWorldLoadEachHook(() => {
                Main.OnPreDraw += this.RefreshTilesOnMap;
            });
            LoadHooks.AddWorldUnloadEachHook(() => {
                Main.OnPreDraw -= this.RefreshTilesOnMap;
                this.ClearTilesOnMap();
            });
        }
Ejemplo n.º 4
0
        ////////////////

        internal LoadHelpers()
        {
            LoadHooks.AddWorldLoadEachHook(() => {
                this.WorldStartupDelay = 0;
            });
            LoadHooks.AddWorldUnloadEachHook(() => {
                this.WorldStartupDelay       = 0;
                this.IsClientPlaying_Hackish = false;
            });
            LoadHooks.AddPostWorldUnloadEachHook(() => {              // Redundant?
                this.WorldStartupDelay       = 0;
                this.IsClientPlaying_Hackish = false;
            });
        }
Ejemplo n.º 5
0
        ////////////////

        public InventoryUI() : base()
        {
            var mymod = ExtensibleInventoryMod.Instance;

            this.ButtonBookTex      = ModContent.GetTexture("Terraria/Item_531");            // Spell Tome
            this.ButtonBookDimTex   = ModContent.GetTexture("Terraria/Item_1313");           // Book of Skulls
            this.ButtonBookLitTex   = ModContent.GetTexture("Terraria/Item_1336");           // Golden Shower
            this.ButtonPageRightTex = mymod.GetTexture("UI/ButtonRight");
            this.ButtonPageLeftTex  = mymod.GetTexture("UI/ButtonLeft");
            this.ButtonPageAddTex   = mymod.GetTexture("UI/ButtonAdd");
            this.ButtonPageSubTex   = mymod.GetTexture("UI/ButtonSub");

            LoadHooks.AddWorldUnloadEachHook(() => {
                this.ButtonBooks = null;
            });
        }
Ejemplo n.º 6
0
        ////////////////

        internal InboxControl()
        {
            if (Main.netMode == 2)
            {
                return;
            }

            var mymod = ModHelpersMod.Instance;

            this.Icon       = mymod.GetTexture("Internals/Inbox/MiniIcon");
            this.IconLit    = mymod.GetTexture("Internals/Inbox/MiniIconLit2");
            this.ArrowLeft  = mymod.GetTexture("Internals/Inbox/ArrowLeft");
            this.ArrowRight = mymod.GetTexture("Internals/Inbox/ArrowRight");

            this.MessageScrollPos = this.Messages.Current;

            LoadHooks.AddWorldUnloadEachHook(this.OnWorldExit);
        }
        internal void OnModLoad()
        {
            LoadHooks.AddPostModLoadHook(() => {
                var hook = new CustomTimerAction(delegate() {
                    if (Main.netMode == 1)
                    {
                        return;
                    }
                    this.ExpireCurrentWorldInSession(ResetModeMod.Instance);
                });

                TimeLimitAPI.AddCustomAction("reset", hook);

                this.Load();
                this.LoadRewards();
            });


            LoadHooks.AddPostWorldLoadEachHook(delegate {
                var mymod = ResetModeMod.Instance;

                if (mymod.Config.AutoStartSession)
                {
                    if (Main.netMode == 0 || Main.netMode == 2)
                    {
                        this.StartSession();
                    }
                }

                this.IsWorldInPlay = true;
            });


            LoadHooks.AddWorldUnloadEachHook(() => {
                this.IsWorldInPlay = false;
            });


            LoadHooks.AddPostWorldUnloadEachHook(() => {
                var mymod = ResetModeMod.Instance;

                if (mymod.Config.DebugModeInfo)
                {
                    LogHelpers.Alert("(In promise) - Unloading world...");
                }

                this.IsExiting = false;

                if (mymod.CurrentNetMode == 0 || mymod.CurrentNetMode == 2)
                {
                    if (mymod.Config.DeleteAllWorldsBetweenGames)
                    {
                        if (this.Data.AwaitingNextWorld)
                        {
                            this.ClearAllWorlds();
                        }
                    }

                    this.Save();
                }

                CustomLoadHooks.TriggerHook(ResetModeMod.WorldExitValidator, ResetModeMod.MyValidatorKey);
            });
        }
Ejemplo n.º 8
0
        ////////////////

        internal LogHelpers()
        {
            this.Reset();

            LoadHooks.AddWorldUnloadEachHook(this.OnWorldExit);
        }