public static void ResetKey(ControlAction actIn)
 {
     if (DigitalActionInput_Keyboard.ContainsKey(actIn))
     {
         DigitalActionValue_Keyboard[actIn] = KeyValue.IDLE;
     }
 }
Exemple #2
0
 public TrickData()
 {
     CurrentTrickPoints = 0;
     ActiveTrickName    = TrickName.BLANK_TRICK;
     ActiveTrickTime    = Constants.ZERO_F;
     ActiveTrickAction  = ControlAction.ERROR_ACTION;
 }
Exemple #3
0
        //Method
        public void HandleInput()
        {
            KeyboardState state = Keyboard.GetState();

            if (state.IsKeyDown(Keys.Up))
            {
                _currentAction = ControlAction.Jump;
            }
            else if (state.IsKeyDown(Keys.Space) && _oldState.IsKeyUp(Keys.Space))
            {
                _currentAction = ControlAction.Attack;
            }
            else if (state.IsKeyDown(Keys.Right))
            {
                _currentAction = ControlAction.Right;
            }
            else if (state.IsKeyDown(Keys.Left))
            {
                _currentAction = ControlAction.Left;
            }
            else
            {
                _currentAction = ControlAction.Idle;
            }

            _oldState = state;
            _commands.Excecute(_player, _currentAction);
        }
Exemple #4
0
 public void attach_to(ISaveChangesPresenter presenter)
 {
     can_be_closed = false;
     save_action = x => { execute(presenter.save); };
     do_not_save_action = x => { execute(presenter.dont_save); };
     cancel_action = x => { execute(presenter.cancel); };
     closing_action = x => { if (!can_be_closed) presenter.cancel(); };
 }
    public static void CheckAndSetAxisValue(ControlAction actIn)
    {
        if (!AnalogActionInput.ContainsKey(actIn))
        {
            return;
        }
        string axisIn = AnalogActionInput[actIn];

        AnalogActionValue[actIn] = Input.GetAxisRaw(axisIn);
    }
    /*
     * public static bool GetBinaryAnalogAction(ControlAction actIn, out float valueOut)
     * {
     *  valueOut = Constants.ZERO_F;
     *
     *  if (actIn == ControlAction.TURN_AXIS ||
     *      actIn == ControlAction.SPIN_AXIS)
     *  {
     *      valueOut = (GetInputAction(ControlAction.RIGHT_BIN) & KeyValue.AXIS_BIN) != 0 ? 1 : valueOut;
     *      valueOut = (GetInputAction(ControlAction.LEFT_BIN) & KeyValue.AXIS_BIN) != 0 ? -1 : valueOut;
     *  }
     *  else if (actIn == ControlAction.SLOW_AXIS ||
     *      actIn == ControlAction.FLIP_AXIS)
     *  {
     *      valueOut = (GetInputAction(ControlAction.UP_BIN) & KeyValue.AXIS_BIN) != 0 ? 1 : valueOut;
     *      valueOut = (GetInputAction(ControlAction.DOWN_BIN) & KeyValue.AXIS_BIN) != 0 ? -1 : valueOut;
     *  }
     *
     *  return !valueOut.Equals(Constants.ZERO_F);
     * }
     */

    public static float GetAnalogInputAction(ControlAction actIn)
    {
        float returnValue = float.MaxValue;

        if (AnalogActionInput.ContainsKey(actIn))
        {
            return(AnalogActionValue[actIn]);
        }
        return(returnValue);
    }
