Ejemplo n.º 1
0
        public override void DoUpdate(GameTime gameTime)
        {
            NavigateThroughNextChoices(Map.sndSelection, Map.sndConfirm);

            if (ActiveInputManager.InputConfirmPressed())
            {//Make sure the mouse is inside the menu.
                AddToPanelListAndSelect(ListNextChoice[ActionMenuCursor]);

                foreach (InteractiveProp ActiveProp in Map.LayerManager[(int)ActiveSquad.Position.Z].ListProp)
                {
                    foreach (Vector3 MovedOverPoint in ListMVHoverPoints)
                    {
                        ActiveProp.OnMovedOverBeforeStop(ActiveSquad, MovedOverPoint, CursorPosition);
                    }
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
            }
            if (ActiveInputManager.InputUpPressed())
            {
                ActionMenuCursor -= (ActionMenuCursor > 0) ? 1 : 0;

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed() && ActiveSquad.CurrentLeader.CanAttack)
            {
                ActionMenuCursor += (ActionMenuCursor < ListNextChoice.Count - 1) ? 1 : 0;

                Map.sndSelection.Play();
            }
        }
Ejemplo n.º 2
0
        public void Draw(CustomSpriteBatch g)
        {
            foreach (SimpleAnimation ActiveAnimation in ListVisualEffects)
            {
                ActiveAnimation.Draw(g);
            }

            foreach (SimpleAnimation ActiveAnimation in ListImages)
            {
                ActiveAnimation.Draw(g);
            }

            foreach (AttackBox ActiveCollision in ListAttackCollisionBox)
            {
                if (!ActiveCollision.IsAlive)
                {
                    continue;
                }

                ActiveCollision.DrawRegular(g);
            }

            foreach (Prop ActiveProp in ListProp)
            {
                ActiveProp.Draw(g);
            }
        }
Ejemplo n.º 3
0
        private List <ActionPanel> GetPropPanelsOnUnitStop(Squad StoppedUnit)
        {
            List <ActionPanel> ListPanel = new List <ActionPanel>();

            foreach (InteractiveProp ActiveProp in Map.LayerManager[(int)ActiveSquad.Position.Z].ListProp)
            {
                ListPanel.AddRange(ActiveProp.OnUnitBeforeStop(StoppedUnit, CursorPosition));
            }
            return(ListPanel);
        }
Ejemplo n.º 4
0
        private void LoadInteractiveProps()
        {
            Dictionary <string, InteractiveProp> BattleMapInteractiveProp = InteractiveProp.LoadProps(this);

            foreach (InteractiveProp ActiveProp in BattleMapInteractiveProp.Values)
            {
                ActiveProp.Load(Content);
                DicInteractiveProp.Add(ActiveProp.PropName, ActiveProp);
            }
        }
Ejemplo n.º 5
0
        public override void OnSelect()
        {
            Map.FinalizeMovement(ActiveSquad, (int)Map.GetTerrain(ActiveSquad).MovementCost);
            ActiveSquad.EndTurn();
            ActiveSquad.CurrentLeader.UpdateSkillsLifetime(SkillEffect.LifetimeTypeOnAction);

            foreach (InteractiveProp ActiveProp in Map.LayerManager[(int)ActiveSquad.Position.Z].ListProp)
            {
                ActiveProp.OnUnitStop(ActiveSquad);
            }

            Map.ActiveSquadIndex = -1;
            RemoveAllSubActionPanels();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            // Clear to the default control background color.
            Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);

            GraphicsDevice.Clear(backColor);

            if (ShowScripts)
            {
                Helper.DrawScripts();
            }
            else
            {
                Update(new GameTime());

                Matrix TransformationMatrix = Matrix.CreateTranslation(-Camera.X, -Camera.Y, 0);

                g.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null, TransformationMatrix);

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        ActiveProp.BeginDraw(g);
                    }
                }

                g.End();
                GraphicsDevice.SetRenderTarget(null);

                if (ActiveFightingZone.Background != null)
                {
                    ActiveFightingZone.Background.Draw(g, Width, Height);
                }

                g.Begin(SpriteSortMode.Deferred, null, null, null, null, null, TransformationMatrix);

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    if (!DisplayOtherLayers && SelectedLayer != ActiveLayer)
                    {
                        continue;
                    }

                    ActiveLayer.Draw(g);

                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        g.Draw(sprPixel, new Rectangle((int)ActiveProp._Position.X + 13, (int)ActiveProp._Position.Y, 6, 20), Color.Black);
                        g.Draw(sprPixel, new Rectangle((int)ActiveProp._Position.X + 13, (int)ActiveProp._Position.Y + 24, 6, 6), Color.Black);
                    }

                    foreach (SpawnPoint ActiveSpawn in ActiveLayer.ListSpawnPointTeam)
                    {
                        g.Draw(sprPixel, new Rectangle((int)ActiveSpawn.SpawnLocation.X + 13, (int)ActiveSpawn.SpawnLocation.Y, 6, 20), Color.Black);
                        g.Draw(sprPixel, new Rectangle((int)ActiveSpawn.SpawnLocation.X + 13, (int)ActiveSpawn.SpawnLocation.Y + 24, 6, 6), Color.Black);
                    }

                    foreach (Polygon ActivePolygon in ActiveLayer.ListWorldCollisionPolygon)
                    {
                        PolygonTriangle.Draw(g, GraphicsDevice, sprPixel, new PolygonTriangle(PolygonTriangle.SelectionTypes.None, ActivePolygon, 0, 0));
                    }

                    if (SelectedAnimation != null)
                    {
                        Vector2 Position1 = SelectedAnimation.Position - SelectedAnimation.Origin;
                        Vector2 Position2 = Position1 + new Vector2(SelectedAnimation.PositionRectangle.Width, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, SelectedAnimation.PositionRectangle.Height);
                        Vector2 Position4 = Position1 + new Vector2(SelectedAnimation.PositionRectangle.Width, SelectedAnimation.PositionRectangle.Height);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    if (SelectedProp != null)
                    {
                        Vector2 Position1 = SelectedProp._Position;
                        Vector2 Position2 = Position1 + new Vector2(32, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, 32);
                        Vector2 Position4 = Position1 + new Vector2(32, 32);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    if (SelectedSpawn != null)
                    {
                        Vector2 Position1 = SelectedSpawn.SpawnLocation;
                        Vector2 Position2 = Position1 + new Vector2(32, 0);
                        Vector2 Position3 = Position1 + new Vector2(0, 32);
                        Vector2 Position4 = Position1 + new Vector2(32, 32);

                        g.DrawLine(sprPixel, Position1, Position2, Color.Red);
                        g.DrawLine(sprPixel, Position1, Position3, Color.Red);
                        g.DrawLine(sprPixel, Position2, Position4, Color.Red);
                        g.DrawLine(sprPixel, Position3, Position4, Color.Red);
                    }

                    //Draw selected polygons.
                    PolygonEffect.Texture = sprRedTexture;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();
                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

                    Polygon ActiveGroundPolygon;

                    for (int V = 0; V < ActiveLayer.GroundLevelCollision.ArrayVertex.Length - 1; V++)
                    {
                        ActiveGroundPolygon = ActiveLayer.GroundLevelCollision;

                        g.Draw(sprPixel, new Rectangle((int)ActiveGroundPolygon.ArrayVertex[V].X - 2, (int)ActiveGroundPolygon.ArrayVertex[V].Y - 2, 5, 5), Color.Red);
                        g.DrawLine(sprPixel, ActiveGroundPolygon.ArrayVertex[V], ActiveGroundPolygon.ArrayVertex[V + 1], Color.Red);
                    }

                    ActiveGroundPolygon = ActiveLayer.GroundLevelCollision;
                    g.Draw(sprPixel, new Rectangle((int)ActiveGroundPolygon.ArrayVertex[ActiveGroundPolygon.ArrayVertex.Length - 1].X - 2,
                                                   (int)ActiveGroundPolygon.ArrayVertex[ActiveGroundPolygon.ArrayVertex.Length - 1].Y - 2, 5, 5), Color.Red);
                }

                foreach (Layer ActiveLayer in ActiveFightingZone.ListLayer)
                {
                    foreach (Prop ActiveProp in ActiveLayer.ListProp)
                    {
                        ActiveProp.EndDraw(g);
                    }
                }

                if (SelectedPolygonTriangle != null)
                {
                    g.End();
                    g.Begin(SpriteSortMode.Deferred, null, null, null, null, null, TransformationMatrix);

                    PolygonEffect.Texture = sprRedTexture;
                    PolygonEffect.CurrentTechnique.Passes[0].Apply();
                    GraphicsDevice.RasterizerState = RasterizerState.CullNone;
                    SelectedPolygonTriangle.Draw(g, GraphicsDevice, sprPixel);
                    if (SelectedPolygonTriangle.ActivePolygon != null)
                    {
                        SelectedPolygonTriangle.ActivePolygon.Draw(GraphicsDevice);
                    }
                }

                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Y), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Bottom), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Y), new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Bottom), Color.Red);
                g.DrawLine(sprPixel, new Vector2(ActiveFightingZone.CameraBounds.X, ActiveFightingZone.CameraBounds.Bottom), new Vector2(ActiveFightingZone.CameraBounds.Right, ActiveFightingZone.CameraBounds.Bottom), Color.Red);

                Thread.Sleep(15);

                g.End();
            }
        }