Exemplo n.º 1
0
        protected override void UpdateMenu(bool active)
        {
            int index = StyleNodes.ActiveNodeIndex;

            StyleNodes.Update(active, -MenuLoc);
            if (index != StyleNodes.ActiveNodeIndex)
            {
                StylePanels[index].active    = false;
                StyleNodes.ActiveNode.active = true;
            }

            CancelButton.Update(active);

            if (active)
            {
                var styleIndex = StyleNodes.consume_triggered(
                    Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                if (styleIndex.IsSomething)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    StyleNodes.set_active_node(StyleNodes[styleIndex]);
                    OnSelected(new EventArgs());
                }
                else if (Global.Input.triggered(Inputs.B) ||
                         Global.Input.KeyPressed(Keys.Escape) ||
                         CancelButton.consume_trigger(MouseButtons.Left) ||
                         CancelButton.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    OnCanceled(new EventArgs());
                }
            }
        }
        protected override void UpdateStandardMenu(bool active)
        {
            // Needed to animate map sprites
            if (this.HidesParent)
            {
                Global.game_system.update_timers();
            }

            Window.update(active);

            Background.update();
            FaceWindow.update();
            Face.update();
            NameBanner.update();
            Name.update();

            // Switch field/base support mode
            if (FieldBaseButton != null)
            {
                FieldBaseButton.Update(active);
            }

            bool switchField = active && Window.FieldBaseDifference &&
                               Global.Input.triggered(Inputs.X);

            if (FieldBaseButton != null)
            {
                switchField |= FieldBaseButton.consume_trigger(MouseButtons.Left) ||
                               FieldBaseButton.consume_trigger(TouchGestures.Tap);
            }
            if (switchField)
            {
                OnFieldBaseSwitched(new EventArgs());
            }
        }
Exemplo n.º 3
0
        private void update_ui(bool input)
        {
            Start.Update(input);
            B_Button.Update(input);
            R_Button.Update(input);

            if (input)
            {
                SelectedIndex = Maybe <PrepCheckMapResults> .Nothing;

                if (Global.Input.triggered(Inputs.Start) ||
                    Start.consume_trigger(MouseButtons.Left) ||
                    Start.consume_trigger(TouchGestures.Tap))
                {
                    SelectedIndex = PrepCheckMapResults.StartChapter;
                    OnSelected(new EventArgs());
                }
                else if (B_Button.consume_trigger(MouseButtons.Left) ||
                         B_Button.consume_trigger(TouchGestures.Tap))
                {
                    SelectedIndex = PrepCheckMapResults.Cancel;
                    OnSelected(new EventArgs());
                }
                else if (R_Button.consume_trigger(MouseButtons.Left) ||
                         R_Button.consume_trigger(TouchGestures.Tap))
                {
                    SelectedIndex = PrepCheckMapResults.Info;
                    OnSelected(new EventArgs());
                }
            }
        }
Exemplo n.º 4
0
        protected virtual bool CanceledTriggered(bool active)
        {
            bool cancel = active && Global.Input.triggered(Inputs.B);

            if (CancelButton != null)
            {
                cancel |= CancelButton.consume_trigger(MouseButtons.Left) ||
                          CancelButton.consume_trigger(TouchGestures.Tap);
            }
            return(cancel);
        }
Exemplo n.º 5
0
        protected virtual bool CanceledTriggered(bool active)
        {
            bool cancel = Window.is_canceled();

            if (CancelButton != null)
            {
                cancel |= CancelButton.consume_trigger(MouseButtons.Left) ||
                          CancelButton.consume_trigger(TouchGestures.Tap);
            }
            return(cancel);
        }
