Update() protected method

protected Update ( ) : void
return void
Beispiel #1
0
        public static async Task Reset()
        {
            if (_resetting)
            {
                Log.Warn("Reset already in progress.");
                return;
            }
            _resetting = true;
            var stoppedReader = await LogReaderManager.Stop();

            Game.Reset();
            if (DeckList.Instance.ActiveDeck != null)
            {
                Game.IsUsingPremade = true;
                MainWindow.UpdateMenuItemVisibility();
            }
            await Task.Delay(1000);

            if (stoppedReader)
            {
                LogReaderManager.Restart();
            }
            Overlay.HideSecrets();
            Overlay.Update(false);
            UpdatePlayerCards(true);
            _resetting = false;
        }
Beispiel #2
0
 protected virtual void BeforePluginsTick(TickEventArgs args)
 {
     if (Overlay != null && Overlay.Form != null)
     {
         Overlay.Update(args.Time, Input.MousePos - new Vector2(Overlay.Form.Location.X, Overlay.Form.Location.Y));
         Overlay.Renderer.Clear(Overlay.BackColor);
     }
 }
 private void Update()
 {
     uiManager.Update();
     timerTick.Tick();
     applicationTime.Update(totalTime, timerTick.ElapsedTime, false);
     overlay.Update(applicationTime);
     totalTime += timerTick.ElapsedTime;
 }
Beispiel #4
0
        /// <summary>
        /// Called every tick
        /// Causes the overlay to re-render
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public static void Render(object sender, EventArgs args)
        {
            if (!General.Active)
            {
                return;
            }

            Overlay.Update();
        }
Beispiel #5
0
        public static void Update(GameTime time)
        {
            SetCursorType(CursorType.Default, 1F);

            Overlay.Update(time);
            if (CurrentInterface != null)
            {
                CurrentInterface.Update(time);
            }
        }
Beispiel #6
0
 public static void Update(double dt)
 {
     if (currentScene != null && currentOverlay == null)
     {
         currentScene.Update(dt);
     }
     if (currentOverlay != null)
     {
         currentOverlay.Update(dt);
     }
 }
Beispiel #7
0
        public static async Task Reset()
        {
            var stoppedReader = await LogReaderManager.Stop();

            Game.Reset();
            if (DeckList.Instance.ActiveDeck != null)
            {
                Game.SetPremadeDeck((Deck)DeckList.Instance.ActiveDeck.Clone());
                MainWindow.UpdateMenuItemVisibility();
            }
            if (stoppedReader)
            {
                LogReaderManager.Restart();
            }
            Overlay.Update(false);
            Overlay.UpdatePlayerCards();
            Windows.PlayerWindow.UpdatePlayerCards();
        }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (InProgress)
            {
                cam.Update(gameTime);
                input.Update(gameTime);
                wave.Update(gameTime);
                projectileManager.Update(gameTime);
                process.Update(gameTime);
                cc.Update(gameTime);
                collision.Update(gameTime);
                overlay.Update(gameTime);
            }
            if (InProgress && (cc.IsGameOver || wave.Won))
            {
                if (cc.IsGameOver)
                {
                    WinValue = 2;
                }
                else if (cc.IsGameOver)
                {
                    WinValue = 1;
                }
                InProgress          = false;
                CommandComponent.ID = 0;
                world.Clear();
            }

            /*if(InProgress && (cc.SelectedBuild == null && cc.SelectedUnits.Count > 0) && input.CheckInput(Controls.Deselect))
             * {
             *  Clean();
             *  InProgress = false;
             * }*/
            // TODO: Add your update logic here

            base.Update(gameTime);
        }
