コード例 #1
0
 private void btnNewGame_Click(object sender, EventArgs e)
 {
     MusicPlayer.playBG(MusicPlayer.Welcome);
     this.pbOak.Visible    = true;
     this.lblIntro.Visible = true;
     this.gbGender.Visible = true;
 }
コード例 #2
0
        public World()
        {
            InitializeComponent();

            if (new TextWindow(new[] { "" }).ShowQuestion("New Game", "Continue") == DialogResult.Yes)
            {
                MusicPlayer.playBG("resources\\music\\kanto\\1-05 Welcome to the World of Pokemon.mp3");
                new TextWindow(new[] {
                    "Hello, there! Glad  to meet you!",
                    "Welcome to the world of Pokemon!",
                    "My name is Oak.",
                    "People affectionately refer to me as the Pokemon Professor.",
                    "This world is inhabited far and wide by creatures called Pokemon!",
                    "For some people, Pokemon are pets. Others use them for battling.",
                    "As for myself...",
                    "I study Pokemon as a profession.",
                    "But first, tell me a little about yourself."
                }).ShowDialog();
                Gender gender = (new TextWindow(new[] { "Now tell me. Are you a boy?  Or are you a girl?" }).ShowQuestion("Boy", "Girl") == DialogResult.Yes) ? Gender.Male : Gender.Female;
                new TextWindow(new[] { "Let's begin with your name. What is it?" }).ShowDialog();
                string text = new NameEntry(null /*(gender == Gender.Male) ? Sprite.BoySprite.Down : Sprite.GirlSprite.Down*/).enterName();
                new TextWindow(new[] { "Right, so your name is " + text }).ShowDialog();
                new TextWindow(new[] {
                    "This is my grandson.",
                    "He's been your rival since you were both babies.",
                    "...Erm, what was his name now?"
                }).ShowDialog();
                string text2 = new NameEntry(null).enterName();
                new TextWindow(new string[]
                {
                    "That's right! I remember now! His name is " + text2,
                    text + "!",
                    "Your very own Pokemon legend is about to unfold!",
                    "A world of dreams and adventures with Pokemon awaits!"
                }).ShowDialog();
                Player.CreatePlayer(text, gender, text2);
            }
            else
            {
                if (this.LoadFile.ShowDialog() == DialogResult.OK)
                {
                    using (FileStream fileStream = new FileStream(this.LoadFile.FileName, FileMode.Open, FileAccess.Read, FileShare.None))
                    {
                        Player.CreatePlayer((Player) new BinaryFormatter().Deserialize(fileStream));
                    }
                    base.Close();
                }
            }
            this.timer2.Stop();
            PRNG.Seed(this.delay);
            this.timer1.Start();
            this.mnuPlayer.Text = Player.Instance.name;
            MusicPlayer.playBG(Player.Instance.currentMap.music);
            this.readMap();
        }
コード例 #3
0
ファイル: Splash.cs プロジェクト: filialpails/Syllogomania
 public Splash()
 {
     InitializeComponent();
     MusicPlayer.playBG("resources\\music\\kanto\\1-03 Opening.mp3");
 }
