Esempio n. 1
0
        private void ChangeLevel()
        {
            string commingLevel = Level.Player.ComingLevel;

            if (commingLevel == "null")
            {
                return;
            }

            if (commingLevel == "TotalLevel.xml")
            {
                Xml.StartLevel = "TotalLevel.xml";
            }

            bindingPoint = null;

            level = new Level(this);
            level.Load(commingLevel);

            level.Player.IsLeaving = false;
        }
Esempio n. 2
0
        public void MenuUpdate()
        {
            // select options
            KeyboardState keystate = Keyboard.GetState();

            if (keystate.IsKeyDown(Keys.Down))
            {
                if (!wasDownKeydown)
                {
                    currentSelection++;
                    if (Level.LevelFileName.IndexOf("-") < 0 && currentSelection == 2)
                    {
                        currentSelection++;
                    }
                    if (currentSelection > maxItemsCount)
                    {
                        currentSelection = 1;
                    }
                }
                wasDownKeydown = true;
            }
            else
            {
                wasDownKeydown = false;
            }

            if (keystate.IsKeyDown(Keys.Up))
            {
                if (!wasUpKeydown)
                {
                    currentSelection--;
                    if (Level.LevelFileName.IndexOf("-") < 0 && currentSelection == 2)
                    {
                        currentSelection--;
                    }
                    if (currentSelection < 1)
                    {
                        currentSelection = maxItemsCount;
                    }
                }
                wasUpKeydown = true;
            }
            else
            {
                wasUpKeydown = false;
            }

            // execute the selectioon
            if (currentSelection == 1 && keystate.IsKeyDown(Keys.Enter))
            {
                gotoMenu = false;
            }
            else if (currentSelection == 2 && keystate.IsKeyDown(Keys.Enter))
            {
                if (Level.LevelFileName.IndexOf("-") > 0)
                {
                    bindingPoint = null;
                    gotoMenu     = false;
                    String general_level = Level.LevelFileName.Substring(0, 6);
                    general_level += ".xml";
                    level          = new Level(this);
                    level.Load(general_level);
                }
            }
            else if (currentSelection == 3 && keystate.IsKeyDown(Keys.Enter))
            {
                bindingPoint = null;
                Level.TreasureMgr.ResetLevel();
                gotoMenu = false;
                LoadContent();
            }
            else if (currentSelection == 4 && keystate.IsKeyDown(Keys.Enter))
            {
                if (musicOn)
                {
                    MediaPlayer.Pause();
                    musicOn = false;
                }
                else
                {
                    MediaPlayer.IsRepeating = true;
                    MediaPlayer.Play(soundEffect);
                    musicOn = true;
                }
                gotoMenu = false;
            }
            else if (currentSelection == 5 && keystate.IsKeyDown(Keys.Enter))
            {
                this.Exit();
            }
        }
Esempio n. 3
0
        private void ChangeLevel()
        {
            string commingLevel = Level.Player.ComingLevel;

            if (commingLevel == "null")
            {
                return;
            }

            if (commingLevel == "TotalLevel.xml")
            {
                Xml.StartLevel = "TotalLevel.xml";
            }

            bindingPoint = null;

            level = new Level(this);
            level.Load(commingLevel);

            level.Player.IsLeaving = false;
        }
Esempio n. 4
0
        public void MenuUpdate()
        {
            // select options
            KeyboardState keystate = Keyboard.GetState();
            if (keystate.IsKeyDown(Keys.Down))
            {
                if (!wasDownKeydown)
                {
                    currentSelection++;
                    if (Level.LevelFileName.IndexOf("-") < 0 && currentSelection == 2)
                    {
                        currentSelection++;
                    }
                    if (currentSelection > maxItemsCount)
                    {
                        currentSelection = 1;
                    }
                }
                wasDownKeydown = true;
            }
            else
            {
                wasDownKeydown = false;
            }

            if (keystate.IsKeyDown(Keys.Up))
            {
                if (!wasUpKeydown)
                {
                    currentSelection--;
                    if (Level.LevelFileName.IndexOf("-") < 0 && currentSelection == 2)
                    {
                        currentSelection--;
                    }
                    if (currentSelection < 1)
                    {
                        currentSelection = maxItemsCount;
                    }
                }
                wasUpKeydown = true;
            }
            else
            {
                wasUpKeydown = false;
            }

            // execute the selectioon
            if (currentSelection == 1 && keystate.IsKeyDown(Keys.Enter))
            {
                gotoMenu = false;
            }
            else if (currentSelection == 2 && keystate.IsKeyDown(Keys.Enter))
            {
                if (Level.LevelFileName.IndexOf("-") > 0)
                {
                    bindingPoint = null;
                    gotoMenu = false;
                    String general_level = Level.LevelFileName.Substring(0, 6);
                    general_level += ".xml";
                    level = new Level(this);
                    level.Load(general_level);
                }
            }
            else if (currentSelection == 3 && keystate.IsKeyDown(Keys.Enter))
            {
                bindingPoint = null;
                Level.TreasureMgr.ResetLevel();
                gotoMenu = false;
                LoadContent();
            }
            else if (currentSelection == 4 && keystate.IsKeyDown(Keys.Enter))
            {
                if (musicOn)
                {
                    MediaPlayer.Pause();
                    musicOn = false;
                }
                else
                {
                    MediaPlayer.IsRepeating = true;
                    MediaPlayer.Play(soundEffect);
                    musicOn = true;
                }
                gotoMenu = false;
            }
            else if (currentSelection == 5 && keystate.IsKeyDown(Keys.Enter))
            {
                this.Exit();
            }
        }