Beispiel #9
0
        private static async void UpdateOverlayAsync()
        {
#if (!SQUIRREL)
            if (Config.Instance.CheckForUpdates)
            {
                Updater.CheckForUpdates(true);
            }
#endif
            var hsForegroundChanged = false;
            var useNoDeckMenuItem   = TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey("startHearthstone");
            while (UpdateOverlay)
            {
                if (Config.Instance.CheckForUpdates)
                {
                    Updater.CheckForUpdates();
                }
                if (User32.GetHearthstoneWindow() != IntPtr.Zero)
                {
                    if (Game.CurrentRegion == Region.UNKNOWN)
                    {
                        //game started
                        Game.CurrentRegion = Helper.GetCurrentRegion();
                        if (Game.CurrentRegion != Region.UNKNOWN)
                        {
                            BackupManager.Run();
                            Game.MetaData.HearthstoneBuild = null;
                        }
                    }
                    Overlay.UpdatePosition();

                    if (!Game.IsRunning)
                    {
                        Overlay.Update(true);
                        Windows.CapturableOverlay?.UpdateContentVisibility();
                    }

                    MainWindow.BtnStartHearthstone.Visibility = Visibility.Collapsed;
                    TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = false;

                    Game.IsRunning = true;

                    Helper.GameWindowState = User32.GetHearthstoneWindowState();
                    Windows.CapturableOverlay?.Update();
                    if (User32.IsHearthstoneInForeground() && Helper.GameWindowState != WindowState.Minimized)
                    {
                        if (hsForegroundChanged)
                        {
                            Overlay.Update(true);
                            if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                            {
                                //if player topmost is set to true before opponent:
                                //clicking on the playerwindow and back to hs causes the playerwindow to be behind hs.
                                //other way around it works for both windows... what?
                                Windows.OpponentWindow.Topmost = true;
                                Windows.PlayerWindow.Topmost   = true;
                                Windows.TimerWindow.Topmost    = true;
                            }
                            hsForegroundChanged = false;
                        }
                    }
                    else if (!hsForegroundChanged)
                    {
                        if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                        {
                            Windows.PlayerWindow.Topmost   = false;
                            Windows.OpponentWindow.Topmost = false;
                            Windows.TimerWindow.Topmost    = false;
                        }
                        hsForegroundChanged = true;
                    }
                }
                else if (Game.IsRunning)
                {
                    Game.IsRunning = false;
                    Overlay.ShowOverlay(false);
                    if (Windows.CapturableOverlay != null)
                    {
                        Windows.CapturableOverlay.UpdateContentVisibility();
                        await Task.Delay(100);

                        Windows.CapturableOverlay.ForcedWindowState = WindowState.Minimized;
                        Windows.CapturableOverlay.WindowState       = WindowState.Minimized;
                    }
                    Log.Info("Exited game");
                    Game.CurrentRegion = Region.UNKNOWN;
                    Log.Info("Reset region");
                    await Reset();

                    Game.IsInMenu = true;
                    Game.InvalidateMatchInfoCache();
                    Overlay.HideRestartRequiredWarning();
                    TurnTimer.Instance.Stop();

                    MainWindow.BtnStartHearthstone.Visibility = Visibility.Visible;
                    TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = true;

                    if (Config.Instance.CloseWithHearthstone)
                    {
                        MainWindow.Close();
                    }
                }

                if (Config.Instance.NetDeckClipboardCheck.HasValue && Config.Instance.NetDeckClipboardCheck.Value && Initialized &&
                    !User32.IsHearthstoneInForeground())
                {
                    NetDeck.CheckForClipboardImport();
                }

                await Task.Delay(UpdateDelay);
            }
            CanShutdown = true;
        }
Beispiel #10
0
        private static async void UpdateOverlayAsync()
        {
            if (Config.Instance.CheckForUpdates)
            {
                Updater.CheckForUpdates(true);
            }
            var hsForegroundChanged = false;
            var useNoDeckMenuItem   = TrayIcon.NotifyIcon.ContextMenu.MenuItems.IndexOfKey("startHearthstone");

            UpdateOverlay = Helper.HearthstoneDirExists;
            while (UpdateOverlay)
            {
                if (User32.GetHearthstoneWindow() != IntPtr.Zero)
                {
                    if (Game.CurrentRegion == Region.UNKNOWN)
                    {
                        //game started
                        Game.CurrentRegion = Helper.GetCurrentRegion();
                    }
                    Overlay.UpdatePosition();

                    if (Config.Instance.CheckForUpdates)
                    {
                        Updater.CheckForUpdates();
                    }

                    if (!Game.IsRunning)
                    {
                        Overlay.Update(true);
                    }

                    MainWindow.BtnStartHearthstone.Visibility = Visibility.Collapsed;
                    TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = false;

                    Game.IsRunning = true;
                    if (User32.IsHearthstoneInForeground())
                    {
                        if (hsForegroundChanged)
                        {
                            Overlay.Update(true);
                            if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                            {
                                //if player topmost is set to true before opponent:
                                //clicking on the playerwindow and back to hs causes the playerwindow to be behind hs.
                                //other way around it works for both windows... what?
                                Windows.OpponentWindow.Topmost = true;
                                Windows.PlayerWindow.Topmost   = true;
                                Windows.TimerWindow.Topmost    = true;
                            }
                            hsForegroundChanged = false;
                        }
                    }
                    else if (!hsForegroundChanged)
                    {
                        if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                        {
                            Windows.PlayerWindow.Topmost   = false;
                            Windows.OpponentWindow.Topmost = false;
                            Windows.TimerWindow.Topmost    = false;
                        }
                        hsForegroundChanged = true;
                    }
                }
                else
                {
                    Overlay.ShowOverlay(false);
                    if (Game.IsRunning)
                    {
                        //game was closed
                        Logger.WriteLine("Exited game", "UpdateOverlayLoop");
                        Game.CurrentRegion = Region.UNKNOWN;
                        Logger.WriteLine("Reset region", "UpdateOverlayLoop");
                        //HsLogReaderV2.Instance.ClearLog();
                        Game.Reset();
                        if (DeckList.Instance.ActiveDeck != null)
                        {
                            Game.SetPremadeDeck((Deck)DeckList.Instance.ActiveDeck.Clone());
                        }
                        await LogReaderManager.Restart();

                        MainWindow.BtnStartHearthstone.Visibility = Visibility.Visible;
                        TrayIcon.NotifyIcon.ContextMenu.MenuItems[useNoDeckMenuItem].Visible = true;

                        if (Config.Instance.CloseWithHearthstone)
                        {
                            MainWindow.Close();
                        }
                    }
                    Game.IsRunning = false;
                }

                if (Config.Instance.NetDeckClipboardCheck.HasValue && Config.Instance.NetDeckClipboardCheck.Value &&
                    Initialized &&
                    !User32.IsHearthstoneInForeground())
                {
                    NetDeck.CheckForClipboardImport();
                }

                await Task.Delay(Config.Instance.UpdateDelay);
            }
            CanShutdown = true;
        }
