void Start () {
        body = GetComponent<Rigidbody>();
        forwardsVector = Vector3.forward;
        sphereCollider = GetComponent<SphereCollider>();

        input = PlayerInput.GetInput((int)playerNumber);
    }
示例#2
0
        public void Apply_UnknownTypeThatCannotBeConstructed_ShouldThrowException()
        {
            // Arrange & Act
            Action action = () => InputMapper.Apply(_interopMock.Object, DataHandle, new { UnknownType = 1.0f });

            // Assert
            action.Should().Throw <InvalidOperationException>()
            .WithMessage("No matching field constructor found");
        }
示例#3
0
 void Start()
 {
     controllerLayoutIndex = InputMapper.PlayerNumToControllerLayoutIndex(playerNum);
     // Only first player layout (keyboard + mouse) is allowed to use mouse
     if (controllerLayoutIndex != 0)
     {
         supportMouse = false;
     }
 }
示例#4
0
 private void Update()
 {
     InputMapper.GetMovement();
     if (!lastControllerValue && InputMapper.usingController && selectedByDefault)
     {
         GetComponent <Button>().Select();
     }
     lastControllerValue = InputMapper.usingController;
 }
示例#5
0
 void Update()
 {
     if (EventSystem.current.currentSelectedGameObject == gameObject)
     {
         if (InputMapper.InteractionButton())
         {
             button.onClick.Invoke();
         }
     }
 }
示例#6
0
    void Start()
    {
        m_characterController = GetComponent <CharacterController>();
        m_inputMapper         = GetComponent <InputMapper>();

        // from the SUVAT equation:
        // v^2 = u^2 + 2as where u = 0
        // thanks chillwell.
        m_jumpForce = Mathf.Sqrt(jumpHeight * Physics.gravity.y * -2.0f);
    }
示例#7
0
 private void Start()
 {
     _inputMapper = new InputMapper();
     _inputConfig = Resources.Load <InputConfig>("InputConfig");
     _inputContextDic.Add(_inputConfig.normalHumanContext.inputContextType, new InputContext(_inputConfig.normalHumanContext));
     _inputContextDic.Add(_inputConfig.priorityConfig.inputContextType, new InputContext(_inputConfig.priorityConfig));
     currentInputContextType = EInputContextType.NormalHumanPlayer;
     AddInputContext(currentInputContextType);
     InitVirtualKeyAccessableDic();
 }
示例#8
0
        protected GameBase(Options options, IGamePlatformFactory gamePlatformFactory, IGraphicsFactory graphicsFactory, IInputFactory inputFactory)
        {
            _options             = options;
            _gamePlatformFactory = gamePlatformFactory;
            GraphicsFactory      = graphicsFactory;
            _inputFactory        = inputFactory;
            _inputMapper         = new InputMapper(_inputFactory);

            _gameLoop = _gamePlatformFactory.CreateGameLoop();
        }
示例#9
0
        public void Apply_NullString_ShouldNotMapString()
        {
            RfcErrorInfo errorInfo;

            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeString = (string)null });

            _interopMock.Verify(
                x => x.SetString(It.IsAny <IntPtr>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <uint>(), out errorInfo),
                Times.Never);
        }
示例#10
0
        public void Apply_Double_ShouldMapAsFloat()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeDouble = 1234.5d });

            // Assert
            _interopMock.Verify(x => x.SetFloat(DataHandle, "SOMEDOUBLE", 1234.5d, out errorInfo), Times.Once);
        }
示例#11
0
        public void Apply_Int_ShouldMapAsInt()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeInt = 555 });

            // Assert
            _interopMock.Verify(x => x.SetInt(DataHandle, "SOMEINT", 555, out errorInfo), Times.Once);
        }
示例#12
0
        internal bool Refresh(InputMapper mapper)
        {
            var mappingCollection = mapper.GetMapping(inputType);

            if (mappingCollection != null)
            {
                double newValue = mappingCollection.GetValue(inputType);
                return(RefreshValue(newValue));
            }
            return(false);
        }