Exemplo n.º 6
0
        protected override void update_input(bool active)
        {
            bool input = active && this.ready;

            CancelButton.Update(input);
            Select.Update(input);

            if (input)
            {
                // Close this window
                if (Global.Input.triggered(Inputs.B) ||
                    CancelButton.consume_trigger(MouseButtons.Left) ||
                    CancelButton.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    if (this.unit_selected)
                    {
                        cancel_unit_selected();
                    }
                    else
                    {
                        close();
                    }
                    return;
                }
                else if (Global.Input.triggered(Inputs.Select) ||
                         Select.consume_trigger(MouseButtons.Left) ||
                         Select.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    OnUnit(new EventArgs());
                    return;
                }

                // Select unit
                var selected_index = Unit_Window.consume_triggered(
                    Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                if (selected_index.IsSomething)
                {
                    select_unit(selected_index); //Debug
                    return;
                }

                // Status screen
                var status_index = Unit_Window.consume_triggered(
                    Inputs.R, MouseButtons.Right, TouchGestures.LongPress);
                if (status_index.IsSomething)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    OnStatus(new EventArgs());
                }
            }
        }
Exemplo n.º 7
0
        protected bool CanceledTriggered(bool active)
        {
            bool cancel = Window.is_canceled();

            if (active)
            {
                if (CancelButton != null)
                {
                    cancel |= CancelButton.consume_trigger(MouseButtons.Left) ||
                              CancelButton.consume_trigger(TouchGestures.Tap);
                }
                // If right clicked
                cancel |= Global.Input.mouse_click(MouseButtons.Right);
            }
            return(cancel);
        }
Exemplo n.º 8
0
        protected override void update_main_selection()
        {
            bool on_buy = On_Buy;

            On_Buy = Choices.ActiveNodeIndex == 0;
            if (On_Buy != on_buy)
            {
                if (On_Buy)
                {
                    refresh_buy(true);
                }
                else
                {
                    refresh_sell(true);
                }
            }

            var selected = Choices.consume_triggered(
                Inputs.A, MouseButtons.Left, TouchGestures.Tap);

            if (selected.IsSomething)
            {
                Global.game_system.play_se(System_Sounds.Confirm);
                Message_Active = true;
                if (On_Buy)
                {
                    if (can_buy)
                    {
                        set_text(Shop_Messages.Buy);
                        this.trading = true;
                    }
                    else
                    {
                        set_text(Shop_Messages.Buy_Nothing);
                    }
                }
                else
                {
                    if (can_sell)
                    {
                        set_text(Shop_Messages.Sell);
                        this.trading = true;
                    }
                    else
                    {
                        set_text(Shop_Messages.Sell_Nothing);
                    }
                }
                clear_choices();
            }
            else if (Global.Input.triggered(Inputs.B) ||
                     CancelButton.consume_trigger(MouseButtons.Left) ||
                     CancelButton.consume_trigger(TouchGestures.Tap))
            {
                Global.game_system.play_se(System_Sounds.Cancel);
                Message_Active = true;
                set_text(Traded ? Shop_Messages.Leave : Shop_Messages.Cancel);
                Message.finished = true;
                clear_choices();
            }
        }