Beispiel #11
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     base.Update(gameTime);
     //foreach (Image img in Images) img.Update(gameTime);
     Overlay.Update(gameTime);
 }
 public void Update(DestinyVendorCategoryEntryDefinition?other)
 {
     if (other is null)
     {
         return;
     }
     if (CategoryIndex != other.CategoryIndex)
     {
         CategoryIndex = other.CategoryIndex;
         OnPropertyChanged(nameof(CategoryIndex));
     }
     if (SortValue != other.SortValue)
     {
         SortValue = other.SortValue;
         OnPropertyChanged(nameof(SortValue));
     }
     if (CategoryHash != other.CategoryHash)
     {
         CategoryHash = other.CategoryHash;
         OnPropertyChanged(nameof(CategoryHash));
     }
     if (QuantityAvailable != other.QuantityAvailable)
     {
         QuantityAvailable = other.QuantityAvailable;
         OnPropertyChanged(nameof(QuantityAvailable));
     }
     if (ShowUnavailableItems != other.ShowUnavailableItems)
     {
         ShowUnavailableItems = other.ShowUnavailableItems;
         OnPropertyChanged(nameof(ShowUnavailableItems));
     }
     if (HideIfNoCurrency != other.HideIfNoCurrency)
     {
         HideIfNoCurrency = other.HideIfNoCurrency;
         OnPropertyChanged(nameof(HideIfNoCurrency));
     }
     if (HideFromRegularPurchase != other.HideFromRegularPurchase)
     {
         HideFromRegularPurchase = other.HideFromRegularPurchase;
         OnPropertyChanged(nameof(HideFromRegularPurchase));
     }
     if (BuyStringOverride != other.BuyStringOverride)
     {
         BuyStringOverride = other.BuyStringOverride;
         OnPropertyChanged(nameof(BuyStringOverride));
     }
     if (DisabledDescription != other.DisabledDescription)
     {
         DisabledDescription = other.DisabledDescription;
         OnPropertyChanged(nameof(DisabledDescription));
     }
     if (DisplayTitle != other.DisplayTitle)
     {
         DisplayTitle = other.DisplayTitle;
         OnPropertyChanged(nameof(DisplayTitle));
     }
     if (!Overlay.DeepEquals(other.Overlay))
     {
         Overlay.Update(other.Overlay);
         OnPropertyChanged(nameof(Overlay));
     }
     if (!VendorItemIndexes.DeepEqualsListNaive(other.VendorItemIndexes))
     {
         VendorItemIndexes = other.VendorItemIndexes;
         OnPropertyChanged(nameof(VendorItemIndexes));
     }
     if (IsPreview != other.IsPreview)
     {
         IsPreview = other.IsPreview;
         OnPropertyChanged(nameof(IsPreview));
     }
     if (IsDisplayOnly != other.IsDisplayOnly)
     {
         IsDisplayOnly = other.IsDisplayOnly;
         OnPropertyChanged(nameof(IsDisplayOnly));
     }
     if (ResetIntervalMinutesOverride != other.ResetIntervalMinutesOverride)
     {
         ResetIntervalMinutesOverride = other.ResetIntervalMinutesOverride;
         OnPropertyChanged(nameof(ResetIntervalMinutesOverride));
     }
     if (ResetOffsetMinutesOverride != other.ResetOffsetMinutesOverride)
     {
         ResetOffsetMinutesOverride = other.ResetOffsetMinutesOverride;
         OnPropertyChanged(nameof(ResetOffsetMinutesOverride));
     }
 }
