/// <summary>
        /// Initializes a new instance of the <see cref="ws.winx.input.InputAction"/> class.
        /// </summary>
        /// <param name="code">Code.</param>
        /// <param name="type">Type.</param>
        public InputAction(int code, InputActionType type = InputActionType.SINGLE, IDevice device = null)
        {
            if (code < InputCode.MAX_KEY_CODE)
            {
                code = InputCode.toCode((KeyCode)code);
            }


            __defaultCode = _code = code;

            __defaultType = _type = type;

            //if(InputCode.toDeviceInx(_code)==(int)Joysticks.Joystick) _fromAny=true;
            //Debug.Log("From Any:"+_fromAny);



            setCode(code, device);

            //if(_codeString.IndexOf("Joy")>-1) throw new Exception("Use JoystickDevice.toCode function for Joystick inputs");

            if ((_isMouse = _codeString.IndexOf("Mou") > -1))
            {
                _isKey = true;
            }
        }
Esempio n. 2
0
 public InputActionEvent(string action, InputContext context, InputActionType type, float delta = 0f)
 {
     Action = action;
     Context = context;
     Type = type;
     Delta = delta;
 }
Esempio n. 3
0
        private void ActionEvent(InputAction inputAction, InputActionType inputActionType, CoreActionEventType coreActionEventType)
        {
            if (_subscriptions.ContainsKey(inputActionType))
            {
                var value = _subscriptions[inputActionType].RegistrationValue;
                value.InputAction         = inputAction;
                value.InputActionType     = inputActionType;
                value.CoreActionEventType = coreActionEventType;

                switch (coreActionEventType)
                {
                case CoreActionEventType.Started:
                    _subscriptions[inputActionType].OnActionStarted.OnNext(value);
                    break;

                case CoreActionEventType.Performed:
                    _subscriptions[inputActionType].OnActionPerformed.OnNext(value);
                    break;

                case CoreActionEventType.Canceled:
                    _subscriptions[inputActionType].OnActionCancelled.OnNext(value);
                    break;
                }
            }
        }
 public InputActionDescription(string name, int categoryId, bool showForController = false, int sectionId = 0, InputActionType type = InputActionType.Button)
 {
     this.name              = name;
     this.categoryId        = categoryId;
     this.showForController = showForController;
     this.sectionId         = sectionId;
     this.type              = type;
 }
Esempio n. 5
0
 public InputActionDescription(string name, int categoryId, ControlType controlType = ControlType.Keyboard, int sectionId = 0, InputActionType type = InputActionType.Button)
 {
     this.name        = name;
     this.categoryId  = categoryId;
     this.controlType = controlType;
     this.sectionId   = sectionId;
     this.type        = type;
 }
Esempio n. 6
0
 public void CharacterInputHandler(InputActionType action)
 {
     if (CharacterInputQueuer != null)
     {
         StopCoroutine(CharacterInputQueuer);
     }
     CharacterInputQueuer = CharacterInputQueue(action);
     StartCoroutine(CharacterInputQueuer);
 }
Esempio n. 7
0
        private void TryAction(InputActionType inputActionType)
        {
            InputActionDelegate del;

            if (_actions.TryGetValue(inputActionType, out del))
            {
                del();
            }
        }
Esempio n. 8
0
    IEnumerator CharacterInputQueue(InputActionType action)
    {
        while (isMoving)
        {
            yield return(null);
        }

        switch (action)
        {
        case InputActionType.Weak:
            StartQuickAttack(false);
            break;

        case InputActionType.Strong:
            StartChargingAtk(AttackInputType.Strong);
            break;

        case InputActionType.Skill1:
            StartChargingAtk(AttackInputType.Skill1);
            break;

        case InputActionType.Skill2:
            StartChargingAtk(AttackInputType.Skill2);
            break;

        case InputActionType.Skill3:
            break;

        case InputActionType.Defend:
            StartDefending();
            break;

        case InputActionType.Defend_Stop:
            if (isDefending)
            {
                StopDefending();
            }
            break;

        case InputActionType.Move_Up:
            break;

        case InputActionType.Move_Down:
            break;

        case InputActionType.Move_Left:
            break;

        case InputActionType.Move_Right:
            break;

        default:
            break;
        }
    }
        ////TODO: add method to add an existing InputAction to a map

        public static InputAction AddAction(this InputActionMap map, string name, InputActionType type = default, string binding = null,
                                            string interactions = null, string processors = null, string groups = null, string expectedControlLayout = null)
        {
            if (map == null)
            {
                throw new ArgumentNullException(nameof(map));
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("Action must have name", nameof(name));
            }
            if (map.enabled)
            {
                throw new InvalidOperationException(
                          $"Cannot add action '{name}' to map '{map}' while it the map is enabled");
            }
            if (map.FindAction(name) != null)
            {
                throw new InvalidOperationException(
                          $"Cannot add action with duplicate name '{name}' to set '{map.name}'");
            }

            // Append action to array.
            var action = new InputAction(name, type)
            {
                expectedControlType = expectedControlLayout
            };

            action.GenerateId();
            ArrayHelpers.Append(ref map.m_Actions, action);
            action.m_ActionMap = map;

            ////TODO: make sure we blast out existing action map state

            // Add binding, if supplied.
            if (!string.IsNullOrEmpty(binding))
            {
                action.AddBinding(binding, interactions: interactions, processors: processors, groups: groups);
            }
            else
            {
                if (!string.IsNullOrEmpty(groups))
                {
                    throw new ArgumentException(
                              $"No binding path was specified for action '{action}' but groups was specified ('{groups}'); cannot apply groups without binding",
                              nameof(groups));
                }

                // If no binding has been supplied but there are interactions and processors, they go on the action itself.
                action.m_Interactions = interactions;
                action.m_Processors   = processors;
            }

            return(action);
        }
