コード例 #1
0
        public BasicSpriteInfo(Vector2 offset, Texture2D sprite)
        {
            Position = new Vector2(0, 0);

            Offset = offset;
            if (sprite == null)
            {
                Sprite = RAM.LoadContent(@"DefultSprite");
            }
            else
            {
                Sprite = sprite;
            }
        }
コード例 #2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            int tempy = 0;
            int tempx = 0;

            for (int x = 0; x <= RAM.GetPlayerCount(); x++)
            {
                if ((x % 2) == 1)
                {
                    spriteBatch.Draw(background4, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                    spriteBatch.Draw(Avatar1, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                    spriteBatch.DrawString(RAM.GetFont(1), "LV", new Vector2(448 + (480 * tempx), 61 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "HP", new Vector2(256 + (480 * tempx), 89 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "MP", new Vector2(256 + (480 * tempx), 119 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "SP", new Vector2(256 + (480 * tempx), 145 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "Next LV", new Vector2(256 + (480 * tempx), 171 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), RAM.GetPlayer(x).name, new Vector2(272 + (480 * tempx), 74 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).Level.ToString(), new Vector2(500 + (480 * tempx), 58 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString(), new Vector2(448 + (480 * tempx), 100 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString(), new Vector2(448 + (480 * tempx), 126 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString(), new Vector2(448 + (480 * tempx), 152 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).EXP.ToString(), new Vector2(448 + (480 * tempx), 168 + (156 * tempy)), Color.White, 0, new Vector2(-100, 0), 1.0f, SpriteEffects.None, 0.5f);
                    tempy++;
                }
                else
                {
                    spriteBatch.Draw(background5, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                    spriteBatch.Draw(Avatar1, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                    spriteBatch.DrawString(RAM.GetFont(1), "LV", new Vector2(448 + (480 * tempx), 61 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "HP", new Vector2(256 + (480 * tempx), 89 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "MP", new Vector2(256 + (480 * tempx), 119 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "SP", new Vector2(256 + (480 * tempx), 145 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), "Next LV", new Vector2(256 + (480 * tempx), 171 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(1), RAM.GetPlayer(x).name, new Vector2(272 + (480 * tempx), 74 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).Level.ToString(), new Vector2(500 + (480 * tempx), 58 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString(), new Vector2(448 + (480 * tempx), 100 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString(), new Vector2(448 + (480 * tempx), 126 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString(), new Vector2(448 + (480 * tempx), 152 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                    spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).EXP.ToString(), new Vector2(448 + (480 * tempx), 168 + (156 * tempy)), Color.White, 0, new Vector2(-100, 0), 1.0f, SpriteEffects.None, 0.5f);
                    tempx++;
                    if (tempx == 2)
                    {
                        tempx = 0;
                    }
                }
            }
            spriteBatch.Draw(GetPointer().GetTexture(), GetPointer().GetPosition(), Color.White);
        }
コード例 #3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int x = 0; x <= 8; x++)
            {
                Vector2 FontOrigin = RAM.GetFont(0).MeasureString(GetText(x)) / 2;
                Vector2 FontPos    = new Vector2(100, 320 + (x * 30));
                spriteBatch.DrawString(RAM.GetFont(0), GetText(x), FontPos, Color.Yellow, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
                Vector2 FontOrigin2 = RAM.GetFont(0).MeasureString(GetStatText(x).ToString()) / 2;
                Vector2 FontPos2    = new Vector2(300, 320 + (x * 30));
                spriteBatch.DrawString(RAM.GetFont(0), GetStatText(x).ToString(), FontPos2, Color.Yellow, 0, FontOrigin2, 1.0f, SpriteEffects.None, 0.5f);
            }
            Vector2 FontOrigin3 = RAM.GetFont(0).MeasureString(RAM.GetPlayer(GetPlayerIndex()).name) / 2;
            Vector2 FontPos3    = new Vector2(300, 120);

            spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(GetPlayerIndex()).name, FontPos3, Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
        }
コード例 #4
0
ファイル: Objects.cs プロジェクト: ThomasDHZ/XNA-RPG-Engine
 public void Draw(SpriteBatch spriteBatch)
 {
     if (ItemGet == true)
     {
         if (time.GetTimeFlag() == true)
         {
             TimePassedFlag = true;
         }
         else
         {
             if (TimePassedFlag == false)
             {
                 spriteBatch.DrawString(RAM.GetFont(0), Item.name + " x " + Item.count, new Vector2(GetPosition().X, (GetPosition().Y) - (float)(time.GetTime() / 35)), Color.White, 0,
                                        RAM.GetFont(0).MeasureString(Item.name) / 2, 1.0f, SpriteEffects.None, 0.5f);
             }
         }
     }
 }
コード例 #5
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (RAM.TalkFlag == true)
            {
                spriteBatch.Draw(RAM.LoadContent(@"TextBox"), new Vector2(RAM.camera.GetTextBoxPosition().X - XFORMATING, RAM.camera.GetTextBoxPosition().Y + YFORMATING), Color.White);

                try
                {
                    for (int x = 0; x <= Letter; x++)
                    {
                        if (x <= StringList[LineCounter].Length - 1)
                        {
                            spriteBatch.DrawString(RAM.GetFont(0), StringList[LineCounter][x].ToString(), new Vector2((RAM.camera.GetTextBoxPosition().X - 590) + (x * KERN), (RAM.camera.GetTextBoxPosition().Y + 215) + (LineCounter * LINESPACE)), Color.White);
                        }
                        if (LineCounter + 1 <= StringList.Count - 1)
                        {
                            if (x <= StringList[LineCounter + 1].Length - 1)
                            {
                                spriteBatch.DrawString(RAM.GetFont(0), StringList[(LineCounter + 1)][x].ToString(), new Vector2((RAM.camera.GetTextBoxPosition().X - 590) + (x * KERN), (RAM.camera.GetTextBoxPosition().Y + 215) + ((LineCounter + 1) * LINESPACE)), Color.White);
                            }
                        }
                        if (LineCounter + 2 <= StringList.Count - 1)
                        {
                            if (x <= StringList[LineCounter + 2].Length - 1)
                            {
                                spriteBatch.DrawString(RAM.GetFont(0), StringList[(LineCounter + 2)][x].ToString(), new Vector2((RAM.camera.GetTextBoxPosition().X - 590) + (x * KERN), (RAM.camera.GetTextBoxPosition().Y + 215) + ((LineCounter + 2) * LINESPACE)), Color.White);
                            }
                        }
                        if (LineCounter + 3 <= StringList.Count - 1)
                        {
                            if (x <= StringList[LineCounter + 3].Length - 1)
                            {
                                spriteBatch.DrawString(RAM.GetFont(0), StringList[(LineCounter + 3)][x].ToString(), new Vector2((RAM.camera.GetTextBoxPosition().X - 590) + (x * KERN), (RAM.camera.GetTextBoxPosition().Y + 215) + ((LineCounter + 3) * LINESPACE)), Color.White);
                            }
                        }
                    }
                }
                catch (ArgumentOutOfRangeException)
                { }
            }
        }
コード例 #6
0
        public EquipmentMenu()
            : base()
        {
            Font1        = RAM.GetFont(0);
            stats        = new string[10];
            statsnum     = new int[10];
            stats[0]     = "LV";
            stats[1]     = "HP";
            stats[2]     = "MP";
            stats[3]     = "SP";
            stats[4]     = "ATK";
            stats[5]     = "DEF";
            stats[6]     = "INT";
            stats[7]     = "RES";
            stats[8]     = "SPD";
            stats[9]     = "EVD";
            Equipment    = new EquipmentItems[10];
            equipment    = new string[10];
            equipment[0] = "Weapon";
            equipment[1] = "Helmet";
            equipment[2] = "Armor";
            equipment[3] = "Bracers";
            equipment[4] = "Shield";
            equipment[5] = "Greaves";
            equipment[6] = "Accessory";
            equipment[7] = "Accessory";
            equipment[8] = "Accessory";
            equipment[9] = "Accessory";
            // EquipmentItemList.Add(new WeaponItem());
            //EquipmentItemList.Add(new HelmetItem());
            //EquipmentItemList.Add(new ArmorItem());
            //EquipmentItemList.Add(new BracersItem());
            //EquipmentItemList.Add(new ShieldItem());
            //EquipmentItemList.Add(new GreavesItem());

            //for(int x = 0; x <= RAM.PlayerList.Count - 1
            //RAM.PlayerList
        }
コード例 #7
0
        public void Draw(SpriteBatch spriteBatch)
        {
            foreach (BattleChar obj in ObjectList[0])
            {
                obj.Draw(spriteBatch);
            }

            for (int count = 0; count <= 5; count++)
            {
                spriteBatch.DrawString(RAM.GetFont(0), MenuItems[count], new Vector2(108, 500 + (25 * count)), Color.White, 0, RAM.GetFont(0).MeasureString(MenuItems[count]) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.Draw(pointer.GetTexture(), pointer.GetPosition(), Color.White);
            }
            //spriteBatch.Draw(MasterDatabase.GetTile(2).GetTexture(), new Vector2(0, 0), Color.White);
            int x = 0;

            foreach (Player player in RAM.PlayerList)
            {
                spriteBatch.DrawString(RAM.GetFont(0), player.name, new Vector2(StatsPos.X + (108 + (256 * x)), StatsPos.Y + 100), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), "LV:", new Vector2(StatsPos.X + (200 + (256 * x)), StatsPos.Y + 100), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("LV:") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.Level.ToString(), new Vector2(StatsPos.X + (230 + (256 * x)), StatsPos.Y + 100), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.Level.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);


                spriteBatch.DrawString(RAM.GetFont(0), "HP", new Vector2(StatsPos.X + (20 + (256 * x)), StatsPos.Y + 124), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("HP") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.HP.ToString(), new Vector2(StatsPos.X + (98 + (256 * x)), StatsPos.Y + 124), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.HP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), "/", new Vector2(StatsPos.X + (148 + (256 * x)), StatsPos.Y + 124), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("/") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.MaxHP.ToString(), new Vector2(StatsPos.X + (198 + (256 * x)), StatsPos.Y + 124), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.MaxHP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);


                spriteBatch.DrawString(RAM.GetFont(0), "MP", new Vector2(StatsPos.X + (20 + (256 * x)), StatsPos.Y + 148), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("MP") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.MP.ToString(), new Vector2(StatsPos.X + (98 + (256 * x)), StatsPos.Y + 148), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.MP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), "/", new Vector2(StatsPos.X + (148 + (256 * x)), StatsPos.Y + 148), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("/") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.MaxMP.ToString(), new Vector2(StatsPos.X + (198 + (256 * x)), StatsPos.Y + 148), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.MaxMP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);


                spriteBatch.DrawString(RAM.GetFont(0), "SP", new Vector2(StatsPos.X + (20 + (256 * x)), StatsPos.Y + 172), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("SP") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.SP.ToString(), new Vector2(StatsPos.X + (98 + (256 * x)), StatsPos.Y + 172), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.SP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), "/", new Vector2(StatsPos.X + (148 + (256 * x)), StatsPos.Y + 172), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("/") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.MaxSP.ToString(), new Vector2(StatsPos.X + (198 + (256 * x)), StatsPos.Y + 172), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.MaxSP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);

                spriteBatch.DrawString(RAM.GetFont(0), "Next", new Vector2(StatsPos.X + (34 + (256 * x)), StatsPos.Y + 196), Color.White, 0,
                                       RAM.GetFont(0).MeasureString("Next") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), player.EXP.ToString(), new Vector2(StatsPos.X + (198 + (256 * x)), StatsPos.Y + 196), Color.White, 0,
                                       RAM.GetFont(0).MeasureString(player.EXP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                x++;
            }

            /*for (int x = 0; x <= GetObjectCount() - 1; x++)
             * {
             *  GetObject(x).Draw(spriteBatch);
             * }*/
        }
コード例 #8
0
        public void Update(GameTime gameTime)
        {
            ((Player)ObjectList[0][0]).ControlledPlayer = true;
            foreach (BaseEnitiy obj in ObjectList[0])
            {
                if (obj is Player)
                {
                    if (((Player)obj).ControlledPlayer == true)
                    {
                        ControlledPlayer = (Player)obj;
                    }
                }
                obj.SetSprite(RAM.LoadContent(obj.CurrentAnimation.GetSpriteName(obj.CurrentAnimation.GetFrame())));
            }



            KeyboardState keyboardState = Keyboard.GetState();

            if (Menuflag == true)
            {
                pointer.Update(gameTime);
                if (keyboardState.IsKeyDown(Keys.Enter))
                {
                    if (pointer.GetChoice() == 0)//Move
                    {
                        Menuflag = false;
                    }
                    else if (pointer.GetChoice() == 1)//Attack
                    {
                        ((BattleChar)ObjectList[0][5]).Targeted = true;
                    }
                    else if (pointer.GetChoice() == 2)//Magic
                    {
                    }
                    else if (pointer.GetChoice() == 3)//Skill
                    {
                    }
                    else if (pointer.GetChoice() == 4)//Defend
                    {
                    }
                    else if (pointer.GetChoice() == 5)//Run
                    {
                        RAM.BattleFlag = false;
                    }
                }
            }
            else
            {
                // base.Update();
                MoveTime.Update(gameTime);
                foreach (BaseEnitiy obj in ObjectList[0])
                {
                    if (obj is Player)
                    {
                        ((Player)obj).Update(gameTime);
                    }
                    if (obj != ControlledPlayer)
                    {
                        if (obj.GetCir().Intersects(ControlledPlayer.GetPosition(), obj.GetPosition()) == false)
                        {
                            if (keyboardState.IsKeyDown(Keys.Up) &&
                                keyboardState.IsKeyDown(Keys.Left))
                            {
                                ControlledPlayer.SetPosition(new Vector2(ControlledPlayer.GetPosition().X + (RAM.TILESIZE / 8), ControlledPlayer.GetPosition().Y + (RAM.TILESIZE / 8)));
                            }
                            else if (keyboardState.IsKeyDown(Keys.Up) &&
                                     keyboardState.IsKeyDown(Keys.Right))
                            {
                                ControlledPlayer.SetPosition(new Vector2(ControlledPlayer.GetPosition().X - (RAM.TILESIZE / 8), ControlledPlayer.GetPosition().Y + (RAM.TILESIZE / 8)));
                            }
                            else if (keyboardState.IsKeyDown(Keys.Down) &&
                                     keyboardState.IsKeyDown(Keys.Left))
                            {
                                ControlledPlayer.SetPosition(new Vector2(ControlledPlayer.GetPosition().X + (RAM.TILESIZE / 8), ControlledPlayer.GetPosition().Y - (RAM.TILESIZE / 8)));
                            }
                            else if (keyboardState.IsKeyDown(Keys.Down) &&
                                     keyboardState.IsKeyDown(Keys.Right))
                            {
                                ControlledPlayer.SetPosition(new Vector2(ControlledPlayer.GetPosition().X - (RAM.TILESIZE / 8), ControlledPlayer.GetPosition().Y - (RAM.TILESIZE / 8)));
                            }
                            else if (keyboardState.IsKeyDown(Keys.Up))
                            {
                                ControlledPlayer.SetPositionY(ControlledPlayer.GetPosition().Y + RAM.TILESIZE / 8);
                            }
                            else if (keyboardState.IsKeyDown(Keys.Down))
                            {
                                ControlledPlayer.SetPositionY(ControlledPlayer.GetPosition().Y - RAM.TILESIZE / 8);
                            }
                            else if (keyboardState.IsKeyDown(Keys.Left))
                            {
                                ControlledPlayer.SetPositionX(ControlledPlayer.GetPosition().X + RAM.TILESIZE / 8);
                            }
                            else if (keyboardState.IsKeyDown(Keys.Right))
                            {
                                ControlledPlayer.SetPositionX(ControlledPlayer.GetPosition().X - RAM.TILESIZE / 8);
                            }
                        }
                    }
                }
            }

            /*
             * KeyboardState keyboardState = Keyboard.GetState();
             * float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
             * BattleChar Chased = null;
             * base.Update();
             *
             * //TempList = ObjectList;
             * for (int x = 0; x <= PlayerList.Count - 1; )
             * {
             *  PlayerList.Remove(PlayerList[x]);
             * }
             * for (int x = 0; x <= EnemyList.Count - 1; )
             * {
             *  EnemyList.Remove(EnemyList[x]);
             * }
             * foreach (BattleChar obj in ObjectList)
             * {
             *  obj.MoveFlag = true;
             *  if (obj is Player)
             *  {
             *      if(((Player)obj).ControlledPlayer == true)
             *      {
             *          ControlledPlayer = ((Player)obj);
             *      }
             *      PlayerList.Add(((Player)obj));
             *      ((Player)obj).Update(gameTime);
             *  }
             *  if (obj is Enemy)
             *  {
             *      EnemyList.Add(((Enemy)obj));
             *      ((Enemy)obj).Update(gameTime);
             *  }
             *  CircleCollision(time);
             * }
             * LeftX = lowest;
             * lowest = 0;
             * int test = 0;
             * /////////////////////////////////////////////////////////////////////////////////////
             * /////////////////////////////////////////////////////////////////////////////////////
             *
             * foreach (Enemy enemy in EnemyList)
             * {
             *  if (enemy.MoveFlag == true)
             *  {
             *      int LowestHP = PlayerList[0].HP;
             *      foreach (Player player in PlayerList)
             *      {
             *
             *          if (LowestHP <= player.HP)
             *          {
             *              Chased = player;
             *          }
             *      }
             *
             *      Chase(gameTime, enemy, Chased);
             *  }
             * }
             * ////////////////////////////////////////////////////////////////////////////////////////////////////////
             * foreach (Player player in PlayerList)
             * {
             *  float MoveSpeed = player.MoveSpeed;
             *  if (player.MoveFlag == true)
             *  {
             *          if (player is TestPlayer)
             *          {
             *
             *              if (keyboardState.IsKeyDown(Keys.Right))
             *              {
             *                  float dsd = player.GetPosition().X;
             *                  float dse = player.GetPosition().Y;
             *                  int sdf = 34;
             *              }
             *                                      if (keyboardState.IsKeyDown(Keys.Up)
             *                  && keyboardState.IsKeyDown(Keys.Left))
             *              {
             *
             *                  player.SetPosition(new Vector2(player.GetPosition().X - MoveSpeed, player.GetPosition().Y - MoveSpeed));
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X + MoveSpeed, camera.GetPosition().Y + MoveSpeed));
             *                  StatsPos.X -= MoveSpeed;
             *                  StatsPos.Y -= MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Up)
             *                  && keyboardState.IsKeyDown(Keys.Right))
             *              {
             *                  player.SetPosition(new Vector2(player.GetPosition().X + MoveSpeed, player.GetPosition().Y - MoveSpeed));
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X - MoveSpeed, camera.GetPosition().Y + MoveSpeed));
             *                  StatsPos.X += MoveSpeed;
             *                  StatsPos.Y -= MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Down)
             *              && keyboardState.IsKeyDown(Keys.Left))
             *              {
             *                  player.SetPosition(new Vector2(player.GetPosition().X - MoveSpeed, player.GetPosition().Y + MoveSpeed));
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X + MoveSpeed, camera.GetPosition().Y - MoveSpeed));
             *                  StatsPos.X -= MoveSpeed;
             *                  StatsPos.Y += MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Down)
             *              && keyboardState.IsKeyDown(Keys.Right))
             *              {
             *                  player.SetPosition(new Vector2(player.GetPosition().X + MoveSpeed, player.GetPosition().Y + MoveSpeed));
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X - MoveSpeed, camera.GetPosition().Y - MoveSpeed));
             *                  StatsPos.X += MoveSpeed;
             *                  StatsPos.Y += MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Up))
             *              {
             *                  player.SetPositionY(player.GetPosition().Y - MoveSpeed);
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X, camera.GetPosition().Y + MoveSpeed));
             *                  StatsPos.Y -= MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Down))
             *              {
             *                  player.SetPositionY( player.GetPosition().Y + MoveSpeed);
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X, camera.GetPosition().Y - MoveSpeed));
             *                  StatsPos.Y += MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Left))
             *              {
             *                  player.SetPositionX(player.GetPositionX() - MoveSpeed);
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X + MoveSpeed, camera.GetPosition().Y));
             *                  StatsPos.X -= MoveSpeed;
             *              }
             *              else if (keyboardState.IsKeyDown(Keys.Right))
             *              {
             *                  float dsd = player.GetPosition().X;
             *                  float dse = player.GetPosition().Y;
             *                  float erew = MoveSpeed;
             *                  player.SetPositionX(player.GetPositionX() + MoveSpeed);
             *                  camera.SetPosition(new Vector2(camera.GetPosition().X - MoveSpeed, camera.GetPosition().Y));
             *                  StatsPos.X += MoveSpeed;
             *                  float dsdg = player.GetPosition().X;
             *                  int ds = 34;
             *              }
             *          }
             *          else
             *          {
             *              Chased = EnemyList[0];
             *              Chase(gameTime, player,Chased);
             *          }
             *  }
             * }
             * foreach (BattleChar obj in ObjectList)
             * {
             *  if (obj.HP < 0)
             *  {
             *      ObjectList.Remove(obj);
             *      break;
             *  }
             * }*/
            foreach (BattleChar obj in ObjectList[0])
            {
                obj.SetSprite(RAM.LoadContent(obj.CurrentAnimation.GetSpriteName(obj.CurrentAnimation.GetFrame())));
            }
        }
コード例 #9
0
        public void Update(GameTime gametime)
        {
            KeyboardState keyboardState = Keyboard.GetState();

            if (Equipmentmenuflag == true)
            {
                if (keyboardState.IsKeyDown(Keys.Right))
                {
                    if (playerindex >= RAM.PlayerList.Count - 1)
                    {
                        playerindex = 0;
                    }
                    else
                    {
                        playerindex++;
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Left))
                {
                    if (playerindex <= 0)
                    {
                        playerindex = RAM.PlayerList.Count - 1;
                    }
                    else
                    {
                        playerindex--;
                    }
                }
                if (keyboardState.IsKeyDown(Keys.Down))
                {
                    if (pointerpoint >= equipment.Length - 1)
                    {
                        pointerpoint = 0;
                    }
                    else
                    {
                        pointerpoint++;
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Up))
                {
                    if (pointerpoint <= 0)
                    {
                        pointerpoint = equipment.Length - 1;
                    }
                    else
                    {
                        pointerpoint--;
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Enter))
                {
                    Equipmenttype     = pointerpoint;
                    Equipmentmenuflag = false;
                }
                statsnum[0]  = RAM.PlayerList[playerindex].Level;
                statsnum[1]  = RAM.PlayerList[playerindex].MaxHP;
                statsnum[2]  = RAM.PlayerList[playerindex].MaxMP;
                statsnum[3]  = RAM.PlayerList[playerindex].MaxSP;
                statsnum[4]  = RAM.PlayerList[playerindex].ATK;
                statsnum[5]  = RAM.PlayerList[playerindex].DEF;
                statsnum[6]  = RAM.PlayerList[playerindex].INT;
                statsnum[7]  = RAM.PlayerList[playerindex].RES;
                statsnum[8]  = RAM.PlayerList[playerindex].SPD;
                statsnum[9]  = RAM.PlayerList[playerindex].EVD;
                Equipment[0] = RAM.PlayerList[playerindex].Weaponitem;
                Equipment[1] = RAM.PlayerList[playerindex].Helmetitem;
                Equipment[2] = RAM.PlayerList[playerindex].Armoritem;
                Equipment[3] = RAM.PlayerList[playerindex].Bracersitem;
                Equipment[4] = RAM.PlayerList[playerindex].Shielditem;
                Equipment[5] = RAM.PlayerList[playerindex].Greavesitem;
                Equipment[6] = RAM.PlayerList[playerindex].Accessoryitem1;
                Equipment[7] = RAM.PlayerList[playerindex].Accessoryitem2;
                Equipment[8] = RAM.PlayerList[playerindex].Accessoryitem3;
                Equipment[9] = RAM.PlayerList[playerindex].Accessoryitem4;
                pointer.SetPosition(new Vector2(680, 320 + (pointerpoint * 30)));
            }
            else
            {
                if (keyboardState.IsKeyDown(Keys.Down))
                {
                    if (ListPoint >= EquipmentItemList.Count - 1)
                    {
                        ListPoint = 0;
                    }
                    else
                    {
                        ListPoint++;
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Up))
                {
                    if (ListPoint <= 0)
                    {
                        ListPoint = EquipmentItemList.Count - 1;
                    }
                    else
                    {
                        ListPoint--;
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Escape))
                {
                    Equipmentmenuflag = true;
                }
                else if (keyboardState.IsKeyDown(Keys.Enter))
                {
                    for (int x = 0; x <= RAM.GetItemListCount(); x++)
                    {
                        if (RAM.PlayerList[playerindex].Weaponitem == RAM.MasterItemList[x])
                        {
                            RAM.MasterItemList.Remove(RAM.MasterItemList[x]);
                        }
                    }
                    if (0 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Weaponitem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((WeaponItem)EquipmentItemList[ListPoint]));
                    }
                    else if (1 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Helmetitem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((HelmetItem)EquipmentItemList[ListPoint]));
                    }
                    else if (2 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Armoritem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((ArmorItem)EquipmentItemList[ListPoint]));
                    }
                    else if (3 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Bracersitem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((BracersItem)EquipmentItemList[ListPoint]));
                    }
                    else if (4 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Shielditem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((ShieldItem)EquipmentItemList[ListPoint]));
                    }
                    else if (5 == Equipmenttype)
                    {
                        RAM.MasterItemList.Add(RAM.PlayerList[playerindex].Greavesitem);
                        ((TestPlayer)RAM.GetPlayer(playerindex)).SetEquipment(((GreavesItem)EquipmentItemList[ListPoint]));
                    }
                    ListPoint         = 0;
                    Equipmentmenuflag = true;
                }
                // EquipmentItemList = RefeshList(EquipmentItemList);

                if (0 == Equipmenttype)
                {
                    //EquipmentItemList.Add(new WeaponItem());
                }
                else if (1 == Equipmenttype)
                {
                    //EquipmentItemList.Add(new HelmetItem());
                }
                else if (2 == Equipmenttype)
                {
                    //EquipmentItemList.Add(new ArmorItem());
                }
                else if (3 == Equipmenttype)
                {
                    //EquipmentItemList.Add(new BracersItem());
                }
                else if (4 == Equipmenttype)
                {
                    // EquipmentItemList.Add(new ShieldItem());
                }
                else if (5 == Equipmenttype)
                {
                    //EquipmentItemList.Add(new GreavesItem());
                }
                for (int x = 0; x <= RAM.GetItemListCount(); x++)
                {
                    if (2 == RAM.GetItem(x).type) // 2 == Equipment Items
                    {
                        //if (((EquipmentItems)RAM.GetItem(x)).EquipmentType == Equipmenttype)
                        // {
                        //   if (RAM.GetItem(x).count >= 1)
                        //   {
                        //       EquipmentItemList.Add(RAM.MasterItemList[x]);
                        //    }
                        // }
                    }
                }
                pointer.SetPosition(new Vector2(680, 320 + (ListPoint * 30)));
            }
        }
コード例 #10
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (Equipmentmenuflag == true)
            {
                for (int x = 0; x <= 8; x++)
                {
                    Vector2 FontOrigin = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos    = new Vector2(100, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, GetText(x), FontPos, Color.Yellow, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
                    Vector2 FontOrigin2 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos2    = new Vector2(300, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, GetStatText(x).ToString(), FontPos2, Color.Yellow, 0, FontOrigin2, 1.0f, SpriteEffects.None, 0.5f);
                    Vector2 FontOrigin3 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos3    = new Vector2(700, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, equipment[x], FontPos3, Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                    Vector2 FontOrigin4 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos4    = new Vector2(900, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, Equipment[x].name, FontPos4, Color.Yellow, 0, FontOrigin4, 1.0f, SpriteEffects.None, 0.5f);
                }
            }
            else
            {
                for (int x = 0; x <= 8; x++)
                {
                    Vector2 FontOrigin = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos    = new Vector2(100, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, GetText(x), FontPos, Color.Yellow, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
                    Vector2 FontOrigin2 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos2    = new Vector2(300, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, GetStatText(x).ToString(), FontPos2, Color.Yellow, 0, FontOrigin2, 1.0f, SpriteEffects.None, 0.5f);
                }
                spriteBatch.DrawString(Font1, RAM.GetPlayer(playerindex).Weaponitem.name, new Vector2(500, 350), Color.Yellow, 0, Font1.MeasureString(RAM.GetPlayer(playerindex).Weaponitem.name) / 2, 1.0f, SpriteEffects.None, 0.5f);

                /* int MaxHP = RAM.PlayerList[playerindex].MaxHP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxHP;
                 * int MaxMP = RAM.PlayerList[playerindex].MaxMP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxMP;
                 * int MaxSP = RAM.PlayerList[playerindex].MaxSP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxSP;
                 * int HP = RAM.PlayerList[playerindex].HP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxHP;
                 * int MP = RAM.PlayerList[playerindex].MP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxMP;
                 * int SP = RAM.PlayerList[playerindex].SP + ((EquipmentItems)EquipmentItemList[ListPoint]).MaxSP;
                 * int ATK = RAM.PlayerList[playerindex].ATK + ((EquipmentItems)EquipmentItemList[ListPoint]).ATK;
                 * int DEF = RAM.PlayerList[playerindex].DEF + ((EquipmentItems)EquipmentItemList[ListPoint]).DEF;
                 * int INT = RAM.PlayerList[playerindex].INT + ((EquipmentItems)EquipmentItemList[ListPoint]).INT;
                 * int RES = RAM.PlayerList[playerindex].RES + ((EquipmentItems)EquipmentItemList[ListPoint]).RES;
                 * int SPD = RAM.PlayerList[playerindex].SPD + ((EquipmentItems)EquipmentItemList[ListPoint]).SPD;
                 * int EVD = RAM.PlayerList[playerindex].EVD + ((EquipmentItems)EquipmentItemList[ListPoint]).EVD;*
                 *
                 * Color Green = Color.Green;
                 * Color Red = Color.Red;
                 * Vector2 FontOrigin3 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                 * spriteBatch.DrawString(Font1, MaxHP.ToString(), new Vector2(500, 350), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * spriteBatch.DrawString(Font1, MaxMP.ToString(), new Vector2(500, 380), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * spriteBatch.DrawString(Font1, MaxSP.ToString(), new Vector2(500, 410), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * // spriteBatch.DrawString(Font1, HP.ToString(), new Vector2(500, 410), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * //spriteBatch.DrawString(Font1, MP.ToString(), new Vector2(500, 440), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * //spriteBatch.DrawString(Font1, SP.ToString(), new Vector2(500, 470), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * if (ATK == (ATK = RAM.PlayerList[playerindex].Stats[(int)stats.kATK] + ((EquipmentItems)EquipmentItemList[ListPoint]).Stats[(int)stats.kATK]) + ((EquipmentItems)EquipmentItemList[ListPoint]).ATK)
                 * {
                 *    spriteBatch.DrawString(Font1, ATK.ToString(), new Vector2(500, 440), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * }
                 * else if (ATK < (ATK = RAM.PlayerList[playerindex].Stats[(int)stats.kATK] + ((EquipmentItems)EquipmentItemList[ListPoint]).Stats[(int)stats.kATK]) + ((EquipmentItems)EquipmentItemList[ListPoint]).ATK)
                 * {
                 *    spriteBatch.DrawString(Font1, ATK.ToString(), new Vector2(500, 440), Color.Green, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * }
                 * else if (ATK > (ATK = RAM.PlayerList[playerindex].Stats[(int)stats.kATK] + ((EquipmentItems)EquipmentItemList[ListPoint]).Stats[(int)stats.kATK]) + ((EquipmentItems)EquipmentItemList[ListPoint]).ATK)
                 * {
                 *    spriteBatch.DrawString(Font1, ATK.ToString(), new Vector2(500, 440), Color.DarkGreen, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                 * }*/


                /*spriteBatch.DrawString(Font1, DEF.ToString(), new Vector2(500, 470), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                *  spriteBatch.DrawString(Font1, INT.ToString(), new Vector2(500, 500), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                *  spriteBatch.DrawString(Font1, RES.ToString(), new Vector2(500, 530), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                *  spriteBatch.DrawString(Font1, SPD.ToString(), new Vector2(500, 560), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
                *  spriteBatch.DrawString(Font1, EVD.ToString(), new Vector2(500, 590), Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);*/
                for (int x = 0; x <= EquipmentItemList.Count - 1; x++)
                {
                    Vector2 FontOrigin4 = Font1.MeasureString("fdgsdfgSFDG") / 2;
                    Vector2 FontPos4    = new Vector2(900, 320 + (x * 30));
                    spriteBatch.DrawString(Font1, EquipmentItemList[x].name, FontPos4, Color.Yellow, 0, FontOrigin4, 1.0f, SpriteEffects.None, 0.5f);
                }
            }
            spriteBatch.Draw(pointer.GetTexture(), pointer.GetPosition(), Color.White);
            //  Vector2 FontOrigin3 = Font1.MeasureString(Players[GetPlayerIndex()].name) / 2;
            // Vector2 FontPos3 = new Vector2(300, 120);
            //  spriteBatch.DrawString(Font1, Players[GetPlayerIndex()].name, FontPos3, Color.Yellow, 0, FontOrigin3, 1.0f, SpriteEffects.None, 0.5f);
        }
コード例 #11
0
ファイル: Map.cs プロジェクト: ThomasDHZ/XNA-RPG-Engine
        public void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = Keyboard.GetState();

            RAM.VRAM.Update();
            for (int x = 0; x <= RAM.VRAM.LayerCount; x++)
            {
                try
                {
                    foreach (BaseEnitiy obj in RAM.VRAM.ObjectList[x])
                    {
                        if (obj is AvatarSprite)
                        {
                            MainChar = (AvatarSprite)obj;
                            ((AvatarSprite)obj).Update(gameTime);
                        }
                        else if (obj is NPC)
                        {
                            ((NPC)obj).Update(gameTime);
                        }
                        else if (obj is Chest)
                        {
                            ((Chest)obj).Update(gameTime);
                        }
                        else if (obj is Door)
                        {
                            ((Door)obj).Update(gameTime);
                        }
                        else if (obj is LayerChange)
                        {
                            ((LayerChange)obj).Update(gameTime);
                        }
                        else if (obj is Encounter_Area)
                        {
                            ((Encounter_Area)obj).Update(gameTime);
                        }
                        else if (obj is Boat)
                        {
                            ((Boat)obj).Update(gameTime);
                        }
                        obj.SetSprite(RAM.LoadContent(obj.CurrentAnimation.GetSpriteName(obj.CurrentAnimation.GetFrame())));
                    }
                }
                catch (InvalidOperationException)
                {
                    Update(gameTime);
                }
            }
            if (RAM.TalkFlag == true)
            {
                // RAM.Storytext.Update(gameTime);
            }

            if (TalkFlag == false)
            {
                foreach (BaseEnitiy obj in RAM.VRAM.ObjectList[RAM.VRAM.LayerLevel])
                {
                    if (obj != MainChar)
                    {
                        if (obj.GetCollision() == true)
                        {
                            if (obj.GetRec().GetCollisionRectangle().Intersects(MainChar.GetRec().GetCollisionRectangle()))
                            {
                                if (keyboardState.IsKeyDown(Keys.Up) &&
                                    keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X + (RAM.TILESIZE / 8), MainChar.GetPosition().Y + (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X + (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Up) &&
                                         keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X - (RAM.TILESIZE / 8), MainChar.GetPosition().Y + (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X - (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down) &&
                                         keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X + (RAM.TILESIZE / 8), MainChar.GetPosition().Y - (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X + (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down) &&
                                         keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X - (RAM.TILESIZE / 8), MainChar.GetPosition().Y - (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X - (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Up))
                                {
                                    MainChar.SetPositionY(MainChar.GetPosition().Y + RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X, RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down))
                                {
                                    MainChar.SetPositionY(MainChar.GetPosition().Y - RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X, RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPositionX(MainChar.GetPosition().X + RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.GetTextBoxPosition().X + (RAM.TILESIZE / 8), RAM.camera.TextBoxPos.Y);
                                }
                                else if (keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPositionX(MainChar.GetPosition().X - RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.GetTextBoxPosition().X - (RAM.TILESIZE / 8), RAM.camera.TextBoxPos.Y);
                                }
                            }
                            if (obj.GetCir().Intersects(MainChar.GetPosition(), obj.GetPosition()) == false)
                            {
                                if (keyboardState.IsKeyDown(Keys.Up) &&
                                    keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X + (RAM.TILESIZE / 8), MainChar.GetPosition().Y + (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X + (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Up) &&
                                         keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X - (RAM.TILESIZE / 8), MainChar.GetPosition().Y + (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X - (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down) &&
                                         keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X + (RAM.TILESIZE / 8), MainChar.GetPosition().Y - (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X + (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down) &&
                                         keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPosition(new Vector2(MainChar.GetPosition().X - (RAM.TILESIZE / 8), MainChar.GetPosition().Y - (RAM.TILESIZE / 8)));
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X - (RAM.TILESIZE / 8), RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Up))
                                {
                                    MainChar.SetPositionY(MainChar.GetPosition().Y + RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X, RAM.camera.GetTextBoxPosition().Y + (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Down))
                                {
                                    MainChar.SetPositionY(MainChar.GetPosition().Y - RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.TextBoxPos.X, RAM.camera.GetTextBoxPosition().Y - (RAM.TILESIZE / 8));
                                }
                                else if (keyboardState.IsKeyDown(Keys.Left))
                                {
                                    MainChar.SetPositionX(MainChar.GetPosition().X + RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.GetTextBoxPosition().X + (RAM.TILESIZE / 8), RAM.camera.TextBoxPos.Y);
                                }
                                else if (keyboardState.IsKeyDown(Keys.Right))
                                {
                                    MainChar.SetPositionX(MainChar.GetPosition().X - RAM.TILESIZE / 8);
                                    RAM.camera.TextBoxPos = new Vector2(RAM.camera.GetTextBoxPosition().X - (RAM.TILESIZE / 8), RAM.camera.TextBoxPos.Y);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #12
0
ファイル: Game1.cs プロジェクト: ThomasDHZ/XNA-RPG-Engine
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            RAM.camera = new Camera();

            RAM.Add_Font(Content.Load <SpriteFont>("SpriteFont1"));
            RAM.Add_Font(Content.Load <SpriteFont>("SpriteFont2"));
            RAM.Add_Font(Content.Load <SpriteFont>("SpriteFont3"));
            RAM.Add_Font(Content.Load <SpriteFont>("SpriteFont4"));
            RAM.Add_Font(Content.Load <SpriteFont>("SpriteFont5"));



            RAM.Add_Player(new TestPlayer(0, new Vector2(486, 543), new Vector2(-20, -130)));
            RAM.Add_Player(new TestPlayer2(1, new Vector2(1054, 445), Vector2.Zero));
            RAM.Add_Player(new TestPlayer3(2, new Vector2(164, 634), Vector2.Zero));
            RAM.Add_Player(new TestPlayer4(3, new Vector2(534, 543), Vector2.Zero));
            RAM.Add_Player(new TestPlayer5(4, new Vector2(16 * 60, 8 * 60), Vector2.Zero));

            //RAM.Add_Item(new ItemPotion());

            RAM.Add_Item(new EquipmentItems("Rusty Armor", "It's old", 1));
            RAM.Add_Item(new EquipmentItems("Paring Knife", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Semispathae", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Cutlass", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Main Gauche", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Claymore", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Gurkha", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Night Saber", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Heavy Sword", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Dragon Blade", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Plant Saber", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Sigh", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Bloody Dagger", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Ninja Sword", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Rock Buster", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Berserk Stinger", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Passing Showers", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Exorcist", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Quaking Blade", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Ancient Hero", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Blood Shark", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Crystal Blade", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Hero Blade", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Super Flashlight", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Dragon Slayer", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Ridill", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Regal Darkness", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Edmon Ninja", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Ogre Knife", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Titan's Treasure", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Heavenly Wings", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Hades Blade", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Hrunting", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Durandal", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("RFragarach", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Dainsleif", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Eckesachs", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Claiomh Solais", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Aroundight", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Yoshisuna", "It's a key... to a door", 1));
            RAM.Add_Item(new EquipmentItems("Baal Sword", "It's a key... to a door", 1));

            RAM.Add_Item(new BattleItems("Poison Pill", "It's a key... to a door", 1));
            RAM.Add_Item(new BattleItems("Freeze Pill", "It's a key... to a door", 1));

            RAM.Add_Item(new Synthesizing("Iron", "It's a key... to a door", 1));
            RAM.Add_Item(new Synthesizing("Steel", "It's a key... to a door", 1));
            RAM.Add_Item(new Synthesizing("Bronze", "It's a key... to a door", 1));
            RAM.Add_Item(new Synthesizing("Sliver", "It's a key... to a door", 1));
            RAM.Add_Item(new Synthesizing("Gold", "It's a key... to a door", 1));

            RAM.Add_Item(new StoryItems("Blood", "It's old", 1));
            RAM.Add_Item(new StoryItems("Key", "It's old", 1));



            map = new Map();


            // TODO: use this.Content to load your game content here
        }
コード例 #13
0
        public void Update(GameTime gameTime)
        {
            KeyboardState keyboardState = Keyboard.GetState();

            maxshowingline = ItemList.Count;
            time          += (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            //////////////////////////////////////////////////////////////

            if ((maxshowingline % ITEMSPERROW) >= 1)
            {
                maxshowingline /= ITEMSPERROW;
                maxshowingline++;
            }
            else
            {
                maxshowingline /= ITEMSPERROW;
            }
            ItemTypeSelected = ItemTypeNum;
            if (ItemType == true)
            {
                showingline  = 0;
                point.X      = 0;
                point.Y      = 0;
                MasterPointY = 0;
                itemnum      = 0;
            }
            px = (int)point.X;
            py = MasterPointY * 3;
            //////////////////////////////////////////////////////////////
            if (menu is PlayerSelectionMenu)
            {
                if (((PlayerSelectionMenu)menu).GetSelectedItem().count == 0)
                {
                    menu = null;
                }
            }
            if (menu == null)
            {
                if (keyboardState.IsKeyDown(Keys.Enter))
                {
                    if (time >= 150)
                    {
                        time = 0;
                        if (ItemType == true)
                        {
                            ItemType = false;
                        }
                        else
                        {
                            if (px >= 0 && py >= 0)
                            {
                                if (ItemList.Count > px + py)
                                {
                                    switch (ItemList[px + py].type)
                                    {
                                    case 1:
                                    {
                                        menu     = new PlayerSelectionMenu(ItemList[px + py]);
                                        MenuFlag = true;
                                        break;
                                    }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Escape))
                {
                    ItemType = true;
                }
                else if (keyboardState.IsKeyDown(Keys.Right))
                {
                    if (ItemType == false)
                    {
                        if (point.X <= 1)
                        {
                            point.X++;
                            itemnum += 1;
                        }
                        else
                        {
                            if (point.Y == LINE_COUNT_OF_CAMERA_VEIW && (showingline / 3) + LINE_COUNT_OF_CAMERA_VEIW <= maxshowingline)
                            {
                                point.X      = 0;
                                showingline += ITEMSPERROW;
                                itemnum     += 1;
                                MasterPointY++;
                            }
                            else if (point.Y != LINE_COUNT_OF_CAMERA_VEIW)
                            {
                                point.Y++;
                                MasterPointY++;
                                point.X  = 0;
                                itemnum += 1;
                            }
                        }
                    }
                    else
                    {
                        if (ItemTypeNum == 5)
                        {
                            ItemTypeNum = 0;
                        }
                        else
                        {
                            ItemTypeNum++;
                        }
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Left))
                {
                    if (ItemType == false)
                    {
                        if (point.X >= 1)
                        {
                            point.X--;
                            itemnum -= 1;
                        }
                        else
                        {
                            if (point.Y == 0)
                            {
                                point.X = 2;
                                MasterPointY--;
                                showingline -= ITEMSPERROW;
                                itemnum     -= 1;

                                if (MasterPointY <= 0 && point.Y == 0)
                                {
                                    point.X        = 0;
                                    point.Y        = 0;
                                    MasterPointY   = 0;
                                    showingline    = 0;
                                    maxshowingline = 0;
                                }
                            }
                            else
                            {
                                point.Y--;
                                MasterPointY--;
                                point.X  = 2;
                                itemnum -= 1;
                            }
                        }
                    }
                    else
                    {
                        if (ItemTypeNum <= 0)
                        {
                            ItemTypeNum = 5;
                        }
                        else
                        {
                            ItemTypeNum--;
                        }
                    }
                }

                else if (keyboardState.IsKeyDown(Keys.Down))
                {
                    if (ItemType == false)
                    {
                        if (point.Y >= LINE_COUNT_OF_CAMERA_VEIW)
                        {
                            if (point.Y != LINE_COUNT_OF_CAMERA_VEIW)
                            {
                                point.Y      = 0;
                                MasterPointY = 0;
                            }
                            else
                            {
                                if ((showingline / 3) + LINE_COUNT_OF_CAMERA_VEIW <= maxshowingline)
                                {
                                    showingline += ITEMSPERROW;
                                    itemnum     += ITEMSPERROW;
                                    MasterPointY++;
                                }
                            }
                        }
                        else
                        {
                            point.Y++;
                            MasterPointY++;
                            itemnum += ITEMSPERROW;
                        }
                    }
                }
                else if (keyboardState.IsKeyDown(Keys.Up))
                {
                    if (point.Y <= 0)
                    {
                        if (showingline <= 0)
                        {
                        }
                        else
                        {
                            showingline -= ITEMSPERROW;
                            itemnum     -= ITEMSPERROW;
                            MasterPointY--;
                        }
                    }
                    else
                    {
                        point.Y--;
                        MasterPointY--;
                        itemnum -= ITEMSPERROW;
                    }
                }
                //////////////////////////////////////////////////////////////

                for (int x = 0; x <= RAM.GetItemListCount(); x++)
                {
                    if (RAM.MasterItemList[x].count == 0)
                    {
                        for (int z = 0; z <= ItemList.Count - 1; z++)
                        {
                            if (ItemList[z].name == RAM.MasterItemList[z].name)
                            {
                                RAM.MasterItemList.Remove(RAM.MasterItemList[x]);
                                ItemList.Remove(ItemList[z]);
                            }
                        }
                    }
                    for (int y = 0; y <= ItemList.Count - 1; y++)
                    {
                        if (ItemList[y].name == RAM.MasterItemList[x].name)
                        {
                            RAM.MasterItemList[x] = ItemList[y];
                            ItemList.Remove(ItemList[y]);
                        }
                    }
                }
                if (ItemTypeSelected == 0)
                {
                    for (int x = 0; x <= RAM.GetItemListCount(); x++)
                    {
                        if (RAM.GetItem(x).count >= 1)
                        {
                            ItemList.Add(RAM.GetItem(x));
                        }
                    }
                }
                else
                {
                    for (int x = 0; x <= RAM.GetItemListCount(); x++)
                    {
                        if (ItemTypeSelected == RAM.GetItem(x).type)
                        {
                            if (RAM.GetItem(x).count >= 1)
                            {
                                ItemList.Add(RAM.GetItem(x));
                            }
                        }
                    }
                }
                /////////////////////////////////////////////////////////////
            }
            else
            {
                if (keyboardState.IsKeyDown(Keys.Escape))
                {
                    if (time >= 150)
                    {
                        time     = 0;
                        menu     = null;
                        MenuFlag = false;
                    }
                }
            }
            ////////////////////////////////////////////////////////////////
            if (ItemType == false)
            {
                pointer.SetPosition(new Vector2(218 + (point.X * 285), 84 + (point.Y * 30)));
            }
            else
            {
                pointer.SetPosition(new Vector2((ItemTypeNum * 214), 60));
            }
            /////////////////////////////////////////////////////////////////
            if (menu is PlayerSelectionMenu)
            {
                ((PlayerSelectionMenu)menu).Update(gameTime);
            }
        }
コード例 #14
0
        public void Draw(SpriteBatch spriteBatch)
        {
            int y          = 0;
            int x          = 0;
            int count      = 0;
            int ItemPassed = showingline;

            spriteBatch.Draw(background6, new Vector2(0, 636), Color.White);
            spriteBatch.Draw(background2, new Vector2(0, 0), Color.White);
            spriteBatch.Draw(background7, new Vector2(0, 48), Color.White);
            spriteBatch.Draw(background8, new Vector2(214, 48), Color.White);
            spriteBatch.Draw(background7, new Vector2(428, 48), Color.White);
            spriteBatch.Draw(background8, new Vector2(642, 48), Color.White);
            spriteBatch.Draw(background7, new Vector2(856, 48), Color.White);
            spriteBatch.Draw(background8, new Vector2(1070, 48), Color.White);
            spriteBatch.Draw(background9, new Vector2(214, 72), Color.White);
            spriteBatch.Draw(background10, new Vector2(0, 72), Color.White);
            spriteBatch.Draw(background10, new Vector2(1066, 72), Color.White);
            spriteBatch.DrawString(RAM.GetFont(4), "All", new Vector2(107, 60), Color.White, 0, RAM.GetFont(0).MeasureString("All") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.DrawString(RAM.GetFont(4), "Usable Items", new Vector2(321, 60), Color.White, 0, RAM.GetFont(0).MeasureString("Usable Items") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.DrawString(RAM.GetFont(4), "Equipment", new Vector2(535, 60), Color.White, 0, RAM.GetFont(0).MeasureString("Equipment") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.DrawString(RAM.GetFont(4), "Battle Items", new Vector2(749, 60), Color.White, 0, RAM.GetFont(0).MeasureString("Battle Items") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.DrawString(RAM.GetFont(4), "Synthesizing", new Vector2(963, 60), Color.White, 0, RAM.GetFont(0).MeasureString("Synthesizing") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.DrawString(RAM.GetFont(4), "Story Items", new Vector2(1177, 60), Color.White, 0, RAM.GetFont(0).MeasureString("Story Items") / 2, 1.0f, SpriteEffects.None, 0.5f);
            spriteBatch.Draw(pointer.GetTexture(), pointer.GetPosition(), Color.White);

            //////////////////////////////////////////////////////////////////////////////////

            for (int a = 0; a <= ItemList.Count - 1; a++)
            {
                if (count != MAX_ITEMS_SHOWN)
                {
                    if (a + ItemPassed < ItemList.Count)
                    {
                        spriteBatch.DrawString(RAM.GetFont(3), ItemList[a + ItemPassed].name, new Vector2(248 + (285 * x), 81 + (ITEM_Y_MULTIPLIER * y)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        if (ItemTypeSelected != 5)
                        {
                            spriteBatch.DrawString(RAM.GetFont(3), ItemList[a + ItemPassed].count.ToString(), new Vector2(418 + (305 * x), 81 + (ITEM_Y_MULTIPLIER * y)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        }
                    }
                    if (ItemList.Count >= itemnum)
                    {
                        if (ItemType == false)
                        {
                            if (px + py >= 0 && px + py <= ItemList.Count - 1)
                            {
                                spriteBatch.DrawString(RAM.GetFont(1), ItemList[px + py].desc, new Vector2(0, 672), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                                spriteBatch.DrawString(RAM.GetFont(2), ItemList[px + py].name, new Vector2(640, 24), Color.White, 0, RAM.GetFont(2).MeasureString(ItemList[px + py].name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                            }
                        }
                    }
                    x++;
                    count++;
                    if (x == 3)
                    {
                        x = 0;
                        y++;
                    }
                }
            }
            ////////////////////////////////////////////////////////////////////////////////////////////////////
            if (menu is PlayerSelectionMenu)
            {
                ((PlayerSelectionMenu)menu).Draw(spriteBatch);
            }
            ////////////////////////////////////////////////////////////////////////////////////////
        }
コード例 #15
0
ファイル: MainMenu.cs プロジェクト: ThomasDHZ/XNA-RPG-Engine
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (MainMenuFlag == true)
            {
                int tempy = 0;
                int tempx = 0;
                spriteBatch.Draw(background, new Vector2(0, 48), Color.White);
                spriteBatch.Draw(background, new Vector2(1120, 48), Color.White);
                spriteBatch.Draw(background2, new Vector2(0, 672), Color.White);
                spriteBatch.Draw(background2, new Vector2(0, 0), Color.White);
                spriteBatch.Draw(background3, new Vector2(160, 48), Color.White);

                for (int x = 0; x <= RAM.GetPlayerCount(); x++)
                {
                    if ((x % 2) == 1)
                    {
                        spriteBatch.Draw(background4, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                        spriteBatch.Draw(Avatar1, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                        spriteBatch.DrawString(RAM.GetFont(1), "LV", new Vector2(448 + (480 * tempx), 61 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "HP", new Vector2(256 + (480 * tempx), 89 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "MP", new Vector2(256 + (480 * tempx), 119 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "SP", new Vector2(256 + (480 * tempx), 145 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "Next LV", new Vector2(256 + (480 * tempx), 171 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), RAM.GetPlayer(x).name, new Vector2(272 + (480 * tempx), 74 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).Level.ToString(), new Vector2(500 + (480 * tempx), 58 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString(), new Vector2(448 + (480 * tempx), 100 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString(), new Vector2(448 + (480 * tempx), 126 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString(), new Vector2(448 + (480 * tempx), 152 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).EXP.ToString(), new Vector2(448 + (480 * tempx), 168 + (156 * tempy)), Color.White, 0, new Vector2(-100, 0), 1.0f, SpriteEffects.None, 0.5f);
                        tempy++;
                    }
                    else
                    {
                        spriteBatch.Draw(background5, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                        spriteBatch.Draw(Avatar1, new Vector2(160 + (480 * tempx), 48 + (156 * tempy)), Color.White);
                        spriteBatch.DrawString(RAM.GetFont(1), "LV", new Vector2(448 + (480 * tempx), 61 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "HP", new Vector2(256 + (480 * tempx), 89 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "MP", new Vector2(256 + (480 * tempx), 119 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "SP", new Vector2(256 + (480 * tempx), 145 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), "Next LV", new Vector2(256 + (480 * tempx), 171 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(1), RAM.GetPlayer(x).name, new Vector2(272 + (480 * tempx), 74 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).name) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).Level.ToString(), new Vector2(500 + (480 * tempx), 58 + (156 * tempy)), Color.White, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString(), new Vector2(448 + (480 * tempx), 100 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).HP.ToString() + "/" + RAM.GetPlayer(x).MaxHP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString(), new Vector2(448 + (480 * tempx), 126 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).MP.ToString() + "/" + RAM.GetPlayer(x).MaxMP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString(), new Vector2(448 + (480 * tempx), 152 + (156 * tempy)), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.GetPlayer(x).SP.ToString() + "/" + RAM.GetPlayer(x).MaxSP.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
                        spriteBatch.DrawString(RAM.GetFont(0), RAM.GetPlayer(x).EXP.ToString(), new Vector2(448 + (480 * tempx), 168 + (156 * tempy)), Color.White, 0, new Vector2(-100, 0), 1.0f, SpriteEffects.None, 0.5f);
                        tempx++;
                        if (tempx == 2)
                        {
                            tempx = 0;
                        }
                    }
                }
                for (int x = 0; x <= MENUNUMBER - 1; x++)
                {
                    Vector2 FontOrigin = RAM.GetFont(0).MeasureString(MenuItems[x]) / 2;
                    Vector2 FontPos    = new Vector2(80, 100 + (x * 30));
                    spriteBatch.DrawString(RAM.GetFont(0), MenuItems[x], FontPos, Color.White, 0, FontOrigin, 1.0f, SpriteEffects.None, 0.5f);
                    pointer.Draw(spriteBatch);
                }
                int    hours   = gameTime.TotalGameTime.Hours;
                int    minutes = gameTime.TotalGameTime.Minutes;
                int    sec     = gameTime.TotalGameTime.Seconds;
                string time;
                if (hours >= 10)
                {
                    if (minutes >= 10)
                    {
                        if (sec >= 10)
                        {
                            time = hours.ToString() + ":" + minutes.ToString() + ":" + sec.ToString();
                        }
                        else
                        {
                            time = hours.ToString() + ":" + minutes.ToString() + ":0" + sec.ToString();
                        }
                    }
                    else
                    {
                        if (sec >= 10)
                        {
                            time = hours.ToString() + ":" + minutes.ToString() + ":" + sec.ToString();
                        }
                        else
                        {
                            time = hours.ToString() + ":0" + minutes.ToString() + ":0" + sec.ToString();
                        }
                    }
                }
                else
                {
                    if (minutes >= 10)
                    {
                        if (sec >= 10)
                        {
                            time = "0" + hours.ToString() + ":" + minutes.ToString() + ":" + sec.ToString();
                        }
                        else
                        {
                            time = "0" + hours.ToString() + ":0" + minutes.ToString() + ":0" + sec.ToString();
                        }
                    }
                    else
                    {
                        if (sec >= 10)
                        {
                            time = "0" + hours.ToString() + ":0" + minutes.ToString() + ":" + sec.ToString();
                        }
                        else
                        {
                            time = "0" + hours.ToString() + ":0" + minutes.ToString() + ":0" + sec.ToString();
                        }
                    }
                }


                spriteBatch.DrawString(RAM.GetFont(1), "Time", new Vector2(1200, 480), Color.White, 0, RAM.GetFont(0).MeasureString("Time") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), time, new Vector2(1200, 520), Color.White, 0, RAM.GetFont(0).MeasureString(time) / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(1), "Money", new Vector2(1200, 540), Color.White, 0, RAM.GetFont(0).MeasureString("Money") / 2, 1.0f, SpriteEffects.None, 0.5f);
                spriteBatch.DrawString(RAM.GetFont(0), RAM.Money.ToString(), new Vector2(1200, 560), Color.White, 0, RAM.GetFont(0).MeasureString(RAM.Money.ToString()) / 2, 1.0f, SpriteEffects.None, 0.5f);
            }

            if (menu is ItemMenu)
            {
                ((ItemMenu)menu).Draw(spriteBatch);
            }
            else if (menu is SkillsMenu)
            {
                ((SkillsMenu)menu).Draw(spriteBatch);
            }
            else if (menu is EquipmentMenu)
            {
                ((EquipmentMenu)menu).Draw(spriteBatch);
            }
            else if (menu is TacticsMenu)
            {
                ((TacticsMenu)menu).Draw(spriteBatch);
            }
            else if (menu is StatusMenu)
            {
                ((StatusMenu)menu).Draw(spriteBatch);
            }
            else if (menu is SettingsMenu)
            {
                ((SettingsMenu)menu).Draw(spriteBatch);
            }
            else if (menu is FileMenu)
            {
                ((FileMenu)menu).Draw(spriteBatch);
            }
        }