コード例 #1
0
 public PokemonSlot()
 {
     this.Position = new Vector2(0, 0);
     this.Size = new Vector2(32, 32);
     Pokemon = null;
     Animation = null;
 }
コード例 #2
0
        public void Initialize()
        {
            /* Pokemon Slots */
            PokemonSlots = new PokemonSlot[SlotXCount, SlotYCount];
            for (int x = 0; x < SlotXCount; x++) {
                for (int y = 0; y < SlotYCount; y++) {
                    PokemonSlots[x, y] = new PokemonSlot();
                    PokemonSlots[x, y].Size = SlotSize;
                    PokemonSlots[x, y].Position = new Vector2(((SlotSize.X + SlotSeperation.X) * x) + SlotOffset.X,
                                                              ((SlotSize.Y + SlotSeperation.Y) * y) + SlotOffset.Y);
                }
            }

            //Portraits
            int xslot = 0;
            int yslot = 0;
            foreach (var kvp in PokemonManager.Pokemons) {
                string Name = kvp.Key;
                Pokemon pokemon = kvp.Value;
                Animation2D anim = new Animation2D(pokemon.Animation);
                anim.state.SetAnimation("idle", true);
                PokemonSlots[xslot, yslot].Pokemon = pokemon;
                PokemonSlots[xslot, yslot].Animation = anim;

                if (++xslot >= SlotXCount) {
                    xslot = 0;
                    yslot++;
                }
            }

            CursorPosition p1c = new CursorPosition(0, 0, SlotXCount - 1, SlotYCount - 1);
            CursorPosition p2c = new CursorPosition(4, 0, SlotXCount - 1, SlotYCount - 1);
            if (preselect) {
                for (int x = 0; x < SlotXCount; x++) {
                    for (int y = 0; y < SlotYCount; y++) {
                        if (PokemonSlots[x, y].Pokemon == null) {
                            continue;
                        }

                        if (PokemonSlots[x, y].Pokemon.Name == player1pre) {
                            p1c.X = x;
                            p1c.Y = y;
                        }

                        if (PokemonSlots[x, y].Pokemon.Name == player2pre) {
                            p2c.X = x;
                            p2c.Y = y;
                        }
                    }
                }
            }

            cursors = new PlayerCursor[2];
            cursors[0] = new PlayerCursor(0, p1c, Controls.Player1, @"Data\Pokeball.png", @"Data\RedSlot.png", new Vector2(0, 1));
            cursors[1] = new PlayerCursor(1, p2c, Controls.Player2, @"Data\Greatball.png", @"Data\BlueSlot.png", new Vector2(1, 1));

            Camera = new Camera2D();
            Camera.OnRender += new GraphicsManager.Renderer(Draw);

            MoveLists[0] = new MoveList();
            MoveLists[1] = new MoveList();
        }
コード例 #3
0
        public void Initialize()
        {
            /* Pokemon Slots */
            PokemonSlots = new PokemonSlot[SlotXCount, SlotYCount];
            for (int x = 0; x < SlotXCount; x++)
            {
                for (int y = 0; y < SlotYCount; y++)
                {
                    PokemonSlots[x, y]          = new PokemonSlot();
                    PokemonSlots[x, y].Size     = SlotSize;
                    PokemonSlots[x, y].Position = new Vector2(((SlotSize.X + SlotSeperation.X) * x) + SlotOffset.X,
                                                              ((SlotSize.Y + SlotSeperation.Y) * y) + SlotOffset.Y);
                }
            }

            //Portraits
            int xslot = 0;
            int yslot = 0;

            foreach (var kvp in PokemonManager.Pokemons)
            {
                string      Name    = kvp.Key;
                Pokemon     pokemon = kvp.Value;
                Animation2D anim    = new Animation2D(pokemon.Animation);
                anim.state.SetAnimation("idle", true);
                PokemonSlots[xslot, yslot].Pokemon   = pokemon;
                PokemonSlots[xslot, yslot].Animation = anim;

                if (++xslot >= SlotXCount)
                {
                    xslot = 0;
                    yslot++;
                }
            }

            CursorPosition p1c = new CursorPosition(0, 0, SlotXCount - 1, SlotYCount - 1);
            CursorPosition p2c = new CursorPosition(4, 0, SlotXCount - 1, SlotYCount - 1);

            if (preselect)
            {
                for (int x = 0; x < SlotXCount; x++)
                {
                    for (int y = 0; y < SlotYCount; y++)
                    {
                        if (PokemonSlots[x, y].Pokemon == null)
                        {
                            continue;
                        }

                        if (PokemonSlots[x, y].Pokemon.Name == player1pre)
                        {
                            p1c.X = x;
                            p1c.Y = y;
                        }

                        if (PokemonSlots[x, y].Pokemon.Name == player2pre)
                        {
                            p2c.X = x;
                            p2c.Y = y;
                        }
                    }
                }
            }


            cursors    = new PlayerCursor[2];
            cursors[0] = new PlayerCursor(0, p1c, Controls.Player1, @"Data\Pokeball.png", @"Data\RedSlot.png", new Vector2(0, 1));
            cursors[1] = new PlayerCursor(1, p2c, Controls.Player2, @"Data\Greatball.png", @"Data\BlueSlot.png", new Vector2(1, 1));

            Camera           = new Camera2D();
            Camera.OnRender += new GraphicsManager.Renderer(Draw);

            MoveLists[0] = new MoveList();
            MoveLists[1] = new MoveList();
        }