Exemple #7
0
 /// <summary>
 /// Sets control value
 /// </summary>
 /// <param name="control"></param>
 /// <param name="message"></param>
 void SetControlAction(ControlAction ca)
 {
     if (!_controlActions.ContainsKey(ca.ActionControl))
     {
         _controlActions.Add(ca.ActionControl, ca);
     }
     else
     {
         _controlActions[ca.ActionControl] = ca;
     }
 }
 public void attach_to(ICheckForUpdatesPresenter presenter)
 {
     update_button = x =>
     {
         ux_update_button.Enabled = false;
         ux_dont_update_button.Enabled = false;
         ux_cancel_button.Enabled = true;
         presenter.begin_update();
     };
     dont_update_button = x => presenter.do_not_update();
     cancel_button = x => presenter.cancel_update();
 }
        protected override void OnEnable()
        {
            base.OnEnable();

            m_ControlAction = (ControlAction)m_Action;

            m_ControlTypeProp   = serializedObject.FindProperty("m_ControlType");
            m_InputTypeProp     = serializedObject.FindProperty("m_InputType");
            m_MinSpeedProp      = serializedObject.FindProperty("m_MinSpeed");
            m_MaxSpeedProp      = serializedObject.FindProperty("m_MaxSpeed");
            m_IdleSpeedProp     = serializedObject.FindProperty("m_IdleSpeed");
            m_RotationSpeedProp = serializedObject.FindProperty("m_RotationSpeed");
            m_IsPlayerProp      = serializedObject.FindProperty("m_IsPlayer");
        }
    public static bool UpdateAction(ControlAction actIn, string axisIn)
    {
        if (AnalogActionInput.ContainsKey(actIn))
        {
            AnalogActionInput.Remove(actIn);
            AnalogActionValue.Remove(actIn);

            // reset value
            AnalogActionInput[actIn] = axisIn;
            AnalogActionValue[actIn] = Constants.ZERO_F;

            return(true);
        }
        return(false);
    }
        public void BeginAction(ControlAction action, float xDist, float yDist, float duration)
        {
            _currentAction     = action;
            _xDist             = xDist;
            _yDist             = yDist;
            _duration          = duration;
            _timeStartedAction = SMH.Now;

            foreach (ControlInfo info in _controls)
            {
                info.Started = info.Finished = false;
                info.StartX  = info.Control.X;
                info.StartY  = info.Control.Y;
            }
        }
Exemple #12
0
        protected void Save_Click(object sender, EventArgs e)
        {
            SysMenuModel model = new SysMenuModel();

            model.ParentID    = this.ParentID.Value.Trim();
            model.MenuName    = this.MenuName.Value.Trim();
            model.MenuImg     = this.MenuImg.Value.Trim();
            model.MenuType    = TypeConversion.StringToInt(this.MenuType.Value.Trim());
            model.NavigateUrl = this.NavigateUrl.Value.Trim();
            model.SortCode    = TypeConversion.StringToInt(this.SortCode.Value.Trim());
            model.DeleteFlag  = 0;
            model.CreateDate  = new DateTime();
            if (model.IsVolid())
            {
                if (MID == "")
                {
                    model.MenuID = Guid.NewGuid();
                    int i = SMBll.MenuAction(model, Common.NetEnum.SysEnum.ActionType.ADD);
                    if (i > 0)
                    {
                        ControlAction.CloseWindow(this.Page, "添加成功!", 2500, SysEnum.MsgType.SUCCESS);
                    }
                    else
                    {
                        ControlAction.CloseWindow(this.Page, "添加失败!", 2500, SysEnum.MsgType.ERROR);
                    }
                }
                else
                {
                    model.MenuID = new Guid(MID);
                    int i = SMBll.MenuAction(model, Common.NetEnum.SysEnum.ActionType.UPDATE);
                    if (i > 0)
                    {
                        ControlAction.CloseWindow(this.Page, "修改成功!", 2500, SysEnum.MsgType.SUCCESS);
                    }
                    else
                    {
                        ControlAction.CloseWindow(this.Page, "修改失败!", 2500, SysEnum.MsgType.ERROR);
                    }
                }
            }
            else
            {
                ShowMsgHelper.ShowScript("showWarningMsg('" + model.ValidateTag.ToString() + "');");
            }
        }
Exemple #13
0
            int InternalControlWaitForExecutionHandlerImpl(IntPtr action, IntPtr parameter, IntPtr ctlVal, bool test, bool synchoCheck)
            {
                GCHandle handle = GCHandle.FromIntPtr(parameter);

                ControlHandlerInfo info = (ControlHandlerInfo)handle.Target;

                if (info != null & info.waitForExecHandler != null)
                {
                    ControlAction controlAction = new ControlAction(action, info, this);

                    return((int)info.waitForExecHandler(controlAction, info.waitForExecHandlerParameter, new MmsValue(ctlVal), test, synchoCheck));
                }
                else
                {
                    return((int)ControlHandlerResult.FAILED);
                }
            }
        //#method
        private void toolStripMenuItem_Click(object sender, EventArgs e)
        {
            var menuItemName = (sender as ToolStripMenuItem).Name;

            this.Tag = menuItemName;
            var menuItem = _menuItems.Find(x => x.Name == menuItemName);
            var args     = new ContextMenuItemClickEventArgs(null, menuItemName, menuItem.Action);

            if (OnMenuItemClick != null)
            {
                var curAction = new ControlAction();
                curAction.Action      = menuItem.Action;
                curAction.DisplayName = LayoutHelper.GetControlDisplayName(_supportMutiLanguages, "", menuItem.Name, _annexes, menuItem.DisplayName);
                CurrentAction         = curAction;
                OnMenuItemClick(this, args);
            }
        }
