public InputTwinState(InputState previous, InputState next, InputTwinState old) { Previous = previous; Next = next; if (old != null) { KeyRepeats = old.KeyRepeats; ButtonRepeats = old.ButtonRepeats; } else { KeyRepeats = new Dictionary <Keys, KeyRepeat>(); ButtonRepeats = new Dictionary <Buttons, KeyRepeat>(); } }
public override void Update(GameTime gameTime) { SeenBosses.RemoveWhere(x => x.Destroyed); CameraFocus.Update(); if (CameraFocus.Dead) { CameraFocus = CameraFocus.MoveNext(Player, 30); } InputTwinState state = Game.InputState; PushObjects(); Menu.Update(this); if (Player.Dead) { Menu.HandleInput(this); } PopupHelper.Global.Update(this); //PopupManager.Update(this); Wait.Update(); bool cancel = false; while (!cancel && Wait.Done && !Player.Dead && CameraFocus.Done) { var corpses = Entities.Where(x => x.Dead && !x.Control.HasImmediateTurns()); List <Wait> waitForDestruction = new List <Wait>(); foreach (var corpse in corpses) { waitForDestruction.Add(Scheduler.Instance.RunAndWait(corpse.RoutineDestroy())); } if (waitForDestruction.Any()) { Wait.Add(new WaitAll(waitForDestruction)); } Enemy foundBoss = Spawner.Bosses.Find(x => !x.Dead && IsBossVisible(x) && !SeenBosses.Contains(x)); if (foundBoss != null) { Wait.Add(Scheduler.Instance.RunAndWait(RoutineBossWarning(foundBoss))); break; } ActionQueue.Step(); Turn = ActionQueue.CurrentTurn; if (Turn == null) { break; } switch (Turn.Phase) { case TurnPhase.Start: Wait.Add(Turn.StartTurn()); break; case TurnPhase.Tick: if (Turn.TurnTaker.Controllable(Player)) { Menu.HandleInput(this); cancel = true; } else if (Turn.TakeTurn()) { Wait.Add(Turn.Wait); } break; case TurnPhase.End: Wait.Add(Turn.EndTurn()); break; } Wait.Update(); } foreach (var obj in GameObjects.GetAndClean(x => x.Destroyed)) { obj.Update(); } foreach (var quest in Quests) { if (!quest.Completed && quest.PrerequisitesCompleted) { quest.Completed = quest.CheckCompletion(); } } Vector2 worldPos = Vector2.Transform(new Vector2(InputState.MouseX, InputState.MouseY), Matrix.Invert(WorldTransform)); int tileX = Util.FloorDiv((int)worldPos.X, 16); int tileY = Util.FloorDiv((int)worldPos.Y, 16); TileCursor = new Point(tileX, tileY); if (Menu.IsMouseOver(InputState.MouseX, InputState.MouseY)) { TileCursor = null; } Tooltip = string.Empty; if (TileCursor.HasValue && CameraMap != null) { Tile tile = CameraMap.GetTile(TileCursor.Value.X, TileCursor.Value.Y); if (tile != null && tile.IsVisible()) { tile.AddTooltip(ref Tooltip); } } Tooltip = Tooltip.Trim(); }