コード例 #4
0
        private void World_KeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;
            Array.Clear(this.OBJ, Player.Instance.location.Y * 10 + Player.Instance.location.X, 1);
            if (Player.Instance.location.Y == -1)
            {
                Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Up);
                Player.Instance.currentMap = connection.toMap;
                Player expr_A5_cp_0 = Player.Instance;
                expr_A5_cp_0.location.X    = expr_A5_cp_0.location.X + connection.shift;
                Player.Instance.location.Y = Player.Instance.currentMap.height - 1;
                MusicPlayer.playBG(Player.Instance.currentMap.music);
                this.readMap();
            }
            else
            {
                if (Player.Instance.location.Y == Player.Instance.currentMap.height)
                {
                    Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Down);
                    Player.Instance.currentMap = connection.toMap;
                    Player expr_176_cp_0 = Player.Instance;
                    expr_176_cp_0.location.X   = expr_176_cp_0.location.X + connection.shift;
                    Player.Instance.location.Y = 0;
                    MusicPlayer.playBG(Player.Instance.currentMap.music);
                    this.readMap();
                }
                else
                {
                    if (Player.Instance.location.X == Player.Instance.currentMap.width)
                    {
                        Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Right);
                        Player.Instance.currentMap = connection.toMap;
                        Player expr_237_cp_0 = Player.Instance;
                        expr_237_cp_0.location.Y   = expr_237_cp_0.location.Y + connection.shift;
                        Player.Instance.location.X = 0;
                        MusicPlayer.playBG(Player.Instance.currentMap.music);
                        this.readMap();
                    }
                    else
                    {
                        if (Player.Instance.location.X == -1)
                        {
                            Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Left);
                            Player.Instance.currentMap = connection.toMap;
                            Player expr_2EA_cp_0 = Player.Instance;
                            expr_2EA_cp_0.location.Y   = expr_2EA_cp_0.location.Y + connection.shift;
                            Player.Instance.location.X = Player.Instance.currentMap.width - 1;
                            MusicPlayer.playBG(Player.Instance.currentMap.music);
                            this.readMap();
                        }
                    }
                }
            }
            Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].Occupied = false;
            switch (e.KeyCode)
            {
            case Keys.Space:
            {
                Event[] events = Player.Instance.currentMap.events;
                for (int i = 0; i < events.Length; i++)
                {
                    Event @event = events[i];
                    if ((Player.Instance.dir == Direction.Up && Player.Instance.location.Y == @event.location.Y + 1 && Player.Instance.location.X == @event.location.X) || (Player.Instance.dir == Direction.Down && Player.Instance.location.Y == @event.location.Y - 1 && Player.Instance.location.X == @event.location.X) || (Player.Instance.dir == Direction.Right && Player.Instance.location.X == @event.location.X - 1 && Player.Instance.location.Y == @event.location.Y) || (Player.Instance.dir == Direction.Left && Player.Instance.location.X == @event.location.X + 1 && Player.Instance.location.Y == @event.location.Y))
                    {
                        @event.script();
                    }
                }
                break;
            }

            case Keys.Left:
            {
                Direction dir = Player.Instance.dir;
                if (dir != Direction.Left)
                {
                    Player.Instance.dir = Direction.Left;
                }
                else
                {
                    if (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].Occupied)
                    {
                        Player expr_73B_cp_0 = Player.Instance;
                        expr_73B_cp_0.location.X = expr_73B_cp_0.location.X - 1;
                    }
                }
                break;
            }

            case Keys.Up:
            {
                Direction dir = Player.Instance.dir;
                if (dir != Direction.Up)
                {
                    Player.Instance.dir = Direction.Up;
                }
                else
                {
                    if (Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].Occupied)
                    {
                        Player expr_474_cp_0 = Player.Instance;
                        expr_474_cp_0.location.Y = expr_474_cp_0.location.Y - 1;
                    }
                }
                break;
            }

            case Keys.Right:
            {
                Direction dir = Player.Instance.dir;
                if (dir != Direction.Right)
                {
                    Player.Instance.dir = Direction.Right;
                }
                else
                {
                    if (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].Occupied)
                    {
                        Player expr_64E_cp_0 = Player.Instance;
                        expr_64E_cp_0.location.X = expr_64E_cp_0.location.X + 1;
                    }
                }
                break;
            }

            case Keys.Down:
            {
                Direction dir = Player.Instance.dir;
                if (dir != Direction.Down)
                {
                    Player.Instance.dir = Direction.Down;
                }
                else
                {
                    if (Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].Occupied)
                    {
                        Player expr_561_cp_0 = Player.Instance;
                        expr_561_cp_0.location.Y = expr_561_cp_0.location.Y + 1;
                    }
                }
                break;
            }
            }
            Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].Occupied = true;
            this.pnlScreen.Invalidate();

            if (Player.Instance.party.Count > 0)
            {
                WildPokemon[] array = new WildPokemon[0];

                switch (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].attribute)
                {
                case TerrainType.TallGrass:
                    array = Player.Instance.currentMap.tallGrassWild;
                    break;

                case TerrainType.LongGrass:
                    array = Player.Instance.currentMap.longGrassWild;
                    break;

                case TerrainType.Water:
                    array = Player.Instance.currentMap.surfWild;
                    break;

                case TerrainType.Cave:
                    array = Player.Instance.currentMap.caveWild;
                    break;
                }

                WildPokemon[] array2 = array;

                for (int i = 0; i < array2.Length; i++)
                {
                    WildPokemon wildPokemon = array2[i];
                    if (PRNG.Instance.Next((int)(187.5 / (double)wildPokemon.rate)) == 1)
                    {
                        new Battle(new Pokemon(wildPokemon.mon, (int)PRNG.Instance.Next((int)wildPokemon.minLevel, (int)wildPokemon.maxLevel), null, null)).ShowDialog();
                        break;
                    }
                }
            }
        }