示例#1
0
        private void StarterPopup(Zombicide game)
        {
            UserInterface.Active.Clear();
            Panel StarterPopup = new Panel(new Vector2(600, 700), PanelSkin.Default, Anchor.Center);
            var   header       = new Header("Select Starter Weapon", Anchor.TopCenter);

            List <Texture2D> starterTextures = new List <Texture2D>();

            foreach (Item I in Item.StarterList)
            {
                string    fileName = I.Name.Replace(' ', '_');
                Texture2D item     = game.Content.Load <Texture2D>(@"Items\" + fileName);
                starterTextures.Add(item);
            }


            Image wpnImage = new Image(starterTextures.First(), new Vector2(350, 500), anchor: Anchor.AutoCenter);

            weaponIndex = 0;

            var leftButton = new Button("", ButtonSkin.Default, Anchor.CenterLeft, new Vector2(50, 50));

            leftButton.Padding = new Vector2(0, 0);
            leftButton.AddChild(new Paragraph("<", Anchor.Center));
            leftButton.OnClick = (Entity btn) =>
            {
                weaponIndex = LimitToRange(weaponIndex - 1, 0, 3);

                wpnImage.Texture = starterTextures.ElementAt(weaponIndex);
            };

            var rightButton = new Button("", ButtonSkin.Default, Anchor.CenterRight, new Vector2(50, 50));

            rightButton.Padding = new Vector2(0, 0);
            rightButton.AddChild(new Paragraph(">", Anchor.Center));
            rightButton.OnClick = (Entity btn) =>
            {
                weaponIndex      = LimitToRange(weaponIndex + 1, 0, 3);
                wpnImage.Texture = starterTextures.ElementAt(weaponIndex);
            };

            var button = new Button("OK", ButtonSkin.Default, Anchor.BottomCenter, new Vector2(300, 50));

            button.OnClick = (Entity btn) =>
            {
                SelectedCharacter.MainHandSlot        = (Weapon)Item.StarterList.Where(x => wpnImage.TextureName.Replace('_', ' ').Contains(x.Name)).First();
                SelectedCharacter.ActiveWeapon        = (Weapon)SelectedCharacter.MainHandSlot;
                SelectedCharacter.ActiveWeapon.Active = true;
                UserInterface.Active.Clear();
                game.SetNextScreen(nameof(MainGameScreen));
            };

            StarterPopup.AddChild(header);
            StarterPopup.AddChild(new HorizontalLine());
            StarterPopup.AddChild(wpnImage);
            StarterPopup.AddChild(leftButton);
            StarterPopup.AddChild(rightButton);
            StarterPopup.AddChild(button);
            UserInterface.Active.AddEntity(StarterPopup);
        }
示例#2
0
        public static void Initialize(Zombicide game)
        {
            ItemList    = new List <Item>();
            StarterList = new List <Weapon>();
            XmlDocument doc      = new XmlDocument();
            string      fileName = "Items.xml";
            string      ItemPath = Path.Combine(Directory.GetCurrentDirectory(), @"Content\Data\", fileName);

            doc.Load(ItemPath);
            foreach (XmlNode I in doc.DocumentElement.ChildNodes)
            {
                Weapon item;
                switch (I.Name)
                {
                case ("Weapon"):
                    item = new Weapon(game, I);
                    if (Boolean.Parse(I.ChildNodes.Item(1).InnerText) == true)
                    {
                        StarterList.Add(item);
                    }
                    else
                    {
                        ItemList.Add(item);
                    }

                    break;
                }
            }
        }
示例#3
0
 public MainGameScreen(Zombicide game)
 {
     LoadMainGame(game);
     PopupFlag = false;
     PopupFlag = false;
     this.game = game;
     Impact    = game.Content.Load <SpriteFont>("Impact");
 }
示例#4
0
 public override void Update(Zombicide game)
 {
     if (game.MouseState.LeftButton == ButtonState.Pressed &&
         newGameButtonRectangle.Contains(game.MouseState.Position))
     {
         game.SetNextScreen(nameof(CharacterSelectScreen));
     }
     textSize += .01;
 }
示例#5
0
 public override void LoadContent(Zombicide game)
 {
     titleFont              = game.Content.Load <SpriteFont>("Zombicide Font");
     newGameButton          = game.Content.Load <Texture2D>(@"New Game");
     textMiddlePoint        = titleFont.MeasureString("Zombicide") / 2;
     titlePosition          = new Vector2(game.Window.ClientBounds.Width / 2, game.Window.ClientBounds.Height / 2);
     newGameButtonRectangle = new Rectangle((int)((game.GraphicsDevice.Viewport.Width / 2) - (Zombicide.NGButtonWidth / 2)), (int)(game.GraphicsDevice.Viewport.Height - (game.GraphicsDevice.Viewport.Height / 5)), (int)Zombicide.NGButtonWidth, (int)Zombicide.NGButtonHeight);
     textSize = 2;
 }
示例#6
0
 public static void Initialize(Zombicide game)
 {
     DiceList = new List <Dice>();
     Texture1 = game.Content.Load <Texture2D>(@"Dice/die_face_1_T");
     Texture2 = game.Content.Load <Texture2D>(@"Dice/die_face_2_T");
     Texture3 = game.Content.Load <Texture2D>(@"Dice/die_face_3_T");
     Texture4 = game.Content.Load <Texture2D>(@"Dice/die_face_4_T");
     Texture5 = game.Content.Load <Texture2D>(@"Dice/die_face_5_T");
     Texture6 = game.Content.Load <Texture2D>(@"Dice/die_face_6_T");
 }
示例#7
0
 public static void Initialize(Zombicide game)
 {
     ObjectiveList = new List <Objective>();
     LoadTextures(game);
     foreach (var O in ObjectiveTiles)
     {
         ObjectiveList.Add(new Objective(O));
     }
     ObjectiveList.ElementAt(MainGameScreen.RNG.Next(0, ObjectiveList.Count)).UndersideColor = "blue";
 }
示例#8
0
 public Weapon(Zombicide game, XmlNode i) : base(game, i)
 {
     Name    = i.ChildNodes.Item(0).InnerText;
     Starter = Boolean.Parse(i.ChildNodes.Item(1).InnerText);
     Enum.TryParse(i.ChildNodes.Item(2).InnerText, out Type);
     MinRange      = Convert.ToInt32(i.ChildNodes.Item(3).InnerText);
     MaxRange      = Convert.ToInt32(i.ChildNodes.Item(4).InnerText);
     Dice          = Convert.ToInt32(i.ChildNodes.Item(5).InnerText);
     DiceThreshold = Convert.ToInt32(i.ChildNodes.Item(6).InnerText);
     Damage        = Convert.ToInt32(i.ChildNodes.Item(7).InnerText);
     Enum.TryParse(i.ChildNodes.Item(8).InnerText, out DoorStatus);
     Enum.TryParse(i.ChildNodes.Item(9).InnerText, out MinimumLevel);
     DualWield = Boolean.Parse(i.ChildNodes.Item(10).InnerText);
 }
示例#9
0
        public void FlipCard(Zombicide game)
        {
            switch (UndersideColor)
            {
            case "green":
                Texture = GreenX;
                break;

            case "blue":
                Texture = BlueX;
                break;

            default:
                break;
            }
            flipped = true;
            game.ActiveCharacter.PickupObjective();
        }
示例#10
0
        public override void Draw(Zombicide game)
        {
            game.SpriteBatch.Draw(mapPic, new Rectangle(mapX, mapY, mapWidth, mapHeight), Color.White);
            foreach (Objective O in Objective.ObjectiveList)
            {
                O.Draw(game);
            }
            game.ActiveCharacter.Draw(game);
            game.SpriteBatch.Draw(resetMapButton, new Rectangle(resetMapX, resetMapY, 54, 54), Color.White);

            if (whosTurn == MoveState.PlayerTurn)
            {
                foreach (Tile T in litTiles)
                {
                    game.SpriteBatch.Draw(Highlight, new Rectangle(mapX + T.column * tileWidth, mapY + T.row * tileHeight, tileWidth, tileHeight), Color.White);
                }
            }
            foreach (Tile T in tileData)
            {
                if (T.LeftSide == RoomSide.closeddoor)
                {
                    game.SpriteBatch.Draw(closedDoor, new Rectangle(mapX + (T.column * tileWidth) - 25, mapY + (T.row * tileHeight) + (tileHeight / 2) - 25, 50, 50), Color.White);
                }
                if (T.RighSide == RoomSide.opendoor)
                {
                    game.SpriteBatch.Draw(openDoor, new Rectangle(mapX + ((T.column + 1) * tileWidth) - 25, mapY + (T.row * tileHeight) + (tileHeight / 2) - 25, 50, 50), Color.White);
                }
                if (T.TopSide == RoomSide.closeddoor)
                {
                    game.SpriteBatch.Draw(closedDoor, new Rectangle(mapX + (T.column * tileWidth) + (tileWidth / 2) - 25, mapY + (T.row * tileHeight) - 25, 50, 50), Color.White);
                }
                if (T.BottomSide == RoomSide.opendoor)
                {
                    game.SpriteBatch.Draw(openDoor, new Rectangle(mapX + (T.column * tileWidth) + (tileWidth / 2) - 25, mapY + ((T.row + 1) * tileHeight) - 25, 50, 50), Color.White);
                }
            }
            foreach (Zombie Z in Zombie.zombieList)
            {
                Z.Draw(game);
            }
        }
示例#11
0
        void applyMoveTiles(Zombicide game)
        {
            Tile curLocation = tileData.Find(x => x.row == game.ActiveCharacter.PlayerTile.row && x.column == game.ActiveCharacter.PlayerTile.column);

            litTiles.Clear();
            if (curLocation.LeftSide == RoomSide.street || curLocation.LeftSide == RoomSide.room || curLocation.LeftSide == RoomSide.opendoor)
            {
                litTiles.Add(tileData.Find(x => x.row == curLocation.row && x.column == curLocation.column - 1));
            }
            if (curLocation.RighSide == RoomSide.street || curLocation.RighSide == RoomSide.room || curLocation.RighSide == RoomSide.opendoor)
            {
                litTiles.Add(tileData.Find(x => x.row == curLocation.row && x.column == curLocation.column + 1));
            }
            if (curLocation.TopSide == RoomSide.street || curLocation.TopSide == RoomSide.room || curLocation.TopSide == RoomSide.opendoor)
            {
                litTiles.Add(tileData.Find(x => x.row == curLocation.row - 1 && x.column == curLocation.column));
            }
            if (curLocation.BottomSide == RoomSide.street || curLocation.BottomSide == RoomSide.room || curLocation.BottomSide == RoomSide.opendoor)
            {
                litTiles.Add(tileData.Find(x => x.row == curLocation.row + 1 && x.column == curLocation.column));
            }
        }
示例#12
0
        public override void Update(Zombicide game)
        {
            int mapSpeed = 10;

            game.ActiveCharacter.Update(game);
            bool moving = Zombie.CheckMoving() || game.ActiveCharacter.moving;

            //Update UI components
            life.Text       = ("Life: " + (game.ActiveCharacter.DeathThreshold - game.ActiveCharacter.GetDamageTaken()).ToString());
            moves.Text      = ("Moves Left: " + (game.ActiveCharacter.movesLeft).ToString());
            level.Text      = ("Level: " + (game.ActiveCharacter.Level).ToString());
            experience.Text = ("Experience: " + (game.ActiveCharacter.Experience).ToString());
            if ((Weapon)game.ActiveCharacter.MainHandSlot != null)
            {
                var mainWeap = (Weapon)game.ActiveCharacter.MainHandSlot;
                MainHand.Texture      = mainWeap.Texture;
                MainHand.ToolTipText  = "Damage: " + mainWeap.Damage + "\nDice: " + mainWeap.Dice + "\nHit Value: " + mainWeap.DiceThreshold + "\nRange: " + mainWeap.MinRange + "-" + mainWeap.MaxRange;
                MainHand.OutlineColor = (mainWeap.Active) ? Color.Red : Color.White;
            }
            else
            {
                MainHand.Texture      = Character.EmptyHand;
                MainHand.ToolTipText  = null;
                MainHand.OutlineColor = Color.White;
            }
            if ((Weapon)game.ActiveCharacter.OffHandSlot != null)
            {
                var offWeap = (Weapon)game.ActiveCharacter.OffHandSlot;
                OffHand.Texture      = offWeap.Texture;
                OffHand.ToolTipText  = "Damage: " + offWeap.Damage + "\nDice: " + offWeap.Dice + "\nHit Value: " + offWeap.DiceThreshold + "\nRange: " + offWeap.MinRange + "-" + offWeap.MaxRange;
                OffHand.OutlineColor = (offWeap.Active) ? Color.Red : Color.White;
            }
            else
            {
                OffHand.Texture      = Character.EmptyHand;
                OffHand.ToolTipText  = null;
                OffHand.OutlineColor = Color.White;
            }

            BackPackTab.panel.ClearChildren();
            game.ActiveCharacter.Backpack.Remove(null);
            foreach (Item I in game.ActiveCharacter.Backpack)
            {
                if (I != null)
                {
                    Image img = new Image(I.Texture, new Vector2(I.Size.X, I.Size.Y), anchor: Anchor.AutoInline);
                    BackPackTab.panel.AddChild(img);
                    img.OnClick = (Entity i) =>
                    {
                        moveItemPopup(img);
                    };
                }
            }


            //Check endgame conditions
            if (EndGameFlag == false)
            {
                if (game.ActiveCharacter.IsAlive == false)
                {
                    EndGamePopup(false);
                }
                else if (Objective.ObjectiveList.Exists(x => x.flipped == true && x.UndersideColor == "blue"))
                {
                    EndGamePopup(true);
                }
            }


            if (PopupFlag == false && LastPopupFlag == false && moving == false)
            {
                if (game.PreviousMouseState.LeftButton == ButtonState.Pressed &&
                    game.MouseState.LeftButton == ButtonState.Released)
                {
                    MouseClicked(game, 1);
                }
                if (game.PreviousMouseState.RightButton == ButtonState.Pressed &&
                    game.MouseState.RightButton == ButtonState.Released)
                {
                    MouseClicked(game, 2);
                }
                if (Keyboard.GetState().IsKeyDown(Keys.Space) && whosTurn == MoveState.PlayerTurn)
                {
                    SearchPopup();
                }
            }
            LastPopupFlag = PopupFlag;

            int mapCenterX = mapX + (mapWidth / 2);
            int mapCenterY = mapY + (mapHeight / 2);

            if (Keyboard.GetState().IsKeyDown(Keys.Up) && mapCenterY > 0)
            {
                mapY -= mapSpeed;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Left) && mapCenterX > 400)
            {
                mapX -= mapSpeed;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Right) && mapCenterX < game.GraphicsDevice.Viewport.Width - 400)
            {
                mapX += mapSpeed;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Down) && mapCenterY < game.GraphicsDevice.Viewport.Height)
            {
                mapY += mapSpeed;
            }
            tileHeight = mapHeight / tilesHigh;
            tileWidth  = mapWidth / tilesWide;

            foreach (Zombie Z in Zombie.zombieList)
            {
                Z.Update(game);
            }


            if (whosTurn == MoveState.PlayerTurn && moving == false)
            {
                applyMoveTiles(game);
                if (game.ActiveCharacter.movesLeft <= 0)
                {
                    whosTurn = MoveState.ZombieTurn;
                }
            }

            if (whosTurn == MoveState.ZombieTurn)
            {
                //Give zombies their move
                foreach (Zombie Z in Zombie.zombieList)
                {
                    if (game.ActiveCharacter.PlayerTile.row == Z.ZombieTile[0] && game.ActiveCharacter.PlayerTile.column == Z.ZombieTile[1])
                    {
                        Z.attackPlayer();
                    }
                    else
                    {
                        Z.Move(tileData, game.ActiveCharacter);
                    }
                }
                //Spawn new Zombies
                foreach (var ST in Zombie.SpawnTiles)
                {
                    if (RNG.Next(0, 2) == 1)
                    {
                        ZombieFactory.Spawn(game.ActiveCharacter.Level, ST[0], ST[1]);
                    }
                }

                whosTurn = MoveState.PlayerTurn;
                game.ActiveCharacter.ResetMoves(moves);
            }
        }
