public Pause_Menu(Screen_Manager screen_manager, GameCamera _camera)
        {
            camera = _camera;

            rect = Assets.It.Get <Texture2D>("gui-rect");
            font = Assets.It.Get <SpriteFont>("gfont");

            actions = new Named_Action_List(new Dictionary <string, Action> {
                { "Resume", () => {
                      LostIslandRanal.Request_Resume();
                      showing = false;
                  } },
                { "Settings", () => {
                  } },
                { "Level Select", () =>
                  {
                      showing = false;
                      screen_manager.Goto_Screen("Level Select", false);
                  } },
                { "Exit", () => {
                      //LostIslandRanal.Request_Resume();
                      showing = false;
                      screen_manager.Goto_Screen("Menu", true);
                  } }
            });
        }
        public override void Load(params string [] args)
        {
            world.Destroy_All();
            lighting.AmbientColor = new Color(0.6f, 0.6f, 0.6f, 1.0f);
            if (args.Length > 0)
            {
                Load_Map(args[0]);
            }
            else
            {
                Load_Map("Demo");
                //Load_Map("Dungeon_Room_2");
                //Load_Map("Dungeon_Floor_1");
            }



            var ai_system = (AI_System)world.Get_System <AI_System>();

            ai_system.Give_Map(Map);

            var song = Song.FromUri("Bloom", new Uri("Content/Audio/Bloom.mp3", UriKind.Relative));

            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;

            camera.Zoom = LostIslandRanal.SCALE;
            LostIslandRanal.Request_Resume(); // Make sure the game is unpaused
        }
Пример #3
0
        //Debug press control + P to see boundaries and entities
        public override void Constant_Update(GameTime time, Entity entity)
        {
            base.Constant_Update(time, entity);
            var player = (Player)entity.Get(Types.Player);

            if (Input.It.Is_Key_Down(Keys.LeftControl) && Input.It.Is_Key_Pressed(Keys.P))
            {
                LostIslandRanal.Toggle_Pause();
            }

            // Toggle the gui and inventory screen
            //var inventory = (Inventory) entity.Get(Types.Inventory);
            //if ( Input.It.Is_Key_Pressed(Keys.Q) || Input.It.Is_Gamepad_Button_Pressed(Buttons.Y))
            //{
            //    show_overlay_gui = !show_overlay_gui;

            //    if (show_overlay_gui)
            //        player.State = Player.Action_State.IN_INVATORY;
            //    else
            //        player.State = Player.Action_State.IDLE;

            //    //LostIslandRanal.Toggle_Pause();
            //}

            //if (Game1.Game_State == Game1.State.PAUSED && inventory.Draw)
            //    invatory_container.Update(time);
        }
Пример #4
0
        public override void Update(GameTime gameTime)
        {
            if (Input.It.Is_Key_Pressed(Keys.Left))
            {
                cursor.X--;
            }
            if (Input.It.Is_Key_Pressed(Keys.Right))
            {
                cursor.X++;
            }

            if (cursor.X > text.Length)
            {
                cursor.X = text.Length;
            }
            if (cursor.X < 0)
            {
                cursor.X = 0;
            }

            if (Input.It.Is_Key_Pressed(Keys.Up))
            {
                if (history.Count > 0)
                {
                    text     = history.Last();
                    cursor.X = text.Length;
                    history.Remove(history.Last());
                }
            }

            if (Input.It.Is_Key_Pressed(Keys.OemTilde) && !Input.It.Is_Key_Down(Keys.LeftShift))
            {
                if (state == State.CLOSED)
                {
                    state = State.QUARTER;
                }
                else if (state == State.QUARTER)
                {
                    state = State.HALF;
                }
                else if (state == State.HALF)
                {
                    state = State.CLOSED;
                }

                if (state != State.CLOSED)
                {
                    Open = true;
                    LostIslandRanal.Request_Pause();
                }
                else
                {
                    //LostIslandRanal.Request_Resume();
                    Open = false;
                    LostIslandRanal.Request_Resume();
                }
            }
        }
        public void Update(GameTime time)
        {
            if (Input.It.Is_Key_Pressed(Keys.Escape) || Input.It.Is_Gamepad_Button_Pressed(Buttons.Start))
            {
                Reset();
                LostIslandRanal.Toggle_Pause();
                showing = LostIslandRanal.Game_State == LostIslandRanal.State.PAUSED;
            }

            if (Input.It.Is_Gamepad_Button_Pressed(Buttons.B) && showing)
            {
                Reset();
                LostIslandRanal.Request_Resume();
                showing = LostIslandRanal.Game_State == LostIslandRanal.State.PAUSED;
            }

            if (!showing)
            {
                return;
            }

            var down = Input.It.Is_Key_Pressed(Keys.Down) || Input.It.Is_Gamepad_Button_Pressed(Buttons.DPadDown) || Input.It.Is_Gamepad_Button_Pressed(Buttons.LeftThumbstickDown);
            var up   = Input.It.Is_Key_Pressed(Keys.Up) || Input.It.Is_Gamepad_Button_Pressed(Buttons.DPadUp) || Input.It.Is_Gamepad_Button_Pressed(Buttons.LeftThumbstickUp);

            if (down)
            {
                selector++;
            }
            if (up)
            {
                selector--;
            }

            if (selector >= actions.Names.Length)
            {
                selector = 0;
            }
            if (selector < 0)
            {
                selector = actions.Names.Length - 1;
            }

            if (Input.It.Is_Key_Pressed(Keys.Enter) || Input.It.Is_Gamepad_Button_Pressed(Buttons.A))
            {
                actions.Call(selector);
            }
        }