Beispiel #13
0
        private static async void UpdateOverlayAsync()
        {
#if (!SQUIRREL)
            if (Config.Instance.CheckForUpdates)
            {
                Updater.CheckForUpdates(true);
            }
#endif
            var hsForegroundChanged = false;
            while (UpdateOverlay)
            {
                if (Config.Instance.CheckForUpdates)
                {
                    Updater.CheckForUpdates();
                }
                if (User32.GetHearthstoneWindow() != IntPtr.Zero)
                {
                    if (Game.CurrentRegion == Region.UNKNOWN)
                    {
                        //game started
                        Helper.VerifyHearthstonePath();
                        Game.CurrentRegion = await Helper.GetCurrentRegion();

                        if (Game.CurrentRegion != Region.UNKNOWN)
                        {
                            BackupManager.Run();
                            Game.MetaData.HearthstoneBuild = null;
                        }
                        Watchers.ExperienceWatcher.Run();
                    }
                    Overlay.UpdatePosition();

                    if (!Game.IsRunning)
                    {
                        Overlay.Update(true);
                        Windows.CapturableOverlay?.UpdateContentVisibility();
                    }

                    TrayIcon.MenuItemStartHearthstone.Visible = false;

                    Game.IsRunning = true;
                    GameIsRunningChanged?.Invoke(true);

                    Helper.GameWindowState = User32.GetHearthstoneWindowState();
                    Windows.CapturableOverlay?.Update();
                    if (User32.IsHearthstoneInForeground() && Helper.GameWindowState != WindowState.Minimized)
                    {
                        if (hsForegroundChanged)
                        {
                            Overlay.Update(true);
                            if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                            {
                                //if player topmost is set to true before opponent:
                                //clicking on the playerwindow and back to hs causes the playerwindow to be behind hs.
                                //other way around it works for both windows... what?
                                Windows.OpponentWindow.Topmost = true;
                                Windows.PlayerWindow.Topmost   = true;
                                Windows.TimerWindow.Topmost    = true;
                            }
                            hsForegroundChanged = false;
                        }
                    }
                    else if (!hsForegroundChanged)
                    {
                        if (Config.Instance.WindowsTopmostIfHsForeground && Config.Instance.WindowsTopmost)
                        {
                            Windows.PlayerWindow.Topmost   = false;
                            Windows.OpponentWindow.Topmost = false;
                            Windows.TimerWindow.Topmost    = false;
                        }
                        hsForegroundChanged = true;
                    }
                }
                else if (Game.IsRunning)
                {
                    Game.IsRunning = false;
                    GameIsRunningChanged?.Invoke(false);
                    Overlay.ShowOverlay(false);
                    Watchers.Stop();
                    if (Windows.CapturableOverlay != null)
                    {
                        Windows.CapturableOverlay.UpdateContentVisibility();
                        await Task.Delay(100);

                        Windows.CapturableOverlay.ForcedWindowState = WindowState.Minimized;
                        Windows.CapturableOverlay.WindowState       = WindowState.Minimized;
                    }
                    Log.Info("Exited game");
                    Game.CurrentRegion = Region.UNKNOWN;
                    Log.Info("Reset region");
                    await Reset();

                    Game.IsInMenu = true;
                    Game.InvalidateMatchInfoCache();
                    Overlay.HideRestartRequiredWarning();
                    Helper.ClearCachedHearthstoneBuild();
                    TurnTimer.Instance.Stop();

                    TrayIcon.MenuItemStartHearthstone.Visible = true;

                    if (Config.Instance.CloseWithHearthstone)
                    {
                        MainWindow.Close();
                    }
                }

                await Task.Delay(UpdateDelay);
            }
            CanShutdown = true;
        }
