Example #1
0
 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();
 }
Example #2
0
        private void HoveringOverTooltip(StackView.StackView stackView)
        {
            //var enable = Tooltip.StartHover();

            //if (enable)
            //{
            //    EnableTooltip(stackView);
            //}
        }
Example #3
0
        internal override void Update(WorldView worldView, float deltaTime)
        {
            if (CheckForBlinkChange(deltaTime))
            {
                ToggleBlink();
            }

            var restartMovement = CheckForRestartOfMovement();

            if (restartMovement)
            {
                StackView.Move();
            }
        }
Example #4
0
        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();
            }
        }
Example #6
0
        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;
 }
Example #8
0
 private void TransitionToMoving(StackView args)
 {
     args.SetStackViewState(new StackViewMovingState(args));
 }
Example #9
0
 internal StackViewPatrollingState(StackView stackView)
 {
     StackView = stackView;
 }
Example #10
0
 private void TransitionToNormal(StackView args)
 {
     args.SetStackViewState(new StackViewNormalState(args));
 }
Example #11
0
 private void TransitionToSelected(StackView args)
 {
     args.SetStackViewState(new StackViewSelectedState(args));
 }
Example #12
0
        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;
 }
Example #14
0
        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);
        }
Example #15
0
 internal void SelectStack(StackView.StackView stackView)
 {
     StackViews.SelectStack(stackView);
 }
Example #16
0
        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);
        }
Example #17
0
 internal StackViewNormalState(StackView stackView)
 {
     StackView = stackView;
     StackView.SetNotCurrent();
     //StackView.SetStatusToNone();
 }
Example #18
0
        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);
        }
Example #19
0
        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++;
            }
        }
Example #20
0
        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);
        }
Example #21
0
 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);
 }
Example #23
0
 internal void SetAsCurrent(StackView stackView)
 {
     StackViews.SetCurrent(stackView);
 }
Example #24
0
        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;
            }
        }