Exemplo n.º 9
0
        protected void update_message_skip_buttons()
        {
            _EventSkip = false;

            bool no_convo           = Message_Window == null || !Message_Window.active;
            bool skip_button_active = this.skip_convo_button_active;

            // Create buttons if needed
            if (SkipButton == null)
            {
                if (skip_button_active)
                {
                    create_convo_skip_buttons();
                    SkipButtonOffset    = new Vector2(0, 16);
                    SkipButtonsOnScreen = false;
                }
            }

            if (SkipButton != null)
            {
                // Bring buttons onscreen if needed
                if (!SkipButtonsOnScreen)
                {
                    SkipButtonOffset.Y = MathHelper.Min(16, SkipButtonOffset.Y + 2);
                    if (skip_button_active &&
                        Global.Input.gesture_triggered(TouchGestures.SwipeUp))
                    {
                        SkipButtonsOnScreen      = true;
                        TimeSinceSkipInteraction = 0;
                    }
                }
                // Move buttons offscreen if needed
                else if (SkipButtonsOnScreen)
                {
                    if (TimeSinceSkipInteraction < SKIP_INTERACTION_TIMEOUT)
                    {
                        TimeSinceSkipInteraction++;
                    }

                    SkipButtonOffset.Y = MathHelper.Max(0, SkipButtonOffset.Y - 2);
                    if (!skip_button_active ||
                        TimeSinceSkipInteraction >= SKIP_INTERACTION_TIMEOUT ||
                        (skip_button_active &&
                         Global.Input.gesture_triggered(TouchGestures.SwipeDown)))
                    {
                        SkipButtonsOnScreen = false;
                    }
                }

                skip_button_active &= SkipButtonsOnScreen && SkipButtonOffset.Y == 0;

                TextSkips skip = TextSkips.None;

                if (Input.ControlSchemeSwitched ||
                    (has_convo_scene_button && SceneButton == null))
                {
                    create_convo_skip_buttons();
                }
                if (SceneButton != null && !has_convo_scene_button)
                {
                    SceneButton = null;
                }

                // Update scene button and consume inputs
                if (SceneButton != null)
                {
                    SceneButton.Update(skip_button_active && !no_convo,
                                       -SkipButtonOffset);
                    if (no_convo)
                    {
                        SceneButton.tint = new Color(128, 128, 128, 255);
                    }
                    if (SceneButton.consume_trigger(MouseButtons.Left) ||
                        SceneButton.consume_trigger(TouchGestures.Tap))
                    {
                        skip = TextSkips.NextScene;
                        TimeSinceSkipInteraction = SKIP_INTERACTION_TIMEOUT - 60;
                    }
                }

                // Update skip button and consume inputs
                SkipButton.Update(skip_button_active, -SkipButtonOffset);
                if (SkipButton.consume_trigger(MouseButtons.Left) ||
                    SkipButton.consume_trigger(TouchGestures.Tap))
                {
                    skip = TextSkips.SkipEvent;
                    TimeSinceSkipInteraction = 0;
                }

                if (!no_convo)
                {
                    Message_Window.ConvoSkip = skip;
                }
                else if (skip == TextSkips.SkipEvent)
                {
                    _EventSkip = true;
                }
            }
        }
Exemplo n.º 10
0
        private void UpdateInput(bool active)
        {
            bool cancel =
                CancelButton.consume_trigger(MouseButtons.Left) ||
                CancelButton.consume_trigger(TouchGestures.Tap);

            bool changeDifficulty =
                active && Global.Input.triggered(Inputs.X);

            changeDifficulty |=
                DifficultyButton.consume_trigger(MouseButtons.Left) ||
                DifficultyButton.consume_trigger(TouchGestures.Tap);

            // Selecting chapter
            if (this.SelectingChapter)
            {
                cancel |= CommandWindow.is_canceled();
                bool left = false, right = false;
                if (active && MenuData.MultipleArcs && ModeSwitchTimer <= 0)
                {
                    if (Global.Input.triggered(Inputs.Left) ||
                        Global.Input.gesture_triggered(TouchGestures.SwipeRight))
                    {
                        left = true;
                    }
                    else if (Global.Input.triggered(Inputs.Right) ||
                             Global.Input.gesture_triggered(TouchGestures.SwipeLeft))
                    {
                        right = true;
                    }
                }

                if (cancel)
                {
                    OnCanceled(new EventArgs());
                }
                else if (changeDifficulty)
                {
                    SwitchDifficulty(true);
                }
                else if (left || right)
                {
                    Global.game_system.play_se(System_Sounds.Status_Page_Change);
                    MenuData.ChangeArc(right);
                    MenuData.Index = MenuData.IndexRedirect[0];
                    CreateCommandWindow();
                    Refresh();
                    ModeSwitchTimer = Constants.WorldMap.WORLDMAP_MODE_SWITCH_DELAY;
                }
                else if (CommandWindow.is_selected())
                {
                    OnChapterSelected(new EventArgs());
                }
            }
            // Chapter selected
            else
            {
                cancel |= ChapterCommandWindow.is_canceled();

                if (cancel)
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    CloseChapterCommands();
                }
                else if (changeDifficulty)
                {
                    SwitchDifficulty(true);
                }
                else if (ChapterCommandWindow.is_selected())
                {
                    OnChapterCommandSelected(new EventArgs());
                }
            }
        }
