示例#1
0
        void PrepareForUpdate(ulong updateTick)
        {
            if (this == InputControl.Null)
            {
                return;
            }

            if (updateTick < pendingTick)
            {
                throw new InvalidOperationException("Cannot be updated with an earlier tick.");
            }

            if (pendingCommit && updateTick != pendingTick)
            {
                throw new InvalidOperationException("Cannot be updated for a new tick until pending tick is committed.");
            }

            if (updateTick > pendingTick)
            {
                lastState = thisState;
                nextState.Reset();
                pendingTick   = updateTick;
                pendingCommit = true;
            }
        }
示例#2
0
        public void Commit()
        {
            thisState = tempState;

            WasRepeated = false;
            if (WasReleased)
            {
                nextRepeatTime = 0.0f;
            }
            else
            if (IsPressed)
            {
                if (HasChanged)
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else
                if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    WasRepeated    = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }

            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }

            pendingCommit = false;
        }
示例#3
0
        internal void PreUpdate(ulong updateTick)
        {
            RawValue = null;
            PreValue = null;

            lastState = thisState;
            tempState.Reset();
        }
示例#4
0
 internal void PostUpdate(ulong updateTick)
 {
     thisState = tempState;
     if (thisState != lastState)
     {
         UpdateTick = updateTick;
     }
 }
		internal void PreUpdate( ulong updateTick )
		{
			RawValue = null;
			PreValue = null;

			lastState = thisState;
			tempState.Reset();
		}
示例#6
0
        public void Commit()
        {
            if (IsNull)
            {
                return;
            }

            pendingCommit = false;
            // nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold );
            thisState = nextState;

            if (clearInputState)
            {
                // The net result here should be that the entire state will return zero/false
                // from when ResetState() is called until the next call to Commit(), which is
                // the next update tick, and WasPressed, WasReleased and WasRepeated will then
                // return false during this following tick.
                lastState       = nextState;
                UpdateTick      = pendingTick;
                clearInputState = false;
                return;
            }

            var lastPressed = lastState.State;
            var thisPressed = thisState.State;

            wasRepeated = false;
            if (lastPressed && !thisPressed)             // if was released...
            {
                nextRepeatTime = 0.0f;
            }
            else
            if (thisPressed)                    // if is pressed...
            {
                if (lastPressed != thisPressed) // if has changed...
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else
                if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    wasRepeated    = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }

            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }

            //ÉèÖûص÷
            SetCallback();
        }
示例#7
0
        internal void SetValue(float value, ulong updateTick)
        {
            if (updateTick > pendingTick)
            {
                lastState = thisState;
                nextState.Reset();
                pendingTick   = updateTick;
                pendingCommit = true;
            }

            nextState.RawValue = value;
            nextState.Set(value, StateThreshold);
        }
示例#8
0
        public void UpdateWithValue(float value, float updateTime)
        {
            if (IsNull)
            {
                throw new InvalidOperationException("A null control cannot be updated.");
            }

            lastState = thisState;

            if (thisState != value)
            {
                UpdateTime = updateTime;
                thisState.Set(value);
            }
        }
		public void UpdateWithValue( float value, ulong updateTick, float stateThreshold )
		{
			if (UpdateTick > updateTick)
			{
				throw new InvalidOperationException( "A control cannot be updated with an earlier tick." );
			}

			lastState = thisState;

			thisState.Set( value, stateThreshold );

			if (thisState != lastState)
			{
				UpdateTick = updateTick;
			}
		}
        public void UpdateWithValue(float value, ulong updateTick, float stateThreshold)
        {
            if (UpdateTick > updateTick)
            {
                throw new InvalidOperationException("A control cannot be updated with an earlier tick.");
            }

            lastState = thisState;

            thisState.Set(value, stateThreshold);

            if (thisState != lastState)
            {
                UpdateTick = updateTick;
            }
        }
示例#11
0
		void PrepareForUpdate( ulong updateTick )
		{
			if (updateTick < pendingTick)
			{
				throw new InvalidOperationException( "Cannot be updated with an earlier tick." );
			}

			if (pendingCommit && updateTick != pendingTick)
			{
				throw new InvalidOperationException( "Cannot be updated for a new tick until pending tick is committed." );
			}

			if (updateTick > pendingTick)
			{
				lastState = thisState;
				tempState.Reset();
				pendingTick = updateTick;
				pendingCommit = true;
			}
		}
        public void Commit()
        {
            if (IsNull)
            {
                return;
            }
            pendingCommit = false;
            thisState     = nextState;
            if (clearInputState)
            {
                lastState       = nextState;
                UpdateTick      = pendingTick;
                clearInputState = false;
                return;
            }
            bool state  = lastState.State;
            bool state2 = thisState.State;

            wasRepeated = false;
            if (state && !state2)
            {
                nextRepeatTime = 0f;
            }
            else if (state2)
            {
                if (state != state2)
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    wasRepeated    = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }
            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }
        }
