예제 #1
0
 protected void update_cursor_location(bool instant)
 {
     if (Cursor != null)
     {
         if (instant)
         {
             Cursor.update();
             Cursor.move_to_target_loc();
         }
         else
         {
             Cursor.update();
         }
     }
 }
예제 #2
0
        protected virtual void update_ui(bool input)
        {
            reset_selected();

            if (Choices != null)
            {
                Choices.Update(input, -(loc + draw_vector() + new Vector2(8, 8)));
                Cursor.update();

                if (input)
                {
                    var selected = Choices.consume_triggered(
                        Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                    if (selected.IsSomething)
                    {
                        SelectedIndex = selected;
                    }

                    if (Global.Input.triggered(Inputs.B))
                    {
                        Canceled = true;
                    }
                }
            }
        }
예제 #3
0
        protected override void update_input(bool active)
        {
            active &= DetailedRanking == null;

            CancelButton.Update(active);
            Nodes.Update(active, new Vector2((int)Scroll.X, (int)Scroll.Y));
            Cursor.update();

            update_scroll(active);

            if (active)
            {
                var selected = Nodes.consume_triggered(
                    Inputs.A, MouseButtons.Left, TouchGestures.Tap);

                if (selected.IsSomething)
                {
                    DetailedRanking = new Window_Ranking(Rankings[selected].Value);
                }
                else if (Global.Input.triggered(Inputs.B) || cancel_button_triggered)
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    close();
                }
            }
        }
예제 #4
0
        public bool SelectSetting(bool selected)
        {
            switch (Settings.SettingType(this.index))
            {
            case ConfigTypes.Button:
                // Simply execute the button's operation
                if (selected)
                {
                    Settings.ConfirmSetting(this.index, null);
                    RefreshItemValues();
                    SelectedSettingCursor.force_loc(UICursor.loc);
                    selected = false;
                }
                break;

            case ConfigTypes.SubSettings:
                if (selected)
                {
                    OpenSubMenu = true;
                    SelectedSettingCursor.force_loc(UICursor.loc);
                    selected = false;
                }
                break;

            case ConfigTypes.Keyboard:
            case ConfigTypes.Gamepad:
                break;

            default:
                Items[this.index].set_text_color(selected ? "Green" : "White");
                break;
            }
            SettingSelected = selected;
            Greyed_Cursor   = SettingSelected;

            if (SettingSelected)
            {
                TempSelectedSettings = (ISettings)Settings.Clone();
                TempOriginalSettings = (ISettings)Settings.Clone();
                SelectedSettingCursor.force_loc(UICursor.loc);
                SelectedSettingCursor.set_loc(UICursor.target_loc + new Vector2(VALUE_OFFSET, 0));
                SelectedSettingCursor.update();
            }
            else
            {
                TempSelectedSettings = null;
                TempOriginalSettings = null;
                RefreshCurrentValue(Settings);
                UICursor.force_loc(SelectedSettingCursor.loc);
                UICursor.update();
            }
            active = !SettingSelected;

            return(SettingSelected);
        }