Exemplo n.º 11
0
        protected override void update_input(bool active)
        {
            bool input = active && this.ready_for_inputs;

            update_node_location(input);
            if (CancelButton != null)
            {
                CancelButton.Update(input);
            }

            if (input)
            {
                if (Global.Input.mouseScroll > 0)
                {
                    Up_Page_Arrow_ArrowClicked(this, null);
                }
                else if (Global.Input.mouseScroll < 0)
                {
                    Down_Page_Arrow_ArrowClicked(this, null);
                }
                else
                {
                    Up_Page_Arrow.UpdateInput();
                    Down_Page_Arrow.UpdateInput();
                }

                var settings_index = SettingsNodes.consume_triggered(
                    MouseButtons.Left, TouchGestures.Tap);
                bool soloanim_node_clicked = false;
                if (settings_index.IsSomething)
                {
                    var node = SettingsNodes[settings_index];
                    jump_to_option(SettingsNodes.ActiveNode);

                    byte setting = setting_from_node(node);
                    if (!this.active_option_data.Gauge && setting != this.current_setting)
                    {
                        Global.game_system.play_se(System_Sounds.Menu_Move2);
                        change_setting(OptionsNodes.ActiveNode.Option, setting);
                        return;
                    }

                    soloanim_node_clicked = this.active_option == (int)Constants.Options.Animation_Mode &&
                                            SettingsGroups[OptionsNodes.ActiveNodeIndex].IndexOf(node) ==
                                            (int)Constants.Animation_Modes.Solo;
                }
                var slider_index = SettingsNodes.consume_triggered(TouchGestures.Scrubbing);
                if (slider_index.IsSomething)
                {
                    var node = SettingsNodes[slider_index];
                    jump_to_option(SettingsNodes.ActiveNode);

                    byte setting = setting_from_node(node);
                    if (setting != this.current_setting)
                    {
                        Global.game_system.play_se(System_Sounds.Menu_Move2);
                        ManualScroll = false;
                    }
                    change_setting(OptionsNodes.ActiveNode.Option, setting);
                    return;
                }

                if (Global.Input.repeated(Inputs.Left))
                {
                    if (can_move_left)
                    {
                        Global.game_system.play_se(System_Sounds.Menu_Move2);
                        move_left();
                    }
                }
                else if (Global.Input.repeated(Inputs.Right))
                {
                    if (can_move_right)
                    {
                        Global.game_system.play_se(System_Sounds.Menu_Move2);
                        move_right();
                    }
                }
                else if (Global.Input.triggered(Inputs.B) ||
                         CancelButton.consume_trigger(MouseButtons.Left) ||
                         CancelButton.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    if (Map_Info_Changed && Global.scene.is_map_scene)
                    {
                        ((Scene_Map)Global.scene).create_info_windows();
                    }
                    close();
                }
                else if (this.on_soloanim && SoloAnim_Allowed &&
                         (Global.Input.triggered(Inputs.A) || soloanim_node_clicked))
                {
                    if (SoloAnim != null)
                    {
                        Global.game_system.play_se(System_Sounds.Confirm);
                        SoloAnim(this, new EventArgs());
                    }
                }
            }
        }