Beispiel #14
0
        protected override void Update(GameTime gameTime)
        {
#if !DEBUG
            if (!IsActive)
            {
                return;
            }
#endif

            if (_wantsToQuit)
            {
                Exit();
            }

            SteamAPI.RunCallbacks();

            GameTime = gameTime;
            GameUpdateCalled?.Invoke();

            InputSystem.Update();

            _frameRateTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (_frameRateTimer > 1000f)
            {
                FPS             = _totalFrames;
                _totalFrames    = 0;
                _frameRateTimer = 0;
            }

            IsMouseVisible = false;

            Cursor.Update();
            SoundtrackManager.Update();

            MessageBox.Update();
            if (MessageBox.IsActive)
            {
                return;
            }

            TextInputBox.Update();
            if (TextInputBox.IsActive)
            {
                return;
            }

            GameDebug.Update();
            if (GameDebug.IsTyping)
            {
                return;
            }

            PauseMenu.Update();
            OptionsMenu.Update();
            if (OptionsMenu.IsActive)
            {
                return;
            }
            if (PauseMenu.IsActive)
            {
                return;
            }

            Dialog.Update();

            Overlay.Update();
            KeyPopUp.Update();

            Player player = GameWorld.GetPlayers()[0];

            Session.Update();

            //Update the game based on what GameState it is
            switch (CurrentGameState)
            {
            case GameState.MainMenu:
                MainMenu.Update();
                if (GameWorld.TileArray != null && GameWorld.TileArray.Length != 0)
                {
                    goto case GameState.GameWorld;
                }
                break;

            case GameState.LoadingScreen:
                LoadingScreen.Update();

                if (!IsLoadingContent)
                {
                    CurrentGameState = _desiredGameState;
                }
                break;

            case GameState.GameWorld:
                if (IsLoadingContent)
                {
                    return;
                }
                if (GameWorld.IsOnDebug)
                {
                    break;
                }
                GameWorld.TotalUpdateTimer.Start();
                if (!TimeFreeze.IsTimeFrozen())
                {
                    GameWorld.UpdateWorld();
                }
                GameWorld.UpdateVisual();
                GameWorld.TotalUpdateTimer.Measure();


                if (StoryTracker.IsInStoryMode)
                {
                    StoryTracker.Update();
                }
                break;
            }

            base.Update(gameTime);
        }
        public override void Update(GameTime gameTime)
        {
            int i; //iterative variable

            timerOffset++;

            // Calibrate current frame to be in-time with the position of the song.
            framecount = Convert.ToUInt64(MediaPlayer.PlayPosition.TotalSeconds * 60);

            // Beat
            if (timerOffset >= offset)
            {
                if (timerBeat >= framesPerBeat)
                {
                    if (enableMetronome)
                    {
                        hitsound.Play();
                    }
                    timerBeat -= framesPerBeat;
                }
                timerBeat++;
            }

            // Update Overlay
            overlay.Update(gameTime);

            // Update Album Art
            albumart.Update();

            // Update Idle Notes
            for (i = 0; i < listnote.Count; i++)
            {
                if (framecount >= listnote[i].spawnframe)
                {
                    listnote_active.Add(listnote[i]);
                    listnote.RemoveAt(i);
                }
            }
            // Update Active Notes
            for (i = 0; i < listnote_active.Count; i++)
            {
                listnote_active[i].Update(gameTime);

                // Double Notes
                if (i + 1 < listnote_active.Count)
                {
                    if (listnote_active[i].spawnframe == listnote_active[i + 1].spawnframe)
                    {
                        listnote_active[i + 1].Bounds.Y = listnote_active[i].Bounds.Y;
                        i++;
                    }
                }

                // Miss
                if (framecount - listnote_active[i].hitframe > accuOkay + calibNoteTiming && framecount - listnote_active[i].hitframe < 100)
                {
                    if (Chain > maxChain)
                    {
                        maxChain = Chain;
                    }

                    Chain      = 0;
                    chainText  = "BREAK";
                    chainColor = Color.Red;
                    textTimer  = 0;

                    countBreak++;

                    listnote_active.RemoveAt(i);
                    break;
                }
            }

            // Checks input to see if the player successfully hits the note
            CheckInput();

            // Update Buttons
            for (i = 0; i < listbutton.Count; i++)
            {
                listbutton[i].Update(gameTime);
            }

            // Update Note Hit Effects
            for (i = 0; i < notehits.Count; i++)
            {
                notehits[i].Update();
                if (notehits[i].AnimationDone)
                {
                    notehits.RemoveAt(i);
                }
            }

            // Check if Song ended
            if (listnote.Count <= 0 && listnote_active.Count <= 0)
            {
                if (timerEndGame <= 0)
                {
                    if (Chain > maxChain)
                    {
                        maxChain = Chain;
                    }

                    MediaPlayer.Stop();
                    GameStateManager.Instance.ChangeScreen(new RhythmGameResults(graphicsDevice, game, this, albumart));
                }
                else
                {
                    timerEndGame--;
                }
            }
        }