Exemple #15
0
 protected override void OnLoad(EventArgs e)
 {
     if (RequestSession.GetSessionUser() == null)
     {
         this.Session.Abandon();
         this.Session.Clear();
         System.Web.UI.Page CurrentPage = (HttpContext.Current.CurrentHandler as System.Web.UI.Page);
         ControlAction.RunScript(CurrentPage, "top.location.href='/Login.html';");
         System.Web.HttpContext.Current.Response.Flush();
         System.Web.HttpContext.Current.Response.End();
     }
     if (null == this.Session["Token"])
     {
         WebHelper.SetToken();
     }
     base.OnLoad(e);
 }
Exemple #16
0
            int InternalCheckHandlerImpl(IntPtr action, IntPtr parameter, IntPtr ctlVal, bool test, bool interlockCheck)
            {
                GCHandle handle = GCHandle.FromIntPtr(parameter);

                ControlHandlerInfo info = (ControlHandlerInfo)handle.Target;

                if (info != null & info.checkHandler != null)
                {
                    ControlAction controlAction = new ControlAction(action, info, this);

                    return((int)info.checkHandler(controlAction, info.checkHandlerParameter, new MmsValue(ctlVal), test, interlockCheck));
                }
                else
                {
                    return((int)CheckHandlerResult.OBJECT_UNDEFINED);
                }
            }
Exemple #17
0
        public void IShouldSeeValueInControl(string not, string expectedValue, string controlName,
                                             string frame)
        {
            var actualValue = ControlAction.ExecuteFunction(controlName, ActionType.GetText,
                                                            frame.ToString()).ToString();

            if (string.IsNullOrEmpty(not))
            {
                Assert.AreEqual(expectedValue.ToString(), actualValue,
                                $"Value '{expectedValue}' is not present in {controlName}.");
            }
            else
            {
                Assert.AreNotEqual(expectedValue.ToString(), actualValue,
                                   $"Value '{expectedValue}' is present in {controlName}");
            }
        }
Exemple #18
0
 /// <summary>
 /// Updates the policy value according to the passed value and currently selected action in the dropdown
 /// </summary>
 /// <param name="value">Current value that will be applied</param>
 private void UpdatePolicy(string value)
 {
     if (parentPanel.BoundControllable == null)
     {
         return;
     }
     Value  = value;
     Policy = new ControlAction
     {
         Action = Action,
         Value  = value
     };
     IsValid = Validate();
     if (IsInitialized)
     {
         parentPanel.UpdatePolicy();
     }
 }
Exemple #19
0
        public string ChangeKeyboardInput(bool setAzerty)
        {
            ControlAction controlAction = UIManager.Action;

            if (setAzerty)
            {
                keyCodes             = new KeyCode[] { KeyCode.Z, KeyCode.Q, KeyCode.S, KeyCode.D, KeyCode.UpArrow, KeyCode.LeftArrow, KeyCode.DownArrow, KeyCode.RightArrow };
                azerty               = true;
                controlAction.azerty = true;
                PlayerPrefs.SetInt("AZERTY", 1);
                PlayerPrefs.Save();
                return("AZERTY");
            }
            keyCodes             = new KeyCode[] { KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.UpArrow, KeyCode.LeftArrow, KeyCode.DownArrow, KeyCode.RightArrow };
            azerty               = false;
            controlAction.azerty = false;
            PlayerPrefs.SetInt("AZERTY", 0);
            return("QWERTY");
        }
    public static KeyCode GetInputKey(ControlAction actIn, InputType inputType = InputType.KEYBOARD_GENERIC)
    {
        if (inputType == InputType.CONTROLLER_GENERIC)
        {
            if (DigitalActionInput_Gamepad.ContainsKey(actIn))
            {
                return(DigitalActionInput_Gamepad[actIn]);
            }
        }

        if (inputType == InputType.KEYBOARD_GENERIC)
        {
            if (DigitalActionInput_Keyboard.ContainsKey(actIn))
            {
                return(DigitalActionInput_Keyboard[actIn]);
            }
        }
        return(KeyCode.None);
    }
