private void EnableTooltip(StackView.StackView stackView) { //Tooltip.Enabled = true; //var position = Camera.WorldHexToScreenPixel(stackView.LocationHex).ToPointI() + new PointI(25, 25); //Tooltip.SetPosition(position); //Tooltip.SetText(); }
private void HoveringOverTooltip(StackView.StackView stackView) { //var enable = Tooltip.StartHover(); //if (enable) //{ // EnableTooltip(stackView); //} }
internal override void Update(WorldView worldView, float deltaTime) { if (CheckForBlinkChange(deltaTime)) { ToggleBlink(); } var restartMovement = CheckForRestartOfMovement(); if (restartMovement) { StackView.Move(); } }
internal static List <UnitView> GetUnitsToDraw(StackViews stackViews, StackView.StackView selectedStackView) { var topLeftPosition = new Vector2(20, 510); var unitViews = new List <UnitView>(); var stackViewsSharingSameLocation = GetStackViewsSharingSameLocation(stackViews, selectedStackView); var i = 0; foreach (var stackView in stackViewsSharingSameLocation) { var unitViewsToAdd = GetUnitBadgesToDraw(topLeftPosition, i, stackView); unitViews.AddRange(unitViewsToAdd); i += stackView.Count; } return(unitViews); }
internal override void Update(WorldView worldView, float deltaTime) { var cantMove = MovementCountdownTimeHasExpired() ? MoveStackToNextCell() : MoveStackBetweenCells(deltaTime); var canMove = !cantMove; worldView.Camera.LookAtPixel(LocationInWorld); if (canMove) { return; } if (StackView.StackHasMovementPoints) // either reached final destination or may not move into cell { SetMovementPathToNewExploreLocation(worldView); } else // run out of movement points { StackView.Unselect(); StackView.SelectNext(); } }
internal override void Update(WorldView worldView, float deltaTime) { var cantMove = MovementCountdownTimeHasExpired() ? MoveStackToNextCell() : MoveStackBetweenCells(deltaTime); var canMove = !cantMove; worldView.Camera.LookAtPixel(LocationInWorld); if (canMove) { return; } if (StackView.StackHasMovementPoints) { StackView.Select(); } else { StackView.Unselect(); StackView.SelectNext(); } }
internal StackViewFortifiedState(StackView stackView) { StackView = stackView; }
private void TransitionToMoving(StackView args) { args.SetStackViewState(new StackViewMovingState(args)); }
internal StackViewPatrollingState(StackView stackView) { StackView = stackView; }
private void TransitionToNormal(StackView args) { args.SetStackViewState(new StackViewNormalState(args)); }
private void TransitionToSelected(StackView args) { args.SetStackViewState(new StackViewSelectedState(args)); }
private static List <StackView.StackView> GetStackViewsSharingSameLocation(StackViews stackViews, StackView.StackView selectedStackView) { var stackViews2 = new List <StackView.StackView>(); if (selectedStackView == null) { return(stackViews2); } foreach (var stackView in stackViews) { if (stackView.LocationHex == selectedStackView.LocationHex) // same location { stackViews2.Add(stackView); } } return(stackViews2); }
internal StackViewShowingPotentialMovementState(StackView stackView) { StackView = stackView; }
private static void DrawUnits(SpriteBatch spriteBatch, StackViews stackViews, StackView.StackView selectedStackView, PointI frmUnitsTopLeft, PointI frmUnitsBottomRight, EnumerableDictionary <IControl> actionButtons) { if (selectedStackView == null) { return; } var topLeftPosition = frmUnitsTopLeft.ToVector2() + new Vector2(10.0f, 10.0f); DrawUnitBadges(spriteBatch, stackViews, selectedStackView, topLeftPosition); DrawMovementTypeImages(spriteBatch, frmUnitsBottomRight, selectedStackView.GetMovementTypeImages()); DrawActionButtons(spriteBatch, selectedStackView.Actions, actionButtons); }
internal void SelectStack(StackView.StackView stackView) { StackViews.SelectStack(stackView); }
private static void DrawUnitBadge(SpriteBatch spriteBatch, StackViews stackViews, Vector2 centerPosition, PhoenixGameLibrary.Unit unit, StackView.StackView stackView) { // draw background var sourceRectangle = stackView.IsSelected ? stackViews.SquareGreenFrame.ToRectangle() : stackViews.SquareGrayFrame.ToRectangle(); var destinationRectangle = new Rectangle((int)centerPosition.X, (int)centerPosition.Y, stackView.ScreenFrame.Width, stackView.ScreenFrame.Height); spriteBatch.Draw(stackViews.GuiTextures, destinationRectangle, sourceRectangle, Color.White, 0.0f, new Vector2(sourceRectangle.Width * Constants.ONE_HALF, sourceRectangle.Height * Constants.ONE_HALF), SpriteEffects.FlipVertically, 0.0f); // draw unit icon var frame = stackViews.UnitAtlas.Frames[unit.UnitTypeTextureName]; sourceRectangle = frame.ToRectangle(); destinationRectangle = new Rectangle((int)centerPosition.X, (int)centerPosition.Y, sourceRectangle.Width, sourceRectangle.Height); spriteBatch.Draw(stackViews.UnitTextures, destinationRectangle, sourceRectangle, Color.White, 0.0f, new Vector2(sourceRectangle.Width * Constants.ONE_HALF, sourceRectangle.Height * Constants.ONE_HALF), SpriteEffects.None, 0.0f); }
internal StackViewNormalState(StackView stackView) { StackView = stackView; StackView.SetNotCurrent(); //StackView.SetStatusToNone(); }
private static Rectangle GetUnitBadgesToDraw(Vector2 centerPosition, StackView.StackView stackView) { var destinationRectangle = new Rectangle((int)centerPosition.X - 50, (int)centerPosition.Y - 50, stackView.ScreenFrame.Width, stackView.ScreenFrame.Height); return(destinationRectangle); }
private static void DrawUnitBadges(SpriteBatch spriteBatch, StackViews stackViews, Vector2 topLeftPosition, int index, StackView.StackView stackView) { var x = topLeftPosition.X + 30; var y = topLeftPosition.Y + 30; foreach (var unit in stackView.Stack) { var indexMod3 = index % 3; var indexDividedBy3 = index / 3; // Floor var xOffset = (stackView.ScreenFrame.Width + 10.0f) * indexMod3; var yOffset = (stackView.ScreenFrame.Height + 10.0f) * indexDividedBy3; DrawUnitBadge(spriteBatch, stackViews, new Vector2(x + xOffset, y + yOffset), unit, stackView); index++; } }
private static List <UnitView> GetUnitBadgesToDraw(Vector2 topLeftPosition, int index, StackView.StackView stackView) { var unitViews = new List <UnitView>(); var x = topLeftPosition.X + 30; var y = topLeftPosition.Y + 30; foreach (var unit in stackView.Stack) { var indexMod3 = index % 3; var indexDividedBy3 = index / 3; // Floor var xOffset = (stackView.ScreenFrame.Width + 10.0f) * indexMod3; var yOffset = (stackView.ScreenFrame.Height + 10.0f) * indexDividedBy3; var destinationRectangle = GetUnitBadgesToDraw(new Vector2(x + xOffset, y + yOffset), stackView); unitViews.Add(new UnitView(unit, destinationRectangle)); index++; } return(unitViews); }
internal StackViewMovingState(StackView stackView) { StackView = stackView; MovementCountdownTime = MOVEMENT_TIME_BETWEEN_CELLS_IN_MILLISECONDS; }
internal StackViewExploringState(StackView stackView, WorldView worldView) { StackView = stackView; MovementCountdownTime = MOVEMENT_TIME_BETWEEN_CELLS_IN_MILLISECONDS; SetMovementPathToNewExploreLocation(worldView); }
internal void SetAsCurrent(StackView stackView) { StackViews.SetCurrent(stackView); }
private static void DrawUnitBadges(SpriteBatch spriteBatch, StackViews stackViews, StackView.StackView selectedStackView, Vector2 topLeftPosition) { var stackViewsSharingSameLocation = GetStackViewsSharingSameLocation(stackViews, selectedStackView); var i = 0; foreach (var stackView in stackViewsSharingSameLocation) { DrawUnitBadges(spriteBatch, stackViews, topLeftPosition, i, stackView); i += stackView.Count; } }