コード例 #1
0
        public async void OnLoad()
        {
            // Small delay to guarantee all game variables are set correctly by now (especially CoreAPI.Game.IsInMenu)
            await Task.Delay(500);

            _advisorOverlay = new AdvisorOverlay();
            Core.OverlayCanvas.Children.Add(_advisorOverlay);
            advisor = new Advisor(_advisorOverlay);

            // Check for updates
            if (Settings.Default.CheckForUpdates)
            {
                await CheckForUpdate();
            }

            GameEvents.OnInMenu.Add(advisor.InMenu);
            GameEvents.OnGameStart.Add(advisor.GameStart);
            //GameEvents.OnTurnStart.Add(advisor.TurnStart);
            GameEvents.OnOpponentPlay.Add(advisor.OpponentPlay);
            GameEvents.OnOpponentSecretTriggered.Add(advisor.OpponentSecretTiggered);
            GameEvents.OnOpponentDeckDiscard.Add(advisor.OpponentDeckDiscard);
            GameEvents.OnOpponentDeckToPlay.Add(advisor.OpponentDeckToPlay);
            GameEvents.OnOpponentHandDiscard.Add(advisor.OpponentHandDiscard);
            GameEvents.OnOpponentJoustReveal.Add(advisor.OpponentJoustReveal);
            // TODO: How to prevent from multiple GameEvent registrations we disabling and reenabling plugins? See: https://github.com/HearthSim/Hearthstone-Deck-Tracker/issues/3079
        }
コード例 #2
0
        public async Task CheckForUpdate()
        {
            var latest = await Github.CheckForUpdate("djdookie", "Advisor", Version);

            if (latest != null)
            {
                Advisor.Notify("Plugin update available", $"[DOWNLOAD]({latest.html_url}) Advisor {latest.tag_name}", 0,
                               "download", () => Process.Start(latest.html_url));
                Log.Info("Update available: " + latest.tag_name, "Advisor");
            }
        }
コード例 #3
0
ファイル: AdvisorPlugin.cs プロジェクト: dev4nce/Advisor
        public async Task CheckForUpdate()
        {
            var latest = await Github.CheckForUpdate("kimsey0", "Advisor", Version);

            if (latest != null)
            {
                Advisor.Notify("Plugin update available", $"[DOWNLOAD]({latest.HtmlUrl}) Advisor {latest.TagName}", 0,
                               "download", () => Process.Start(latest.HtmlUrl));
                Log.Info($"Update available: {latest.TagName}", "Advisor");
            }
        }
コード例 #4
0
 public void OnButtonPress()
 {
     Advisor.ShowSettings();
 }