示例#13
0
        public void Apply_String_ShouldMapAsString()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeString = "Hello" });

            // Assert
            _interopMock.Verify(x => x.SetString(DataHandle, "SOMESTRING", "Hello", 5, out errorInfo));
        }
示例#14
0
        public void Apply_CharArray_ShouldMapAsCharArray()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeCharArray = new char[] { '0', '1', '2' } });

            // Assert
            _interopMock.Verify(x => x.SetChars(DataHandle, "SOMECHARARRAY", new char[] { '0', '1', '2' }, 3, out errorInfo));
        }
示例#15
0
        public void Apply_ByteArray_ShouldMapAsByteArray()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeByteArray = new byte[] { 0, 1, 2 } });

            // Assert
            _interopMock.Verify(x => x.SetBytes(DataHandle, "SOMEBYTEARRAY", new byte[] { 0, 1, 2 }, 3, out errorInfo));
        }
示例#16
0
        public void Apply_Decimal_ShouldMapAsFormattedString()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeDecimal = 123.4M });

            // Assert
            _interopMock.Verify(x => x.SetString(DataHandle, "SOMEDECIMAL", "123.4", 5, out errorInfo), Times.Once);
        }
示例#17
0
 // Token: 0x06001847 RID: 6215 RVA: 0x000739BC File Offset: 0x00071BBC
 private void RemoveInputMapper(InputMapper inputMapper)
 {
     inputMapper.ConflictFoundEvent -= this.InputMapperOnConflictFoundEvent;
     inputMapper.CanceledEvent      -= this.InputMapperOnCanceledEvent;
     inputMapper.ErrorEvent         -= this.InputMapperOnErrorEvent;
     inputMapper.InputMappedEvent   -= this.InputMapperOnInputMappedEvent;
     inputMapper.StartedEvent       -= this.InputMapperOnStartedEvent;
     inputMapper.StoppedEvent       -= this.InputMapperOnStoppedEvent;
     inputMapper.TimedOutEvent      -= this.InputMapperOnTimedOutEvent;
     this.inputMappers.Remove(inputMapper);
 }
示例#18
0
 private void Update()
 {
     if (continueTimer > 0.2f && InputMapper.InteractionButton())
     {
         callback?.Invoke(0);
     }
     else if (continueTimer <= 0.2f)
     {
         continueTimer += Time.unscaledDeltaTime;
     }
 }
示例#19
0
        public void MapperTest(double min, double max, double value, double mappedValue)
        {
            var mapper = new InputMapper
            {
                MinValue = min,
                MaxValue = max,
            };
            double result = mapper.GetValue(value);

            Assert.AreEqual(mappedValue, result);
        }
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
示例#21
0
 private void Awake()
 {
     if (Instance)
     {
         GameObject.Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
 }
示例#22
0
        public void Apply_Long_ShouldMapAsInt8()
        {
            // Arrange
            RfcErrorInfo errorInfo;

            // Act
            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeLong = 123L });

            // Assert
            _interopMock.Verify(x => x.SetInt8(DataHandle, "SOMELONG", 123L, out errorInfo), Times.Once);
        }
示例#23
0
    private void Awake()
    {
        inputMapper = GetComponent <InputMapper>();

        foreach (InputSystem system in inputSystems)
        {
            inputMapper.AddToWatch(system);
        }

        InputSystem = inputMapper;
    }
示例#24
0
        public void Apply_Array_ShouldMapAsTable()
        {
            RfcErrorInfo errorInfo;
            var          model = new { SomeArray = Fixture.CreateMany <ArrayElement>(2).ToArray() };

            InputMapper.Apply(_interopMock.Object, DataHandle, model);

            IntPtr tableHandle;

            _interopMock.Verify(x => x.GetTable(DataHandle, "SOMEARRAY", out tableHandle, out errorInfo), Times.Once);
        }