Exemple #21
0
        public ControlDefinition(string id)
        {
            ID              = id;
            Action          = ControlAction.Custom;
            StringParameter = "";
            IntParameter    = -1;
            CustomAction    = CustomControlAction.Begin_Event;

            VisibleName = id;
            HasModifier = false;
            Key         = KeyCode.None;
            MouseButton = -1;

            HasModifierAlt = false;
            KeyAlt         = KeyCode.None;
            MouseButtonAlt = -1;
            ModifierKeyAlt = EventModifiers.None;

            IsRequiredControl = true;
        }
Exemple #22
0
        public ControlDefinition(string id, ControlAction action, MouseButton defaultMouseButton, bool modifier = true, EventModifiers defaultModifier = EventModifiers.CapsLock)
        {
            ID = id;
            StringParameter = "";
            IntParameter    = -1;
            Action          = action;
            VisibleName     = id.Replace("_", " ");
            HasModifier     = defaultModifier != EventModifiers.CapsLock;
            ModifierKey     = defaultModifier;
            Key             = KeyCode.None;
            MouseButton     = (int)defaultMouseButton;
            CustomAction    = CustomControlAction.Begin_Event;

            HasModifierAlt = false;
            KeyAlt         = KeyCode.None;
            MouseButtonAlt = -1;
            ModifierKeyAlt = EventModifiers.None;

            IsRequiredControl = modifier;
        }
    public static bool GetInputAction(ControlAction actIn, KeyValue desiredValue)
    {
        /*
         * IDLE true = key IDLE and pad IDLE
         * PRS true = key PRESS or pad PRESS
         * HLD true = key HLD or pad HLD
         * UP true = key UP and pad IDLE OR pad IDLE and key UP
         */


        KeyValue ControllerValue = KeyValue.BTN_NOT_FOUND;
        KeyValue KeyboardValue   = KeyValue.BTN_NOT_FOUND;

        // assume no keys are assigned to one and not the other
        if (DigitalActionInput_Gamepad.ContainsKey(actIn))
        {
            ControllerValue = DigitalActionValue_Gamepad[actIn];
        }
        if (DigitalActionInput_Keyboard.ContainsKey(actIn))
        {
            KeyboardValue = DigitalActionValue_Keyboard[actIn];
        }

        switch (desiredValue)
        {
        case KeyValue.IDLE:
            return(ControllerValue == desiredValue && KeyboardValue == desiredValue);

        case KeyValue.PRESSED:
            return(ControllerValue == desiredValue || KeyboardValue == desiredValue);

        case KeyValue.HELD:
            return(ControllerValue == desiredValue || KeyboardValue == desiredValue);

        case KeyValue.UP:
            return((ControllerValue == desiredValue && (KeyboardValue & KeyValue.UP_VALID) != KeyValue.BTN_NOT_FOUND) ||
                   (KeyboardValue == desiredValue && (ControllerValue & KeyValue.UP_VALID) != KeyValue.BTN_NOT_FOUND));
        }

        return(false);
    }
    public static bool UpdateAction(ControlAction actIn, KeyCode keyIn, InputType inputType)
    {
        // check if action is mapped to key
        // and if key is in the key dictionary
        // set them all and in controllerdata
        if (inputType == InputType.KEYBOARD_GENERIC)
        {
            if (DigitalActionInput_Keyboard.ContainsKey(actIn))
            {
                DigitalActionInput_Keyboard.Remove(actIn);
                DigitalActionValue_Keyboard.Remove(actIn);

                // reset value
                DigitalActionInput_Keyboard[actIn] = keyIn;
                DigitalActionValue_Keyboard[actIn] = KeyValue.IDLE;

                return(true);
            }
        }

        if (inputType == InputType.CONTROLLER_GENERIC)
        {
            if (DigitalActionInput_Gamepad.ContainsKey(actIn))
            {
                DigitalActionInput_Gamepad.Remove(actIn);
                DigitalActionValue_Gamepad.Remove(actIn);

                // reset value
                DigitalActionInput_Gamepad[actIn] = keyIn;
                DigitalActionValue_Gamepad[actIn] = KeyValue.IDLE;

                return(true);
            }
        }
        return(false);
    }
