Exemple #1
0
        private void update_input()
        {
            Left_Page_Arrow.UpdateInput(-MenuLoc);
            Right_Page_Arrow.UpdateInput(-MenuLoc);

            if (!Global.Input.pressed(Inputs.Up) && !Global.Input.pressed(Inputs.Down))
            {
                if (Page > 0 && (Global.Input.repeated(Inputs.Left) ||
                                 Global.Input.gesture_triggered(TouchGestures.SwipeRight)))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    Page--;
                    refresh_page();
                }
                if (Page < Max_Page && (Global.Input.repeated(Inputs.Right) ||
                                        Global.Input.gesture_triggered(TouchGestures.SwipeLeft)))
                {
                    Global.game_system.play_se(System_Sounds.Menu_Move2);
                    Page++;
                    refresh_page();
                }
            }
            if (!Global.Input.pressed(Inputs.Up))
            {
                locked_inputs.Remove(Inputs.Up);
            }
            if (!Global.Input.pressed(Inputs.Down))
            {
                locked_inputs.Remove(Inputs.Down);
            }
        }
        private void update_input()
        {
            Left_Page_Arrow.UpdateInput(new Vector2(0, Offset.Y));
            Right_Page_Arrow.UpdateInput(new Vector2(0, Offset.Y));
            if (Delay != 0)
            {
                return;
            }

            if (Global.Input.pressed(Inputs.Up) || Global.Input.mouseScroll > 0 ||
                Global.Input.gesture_triggered(TouchGestures.SwipeDown))
            {
                Delay     = 14;
                Direction = 8;
            }
            else if (Global.Input.pressed(Inputs.Down) || Global.Input.mouseScroll < 0 ||
                     Global.Input.gesture_triggered(TouchGestures.SwipeUp))
            {
                Delay     = 14;
                Direction = 2;
            }
            else if (Global.Input.pressed(Inputs.Left) ||
                     Global.Input.gesture_triggered(TouchGestures.SwipeRight))
            {
                Delay     = 22;
                Direction = 4;
            }
            else if (Global.Input.pressed(Inputs.Right) ||
                     Global.Input.gesture_triggered(TouchGestures.SwipeLeft))
            {
                Delay     = 22;
                Direction = 6;
            }
            else if (Global.Input.triggered(Inputs.B) ||
                     Global.Input.mouse_click(MouseButtons.Right) ||
                     CancelButton.consume_trigger(MouseButtons.Left) ||
                     CancelButton.consume_trigger(TouchGestures.Tap))
            {
                Global.game_system.play_se(System_Sounds.Cancel);
                if (!Actors)
                {
                    Game_Unit status_unit = Global.game_map.units[Global.game_temp.status_unit_id];
                    status_unit.highlighted         = false;
                    Global.game_temp.status_unit_id = -1;
                }
                Closing              = true;
                Black_Screen_Timer   = BLACK_SCREEN_TIME;
                Black_Screen.visible = true;
            }
            else if (Global.Input.triggered(Inputs.R))
            {
                open_help();
            }
            else if (Global.Input.triggered(Inputs.A) && (unit.is_rescued || unit.is_rescuing))
            {
                if (Actors)
                {
                    bool same_team = false;
                    if (unit.is_rescued)
                    {
                        if (Global.game_map.units[unit.rescued].same_team(unit))
                        {
                            same_team = true;
                        }
                    }
                    else
                    if (Global.game_map.units[unit.rescuing].same_team(unit))
                    {
                        same_team = true;
                    }
                    if (!same_team)
                    {
                        return;
                    }
                }
                if (unit.is_rescued && !Team.Contains(unit.rescued) &&
                    Global.game_map.units[unit.rescued].same_team(unit))
                {
                    return;
                }
                if (unit.is_rescuing && !Team.Contains(unit.rescuing) &&
                    Global.game_map.units[unit.rescuing].same_team(unit))
                {
                    return;
                }

                Delay        = 14;
                Direction    = unit.is_rescuing ? 2 : 8;
                Goto_Rescued = true;
            }
        }