示例#25
0
        public void Apply_ModelWithCustomNameAttribute_ShouldUseCustomSapNameInsteadOfPropertyName()
        {
            RfcErrorInfo errorInfo;
            var          model = new CustomNameAttributeModel {
                Value = 123
            };

            InputMapper.Apply(_interopMock.Object, DataHandle, model);

            _interopMock.Verify(x => x.SetInt(DataHandle, "CUSTOM_IN_VAL", 123, out errorInfo), Times.Once);
        }
示例#26
0
 void Awake()
 {
     _qualtyNames = QualitySettings.names;
     _inputMapper = InputMapper.Default;
     _inputMapper.options.timeout          = 5;
     _inputMapper.options.ignoreMouseXAxis = true;
     _inputMapper.options.ignoreMouseYAxis = true;
     ReInput.userDataStore.Load();
     _version.text = Game.Version.ToString("F2");
     //_partyManagement.OnWindowClose += CloseClassMenu;
     //_partyManagement.OnWindowConfirm += StartNewGame;
 }
    // Start is called before the first frame update
    void Start()
    {
        inputMapper = GetComponent <InputMapper>();

        //inputMapper.AddMapping(Action.Test, KeyCode.A);
        //Debug.Log("Added mapping for Test");
        //inputMapper.AddMapping(Action.MoveLeft, KeyCode.S);
        //Debug.Log("Added mapping for MoveLeft");

        //inputMapper.RemoveMapping(Action.Test);
        //Debug.Log("Removed mapping for Test");
    }
示例#28
0
        public void Apply_ModelWithSapIgnoreAttribute_ShouldIgnorePropertiesWithIgnoreAttribute()
        {
            RfcErrorInfo errorInfo;
            var          model = new SapIgnoreAttributeModel {
                Value = 123, IgnoredProperty = 234
            };

            InputMapper.Apply(_interopMock.Object, DataHandle, model);

            _interopMock.Verify(x => x.SetInt(DataHandle, "VALUE", 123, out errorInfo), Times.Once);
            _interopMock.Verify(x => x.SetInt(DataHandle, "IGNOREDPROPERTY", 234, out errorInfo), Times.Never);
        }
示例#29
0
        public override void Apply(IRfcInterop interop, IntPtr dataHandle)
        {
            RfcResultCodes resultCode = interop.GetStructure(
                dataHandle: dataHandle,
                name: Name,
                structHandle: out IntPtr structHandle,
                out RfcErrorInfo errorInfo);

            resultCode.ThrowOnError(errorInfo);

            InputMapper.Apply(interop, structHandle, Value);
        }
示例#30
0
 private void Update()
 {
     if (InputMapper.DropButton())
     {
         for (int i = 0; i < buttons.Count; i++)
         {
             if (buttons[i].gameObject == EventSystem.current.currentSelectedGameObject)
             {
                 container.DropItem(i);
             }
         }
     }
 }
示例#31
0
        public void Apply_NullableDateTime_HasValue_ShouldMapAsDate()
        {
            RfcErrorInfo errorInfo;
            DateTime?    date = new DateTime(2020, 4, 1);

            InputMapper.Apply(_interopMock.Object, DataHandle, new { SomeDate = date });

            _interopMock.Verify(x => x.SetDate(
                                    DataHandle,
                                    "SOMEDATE",
                                    It.Is <char[]>(y => y.SequenceEqual("20200401")),
                                    out errorInfo));
        }
示例#32
0
 public InputControlSetup()
 {
     Mapper = new InputMapper();
     Mapper.AddInputBindProvider(typeof(KeyInputBindProvider), new KeyInputBindProvider());
     Mapper.AddInputBindProvider(typeof(PadInputBindProvider), new PadInputBindProvider());
 }
示例#33
0
 public InputManager(Microsoft.Xna.Framework.Game game)
     : base(game)
 {
     stateProviders = new Dictionary<Type, IInputStateProvider>();
     Mapper = new InputMapper();
 }