Exemple #25
0
 /// <summary>
 /// Applies the specified control action recursively.
 /// </summary>
 /// <param name="controlAction">The control action.</param>
 /// <param name="root">The root control.</param>
 public static void ApplyRecursively(ControlAction controlAction, Control root)
 {
     foreach(Control control in root.Controls)
     {
         controlAction(control);
         ApplyRecursively(controlAction, control);
     }
 }
Exemple #26
0
 protected ControlActionVerificationSteps(ScenarioContext scenarioContext, ControlAction controlAction) : base(scenarioContext, controlAction)
 {
 }
Exemple #27
0
 public void attach_to(IAddBillPaymentPresenter presenter)
 {
     submit_clicked = x => presenter.submit_bill_payment(create_dto());
 }
Exemple #28
0
 public ControlButton(INuGenServiceProvider serviceProvider, ControlAction action)
     : base(serviceProvider)
 {
     _action = action;
 }
			public ControlButton(INuGenServiceProvider serviceProvider, ControlAction action)
				: base(serviceProvider)
			{
				_action = action;
			}
Exemple #30
0
 public void attach_to(IUnhandledErrorPresenter presenter)
 {
     close_action = x => Close();
     restart_action = x => presenter.restart_application();
 }
 public ControlChange(string id, ControlAction action)
 {
     Id = id;
     Action = action;
 }
Exemple #32
0
 public void attach_to(IAddNewIncomePresenter presenter)
 {
     submit_button = x => presenter.submit_new(create_income());
 }
Exemple #33
0
 /// <summary>
 /// Sets control value
 /// </summary>
 /// <param name="control"></param>
 /// <param name="message"></param>
 void SetControlAction(ControlAction ca)
 {
     if (!_controlActions.ContainsKey(ca.ActionControl))
     {
         _controlActions.Add(ca.ActionControl, ca);
     }
     else
     {
         _controlActions[ca.ActionControl] = ca;
     }
 }
 private async void  menuTabs_ControlEvent(object sender, ControlAction e)
 {
     switch (e)
     {
         case ControlAction.AppMenu:
             break;
         case ControlAction.Close:
             CloseOpenToursOrAbort(false);
             TourPopup.CloseTourPopups();
             this.Close();
             break;
         case ControlAction.Maximize:
         case ControlAction.Restore:
             if (WindowState == FormWindowState.Maximized)
             {
                 this.WindowState = FormWindowState.Normal;
             }
             else
             {
                 this.WindowState = FormWindowState.Maximized;
             }
             break;
         case ControlAction.CloseTour:
             if (tourEdit != null)
             {
                 CloseOpenToursOrAbort(false);
             }
             break;
         case ControlAction.SignOut:
             WindowsLiveSignOut();
             if (communitiesPane != null)
             {
                 communitiesPane.SetCommunitiesMode();
                 communitiesPane.Refresh();
                 communitiesPane.LoadCommunities();
             }
             break;
         case ControlAction.SignIn:
             await WindowsLiveSignIn();
             menuTabs.SetSelectedIndex((int)ApplicationMode.Community, false);
             break;
     }
 }
 void SetAction(ref bool prevAction, ControlAction action, bool newState)
 {
     if(Actions[action] != newState)
     {
         Actions[action] = newState;
         prevAction |= true;
     }
     else
     {
         prevAction |= false;
     }
 }
 protected BrowserSteps(ScenarioContext scenarioContext, ControlAction controlAction) : base(scenarioContext, controlAction)
 {
 }
Exemple #37
0
 public override String ToString()
 {
     return(ControlAction.ToString());
 }
        protected BaseStepDefinition(ScenarioContext scenarioContext, ControlAction controlAction)
        {
            this.scenarioContext = scenarioContext;
//            this.ControlAction = controlAction;
        }
Exemple #39
0
 protected void Save_Click(object sender, EventArgs e)
 {
     ControlAction.CloseTab(this.Page, "保存成功");
 }
 protected BaseStepDefinition(ScenarioContext scenarioContext, ControlAction controlAction,
                              BrowserActions browserActions)
 {
     this.scenarioContext = scenarioContext;
 }
Exemple #41
0
 protected BaseHooks(ScenarioContext scenarioContext, ControlAction controlAction, BrowserActions browserActions) : base(scenarioContext, controlAction, browserActions)
 {
 }
Exemple #42
0
 public void attach_to(IAddCompanyPresenter presenter)
 {
     ux_company_name.bind_to(dto, x => x.company_name);
     submit_button = x => presenter.submit(dto);
 }