Esempio n. 10
0
        /// <summary>
        /// Parse the specified code.
        /// That could be some KeyCode or additional like
        /// Joystick3AxisYNegative | Joystick2PovAxisXForward
        ///
        /// </summary>
        /// <param name="code">Code.</param>
        protected void parse(String code, IDevice device)
        {
            //parse TYPE
            _type = InputActionType.SINGLE;

            if (code.Contains(InputAction.DOUBLE_DESIGNATOR))
            {
                _type = InputActionType.DOUBLE;
                code  = code.Replace(InputAction.DOUBLE_DESIGNATOR, "");
            }
            else if (code.Contains(InputAction.LONG_DESIGNATOR))
            {
                _type = InputActionType.LONG;
                code  = code.Replace(InputAction.LONG_DESIGNATOR, "");
            }


            if (device != null && device.profile != null)//parsing by profile
            {
                _code = InputCode.toCode(code, device.profile);
            }
            else//default parsing
            {
                _isJoystick = code.IndexOf("Joy") > -1;

                if ((_isMouse = code.IndexOf("Mou") > -1) && _isJoystick)
                {
                    _isKey = true;
                }



                if (_isJoystick)
                {
                    _code = InputCode.toCode(code);


                    // if (InputCode.toDeviceInx(_code) == (int)Joysticks.Joystick) _fromAny = true;
                }
                else
                {
                    if (_isKey)
                    {
                        code = code.ToUpper();
                    }
                    _code = (int)Enum.Parse(typeof(KeyCode), code);
                }
            }



            __defaultType = _type;
            __defaultCode = _code;
        }
Esempio n. 11
0
    protected override void OnInputEvent(InputActionType iat)
    {
        switch (iat)
        {
        case InputActionType.ROTATE_Y_RIGHT:
            addRotY += rotateAngleSpeed * Time.deltaTime;
            break;

        case InputActionType.ROTATE_Y_LEFT:
            addRotY += -rotateAngleSpeed * Time.deltaTime;
            break;
        }
    }
 void HandleOn_PlayerInputAction(float x, float y, InputActionType inputActionType)
 {
     if (isCrossModel)
     {
         _curAttachController.playerInputState.X = Screen.width / 2;
         _curAttachController.playerInputState.Y = Screen.height / 2;
     }
     else
     {
         _curAttachController.playerInputState.X = x;
         _curAttachController.playerInputState.Y = y;
     }
     _curAttachController.playerInputState.inputActionType = inputActionType;
 }
Esempio n. 13
0
        internal static InputAction CreateInputAction(int id, string name, InputActionType type = InputActionType.Button)
        {
            var action = new InputAction();

            action.SetFieldValue("_id", id);
            action.SetFieldValue("_name", name);
            action.SetFieldValue("_type", type);
            action.SetFieldValue("_descriptiveName", name);
            action.SetFieldValue("_behaviorId", 0);
            action.SetFieldValue("_userAssignable", true);
            action.SetFieldValue("_categoryId", 0);

            return(action);
        }
Esempio n. 14
0
    public void OnInputEvent(InputActionType action)
    {
        switch (action)
        {
        case InputActionType.ROTATE:
            rotate = true;
            break;

        case InputActionType.STOP_ROTATE:
            rotate = false;

            break;
        }
    }
        public InputActionSegment Load(BinaryReader reader)
        {
            Type = (InputActionType)reader.ReadByte();

            if (Type.IsSegmentable())
            {
                Id             = reader.ReadInt32();
                PlayerIndex    = reader.ReadVarShort();
                TotalFragments = reader.ReadVarInt();
                FragmentNumber = reader.ReadVarInt();
            }

            Payload = reader.ReadBytes(reader.ReadVarInt());
            return(this);
        }
Esempio n. 16
0
 void OnInteract(InputActionType actionType)
 {
     if (actionType == InputActionType.Down)
     {
         if (currentInteractable != null)
         {
             var item = currentInteractable.GetComponent <Item>();
             if (item != null)
             {
                 Game.Data.Inventory.AddItem(item.ItemData);
                 item.Pickup();
             }
         }
     }
 }