示例#13
0
 public void Click(Zombicide game, bool RightClick)
 {
     throw new NotImplementedException();
 }
示例#14
0
        void LoadCharSelection(Zombicide game)
        {
            //Setup Last Panel to hold skills and confirm button
            Panel     skillPanel = new Panel(new Vector2(400, 600), PanelSkin.Default, Anchor.AutoInline);
            Paragraph bs         = new Paragraph("Blue Skill", Anchor.Auto, Color.DeepSkyBlue);
            Paragraph ys         = new Paragraph("Yellow Skill", Anchor.Auto, Color.Yellow);
            Paragraph os1        = new Paragraph("Orange Skill", Anchor.Auto, Color.Orange);
            Paragraph os2        = new Paragraph("Orange Skill", Anchor.Auto, Color.Orange);
            Paragraph rs1        = new Paragraph("Red Skill", Anchor.Auto, Color.Red);
            Paragraph rs2        = new Paragraph("Red Skill", Anchor.Auto, Color.Red);
            Paragraph rs3        = new Paragraph("Red Skill", Anchor.Auto, Color.Red);
            Paragraph ArmAlt     = new Paragraph("Item", Anchor.Auto, Color.White);
            Button    ConfirmBut = new Button("CONFIRM", ButtonSkin.Default, Anchor.BottomCenter);

            ConfirmBut.Enabled = false;

            skillPanel.AddChild(new Header("Skills"));
            skillPanel.AddChild(new HorizontalLine());
            skillPanel.AddChild(bs);
            skillPanel.AddChild(ys);
            skillPanel.AddChild(os1);
            skillPanel.AddChild(os2);
            skillPanel.AddChild(rs1);
            skillPanel.AddChild(rs2);
            skillPanel.AddChild(rs3);
            skillPanel.AddChild(new LineSpace(5));
            skillPanel.AddChild(new Header("Armor Alternative"));
            skillPanel.AddChild(new HorizontalLine());
            skillPanel.AddChild(ArmAlt);
            skillPanel.AddChild(ConfirmBut);


            //Setup First Panel to hold character list
            Panel Charpanel = new Panel(new Vector2(400, 600), PanelSkin.Default, Anchor.AutoInline, new Vector2((game.GraphicsDevice.Viewport.Width / 2) - 700, 100));

            Charpanel.AddChild(new Header("Select Character"));
            Charpanel.AddChild(new HorizontalLine());
            SelectList list         = new SelectList(new Vector2(0, 500));
            var        CharDocument = PopulateCharacters();

            foreach (XmlNode node in CharDocument.DocumentElement.ChildNodes)
            {
                list.AddItem(node.FirstChild.InnerText);
            }
            Charpanel.AddChild(list);

            //Setup middle panel to hold character image
            Panel picpanel = new Panel(new Vector2(600, 600), PanelSkin.Default, Anchor.AutoInline);
            Image img      = new Image(new Texture2D(game.GraphicsDevice, 400, 400));

            picpanel.AddChild(img);

            //Add Panels to UI
            UserInterface.Active.AddEntity(Charpanel);
            UserInterface.Active.AddEntity(picpanel);
            UserInterface.Active.AddEntity(skillPanel);

            //Set events
            ConfirmBut.OnClick = (Entity btn) =>
            {
                Character.Initialize(game, list.SelectedValue.First());
                SelectedCharacter = new Character(list.SelectedValue, bs.Text, ys.Text, os1.Text, os2.Text, rs1.Text, rs2.Text, rs3.Text, ArmAlt.Text);
                StarterPopup(game);
            };

            list.OnValueChange = (Entity lst) =>
            {
                ConfirmBut.Enabled = true;
                var     name         = list.SelectedValue;
                XmlNode selectedNode = null;
                foreach (XmlNode node in CharDocument.DocumentElement.ChildNodes)
                {
                    if (node.FirstChild.InnerText == name)
                    {
                        selectedNode = node;
                    }
                }
                string blueSkill        = selectedNode.ChildNodes.Item(1).InnerText;
                string yellowSkill      = selectedNode.ChildNodes.Item(2).InnerText;
                string orangeSkill1     = selectedNode.ChildNodes.Item(3).InnerText;
                string OrangeSkill2     = selectedNode.ChildNodes.Item(4).InnerText;
                string RedSkill1        = selectedNode.ChildNodes.Item(5).InnerText;
                string RedSkill2        = selectedNode.ChildNodes.Item(6).InnerText;
                string RedSkill3        = selectedNode.ChildNodes.Item(7).InnerText;
                string ArmorAlternative = selectedNode.ChildNodes.Item(8).InnerText;

                bs.Text     = blueSkill;
                ys.Text     = yellowSkill;
                os1.Text    = orangeSkill1;
                os2.Text    = OrangeSkill2;
                rs1.Text    = RedSkill1;
                rs2.Text    = RedSkill2;
                rs3.Text    = RedSkill3;
                ArmAlt.Text = ArmorAlternative;

                string     baseDir  = Directory.GetCurrentDirectory();
                string     fileName = name + ".jpg";
                var        imgPath  = Path.Combine(baseDir, @"Data\", fileName);
                FileStream imgFile  = File.OpenRead(imgPath);
                img.Texture = Texture2D.FromStream(game.GraphicsDevice, imgFile);
            };
        }
示例#15
0
 public StartScreen(Zombicide game)
 {
     LoadContent(game);
 }
示例#16
0
 public override void Update(Zombicide game)
 {
 }
示例#17
0
 public override void Draw(Zombicide game)
 {
 }
示例#18
0
 public override void Draw(Zombicide game)
 {
     game.SpriteBatch.DrawString(titleFont, "Zombicide", titlePosition, Color.Black, 0, textMiddlePoint, (float)(Math.Sin(textSize) * .3) + 2, SpriteEffects.None, 0.5f);
     game.SpriteBatch.Draw(newGameButton, newGameButtonRectangle, Color.White);
 }
示例#19
0
 public void Update(Zombicide game)
 {
 }
示例#20
0
 public void Update(Zombicide game)
 {
     throw new NotImplementedException();
 }
示例#21
0
 static void Main()
 {
     using (var game = new Zombicide())
         game.Run();
 }
示例#22
0
 public virtual void Update(Zombicide game)
 {
 }
示例#23
0
        void BreakDoor(Zombicide game, Tile T, string side)
        {
            bool success = false;

            if (game.ActiveCharacter.ActiveWeapon.DoorStatus == DoorOpener.True)
            {
                //Roll Dice
                success = true;
            }
            else if (game.ActiveCharacter.ActiveWeapon.DoorStatus == DoorOpener.Auto)
            {
                //Roll Dice
                success = true;
            }
            else
            {
                PopupFlag = true;
                GeonBit.UI.Utils.MessageBox.ShowMsgBox("Item Cannot Open Doors", "Please Equip An Item That Can Open Doors.", new GeonBit.UI.Utils.MessageBox.MsgBoxOption[] {
                    new GeonBit.UI.Utils.MessageBox.MsgBoxOption("OK", () => {
                        return(true);
                    })
                });
                PopupFlag = false;
            }
            if (success)
            {
                if (side == "left")
                {
                    T.LeftSide = RoomSide.opendoor;
                    var neighborTile = tileData.Find(x => x.row == T.row && x.column == T.column - 1);
                    neighborTile.RighSide = RoomSide.opendoor;
                }
                else if (side == "top")
                {
                    T.TopSide = RoomSide.opendoor;
                    var neighborTile = tileData.Find(x => x.row == T.row - 1 && x.column == T.column);
                    neighborTile.BottomSide = RoomSide.opendoor;
                }
                if (side == "right")
                {
                    T.RighSide = RoomSide.opendoor;
                    var neighborTile = tileData.Find(x => x.row == T.row && x.column == T.column + 1);
                    neighborTile.LeftSide = RoomSide.opendoor;
                }
                else if (side == "bottom")
                {
                    T.BottomSide = RoomSide.opendoor;
                    var neighborTile = tileData.Find(x => x.row == T.row + 1 && x.column == T.column);
                    neighborTile.TopSide = RoomSide.opendoor;
                }
                applyMoveTiles(game);
                game.ActiveCharacter.movesLeft--;
                //Make function that finds all connnected tiles in a room, this will help with spawning zombies too...
                //if (findallconnectingtiles.where(x => x.topside==open ||left||right||bottom).count <=1) to check if this is the first time youve opened the room
                ZombieFactory.SpawnInRooms(T, side, game.ActiveCharacter.Level);
                if (game.ActiveCharacter.movesLeft == 0)
                {
                    whosTurn = MoveState.ZombieTurn;
                }
            }
        }
示例#24
0
 public void Draw(Zombicide game)
 {
     game.SpriteBatch.Draw(Texture, new Rectangle(MainGameScreen.mapX + (Tile[1] * MainGameScreen.tileWidth) + (MainGameScreen.tileWidth / 2) - 25, MainGameScreen.mapY + Tile[0] * MainGameScreen.tileHeight + (MainGameScreen.tileWidth / 2) - 25, 50, 50), Color.White);
 }
示例#25
0
        void LoadMainGame(Zombicide game)
        {
            //Initialize map
            map        = new TiledSharp.TmxMap(@"Content/Tiled/Big Game Hunting.tmx");
            mapPic     = game.Content.Load <Texture2D>(@"Tiled/Big Game Hunting");
            Highlight  = game.Content.Load <Texture2D>(@"Highlight");
            closedDoor = game.Content.Load <Texture2D>(@"ClosedDoor");
            openDoor   = game.Content.Load <Texture2D>(@"OpenDoor");
            mapX       = (game.GraphicsDevice.Viewport.Width / 2) - (mapWidth / 2);
            mapY       = (game.GraphicsDevice.Viewport.Height / 2) - (mapHeight / 2);
            tilesHigh  = Convert.ToInt32(map.Layers[0].Properties.Where(x => x.Key == "TilesHigh").FirstOrDefault().Value);
            tilesWide  = Convert.ToInt32(map.Layers[0].Properties.Where(x => x.Key == "TilesWide").FirstOrDefault().Value);
            tileWidth  = mapWidth / tilesWide;
            tileHeight = mapHeight / tilesHigh;
            litTiles   = new List <Tile>();
            doorTiles  = new List <Tile>();
            tileData   = LoadTileData("BigGameHunting");
            foreach (Tile T in tileData)
            {
                if (T.LeftSide == RoomSide.closeddoor || T.LeftSide == RoomSide.opendoor || T.TopSide == RoomSide.closeddoor || T.TopSide == RoomSide.opendoor)
                {
                    doorTiles.Add(T);
                }
            }

            //Initialize random number generator
            RNG = new Random();

            //Place reset map Button
            resetMapButton = game.Content.Load <Texture2D>(@"CenterMapButton");
            resetMapX      = 1200 - 54;
            resetMapY      = game.GraphicsDevice.Viewport.Height - 54;

            //read in Start tile from map data and place player there
            var startTile = map.Layers[0].Properties.Where(x => x.Key == "StartTile").FirstOrDefault().Value.Split(',');

            game.ActiveCharacter.Move(startTile, true);

            //Load Zombie Spawns
            Zombie.SpawnTiles = map.Layers[0].Properties.Where(x => x.Key.StartsWith("SpawnZone")).Select(x => x.Value.Split(',').Select(y => Convert.ToInt32(y)).ToArray()).ToList();

            //Load and initialize objectives
            Objective.ObjectiveTiles = map.Layers[0].Properties.Where(x => x.Key.StartsWith("Objective")).Select(x => x.Value.Split(',').Select(y => Convert.ToInt32(y)).ToArray()).ToList();
            Objective.Initialize(game);

            //Initialize UI for Main game screen
            PanelTabs tabs        = new PanelTabs();
            PanelTabs RightTabs   = new PanelTabs();
            Panel     movePanel   = new Panel(new Vector2(400, 750), PanelSkin.Default, Anchor.TopRight, new Vector2(0, 50));
            Panel     playerPanel = new Panel(new Vector2(400, 750), PanelSkin.Default, Anchor.TopLeft, new Vector2(0, 50));

            playerPanel.AddChild(tabs);
            movePanel.AddChild(RightTabs);

            TabData EquipmentTab = RightTabs.AddTab("Equipment");
            Item    MH           = game.ActiveCharacter.MainHandSlot;

            MainHand = new Image(MH.Texture, new Vector2(MH.Size.X, MH.Size.Y), anchor: Anchor.TopLeft);
            MainHand.OutlineWidth = 3;
            var mainWeap = (Weapon)game.ActiveCharacter.MainHandSlot;

            MainHand.ToolTipText = "Damage: " + mainWeap.Damage + "\nDice: " + mainWeap.Dice + "\nHit Value: " + mainWeap.DiceThreshold + "\nRange: " + mainWeap.MinRange + "-" + mainWeap.MaxRange;
            MainHand.OnClick     = (Entity pgh) =>
            {
                game.ActiveCharacter.SetActiveWeapon("MAIN");
            };
            OffHand = new Image(Character.EmptyHand, new Vector2(MH.Size.X, MH.Size.Y), anchor: Anchor.TopRight);
            OffHand.OutlineWidth = 3;
            OffHand.OutlineColor = Color.White;
            OffHand.OnClick      = (Entity pgh) =>
            {
                if (game.ActiveCharacter.OffHandSlot != null)
                {
                    game.ActiveCharacter.SetActiveWeapon("OFF");
                }
            };
            ArmorSlot = new Image(Character.EmptyArmor, new Vector2(MH.Size.X, MH.Size.Y), anchor: Anchor.AutoCenter, offset: new Vector2(0, 50));
            ArmorSlot.OutlineWidth      = 3;
            ArmorSlot.OutlineColor      = Color.White;
            EquipmentTab.button.Padding = new Vector2(0, 0);
            EquipmentTab.button.Size    = new Vector2(100, 50);
            EquipmentTab.button.Offset  = new Vector2(0, -50);
            EquipmentTab.panel.Offset   = new Vector2(0, -50);
            EquipmentTab.button.ButtonParagraph.Scale = .9f;
            EquipmentTab.panel.AddChild(MainHand);
            EquipmentTab.panel.AddChild(OffHand);
            EquipmentTab.panel.AddChild(ArmorSlot);

            TabData SkillTab = RightTabs.AddTab("Skills");

            BlueSkill    = new Paragraph(game.ActiveCharacter.BlueSkill.SkillName, Anchor.Auto, color: Color.DeepSkyBlue);
            YellowSkill  = new Paragraph(game.ActiveCharacter.YellowSkill.SkillName, Anchor.Auto, color: Color.DarkGray);
            OrangeSkill1 = new Paragraph(game.ActiveCharacter.OrangeSkills.First().SkillName, Anchor.Auto, color: Color.DarkGray);
            OrangeSkill2 = new Paragraph(game.ActiveCharacter.OrangeSkills.Last().SkillName, Anchor.Auto, color: Color.DarkGray);
            RedSkill1    = new Paragraph(game.ActiveCharacter.RedSkills.First().SkillName, Anchor.Auto, color: Color.DarkGray);
            RedSkill2    = new Paragraph(game.ActiveCharacter.RedSkills.ElementAt(1).SkillName, Anchor.Auto, color: Color.DarkGray);
            RedSkill3    = new Paragraph(game.ActiveCharacter.RedSkills.Last().SkillName, Anchor.Auto, color: Color.DarkGray);
            SkillTab.panel.AddChild(BlueSkill);
            SkillTab.panel.AddChild(YellowSkill);
            SkillTab.panel.AddChild(OrangeSkill1);
            SkillTab.panel.AddChild(OrangeSkill2);
            SkillTab.panel.AddChild(RedSkill1);
            SkillTab.panel.AddChild(RedSkill2);
            SkillTab.panel.AddChild(RedSkill3);
            SkillTab.button.Padding = new Vector2(0, 0);
            SkillTab.button.Size    = new Vector2(100, 50);
            SkillTab.panel.Offset   = new Vector2(0, -50);
            SkillTab.button.ButtonParagraph.Scale = .9f;



            TabData tab1 = tabs.AddTab("Player");

            life                = new Paragraph("Life: " + (game.ActiveCharacter.DeathThreshold - game.ActiveCharacter.GetDamageTaken()).ToString());
            moves               = new Paragraph("Moves Left: " + (game.ActiveCharacter.movesLeft).ToString());
            level               = new Paragraph("Level: " + (game.ActiveCharacter.Level).ToString());
            experience          = new Paragraph("Experience: " + (game.ActiveCharacter.Experience).ToString());
            forfeitMove         = new Button("Forfeit Move", anchor: Anchor.BottomCenter);
            forfeitMove.OnClick = (Entity btn) =>
            {
                game.ActiveCharacter.movesLeft--;
            };
            tab1.button.Padding = new Vector2(0, 0);
            tab1.button.Size    = new Vector2(100, 50);
            tab1.button.Offset  = new Vector2(0, -50);
            tab1.panel.Offset   = new Vector2(0, -50);
            tab1.panel.AddChild(new Header(game.ActiveCharacter.CharacterName));
            tab1.panel.AddChild(new HorizontalLine());
            tab1.panel.AddChild(life);
            tab1.panel.AddChild(moves);
            tab1.panel.AddChild(level);
            tab1.panel.AddChild(experience);
            tab1.panel.AddChild(forfeitMove);
            tab1.button.ButtonParagraph.Scale = .9f;

            BackPackTab = tabs.AddTab("Backpack");
            BackPackTab.panel.AddChild(new Header("Items"));
            BackPackTab.button.Padding = new Vector2(0, 0);
            BackPackTab.button.Size    = new Vector2(100, 50);
            BackPackTab.button.ButtonParagraph.Scale = .9f;

            TabData tab3 = tabs.AddTab("Team");

            tab3.button.Padding = new Vector2(0, 0);
            tab3.button.Size    = new Vector2(100, 50);
            tab3.button.ButtonParagraph.Scale = .9f;

            UserInterface.Active.AddEntity(playerPanel);
            UserInterface.Active.AddEntity(movePanel);
            whosTurn = MoveState.PlayerTurn;
            applyMoveTiles(game);

            //Initialize Dice and Zombies
            Zombie.Initialize(game);
            Dice.Initialize(game);
        }
示例#26
0
 public CharacterSelectScreen(Zombicide game)
 {
     Item.Initialize(game);
     LoadCharSelection(game);
 }
示例#27
0
 public static void LoadTextures(Zombicide game)
 {
     RedX   = game.Content.Load <Texture2D>("redX");
     BlueX  = game.Content.Load <Texture2D>("blueX");
     GreenX = game.Content.Load <Texture2D>("greenX");
 }
示例#28
0
 public Item(Zombicide game, XmlNode I)
 {
     Texture = game.Content.Load <Texture2D>(@"Items\" + I.FirstChild.InnerText.Replace(' ', '_'));
     Size    = new Point(160, 250);
     drawn   = false;
 }
示例#29
0
        void MouseClicked(Zombicide game, int LR)
        {
            int x = game.MouseState.X;
            int y = game.MouseState.Y;

            Rectangle mouseClickRect = new Rectangle(x, y, 10, 10);

            if (LR == 1) //left Click
            {
                Rectangle resetMapRect = new Rectangle(resetMapX, resetMapY, 54, 54);
                if (mouseClickRect.Intersects(resetMapRect))
                {
                    mapWidth  = 800;
                    mapHeight = 800;
                    mapX      = (game.GraphicsDevice.Viewport.Width / 2) - (mapWidth / 2);
                    mapY      = (game.GraphicsDevice.Viewport.Height / 2) - (mapHeight / 2);
                }


                if (whosTurn == MoveState.PlayerTurn)
                {
                    Tile      T              = game.ActiveCharacter.PlayerTile;
                    Rectangle leftdoorRect   = new Rectangle(mapX + (T.column * tileWidth) - 25, mapY + (T.row * tileHeight) + (tileHeight / 2) - 25, 50, 50);
                    Rectangle topdoorRect    = new Rectangle(mapX + (T.column * tileWidth) + (tileWidth / 2) - 25, mapY + (T.row * tileHeight) - 25, 50, 50);
                    Rectangle rightdoorRect  = new Rectangle(mapX + ((T.column + 1) * tileWidth) - 25, mapY + (T.row * tileHeight) + (tileHeight / 2) - 25, 50, 50);
                    Rectangle bottomdoorRect = new Rectangle(mapX + (T.column * tileWidth) + (tileWidth / 2) - 25, mapY + ((T.row + 1) * tileHeight) - 25, 50, 50);

                    bool   doorClicked = false;
                    string doorSide    = "";
                    if (mouseClickRect.Intersects(leftdoorRect) && T.LeftSide == RoomSide.closeddoor)
                    {
                        doorClicked = true;
                        doorSide    = "left";
                    }
                    else if (mouseClickRect.Intersects(topdoorRect) && T.TopSide == RoomSide.closeddoor)
                    {
                        doorClicked = true;
                        doorSide    = "top";
                    }
                    else if (mouseClickRect.Intersects(rightdoorRect) && T.RighSide == RoomSide.closeddoor)
                    {
                        doorClicked = true;
                        doorSide    = "right";
                    }
                    else if (mouseClickRect.Intersects(bottomdoorRect) && T.BottomSide == RoomSide.closeddoor)
                    {
                        doorClicked = true;
                        doorSide    = "bottom";
                    }

                    if (doorClicked)
                    {
                        PopupFlag = true;
                        GeonBit.UI.Utils.MessageBox.ShowMsgBox("Locked Door", "Break Down Door?", new GeonBit.UI.Utils.MessageBox.MsgBoxOption[] {
                            new GeonBit.UI.Utils.MessageBox.MsgBoxOption("Yes", () => { BreakDoor(game, T, doorSide);
                                                                                        PopupFlag = false;
                                                                                        return(true); }),
                            new GeonBit.UI.Utils.MessageBox.MsgBoxOption("no", () => {
                                PopupFlag = false;
                                return(true);
                            })
                        });
                        return;
                    }

                    foreach (Objective O in Objective.ObjectiveList)
                    {
                        if (mouseClickRect.Intersects(O.Area) && O.flipped == false && game.ActiveCharacter.PlayerTile.row == O.Tile[0] && game.ActiveCharacter.PlayerTile.column == O.Tile[1])
                        {
                            O.FlipCard(game);
                            return;
                        }
                    }
                    foreach (Tile L in litTiles)
                    {
                        Rectangle tileRect = new Rectangle(mapX + L.column * tileWidth, mapY + L.row * tileHeight, tileWidth, tileHeight);
                        if (mouseClickRect.Intersects(tileRect))
                        {
                            game.ActiveCharacter.Move(new string[] { L.row.ToString(), L.column.ToString() });
                            applyMoveTiles(game);
                            if (game.ActiveCharacter.movesLeft == 0)
                            {
                                whosTurn = MoveState.ZombieTurn;
                            }
                            return;
                        }
                    }
                }
            }

            if (LR == 2) //Right Click
            {
                foreach (Tile T in tileData)
                {
                    Rectangle tileRect = new Rectangle(mapX + T.column * tileWidth, mapY + T.row * tileHeight, tileWidth, tileHeight);
                    if (mouseClickRect.Intersects(tileRect))
                    {
                        List <Zombie> tileZombies = new List <Zombie>();
                        tileZombies = Zombie.zombieList.FindAll(z => z.ZombieTile[0] == T.row && z.ZombieTile[1] == T.column);
                        if (tileZombies.Count > 0)
                        {
                            PopupFlag = true;
                            GeonBit.UI.Utils.MessageBox.ShowMsgBox("Zombie", "Attack Zombie In This Tile?", new GeonBit.UI.Utils.MessageBox.MsgBoxOption[] {
                                new GeonBit.UI.Utils.MessageBox.MsgBoxOption("Yes", () => {
                                    var hits = game.ActiveCharacter.Attack(game, tileZombies.First());
                                    for (int i = 0; i < hits; i++)
                                    {
                                        if (tileZombies.Count > 0)
                                        {
                                            Zombie.zombieList.RemoveAt(Zombie.zombieList.FindIndex(z => z.ZombieTile[0] == T.row && z.ZombieTile[1] == T.column));
                                            tileZombies.RemoveAt(0);
                                            game.ActiveCharacter.ApplyExperience(1);
                                        }
                                    }
                                    PopupFlag = false;
                                    return(true);
                                }),
                                new GeonBit.UI.Utils.MessageBox.MsgBoxOption("no", () => {
                                    PopupFlag = false;
                                    return(true);
                                })
                            });
                        }
                    }
                }
            }
        }
示例#30
0
 public virtual void Draw(Zombicide game)
 {
 }