Exemplo n.º 12
0
        protected override void UpdateStandardMenu(bool active)
        {
            Background.update();
            if (Scrollbar != null)
            {
                Scrollbar.update();
                if (active)
                {
                    Scrollbar.update_input();
                }
            }

            bool holdDown = false, holdUp = false;

            if (Global.Input.pressed(Inputs.Down))
            {
                holdDown = true;
            }
            else if (Global.Input.pressed(Inputs.Up))
            {
                holdUp = true;
            }
            else if (Scrollbar != null)
            {
                if (Scrollbar.DownHeld)
                {
                    holdDown = true;
                }
                else if (Scrollbar.UpHeld)
                {
                    holdUp = true;
                }
            }

            if (holdDown)
            {
                ScrollSpeed = Math.Max(1, ScrollSpeed);
                ScrollSpeed = Math.Min(ScrollSpeed + 0.25f, +MAX_SCROLL);
            }
            else if (holdUp)
            {
                ScrollSpeed = Math.Min(-1, ScrollSpeed);
                ScrollSpeed = Math.Max(ScrollSpeed - 0.25f, -MAX_SCROLL);
            }
            else
            {
                ScrollSpeed = 0f;
            }

            ScrollOffset.Y = (int)MathHelper.Clamp(
                ScrollOffset.Y + ScrollSpeed,
                0, this.MaxScroll);

            if (Scrollbar != null)
            {
                Scrollbar.scroll = (int)ScrollOffset.Y;
            }

            // Full credits link
            if (FullCreditsButton != null)
            {
                FullCreditsButton.Update(active);

                bool fullCredits = false;
                fullCredits |= FullCreditsButton.consume_trigger(MouseButtons.Left) ||
                               FullCreditsButton.consume_trigger(TouchGestures.Tap);
                if (active)
                {
                    fullCredits |= Global.Input.triggered(Inputs.X);
                }

                if (fullCredits)
                {
                    OnOpenFullCredits(new EventArgs());
                }
            }
        }
Exemplo n.º 13
0
        protected override void UpdateMenu(bool active)
        {
            update_map_sprite();
            update_direction();
            // Black Screen
            update_black_screen();
            // Inputs
            bool input = active && Delay == 0 && !Closing && Black_Screen_Timer <= 0;

#if DEBUG
            if (Help_Window != null && input && Global.Input.pressed(Inputs.X))
            {
                DirectionFlags dir = Global.Input.dir_triggered();
                if (dir != DirectionFlags.None)
                {
                    StatusNodes[page].ActiveNode.cheat(this.unit, dir);
                    move_to(Help_Index);
                    Help_Window.add_remaining_text();

                    foreach (var status_page in Pages)
                    {
                        status_page.refresh(this.unit);
                    }
                    foreach (StatusUINode node in TopPanelNodes)
                    {
                        node.refresh(unit);
                    }
                }
                input = false;
            }
#endif

            // Cancel button
            CancelButton.Update(input);

            StatusNodes[page].Update(!input ? ControlSet.None :
                                     (Help_Window != null ?
                                      ControlSet.Movement : (ControlSet.Mouse | ControlSet.Touch)));

            if (input)
            {
                if (Help_Window == null)
                {
                    update_input();

                    var help_index = StatusNodes[page].consume_triggered(
                        MouseButtons.Left, TouchGestures.Tap);
                    if (help_index.IsNothing)
                    {
                        help_index = StatusNodes[page].consume_triggered(
                            TouchGestures.LongPress);
                    }

                    if (help_index.IsSomething)
                    {
                        Help_Index = StatusNodes[page][help_index].HelpLabel;
                        open_help();
                    }
                }
                else
                {
                    if (StatusNodes[page].ActiveNode.HelpLabel != Help_Index)
                    {
                        move_to(StatusNodes[page].ActiveNode.HelpLabel);
                    }

                    var help_index = StatusNodes[page].consume_triggered(
                        MouseButtons.Left, TouchGestures.Tap);
                    var help_cancel_index = StatusNodes[page].consume_triggered(
                        TouchGestures.LongPress);

                    if (Global.Input.triggered(Inputs.B) ||
                        Global.Input.triggered(Inputs.R) ||
                        Global.Input.mouse_click(MouseButtons.Right) ||
                        help_cancel_index.IsSomething ||
                        CancelButton.consume_trigger(MouseButtons.Left) ||
                        CancelButton.consume_trigger(TouchGestures.Tap))
                    {
                        close_help();
                    }

                    /* //Debug
                     * if (Global.Input.repeated(Inputs.Down))
                     * {
                     *  if (move(2))
                     *  {
                     *
                     *  }
                     * }
                     * if (Global.Input.repeated(Inputs.Up))
                     * {
                     *  if (move(8))
                     *  {
                     *
                     *  }
                     * }
                     * if (Global.Input.repeated(Inputs.Right))
                     * {
                     *  if (move(6))
                     *  {
                     *
                     *  }
                     * }
                     * if (Global.Input.repeated(Inputs.Left))
                     * {
                     *  if (move(4))
                     *  {
                     *
                     *  }
                     * }
                     * else if (Global.Input.triggered(Inputs.R) || Global.Input.triggered(Inputs.B))
                     * {
                     *  close_help();
                     * }*/
                }
                StatusCursors[page].update();
            }

            if (Help_Window != null)
            {
                Help_Window.update();
            }
            Background.update();
            // Top Panel
            Top_Panel.update();
            foreach (TextSprite label in Battle_Stat_Labels)
            {
                label.update();
            }
            // Pages
            foreach (Status_Page status_page in Pages)
            {
                status_page.update();
            }
            Left_Page_Arrow.update();
            Right_Page_Arrow.update();
        }
