示例#1
0
        public override void Update()
        {
            // Note: You may instinctually call base.Update();
            // DON'T! The original method is orig_Update
            if (Focused && !disableInput && display && (Input.Pause.Pressed || Input.ESC.Pressed))
            {
                Overworld.Maddy.Hide(true);
                Audio.Play(Sfxs.ui_main_button_select);
                Audio.Play(Sfxs.ui_main_whoosh_large_in);
                OuiMapList list = Overworld.Goto <OuiMapList>();
                list.OuiIcons = icons;
                return;
            }

            if (Focused && display && !disableInput && inputDelay <= 0f)
            {
                if (Input.MenuUp.Pressed)
                {
                    Audio.Play(Sfxs.ui_world_chapter_pane_contract);
                    Audio.Play(Sfxs.ui_world_icon_roll_left);
                    Overworld.Goto <OuiHelper_ChapterSelect_LevelSet>().Direction = -1;
                    return;
                }
                if (Input.MenuDown.Pressed)
                {
                    Audio.Play(Sfxs.ui_world_chapter_pane_expand);
                    Audio.Play(Sfxs.ui_world_icon_roll_right);
                    Overworld.Goto <OuiHelper_ChapterSelect_LevelSet>().Direction = +1;
                    return;
                }
                // We don't want to copy the entire Update method, but still prevent the option from going out of bounds.
                if (Input.MenuLeft.Pressed &&
                    (area > 0) &&
                    icons[area - 1].IsHidden()
                    )
                {
                    return;
                }
                if (Input.MenuRight.Pressed &&
                    (area < SaveData.Instance.UnlockedAreas || (SaveData.Instance.AssistMode && area == SaveData.Instance.UnlockedAreas && area < SaveData.Instance.MaxArea)) &&
                    icons[area + 1].IsHidden()
                    )
                {
                    return;
                }
            }

            orig_Update();

            maplistEase  = Calc.Approach(maplistEase, (display && !disableInput && Focused) ? 1f : 0f, Engine.DeltaTime * 4f);
            levelsetEase = Calc.Approach(levelsetEase, (display && !disableInput && Focused) ? 1f : 0f, Engine.DeltaTime * 4f);
        }
示例#2
0
        public override void Update()
        {
            // Note: You may instinctually call base.Update();
            // DON'T! The original method is orig_Update

            if (Everest.Flags.IsDisabled)
            {
                orig_Update();
                return;
            }

            KeyboardState keysPrev = _keys;
            KeyboardState keys     = Keyboard.GetState();

            _keys = keys;

            if (Focused && !disableInput && display && (Input.Pause.Pressed || Input.ESC.Pressed))
            {
                Overworld.Maddy.Hide(true);
                Audio.Play(SFX.ui_main_button_select);
                Audio.Play(SFX.ui_main_whoosh_large_in);
                OuiMapList list = Overworld.Goto <OuiMapList>();
                list.OuiIcons = icons;
                return;
            }

            // note: Engine.DeltaTime is removed from inputDelay before being compared to zero in the orig method.
            if (Focused && display && !disableInput && inputDelay <= Engine.DeltaTime)
            {
                if (Input.MenuUp.Pressed)
                {
                    Audio.Play(SFX.ui_world_chapter_pane_contract);
                    Audio.Play(SFX.ui_world_icon_roll_left);
                    Overworld.Goto <OuiHelper_ChapterSelect_LevelSet>().Direction = -1;
                    return;
                }
                if (Input.MenuDown.Pressed)
                {
                    Audio.Play(SFX.ui_world_chapter_pane_expand);
                    Audio.Play(SFX.ui_world_icon_roll_right);
                    Overworld.Goto <OuiHelper_ChapterSelect_LevelSet>().Direction = +1;
                    return;
                }

                if (keys[Keys.F5] == KeyState.Down && keysPrev[Keys.F5] == KeyState.Up)
                {
                    Audio.Play(SFX.ui_postgame_unlock_newchapter);
                    Audio.Play(SFX.ui_world_whoosh_1000ms_forward);
                    Overworld.Goto <OuiHelper_ChapterSelect_Reload>();
                    return;
                }

                // We don't want to copy the entire Update method, but still prevent the option from going out of bounds.
                GetMinMaxArea(out int areaOffs, out int areaMax);
                if (area < areaOffs)
                {
                    area = areaOffs;
                }
                else
                {
                    if (area > areaMax)
                    {
                        area = areaMax;
                    }
                    while (area > 0 && icons[area].GetIsHidden())
                    {
                        area--;
                    }
                }

                if (Input.MenuLeft.Pressed && (area - 1 < 0 || icons[area - 1].GetIsHidden()))
                {
                    return;
                }

                if (Input.MenuRight.Pressed && (area + 1 >= icons.Count || icons[area + 1].GetIsHidden()))
                {
                    return;
                }
            }

            orig_Update();

            maplistEase  = Calc.Approach(maplistEase, (display && !disableInput && Focused) ? 1f : 0f, Engine.DeltaTime * 4f);
            levelsetEase = Calc.Approach(levelsetEase, (display && !disableInput && Focused) ? 1f : 0f, Engine.DeltaTime * 4f);
        }