예제 #5
0
        private void update_ui(bool input)
        {
            if (input)
            {
                foreach (var arrow in LeftArrows.Keys)
                {
                    arrow.UpdateInput(-Loc);
                }
                foreach (var arrow in RightArrows.Keys)
                {
                    arrow.UpdateInput(-Loc);
                }
            }

            int index = Items.ActiveNodeIndex;

            Items.Update(input, -(Loc));
            bool moved = index != Items.ActiveNodeIndex;

            UICursor.update();

            if (CancelButton != null)
            {
                CancelButton.Update(input);
            }
            bool cancel = CanceledTriggered(input);

            if (cancel)
            {
                Global.game_system.play_se(System_Sounds.Cancel);
                OnCanceled(new EventArgs());
            }
            else if (input)
            {
                if (Global.Input.triggered(Inputs.Left))
                {
                    change_index(-1);
                }
                else if (Global.Input.triggered(Inputs.Right))
                {
                    change_index(1);
                }


                var selected = Items.consume_triggered(
                    Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                // Select event if on Confirm
                if (selected.IsSomething && selected == ValidPreviousChapters.Count)
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                    OnSelected(new EventArgs());
                }
            }
        }
        protected override void update_movement(bool input)
        {
            int index = this.index;

            if (num_items() > 0)
            {
                (Items as PartialRangeVisibleUINodeSet <CommandUINode>)
                .Update(
                    input && !Movement_Locked,
                    visible_indexes_range().Enumerate(),
                    -(this.loc + text_draw_vector()));
            }
            UICursor.update();
            if (Grey_Cursor != null)
            {
                Grey_Cursor.force_loc(UICursor.target_loc);
            }

            if (index != this.index)
            {
                on_index_changed(index);
            }

            if (input)
            {
                if (Global.Input.touch_pressed(false))
                {
                    Vector2 loc = this.loc + Text_Offset + new Vector2(8, 8);
                    if (Global.Input.touch_rectangle(
                            Services.Input.InputStates.Triggered,
                            new Rectangle((int)loc.X, (int)loc.Y,
                                          text_area_width, this.rows * 16)))
                    {
                        ManualScroll = true;
                        Console.WriteLine("starting scroll");
                    }
                }
                else
                {
                    ManualScroll = false;
                }

                if (ManualScroll &&
                    Global.Input.gesture_triggered(TouchGestures.VerticalDrag))
                {
                    ScrollOffset.Y += -Global.Input.verticalDragVector.Y;
                    ScrollOffset.Y  = MathHelper.Clamp(ScrollOffset.Y,
                                                       0, (this.total_rows - this.rows) * 16);
                    refresh_scroll();
                }
            }
        }
예제 #7
0
        protected virtual void update_movement(bool input)
        {
            if (Items == null)
            {
                return; //Debug
            }
            int index = this.index;

            Items.Update(input && !Movement_Locked, -(loc + text_draw_vector()));
            UICursor.update();
            if (Grey_Cursor != null)
            {
                Grey_Cursor.force_loc(UICursor.target_loc);
            }

            if (index != this.index)
            {
                on_index_changed(index);
            }
        }
예제 #8
0
        private void update_ui(bool input)
        {
            reset_selected();

            int index = ItemNodes.ActiveNodeIndex;

            ItemNodes.Update(input, -(loc));
            bool moved = index != ItemNodes.ActiveNodeIndex;

            UICursor.update();
            if (moved && is_help_active)
            {
                Help_Window.set_item(item_data(), column == 0 ? actor1 : actor2);
                update_help_loc();
            }

            if (input)
            {
                if (!is_help_active)
                {
                    var selected = ItemNodes.consume_triggered(
                        Inputs.A, MouseButtons.Left, TouchGestures.Tap);
                    if (selected.IsSomething)
                    {
                        SelectedIndex = selected;
                    }
                    var help = ItemNodes.consume_triggered(
                        Inputs.R, MouseButtons.Right, TouchGestures.LongPress);
                    if (help.IsSomething)
                    {
                        HelpIndex = help;
                    }
                }

                if (Global.Input.triggered(Inputs.B))
                {
                    Canceled = true;
                }
                if (is_help_active)
                {
                    var help = ItemNodes.consume_triggered(
                        Inputs.R, MouseButtons.Right, TouchGestures.LongPress);
                    if (help.IsSomething)
                    {
                        Canceled = true;
                    }
                }

                Rectangle target_rect = new Rectangle(
                    (int)loc.X + 8, (int)loc.Y + 8,
                    SPACING * 2 - 16, Global.ActorConfig.NumItems * 16);
                // Right clicked on nothing
                if (!Global.Input.mouse_in_rectangle(target_rect))
                {
                    if (Global.Input.mouse_click(MouseButtons.Right))
                    {
                        Canceled = true;
                    }
                }
            }
        }
예제 #9
0
 protected void update_cursor()
 {
     UnitCursor.update(new Vector2(0, this.RowSize * Scroll) - this.loc);
 }
예제 #10
0
 private void update_cursor()
 {
     OptionsCursor.update(new Vector2(0, 16 * Scroll));
     SettingsCursor.update(new Vector2(0, 16 * Scroll));
 }