private void EnableOnPropertyChanged(object sender, PropertyChangedEventArgs e) { if (Enable) { OnActivate(); Render.Draw += OnDraw; Game.OnWndProc += OnWndProc; if (OnInGameUpdateEventEnable) { Game.OnIngameUpdate += OnInGameUpdate; } ConsoleUtility.InfoWriteLine($"[{MenuTitle}] activated."); } else { OnDeActivate(); Render.Draw -= OnDraw; Game.OnWndProc -= OnWndProc; if (OnInGameUpdateEventEnable) { Game.OnIngameUpdate -= OnInGameUpdate; } ConsoleUtility.InfoWriteLine($"[{MenuTitle}] deactivated."); } }
protected override void OnActivate() { ConsoleUtility.SetPrefix("[Advanced MiniMap] "); Renderer = Context.Value.Renderer; Owner = (Hero)Context.Value.Owner; Config = new Config(this); ConsoleUtility.SetConfig(Config); ConsoleUtility.InfoWriteLine("Config loaded"); Database = new Database(); ConsoleUtility.InfoWriteLine("Database loaded"); InitLocalScripts(); }
public virtual void Load() { LoadTexture(RenderMode, Render); if (Enable) { OnActivate(); Render.Draw += OnDraw; if (EnableAltHider) { Game.OnWndProc += OnWndProc; } if (OnInGameUpdateEventEnable) { Game.OnIngameUpdate += OnInGameUpdate; } ConsoleUtility.InfoWriteLine($"Script \"{MenuTitle}\" activated."); } Enable.PropertyChanged += EnableOnPropertyChanged; }