Exemplo n.º 14
0
        protected override void update_ui(bool active)
        {
            if (active)
            {
                if (Global.Input.triggered(Inputs.X) ||
                    SwitchButton.consume_trigger(MouseButtons.Left) ||
                    SwitchButton.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    switch_giving();
                    HardSwitch = this.giving;
                    Supply_Window.show_type_icon();
                    return;
                }
            }

            if (active && this.taking && this.can_give)
            {
                // Pressed left on the first weapon type
                // Press right on the last weapon type
                if (Global.game_system.Supply_Item_Type == 0 &&
                    Global.Input.repeated(Inputs.Left))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    Supply_Window.change_page(0);
                    switch_giving();
                    Supply_Window.hide_type_icon();
                    return;
                }
                else if (Global.game_system.Supply_Item_Type ==
                         Supply_Window.supply_type_count - 1 &&
                         Global.Input.repeated(Inputs.Right))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    Supply_Window.change_page(0);
                    switch_giving();
                    Supply_Window.hide_type_icon();
                    return;
                }
            }
            int item_index = Item_Window.index;

            base.update_ui(active);
            if (this.giving && item_index == Item_Window.index)
            {
                if (Global.Input.repeated(Inputs.Left))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    if (!HardSwitch)
                    {
                        Supply_Window.change_page(Supply_Window.supply_type_count - 1);
                    }
                    switch_giving();
                }
                else if (Global.Input.repeated(Inputs.Right))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    if (!HardSwitch)
                    {
                        Supply_Window.change_page(0);
                    }
                    switch_giving();
                }
            }
        }
Exemplo n.º 15
0
        protected virtual void update_ui(bool input)
        {
            int index = PanelNodes.ActiveNodeIndex;

            PanelNodes.Update(input, -MenuLoc);
            if (index != PanelNodes.ActiveNodeIndex)
            {
                Panels[index].active         = false;
                PanelNodes.ActiveNode.active = true;
                refresh_panel_locations();
            }

            CancelButton.Update(input);

            if (input)
            {
                if (Cursor.target_loc != PanelNodes.ActiveNode.loc)
                {
                    Cursor.set_loc(PanelNodes.ActiveNode.loc);
                }

                var file_index = PanelNodes.consume_triggered(
                    Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                if (file_index.IsSomething)
                {
                    int file_id = file_index + 1 + Page * Config.SAVES_PER_PAGE;
                    if (this.file_id != file_id)
                    {
                        this.file_id = file_id;
                    }

                    if (Copying)
                    {
                        OnCopyFile(new EventArgs());
                    }
                    else if (Moving)
                    {
                        OnMoveFile(new EventArgs());
                    }
                    else
                    {
                        OnSelected(new EventArgs());
                    }
                }
                else if (Global.Input.triggered(Inputs.B) ||
                         Global.Input.KeyPressed(Keys.Escape) ||
                         CancelButton.consume_trigger(MouseButtons.Left) ||
                         CancelButton.consume_trigger(TouchGestures.Tap))
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    if (Copying)
                    {
                        this.copying = false;
                    }
                    else if (Moving)
                    {
                        this.moving_file = false;
                    }
                    else
                    {
                        OnCanceled(new EventArgs());
                    }
                }
            }
        }