Esempio n. 17
0
    public void OnInputEvent(InputActionType action)
    {
        switch (action)
        {
        case InputActionType.ZOOM_IN:
            fieldOfView -= sensitivity;
            break;

        case InputActionType.ZOOM_OUT:
            fieldOfView += sensitivity;
            break;
        }

        fieldOfView            = Mathf.Clamp(fieldOfView, minFOV, maxFOV);
        zoomCamera.fieldOfView = fieldOfView;
    }
Esempio n. 18
0
        public IObservable <RegistrationValue> RegisterInputAction(InputActionType inputActionType, CoreActionEventType coreActionEventType)
        {
            switch (coreActionEventType)
            {
            case CoreActionEventType.Started:
                return(_subscriptions[inputActionType].OnActionStarted);

            case CoreActionEventType.Performed:
                return(_subscriptions[inputActionType].OnActionPerformed);

            case CoreActionEventType.Canceled:
                return(_subscriptions[inputActionType].OnActionCancelled);

            default:
                throw new ArgumentOutOfRangeException(nameof(coreActionEventType), coreActionEventType, "RegisterInputAction critical error. Verify that subscriptions are setup correctly.");
            }
        }
Esempio n. 19
0
        public static bool IsSegmentable(this InputActionType type)
        {
            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (type)
            {
            case InputActionType.WriteToConsole:
            case InputActionType.UpdateBlueprintShelf:
            case InputActionType.TransferBlueprint:
            case InputActionType.ServerCommand:
            case InputActionType.ImportBlueprintString:
            case InputActionType.ReloadScript:
                return(true);

            default:
                return(false);
            }
        }
Esempio n. 20
0
// The following is just a wrapper for UserData.AddAction(_categoryId) since it's a little fiddly to configure.
        private static InputAction AddRewiredAction(UserData userData, string name, InputActionType type, string descriptiveName, int categoryId, bool userAssignable)
        {
            // Add an action to the data store
            userData.AddAction(categoryId);

            // Get a reference to the added action
            int[]       actionIds    = userData.GetActionIds();
            int         lastActionId = actionIds[actionIds.Length - 1];
            InputAction inputAction  = userData.GetActionById(lastActionId);

            // Configure our action according to args

            if (string.IsNullOrEmpty(name) == false)
            {
                FieldInfo _name = inputAction.GetType().GetField("_name", BindingFlags.NonPublic | BindingFlags.Instance);
                _name.SetValue(inputAction, name);
            }

            if (type != InputActionType.Button)
            {
                FieldInfo _type = inputAction.GetType().GetField("_type", BindingFlags.NonPublic | BindingFlags.Instance);
                _type.SetValue(inputAction, type);
            }

            if (string.IsNullOrEmpty(descriptiveName) == false)
            {
                FieldInfo _descriptiveName = inputAction.GetType().GetField("_descriptiveName", BindingFlags.NonPublic | BindingFlags.Instance);
                _descriptiveName.SetValue(inputAction, descriptiveName);
            }

            if (!userAssignable)
            {
                FieldInfo _userAssignable = inputAction.GetType().GetField("_userAssignable", BindingFlags.NonPublic | BindingFlags.Instance);
                _userAssignable.SetValue(inputAction, userAssignable);
            }

            /*
             * if (false) { // not used for simple keybinds
             *  FieldInfo _behaviorId = inputAction.GetType().GetField("_behaviorId", BindingFlags.NonPublic | BindingFlags.Instance);
             *  _behaviorId.SetValue(inputAction, _behaviorId);
             * }
             */

            return(inputAction);
        }
Esempio n. 21
0
        public static string ToDesignatorString(this InputActionType type)
        {
            if (type == InputActionType.SINGLE)
            {
                return("");
            }

            switch (type)
            {
            case InputActionType.DOUBLE:
                return(InputAction.DOUBLE_DESIGNATOR);

            case InputActionType.LONG:
                return(InputAction.LONG_DESIGNATOR);
            }

            throw new Exception("Undefined InputActionType!");
        }