示例#13
0
        public void Commit()
        {
//			nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold );

            thisState = nextState;

            var lastPressed = lastState.State;
            var thisPressed = thisState.State;

            wasRepeated = false;
            if (lastPressed && !thisPressed)             // if was released...
            {
                nextRepeatTime = 0.0f;
            }
            else
            if (thisPressed)                    // if is pressed...
            {
                if (lastPressed != thisPressed) // if has changed...
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else
                if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    wasRepeated    = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }

            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }

            pendingCommit = false;
        }
示例#14
0
        public void Commit()
        {
            thisState = tempState;

            var lastPressed = lastState.State;
            var thisPressed = thisState.State;

            wasRepeated = false;
            if (lastPressed && !thisPressed) // if (WasReleased)
            {
                nextRepeatTime = 0.0f;
            }
            else
            if (thisPressed) // if (IsPressed)
            {
                if (lastPressed != thisPressed) // if (HasChanged)
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else
                if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    wasRepeated = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }

            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }

            pendingCommit = false;
        }
示例#15
0
 internal void PreUpdate(ulong updateTick)
 {
     lastState = thisState;
     tempState.Reset();
 }
示例#16
0
		internal void SetValue( float value, ulong updateTick )
		{
			if (updateTick > pendingTick)
			{
				lastState = thisState;
				nextState.Reset();
				pendingTick = updateTick;
				pendingCommit = true;
			}

			nextState.RawValue = value;
			nextState.Set( value, StateThreshold );
		}
示例#17
0
		public void Commit()
		{
//			nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold );

			thisState = nextState;

			var lastPressed = lastState.State;
			var thisPressed = thisState.State;

			wasRepeated = false;
			if (lastPressed && !thisPressed) // if was released...
			{
				nextRepeatTime = 0.0f;
			}
			else
			if (thisPressed) // if is pressed...
			{
				if (lastPressed != thisPressed) // if has changed...
				{
					nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
				}
				else
				if (Time.realtimeSinceStartup >= nextRepeatTime)
				{
					wasRepeated = true;
					nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
				}
			}

			if (thisState != lastState)
			{
				UpdateTick = pendingTick;
			}

			pendingCommit = false;
		}
示例#18
0
        public void Commit()
        {
            pendingCommit = false;
            //			nextState.Set( Utility.ApplySmoothing( nextState.Value, lastState.Value, Time.deltaTime, sensitivity ), stateThreshold );
            thisState = nextState;

            if (clearInputState)
            {
                // The net result here should be that the entire state will return zero/false
                // from when ResetState() is called until the next call to Commit(), which is
                // the next update tick, and WasPressed, WasReleased and WasRepeated will then
                // return false during this following tick.
                lastState = nextState;
                UpdateTick = pendingTick;
                clearInputState = false;
                return;
            }

            var lastPressed = lastState.State;
            var thisPressed = thisState.State;

            wasRepeated = false;
            if (lastPressed && !thisPressed) // if was released...
            {
                nextRepeatTime = 0.0f;
            }
            else
            if (thisPressed) // if is pressed...
            {
                if (lastPressed != thisPressed) // if has changed...
                {
                    nextRepeatTime = Time.realtimeSinceStartup + FirstRepeatDelay;
                }
                else
                if (Time.realtimeSinceStartup >= nextRepeatTime)
                {
                    wasRepeated = true;
                    nextRepeatTime = Time.realtimeSinceStartup + RepeatDelay;
                }
            }

            if (thisState != lastState)
            {
                UpdateTick = pendingTick;
            }
        }
示例#19
0
 internal void PreUpdate( ulong updateTick )
 {
     lastState = thisState;
     tempState.Reset();
 }
		internal void PostUpdate( ulong updateTick )
		{
			thisState = tempState;
			if (thisState != lastState)
			{
				UpdateTick = updateTick;
			}
		}
示例#21
0
        public void UpdateWithValue( float value, float updateTime )
        {
            if (IsNull)
            {
                throw new InvalidOperationException( "A null control cannot be updated." );
            }

            lastState = thisState;

            if (thisState != value)
            {
                UpdateTime = updateTime;
                thisState.Set( value );
            }
        }