Esempio n. 22
0
        public bool GetAction(string actionName, InputActionType type)
        {
            var action = _settings.Actions.FirstOrDefault(a => a.Name == actionName);

            if (action == null)
            {
                throw new ArgumentException("Could not find an input action with name '" + actionName + "'.");
            }

            switch (type)
            {
            case InputActionType.Pressed:
                return(action.GetPressed(_state));

            case InputActionType.Released:
                return(action.GetReleased(_state));

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Esempio n. 23
0
 protected void FireTrigger(string actionName, InputActionType actionType, float delta = 0f)
 {
     FireTrigger(new InputActionEvent(actionName, Context, actionType, delta));
 }
Esempio n. 24
0
        public static Dictionary <int, RewiredInputs> m_playerInputManager = (Dictionary <int, RewiredInputs>) typeof(ControlsInput).GetField("m_playerInputManager", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); // null for static field

        //
        // USE THIS METHOD TO EASILY ADD ACTIONS AND KEYBINDINGS FOR YOUR MOD
        //
        // The name arg is displayed in the keybindings menu
        //
        // The categoryId arg determines where in the keybindings list this action will appear
        //
        // The showForController arg determines if this action can also be bound to a controller
        //
        // The sectionId arg is a weird number. It somehow affects where in the list of keybindings
        // the action appears but I haven't figured out yet what it means. I just try different numbers
        // from 0-5 until I'm happy with where in the list the keybind ends up
        //
        public static void AddAction(string name, KeybindingsCategory categoryId, ControlType controlType, int sectionId = 0, InputActionType type = InputActionType.Button)
        {
            // Capture the info the user has specified for the action they would like to create
            InputActionDescription protoAction = new InputActionDescription(name, (int)categoryId, controlType, sectionId, type);

            myActionInfos.Add(protoAction);

            // If this method is called after InputManager_Base.Initialize() has been called, then these actions won't be added
            // So let's report that back to the mod maker to avoid headaches
            bool shouldReportTooLateAdd = false;

            if (shouldReportTooLateAdd)
            {
                bool alreadyInitialized = (bool)typeof(ReInput).GetProperty("initialized", BindingFlags.NonPublic | BindingFlags.Static).GetGetMethod(true).Invoke(null, null);
                if (alreadyInitialized)
                {
                    Debug.Log("Tried to add action too late. Add your action earlier in the life cycle.");
                }
            }
        }
Esempio n. 25
0
        public InputAction Load(BinaryReader reader)
        {
            Action      = (InputActionType)reader.ReadByte();
            PlayerIndex = reader.ReadVarShort();
            switch (Action)
            {
            case InputActionType.Nothing:
            case InputActionType.StopWalking:
            case InputActionType.BeginMining:
            case InputActionType.StopMining:
            case InputActionType.ToggleDriving:
            case InputActionType.OpenGui:
            case InputActionType.CloseGui:
            case InputActionType.OpenCharacterGui:
            case InputActionType.ConnectRollingStock:
            case InputActionType.DisconnectRollingStock:
            case InputActionType.SelectedEntityCleared:
            case InputActionType.CleanCursorStack:
            case InputActionType.ResetAssemblingMachine:
            case InputActionType.OpenTechnologyGui:
            case InputActionType.LaunchRocket:
            case InputActionType.OpenBlueprintLibraryGui:
            case InputActionType.OpenProductionGui:
            case InputActionType.OpenKillsGui:
            case InputActionType.StopRepair:
            case InputActionType.CancelNewBlueprint:
            case InputActionType.CloseBlueprintRecord:
            case InputActionType.CopyEntitySettings:
            case InputActionType.PasteEntitySettings:
            case InputActionType.DestroyOpenedItem:
            case InputActionType.UpgradeOpenedBlueprint:
            case InputActionType.ToggleShowEntityInfo:
            case InputActionType.SingleplayerInit:
            case InputActionType.MultiplayerInit:
            case InputActionType.SwitchToRenameStopGui:
            case InputActionType.OpenBonusGui:
            case InputActionType.OpenTrainsGui:
            case InputActionType.OpenAchievementsGui:
            case InputActionType.OpenTutorialsGui:
            case InputActionType.CycleBlueprintBookForwards:
            case InputActionType.CycleBlueprintBookBackwards:
            case InputActionType.CycleClipboardForwards:
            case InputActionType.CycleClipboardBackwards:
            case InputActionType.StopMovementInTheNextTick:
            case InputActionType.ToggleEnableVehicleLogisticsWhileMoving:
            case InputActionType.ToggleDeconstructionItemEntityFilterMode:
            case InputActionType.ToggleDeconstructionItemTileFilterMode:
            case InputActionType.OpenLogisticGui:
            case InputActionType.CancelDropBlueprintRecord:
            case InputActionType.SelectNextValidGun:
            case InputActionType.ToggleMapEditor:
            case InputActionType.DeleteBlueprintLibrary:
            case InputActionType.GameCreatedFromScenario:
            case InputActionType.ActivateCopy:
            case InputActionType.ActivateCut:
            case InputActionType.ActivatePaste:
            case InputActionType.Undo:
            case InputActionType.TogglePersonalRoboport:
            case InputActionType.ToggleEquipmentMovementBonus:
            case InputActionType.StopBuildingByMoving:
                break;

            case InputActionType.DropItem:
                Add(new PixelPosition(reader));
                break;

            case InputActionType.BuildItem:
                Add(new PixelPosition(reader));
                Add(new Direction(reader));
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.StartWalking:
                Add(new Direction(reader));
                break;

            case InputActionType.BeginMiningTerrain:
                Add(new PixelPosition(reader));
                break;

            case InputActionType.ChangeRidingState:
                Add(new RidingState(reader));
                break;

            case InputActionType.OpenItem:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.OpenModItem:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.OpenEquipment:
                Add(new TilePosition(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.CursorTransfer:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.CursorSplit:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.StackTransfer:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.InventoryTransfer:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.CheckCRCHeuristic:
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.Craft:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.WireDragging:
                Add(new PixelPosition(reader));
                break;

            case InputActionType.ChangeShootingState:
                Add(reader.ReadByte());
                Add(new PixelPosition(reader));
                break;

            case InputActionType.SetupAssemblingMachine:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SelectedEntityChanged:
                Add(new PixelPosition(reader));
                break;

            case InputActionType.SmartPipette:
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.StackSplit:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.InventorySplit:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.CancelCraft:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SetFilter:
                Add(new ItemStackTargetSpecification(reader));
                Add(reader.ReadUInt16());
                break;

            case InputActionType.CheckCRC:
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetCircuitCondition:
                Add(reader.ReadByte());
                Add(new CircuitCondition(reader));
                break;

            case InputActionType.SetSignal:
                Add(new SignalId(reader));
                Add(reader.ReadUInt16());
                break;

            case InputActionType.StartResearch:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SetLogisticFilterItem:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetLogisticFilterSignal:
                Add(new SignalId(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetCircuitModeOfOperation:
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.GuiClick:
                Add(new GuiChangedData(reader));
                break;

            case InputActionType.GuiConfirmed:
                Add(new GuiChangedData(reader));
                break;

            case InputActionType.WriteToConsole:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.MarketOffer:
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.AddTrainStation:
                var name = reader.ReadFactorioString();
                Add(name);
                if (name.Length == 0)
                {
                    Add(new PixelPosition(reader));
                }
                Add(reader.ReadByte());
                break;

            case InputActionType.ChangeTrainStopStation:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.ChangeActiveItemGroupForCrafting:
                Add(reader.ReadByte());
                break;

            case InputActionType.GuiTextChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.GuiCheckedStateChanged:
                Add(new GuiChangedData(reader));
                break;

            case InputActionType.GuiSelectionStateChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadUInt32());
                break;

            case InputActionType.GuiSelectedTabChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadUInt32());
                break;

            case InputActionType.GuiValueChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadUInt64());
                break;

            case InputActionType.GuiSwitchStateChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.GuiLocationChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.PlaceEquipment:
                Add(new TilePosition(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.TakeEquipment:
                Add(new TilePosition(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.UseItem:
                Add(new MapPosition(reader));
                break;

            case InputActionType.UseArtilleryRemote:
                Add(new MapPosition(reader));
                break;

            case InputActionType.SetInventoryBar:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.ChangeActiveItemGroupForFilters:
                Add(reader.ReadByte());
                break;

            case InputActionType.MoveOnZoom:
                Add(new Vector(reader));
                break;

            case InputActionType.StartRepair:
                Add(new MapPosition(reader));
                break;

            case InputActionType.Deconstruct:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.Upgrade:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.Copy:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.AlternativeCopy:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.SelectBlueprintEntities:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.AltSelectBlueprintEntities:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.SetupBlueprint:
                Add(new SetupBlueprintData(reader));
                break;

            case InputActionType.SetupSingleBlueprintRecord:
                Add(new SetupBlueprintData(reader));
                break;

            case InputActionType.SetSingleBlueprintRecordIcon:
                Add(new SignalId(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.OpenBlueprintRecord:
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.CloseBlueprintBook:
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.ChangeSingleBlueprintRecordLabel:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.GrabBlueprintRecord:
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.DropBlueprintRecord:
                Add(reader.ReadUInt16());
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.DeleteBlueprintRecord:
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.CreateBlueprintLike:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.CreateBlueprintLikeStackTransfer:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.UpdateBlueprintShelf:
                Add(new UpdateBlueprintShelfData(reader));
                break;

            case InputActionType.TransferBlueprint:
                Add(new BlueprintRecordId(reader));
                Add(reader.ReadString());
                break;

            case InputActionType.TransferBlueprintImmediately:
                Add(new BlueprintRecordId(reader));
                Add(reader.ReadString());
                break;

            case InputActionType.ChangeBlueprintBookRecordLabel:
                Add(new BlueprintRecordId(reader));
                Add(reader.ReadString());
                break;

            case InputActionType.RemoveCables:
                Add(new MapPosition(reader));
                break;

            case InputActionType.ExportBlueprint:
                Add(reader.ReadUInt16());
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.ImportBlueprint:
                Add(new BlueprintRecordId(reader));
                break;

            case InputActionType.PlayerJoinGame:
                Add(new PlayerJoinGameData(reader));
                break;

            case InputActionType.CancelDeconstruct:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.CancelUpgrade:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.ChangeArithmeticCombinatorParameters:
                Add(new ArithmeticCombinatorParameters(reader));
                break;

            case InputActionType.ChangeDeciderCombinatorParameters:
                Add(new DeciderCombinatorParameters(reader));
                break;

            case InputActionType.ChangeProgrammableSpeakerParameters:
                Add(reader.ReadUInt64());
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.ChangeProgrammableSpeakerAlertParameters:
                Add(new ProgrammableSpeakerAlertParameters(reader));
                break;

            case InputActionType.ChangeProgrammableSpeakerCircuitParameters:
                Add(reader.ReadByte());
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.BuildTerrain:
                Add(new BuildTerrainParameters(reader));
                break;

            case InputActionType.ChangeTrainWaitCondition:
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.ChangeTrainWaitConditionData:
                Add(new TrainWaitConditionData(reader));
                break;

            case InputActionType.CustomInput:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.ChangeItemLabel:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.BuildRail:
                Add(reader.ReadByte());
                Add(new TilePosition(reader));
                Add(new Direction(reader));
                Add(new ExtendedBitBuffer(reader));
                Add(reader.ReadByte());
                break;

            case InputActionType.CancelResearch:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SelectArea:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.AltSelectArea:
                Add(new BoundingBox(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                break;

            case InputActionType.ServerCommand:
                Add(reader.ReadFactorioString());
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt64());
                break;

            case InputActionType.ClearSelectedBlueprint:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.ClearSelectedDeconstructionItem:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.ClearSelectedUpgradeItem:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.SetLogisticTrashFilterItem:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetInfinityContainerFilterItem:
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetInfinityPipeFilter:
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                Add(reader.ReadUInt64());
                Add(reader.ReadUInt64());
                break;

            case InputActionType.ModSettingsChanged:
                var modSettingsCount = reader.ReadUInt32();
                var modSettings      = new ModSetting[modSettingsCount];
                for (var i = 0; i < modSettingsCount; i++)
                {
                    modSettings[i] = new ModSetting(reader);
                }
                Add(modSettings);
                break;

            case InputActionType.SetEntityEnergyProperty:
                Add(reader.ReadByte());
                Add(reader.ReadUInt64());
                break;

            case InputActionType.EditCustomTag:
                Add(reader.ReadUInt64());
                Add(reader.ReadFactorioString());
                Add(new SignalId(reader));
                Add(new MapPosition(reader));
                break;

            case InputActionType.EditPermissionGroup:
                Add(new EditPermissionGroupParameters(reader));
                break;

            case InputActionType.ImportBlueprintString:
                Add(new ImportBlueprintStringData(reader));
                break;

            case InputActionType.ImportPermissionsString:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.ReloadScript:
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.ReloadScriptDataTooLarge:
                Add(reader.ReadUInt32());
                Add(reader.ReadUInt32());
                break;

            case InputActionType.GuiElemChanged:
                Add(new GuiChangedData(reader));
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                Add(new SignalId(reader));
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                break;

            case InputActionType.BlueprintTransferQueueUpdate:
                Add(reader.ReadArray(x =>
                                     new Tuple <uint, uint>(x.ReadUInt32(), x.ReadUInt32())));
                break;

            case InputActionType.DragTrainSchedule:
                Add(new TilePosition(reader));
                break;

            case InputActionType.DragTrainWaitCondition:
                Add(new TilePosition(reader));
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SelectItem:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SelectEntitySlot:
                Add(reader.ReadUInt16());
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SelectTileSlot:
                Add(reader.ReadByte());
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SelectMapperSlot:
                Add(new SelectMapperSlotParameters(reader));
                break;

            case InputActionType.DisplayResolutionChanged:
                Add(new TilePosition(reader));
                break;

            case InputActionType.QuickBarSetSlot:
                Add(reader.ReadUInt16());
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.QuickBarPickSlot:
                Add(reader.ReadUInt16());
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.QuickBarSetSelectedPage:
                Add(reader.ReadByte());
                Add(reader.ReadByte());
                break;

            case InputActionType.PlayerLeaveGame:
                Add(reader.ReadByte());
                break;

            case InputActionType.MapEditorAction:
                throw new NotImplementedException("TODO EditorAction::loadAction");

            case InputActionType.PutSpecialItemInMap:
                Add(new ItemStackTargetSpecification(reader));
                break;

            case InputActionType.ChangeMultiplayerConfig:
                Add(new MultiplayerConfigSettings(reader));
                break;

            case InputActionType.AdminAction:
                Add(new AdminAction(reader));
                break;

            case InputActionType.LuaShortcut:
                Add(reader.ReadUInt16());
                Add(reader.ReadFactorioString());
                break;

            case InputActionType.ChangePickingState:
                Add(reader.ReadByte());
                break;

            case InputActionType.SelectedEntityChangedVeryClose:
                Add(reader.ReadByte());
                break;

            case InputActionType.SelectedEntityChangedVeryClosePrecise:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.SelectedEntityChangedRelative:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SelectedEntityChangedBasedOnUnitNumber:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetAutosortInventory:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetAutoLaunchRocket:
                Add(reader.ReadByte());
                break;

            case InputActionType.SwitchConstantCombinatorState:
                Add(reader.ReadByte());
                break;

            case InputActionType.SwitchPowerSwitchState:
                Add(reader.ReadByte());
                break;

            case InputActionType.SwitchInserterFilterModeState:
                Add(reader.ReadByte());
                break;

            case InputActionType.SwitchConnectToLogisticNetwork:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetBehaviorMode:
                Add(reader.ReadByte());
                break;

            case InputActionType.FastEntityTransfer:
                Add(reader.ReadByte());
                break;

            case InputActionType.RotateEntity:
                Add(reader.ReadByte());
                break;

            case InputActionType.FastEntitySplit:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetTrainStopped:
                Add(reader.ReadByte());
                break;

            case InputActionType.ChangeControllerSpeed:
                Add(reader.ReadUInt64());
                break;

            case InputActionType.SetAllowCommands:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetResearchFinishedStopsGame:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetInserterMaxStackSize:
                Add(reader.ReadByte());
                break;

            case InputActionType.OpenTrainGui:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetEntityColor:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetDeconstructionItemTreesAndRocksOnly:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetDeconstructionItemTileSelectionMode:
                Add(reader.ReadByte());
                break;

            case InputActionType.DropToBlueprintBook:
                Add(reader.ReadUInt16());
                break;

            case InputActionType.DeleteCustomTag:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.DeletePermissionGroup:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.AddPermissionGroup:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetInfinityContainerRemoveUnfilteredItems:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetCarWeaponsControl:
                Add(reader.ReadByte());
                break;

            case InputActionType.SetRequestFromBuffers:
                Add(reader.ReadByte());
                break;

            case InputActionType.ChangeActiveQuickBar:
                Add(reader.ReadByte());
                break;

            case InputActionType.OpenPermissionsGui:
                Add(reader.ReadByte());
                break;

            case InputActionType.DisplayScaleChanged:
                Add(reader.ReadUInt64());
                break;

            case InputActionType.SetSplitterPriority:
                Add(reader.ReadByte());
                break;

            case InputActionType.GrabInternalBlueprintFromText:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.SetHeatInterfaceTemperature:
                Add(reader.ReadUInt64());
                break;

            case InputActionType.SetHeatInterfaceMode:
                Add(reader.ReadByte());
                break;

            case InputActionType.OpenTrainStationGui:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.RemoveTrainStation:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.GoToTrainStation:
                Add(reader.ReadUInt32());
                break;

            case InputActionType.RenderModeChanged:
                Add(reader.ReadByte());
                break;

            default:
                throw new Exception($"No such InputAction: 0x{Action}");
            }

            return(this);
        }
Esempio n. 26
0
 public ElementAssignmentChange(int playerId, InputMappingAction.ElementAssignmentChangeType changeType, int actionElementMapId, int actionId, Pole actionAxisContribution, InputActionType actionType, bool assignFullAxis, bool invert)
 {
     this.playerId = playerId;
     this.changeType = changeType;
     this.actionElementMapId = actionElementMapId;
     this.actionId = actionId;
     this.actionAxisContribution = actionAxisContribution;
     this.actionType = actionType;
     this.assignFullAxis = assignFullAxis;
     this.invert = invert;
 }
Esempio n. 27
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ws.winx.input.InputAction"/> class.
		/// </summary>
		/// <param name="code">Code.</param>
		/// <param name="type">Type.</param>
		public InputAction(int code,InputActionType type=InputActionType.SINGLE,IDevice device=null){
            if (code < InputCode.MAX_KEY_CODE)
            {

                code = InputCode.toCode((KeyCode)code);

            }


            __defaultCode = _code = code;

            __defaultType = _type = type;

            //if(InputCode.toDeviceInx(_code)==(int)Joysticks.Joystick) _fromAny=true;
            //Debug.Log("From Any:"+_fromAny);



            if (device != null)
                _codeString = InputCode.toProfiled(code, device);
            else
                _codeString = InputCode.toEnumString(code);

            //if(_codeString.IndexOf("Joy")>-1) throw new Exception("Use JoystickDevice.toCode function for Joystick inputs");

            if ((_isMouse = _codeString.IndexOf("Mou") > -1))
            {

                _isKey = true;
            }

            if (_type != InputActionType.SINGLE)
                _codeString += _type.ToDesignatorString();

		}
 /// <summary>
 /// Initializes a new instance of the <see cref="ws.winx.input.InputAction"/> class.
 /// </summary>
 /// <param name="code">Code.</param>
 /// <param name="type">Type.</param>
 public InputAction(KeyCode code, InputActionType type = InputActionType.SINGLE, IDevice device = null) : this((int)code, type, device)
 {
 }
 /// <summary>
 /// Reset this instance.
 /// </summary>
 public void reset()
 {
     _code = __defaultCode;
     _type = __defaultType;
 }
Esempio n. 30
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ws.winx.input.InputAction"/> class.
		/// </summary>
		/// <param name="code">Code.</param>
		/// <param name="type">Type.</param>
		public InputAction(KeyCode code,InputActionType type=InputActionType.SINGLE,IDevice device=null):this((int)code,type,device)
        {
		

		        



		}
Esempio n. 31
0
 protected virtual void OnInputEvent(InputActionType inputActionType)
 {
 }
Esempio n. 32
0
    protected override void OnInputEvent(InputActionType iat)
    {
        /*
         * switch (iat) {
         *      case InputActionType.MOVE_DOWN:
         *              rb.MovePosition(transform.position + transform.forward * -moveSpeed * Time.deltaTime);
         *              walking = true;
         *              break;
         *      case InputActionType.MOVE_LEFT:
         *              rb.MovePosition(transform.position + transform.right * -moveSpeed * Time.deltaTime);
         *              break;
         *      case InputActionType.MOVE_RIGHT:
         *              rb.MovePosition(transform.position + transform.right * moveSpeed * Time.deltaTime);
         *              break;
         *      case InputActionType.MOVE_UP:
         *              rb.MovePosition(transform.position + transform.forward * moveSpeed * Time.deltaTime);
         *              walking = true;
         *              break;
         *      case InputActionType.ROTATE_Y_RIGHT:
         *              transform.Rotate(Vector3.up * rotateSpeed);
         *              break;
         *      case InputActionType.ROTATE_Y_LEFT:
         *              transform.Rotate(Vector3.up * -rotateSpeed);
         *              break;
         *      case InputActionType.IDLE:
         *              walking = false;
         *              break;
         *      case InputActionType.JUMP:
         *              Jump();
         *              break;
         * }
         */

        switch (iat)
        {
        case InputActionType.MOVE_DOWN:
            if (moveVector.z >= 0)
            {
                moveVector.z--;
            }
            walking = true;
            break;

        case InputActionType.MOVE_LEFT:
            if (moveVector.x >= 0)
            {
                moveVector.x--;
            }
            break;

        case InputActionType.MOVE_RIGHT:
            if (moveVector.x <= 0)
            {
                moveVector.x++;
            }
            break;

        case InputActionType.MOVE_UP:
            if (moveVector.z <= 0)
            {
                moveVector.z++;
            }
            walking = true;
            break;

        case InputActionType.ROTATE_Y_RIGHT:
            break;

        case InputActionType.ROTATE_Y_LEFT:
            break;

        case InputActionType.IDLE:
            walking = false;
            break;

        case InputActionType.JUMP:
            jump = true;
            break;
        }

        anim.SetBool("Walking", walking);
    }
Esempio n. 33
0
		/// <summary>
		/// Reset this instance.
		/// </summary>
		public void reset(){
			_code=__defaultCode;
			_type=__defaultType;
		}
Esempio n. 34
0
 public InputAction(InputActionType type, Action action, KeyPressType keyPressType = KeyPressType.Press)
 {
     Type         = type;
     Action       = action;
     KeyPressType = keyPressType;
 }
Esempio n. 35
0
		/// <summary>
		/// Parse the specified code.
		/// That could be some KeyCode or additional like
		/// Joystick3AxisYNegative | Joystick2PovAxisXForward 
		///
		/// </summary>
		/// <param name="code">Code.</param>
		protected void parse(String code,IDevice device){

         


				//parse TYPE
               _type = InputActionType.SINGLE;

            if (code.Contains(InputAction.DOUBLE_DESIGNATOR))
            {
                _type = InputActionType.DOUBLE;
                code = code.Replace(InputAction.DOUBLE_DESIGNATOR, "");


            }
            else if (code.Contains(InputAction.LONG_DESIGNATOR))
            {
                _type = InputActionType.LONG;
                code = code.Replace(InputAction.LONG_DESIGNATOR, "");

            }


            if (device != null  && device.profile!=null)//parsing by profile
            {

                _code = InputCode.toCode(code, device.profile);

      
            }
            else//default parsing 
            {
                _isJoystick = code.IndexOf("Joy") > -1;

                if ((_isMouse = code.IndexOf("Mou") > -1) && _isJoystick)
                {

                    _isKey = true;
                }



                if (_isJoystick)
                {



                    _code = InputCode.toCode(code);


                   // if (InputCode.toDeviceInx(_code) == (int)Joysticks.Joystick) _fromAny = true;


                }
                else
                {
                    if (_isKey) code = code.ToUpper();
                    _code = (int)Enum.Parse(typeof(KeyCode), code);
                }

            }





			__defaultType=_type;
			__defaultCode=_code;

		}
Esempio n. 36
0
 public ElementAssignmentChange(
     int playerId,
     int controllerId,
     ControllerType controllerType,
     ControllerMap controllerMap,
     ElementAssignmentChangeType changeType,
     int actionElementMapId,
     int actionId,
     Pole actionAxisContribution,
     InputActionType actionType,
     bool assignFullAxis,
     bool invert
 ) : base(QueueActionType.ElementAssignment) {
     this.playerId = playerId;
     this.controllerId = controllerId;
     this.controllerType = controllerType;
     this.controllerMap = controllerMap;
     this.changeType = changeType;
     this.actionElementMapId = actionElementMapId;
     this.actionId = actionId;
     this.actionAxisContribution = actionAxisContribution;
     this.actionType = actionType;
     this.assignFullAxis = assignFullAxis;
     this.invert = invert;
 }