Event Data associated with Axis Events (Controller / Keyboard).

Inheritance: BaseEventData
Esempio n. 1
1
 // Update is called once per frame
 void Update() {
     // Submit button
     if (ButtonDown("Submit")) {
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.submitHandler);
     }
     // Cancel button
     if (ButtonDown("Menu")) {
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.cancelHandler);
     }
     // Direction buttons
     if (ButtonDown("MenuUp")) {
         AxisEventData axisEventData = new AxisEventData(eventSystem);
         axisEventData.moveDir = MoveDirection.Up;
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
     } else if (ButtonDown("MenuDown")) {
         AxisEventData axisEventData = new AxisEventData(eventSystem);
         axisEventData.moveDir = MoveDirection.Down;
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
     } else if (ButtonDown("MenuLeft")) {
         AxisEventData axisEventData = new AxisEventData(eventSystem);
         axisEventData.moveDir = MoveDirection.Left;
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
     } else if (ButtonDown("MenuRight")) {
         AxisEventData axisEventData = new AxisEventData(eventSystem);
         axisEventData.moveDir = MoveDirection.Right;
         ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
     }
 }
Esempio n. 2
0
    // ####################################################################################################################################### Methods

    /// <summary>
    /// Input cycle
    /// </summary>
    void Update()
    {
        input_timer -= Time.deltaTime;
        if (input_timer <= 0f)
        {
            AxisEventData ad = new AxisEventData(EventSystem.current);
            //BaseEventData bd = new BaseEventData(EventSystem.current);
            if (Controls.Control.GetLH() > 0.5f)
            {
                ad.moveDir = MoveDirection.Right;
            }
            else if (Controls.Control.GetLH() < -0.5f)
            {
                ad.moveDir = MoveDirection.Left;
            }
            else if (Controls.Control.GetLV() > 0.5f)
            {
                ad.moveDir = MoveDirection.Up;
            }
            else if (Controls.Control.GetLV() < -0.5f)
            {
                ad.moveDir = MoveDirection.Down;
            }
            else if (Controls.Control.GetADown())
            {
                ExecuteEvents.Execute(EventSystem.current.currentSelectedGameObject, new BaseEventData(EventSystem.current), ExecuteEvents.submitHandler);
            }
            else
            {
                return;
            }
            ExecuteEvents.Execute(EventSystem.current.currentSelectedGameObject, ad, ExecuteEvents.moveHandler);
            input_timer = InputDelay;
        }        
    }
 static public int constructor(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.EventSystems.AxisEventData o;
         UnityEngine.EventSystems.EventSystem   a1;
         checkType(l, 2, out a1);
         o = new UnityEngine.EventSystems.AxisEventData(a1);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Esempio n. 4
0
 public void Call(UnityEngine.EventSystems.AxisEventData param0)
 {
     func.BeginPCall();
     func.PushObject(param0);
     func.PCall();
     func.EndPCall();
 }
 static public int set_moveVector(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         UnityEngine.Vector2 v;
         checkType(l, 2, out v);
         self.moveVector = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Esempio n. 6
0
 static int OnMove(IntPtr L)
 {
     L.ChkArgsCount(2);
     UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)L.ChkUnityObjectSelf(1, "UnityEngine.UI.Selectable");
     UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)L.ChkUserData(2, typeof(UnityEngine.EventSystems.AxisEventData));
     obj.OnMove(arg0);
     return(0);
 }
Esempio n. 7
0
 static public int set_moveVector(IntPtr l)
 {
     UnityEngine.EventSystems.AxisEventData o = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
     UnityEngine.Vector2 v;
     checkType(l, 2, out v);
     o.moveVector = v;
     return(0);
 }
Esempio n. 8
0
 static public int set_moveDir(IntPtr l)
 {
     UnityEngine.EventSystems.AxisEventData o = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
     UnityEngine.EventSystems.MoveDirection v;
     checkEnum(l, 2, out v);
     o.moveDir = v;
     return(0);
 }
 static int OnMove(IntPtr L)
 {
     LuaScriptMgr.CheckArgsCount(L, 2);
     UnityEngine.UI.Slider obj = (UnityEngine.UI.Slider)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.UI.Slider");
     UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)LuaScriptMgr.GetNetObject(L, 2, typeof(UnityEngine.EventSystems.AxisEventData));
     obj.OnMove(arg0);
     return(0);
 }
Esempio n. 10
0
 static int OnMove(IntPtr L)
 {
     L.ChkArgsCount(2);
     ZFrame.UGUI.UIEventTrigger             obj  = (ZFrame.UGUI.UIEventTrigger)L.ChkUnityObjectSelf(1, "ZFrame.UGUI.UIEventTrigger");
     UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)L.ChkUserData(2, typeof(UnityEngine.EventSystems.AxisEventData));
     obj.OnMove(arg0);
     return(0);
 }
 static public int constructor(IntPtr l)
 {
     UnityEngine.EventSystems.AxisEventData o;
     UnityEngine.EventSystems.EventSystem   a1;
     checkType(l, 2, out a1);
     o = new UnityEngine.EventSystems.AxisEventData(a1);
     pushObject(l, o);
     return(1);
 }
Esempio n. 12
0
    static int OnMove(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Toggle obj = LuaScriptMgr.GetNetObject <Toggle>(L, 1);

        EventSystems.AxisEventData arg0 = LuaScriptMgr.GetNetObject <EventSystems.AxisEventData>(L, 2);
        obj.OnMove(arg0);
        return(0);
    }
Esempio n. 13
0
        /// <summary>
        /// Given some input data generate an AxisEventData that can be used by the event system.
        /// </summary>
        /// <param name="x">X movement.</param>
        /// <param name="y">Y movement.</param>
        /// <param name="deadZone">Dead zone.</param>
        protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
        {
            if (m_AxisEventData == null)
                m_AxisEventData = new AxisEventData(eventSystem);

            m_AxisEventData.Reset();
            m_AxisEventData.moveVector = new Vector2(x, y);
            m_AxisEventData.moveDir = DetermineMoveDirection(x, y, moveDeadZone);
            return m_AxisEventData;
        }
 static public int get_moveDir(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         pushEnum(l, (int)self.moveDir);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 15
0
 /// <summary>
 ///
 /// <para>
 /// Given some input data generate an AxisEventData that can be used by the event system.
 /// </para>
 ///
 /// </summary>
 /// <param name="x">X movement.</param><param name="y">Y movement.</param><param name="moveDeadZone">Dead Zone.</param>
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
Esempio n. 16
0
 static public int get_moveVector(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.moveVector);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 17
0
 static public int get_moveVector(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         pushValue(l, self.moveVector);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 18
0
        protected bool SendMoveEventToSelectedObject()
        {
            float   unscaledTime  = Time.unscaledTime;
            Vector2 rawMoveVector = this.GetRawMoveVector();
            bool    result;

            if (Mathf.Approximately(rawMoveVector.x, 0f) && Mathf.Approximately(rawMoveVector.y, 0f))
            {
                this.m_ConsecutiveMoveCount = 0;
                result = false;
            }
            else
            {
                bool flag  = base.input.GetButtonDown(this.m_HorizontalAxis) || base.input.GetButtonDown(this.m_VerticalAxis);
                bool flag2 = Vector2.Dot(rawMoveVector, this.m_LastMoveVector) > 0f;
                if (!flag)
                {
                    if (flag2 && this.m_ConsecutiveMoveCount == 1)
                    {
                        flag = (unscaledTime > this.m_PrevActionTime + this.m_RepeatDelay);
                    }
                    else
                    {
                        flag = (unscaledTime > this.m_PrevActionTime + 1f / this.m_InputActionsPerSecond);
                    }
                }
                if (!flag)
                {
                    result = false;
                }
                else
                {
                    AxisEventData axisEventData = this.GetAxisEventData(rawMoveVector.x, rawMoveVector.y, 0.6f);
                    if (axisEventData.moveDir != MoveDirection.None)
                    {
                        ExecuteEvents.Execute <IMoveHandler>(base.eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
                        if (!flag2)
                        {
                            this.m_ConsecutiveMoveCount = 0;
                        }
                        this.m_ConsecutiveMoveCount++;
                        this.m_PrevActionTime = unscaledTime;
                        this.m_LastMoveVector = rawMoveVector;
                    }
                    else
                    {
                        this.m_ConsecutiveMoveCount = 0;
                    }
                    result = axisEventData.used;
                }
            }
            return(result);
        }
 static public int set_moveDir(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         UnityEngine.EventSystems.MoveDirection v;
         checkEnum(l, 2, out v);
         self.moveDir = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 20
0
        /// <summary>
        /// Given some input data generate an AxisEventData that can be used by the event system.
        /// 生成一个AxisEventData
        /// </summary>
        /// <param name="x">X movement.</param>
        /// <param name="y">Y movement.</param>
        /// <param name="moveDeadZone">Dead zone.</param>
        protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
        {
            if (m_AxisEventData == null)
            {
                m_AxisEventData = new AxisEventData(eventSystem);
            }

            //设置m_Used标记为假,表示该事件数据未被使用过
            m_AxisEventData.Reset();
            m_AxisEventData.moveVector = new Vector2(x, y);
            m_AxisEventData.moveDir    = DetermineMoveDirection(x, y, moveDeadZone);
            return(m_AxisEventData);
        }
Esempio n. 21
0
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {        /*	used in StandaloneInputModule.SendMoveEventToSelectedObject()
           *     create new AxisEventData and assign m_AxisEventData to it
           *     update its fields
           */
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir    = BaseInputModule.DetermineMoveDirection(x, y, moveDeadZone);
     return(this.m_AxisEventData);
 }
Esempio n. 22
0
 static int QPYX_OnMove_YXQP(IntPtr L_YXQP)
 {
     try
     {
         ToLua.CheckArgsCount(L_YXQP, 2);
         UnityEngine.UI.Scrollbar QPYX_obj_YXQP = (UnityEngine.UI.Scrollbar)ToLua.CheckObject <UnityEngine.UI.Scrollbar>(L_YXQP, 1);
         UnityEngine.EventSystems.AxisEventData QPYX_arg0_YXQP = (UnityEngine.EventSystems.AxisEventData)ToLua.CheckObject <UnityEngine.EventSystems.AxisEventData>(L_YXQP, 2);
         QPYX_obj_YXQP.OnMove(QPYX_arg0_YXQP);
         return(0);
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
Esempio n. 23
0
 static public int set_moveVector(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         UnityEngine.Vector2 v;
         checkType(l, 2, out v);
         self.moveVector = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData o;
         UnityEngine.EventSystems.EventSystem   a1;
         checkType(l, 2, out a1);
         o = new UnityEngine.EventSystems.AxisEventData(a1);
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 25
0
 static public int set_moveVector(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData self = (UnityEngine.EventSystems.AxisEventData)checkSelf(l);
         UnityEngine.Vector2 v;
         checkType(l, 2, out v);
         self.moveVector = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Esempio n. 26
0
 static int OnMove(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.UI.Selectable obj = (UnityEngine.UI.Selectable)ToLua.CheckObject(L, 1, typeof(UnityEngine.UI.Selectable));
         UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.AxisEventData));
         obj.OnMove(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 27
0
 static int OnMove(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.UI.Slider obj = (UnityEngine.UI.Slider)ToLua.CheckObject <UnityEngine.UI.Slider>(L, 1);
         UnityEngine.EventSystems.AxisEventData arg0 = (UnityEngine.EventSystems.AxisEventData)ToLua.CheckObject <UnityEngine.EventSystems.AxisEventData>(L, 2);
         obj.OnMove(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Esempio n. 28
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.EventSystems.AxisEventData o;
     if (matchType(l, 1, typeof(UnityEngine.EventSystems.EventSystem)))
     {
         UnityEngine.EventSystems.EventSystem a1;
         checkType(l, 1, out a1);
         o = new UnityEngine.EventSystems.AxisEventData(a1);
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
		public override void OnMove (AxisEventData eventData)
		{
			switch (eventData.moveDir)
			{
				case MoveDirection.Left:
					Count.Value -= 1;
					break;
				case MoveDirection.Right:
					Count.Value += 1;
					break;
				default:
					base.OnMove(eventData);
					break;
			}

		}
    static int set_moveVector(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.EventSystems.AxisEventData obj = (UnityEngine.EventSystems.AxisEventData)o;
            UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2);
            obj.moveVector = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index moveVector on a nil value"));
        }
    }
    static int get_moveDir(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.EventSystems.AxisEventData obj = (UnityEngine.EventSystems.AxisEventData)o;
            UnityEngine.EventSystems.MoveDirection ret = obj.moveDir;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index moveDir on a nil value"));
        }
    }
    static int set_moveDir(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.EventSystems.AxisEventData obj  = (UnityEngine.EventSystems.AxisEventData)o;
            UnityEngine.EventSystems.MoveDirection arg0 = (UnityEngine.EventSystems.MoveDirection)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.MoveDirection));
            obj.moveDir = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index moveDir on a nil value"));
        }
    }
Esempio n. 33
0
        // Token: 0x06000260 RID: 608 RVA: 0x0001ED08 File Offset: 0x0001CF08
        private bool SendMoveEventToSelectedObject()
        {
            float unscaledTime = Time.unscaledTime;

            if (!this.AllowMoveEventProcessing(unscaledTime))
            {
                return(false);
            }
            Vector2       rawMoveVector = this.GetRawMoveVector();
            AxisEventData axisEventData = this.GetAxisEventData(rawMoveVector.x, rawMoveVector.y, 0.6f);

            if (!Mathf.Approximately(axisEventData.moveVector.x, 0f) || !Mathf.Approximately(axisEventData.moveVector.y, 0f))
            {
                ExecuteEvents.Execute <IMoveHandler>(base.eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
            }
            this.m_NextAction = unscaledTime + 1f / this.m_InputActionsPerSecond;
            return(axisEventData.used);
        }
Esempio n. 34
0
 public void OnMove(AxisEventData eventData)
 {
     if (onMove != null)
         onMove.CallEventHandle(this.gameObject, eventData);
 }
Esempio n. 35
0
 // Convenience function -- change the selection to the specified object if it's not null and happens to be active.
 void Navigate(AxisEventData eventData, Selectable sel)
 {
     if (sel != null && sel.IsActive())
         eventData.selectedObject = sel.gameObject;
 }
 public override void OnMove(AxisEventData eventData)
 {
     if (onMove != null) onMove(gameObject);
 }
		public void OnMove(AxisEventData eventData){
			Send("OnMove", eventData);
		}
Esempio n. 38
0
 public override void OnMove(AxisEventData eventData)
 {
     //Debug.Log("OnMove");
     base.OnMove(eventData);
 }
 void IMoveHandler.OnMove(AxisEventData eventData)
 {
     if (onMove != null) onMove.OnNext(eventData);
 }
Esempio n. 40
0
File: GMB.cs Progetto: xqy/game
 protected virtual void OnMove(AxisEventData eventData)
 {
 }
Esempio n. 41
0
 public virtual void OnMove(AxisEventData e) {
     //Debug.Log("Move:" + e);
 }
Esempio n. 42
0
 private void Navigate(AxisEventData eventData, Selectable sel)
 {
   if (!((UnityEngine.Object) sel != (UnityEngine.Object) null) || !sel.IsActive())
     return;
   eventData.selectedObject = sel.gameObject;
 }
		/// <summary>
		/// Raises the move event.
		/// </summary>
		/// <param name="eventData">Event data.</param>
		public override void OnMove(AxisEventData eventData)
		{
			if (!IsActive() || !IsInteractable())
			{
				base.OnMove(eventData);
				return;
			}
			
			switch (eventData.moveDir)
			{
				case MoveDirection.Left:
					if (IsHorizontal() && FindSelectableOnLeft()==null)
					{
						Decrease();
					}
					else
					{
						base.OnMove(eventData);
					}
					break;
				case MoveDirection.Right:
					if (IsHorizontal() && FindSelectableOnRight()==null)
					{
						Increase();
					}
					else
					{
						base.OnMove(eventData);
					}
					break;
				case MoveDirection.Up:
					if (!IsHorizontal() && FindSelectableOnUp()==null)
					{
						Increase();
					}
					else
					{
						base.OnMove(eventData);
					}
					break;
				case MoveDirection.Down:
					if (!IsHorizontal() && FindSelectableOnDown()==null)
					{
						Decrease();
					}
					else
					{
						base.OnMove(eventData);
					}
					break;
			}
		}
 public void OnMove(AxisEventData eventData)
 {
     Debug.Log ( "OnMove : " + eventData );
 }
Esempio n. 45
0
 public virtual void OnMove(AxisEventData eventData)
 {
     ;
 }
Esempio n. 46
0
 public override void OnMove(AxisEventData eventData)
 {
     if (UiMove != null)
         UiMove(this, eventData);
 }
Esempio n. 47
0
 void IMoveHandler.OnMove(AxisEventData eventData)
 {
     SendMessage(UIEvents.OnMove, eventData);
 }
Esempio n. 48
0
 public void OnMove(AxisEventData eventData)
 {
     Publish(this);
 }
Esempio n. 49
0
 public virtual void OnMove(AxisEventData eventData)
 {
     MethodParamList paramTypeList = CLRSharpManager.instance.getParamTypeList(typeof(AxisEventData));
     object[] paramList = new object[] { eventData };
     doFun(GMBEventMethod.OnMove, paramTypeList, paramList);
 }
Esempio n. 50
0
 // Manage general inputs
 void Update() {
     if (ButtonDown("Menu")) {
         if (!GameManager.paused) {
             Lock();
             PausePanel.ShowPanel();
             GameManager.PauseGame();
             menuMode = true;
         } else {
             ResumeGame();
         }
     } else if (locked == 0) {
         // Switch Players Buttons
         if (ButtonDown("Character1")) {
             characterManager.ActivateCharacter(0);
         } else if (ButtonDown("Character2")) {
             characterManager.ActivateCharacter(1);
         } else if (ButtonDown("Character3")) {
             characterManager.ActivateCharacter(2);
         } else if (ButtonDown("NextCharacter")) {
             characterManager.ActivateNextCharacter();
         } else if (ButtonDown("PrevCharacter")) {
             characterManager.ActivatePreviousCharacter();
         } else
         // Abilities Buttons
         if (ButtonDown("Ability1")) {
             abilityControl.ActivateAbility1();
         } else if (ButtonDown("Ability2")) {
             abilityControl.ActivateAbility2();
         } else
         // Use Button
         if (ButtonDown("Use")) {
             characterStatus.UseButton();
         } else
         // Jump button
         if (ButtonDown("Jump")) {
             jumpButton = 2;
         } else if (ButtonUp("Jump")) {
             characterStatus.JumpButtonUp();
         } else if (Button("Jump")) {
             if (jumpButton != 2) {
                 jumpButton = 1;
             }
         } else
         // Suicide button
         if ((Button("Sacrifice1")) && (Button("Sacrifice2"))) {
             characterStatus.SacrificeButtons();
         } else if ((ButtonUp("Sacrifice1")) || (ButtonUp("Sacrifice2"))) {
             characterStatus.SacrificeButtonsUp();
         }
         // Movement buttons
         horizontalButton = ButtonValue("Horizontal");
         verticalButton = ButtonValue("Vertical");
     } else if (menuMode) {
         // Controla únicamente la entrada por mando, ya que el EventSystem no lo hace
         // Submit button
         if (GetControlDown(GetButtonControl("Jump"))) {
             ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, new BaseEventData(eventSystem), ExecuteEvents.submitHandler);
         }
         // Direction buttons
         if (GetControlDown(GetButtonControl("MenuUp"))) {
             AxisEventData axisEventData = new AxisEventData(eventSystem);
             axisEventData.moveDir = MoveDirection.Up;
             ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
         } else if (GetControlDown(GetButtonControl("MenuDown"))) {
             AxisEventData axisEventData = new AxisEventData(eventSystem);
             axisEventData.moveDir = MoveDirection.Down;
             ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
         } else if (GetControlDown(GetButtonControl("MenuLeft"))) {
             AxisEventData axisEventData = new AxisEventData(eventSystem);
             axisEventData.moveDir = MoveDirection.Left;
             ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
         } else if (GetControlDown(GetButtonControl("MenuRight"))) {
             AxisEventData axisEventData = new AxisEventData(eventSystem);
             axisEventData.moveDir = MoveDirection.Right;
             ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisEventData, ExecuteEvents.moveHandler);
         }
     } else {
         //Pasar mensajes
         if (ButtonDown("Use")) {
             if (messageManager.ShowingMessage()) {
                 messageManager.SkipText();
             }
         }
     }
 }
Esempio n. 51
0
 public void OnMove(AxisEventData eventData)
 {
     if (eventData.moveDir == MoveDirection.Left && leftPanel.GetComponent<Image>().enabled)
         MoveSelection(-1);
     if (eventData.moveDir == MoveDirection.Right && rightPanel.GetComponent<Image>().enabled)
         MoveSelection(1);
 }
 public void OnMove(AxisEventData eventData)
 {
     if (FuncOnMove != null)
     {
     #if !_DEBUG
         try
         {
     #endif
             FuncOnMove.Invoke(eventData);
     #if !_DEBUG
         }
         catch (Exception e)
         {
             ExceptionHandler.LogException(e);
         }
     #endif
     }
 }
    public virtual void OnMove(AxisEventData eventData)
    {
		callIfExist(idOnMove, eventData);
    }
Esempio n. 54
0
    // Process is called by UI system to process events
    public override void Process()
    {
        VRCursorController cursor= VRCursorController.GetInstance();

        // send update events if there is a selected object - this is important for InputField to receive keyboard events
        SendUpdateEventToSelectedObject();

        // see if there is a UI element that is currently being looked at
        PointerEventData lookData = GetLookPointerEventData();
        m_currentHoverObject = lookData.pointerCurrentRaycast.gameObject;

        // handle enter and exit events (highlight)
        // using the function that is already defined in BaseInputModule
        HandlePointerExitAndEnter(lookData, m_currentHoverObject);

        // Cursor Pressed Handling
        if (cursor.GetCursorPressed())
        {
            ClearSelection();

            lookData.pressPosition = lookData.position;
            lookData.pointerPressRaycast = lookData.pointerCurrentRaycast;
            lookData.pointerPress = null;

            if (m_currentHoverObject != null)
            {
                GameObject newPressed = null;
                m_currentPressedObject = m_currentHoverObject;

                newPressed = ExecuteEvents.ExecuteHierarchy(m_currentPressedObject, lookData, ExecuteEvents.pointerDownHandler);

                if (newPressed == null)
                {
                    // some UI elements might only have click handler and not pointer down handler
                    newPressed = ExecuteEvents.ExecuteHierarchy(m_currentPressedObject, lookData, ExecuteEvents.pointerClickHandler);

                    if (newPressed != null)
                    {
                        m_currentPressedObject = newPressed;
                    }
                }
                else
                {
                    m_currentPressedObject = newPressed;

                    // we want to do click on button down at same time, unlike regular mouse processing
                    // which does click when mouse goes up over same object it went down on
                    // reason to do this is head tracking might be jittery and this makes it easier to click buttons
                    ExecuteEvents.Execute(newPressed, lookData, ExecuteEvents.pointerClickHandler);
                }

                if (newPressed != null)
                {
                    lookData.pointerPress = newPressed;
                    m_currentPressedObject = newPressed;

                    Select(m_currentPressedObject);
                }

                if (ExecuteEvents.Execute(m_currentPressedObject, lookData, ExecuteEvents.beginDragHandler))
                {
                    lookData.pointerDrag = m_currentPressedObject;
                    m_currentDraggingObject = m_currentPressedObject;
                }
            }
        }

        // Cursor release handling
        if (cursor.GetCursorReleased())
        {
            if (m_currentDraggingObject)
            {
                ExecuteEvents.Execute(m_currentDraggingObject,lookData,ExecuteEvents.endDragHandler);

                if (m_currentHoverObject != null)
                {
                    ExecuteEvents.ExecuteHierarchy(m_currentHoverObject,lookData,ExecuteEvents.dropHandler);
                }

                lookData.pointerDrag = null;
                m_currentDraggingObject = null;
            }

            if (m_currentPressedObject)
            {
                ExecuteEvents.Execute(m_currentPressedObject,lookData,ExecuteEvents.pointerUpHandler);

                lookData.rawPointerPress = null;
                lookData.pointerPress = null;
                m_currentPressedObject = null;
            }
        }

        // Drag handling
        if (m_currentDraggingObject != null)
        {
            ExecuteEvents.Execute(m_currentDraggingObject,lookData,ExecuteEvents.dragHandler);
        }

        // Scroll Handling
        if (eventSystem.currentSelectedGameObject != null)
        {
            float scrollAmount = cursor.GetCursorScroll();

            if (scrollAmount > 0.01f || scrollAmount < -0.01f)
            {
                Slider slider = eventSystem.currentSelectedGameObject.GetComponent<Slider>();

                if (slider != null)
                {
                    float multiplier = slider.maxValue - slider.minValue;

                    slider.value += scrollAmount*ScrollSpeedMultiplier*multiplier;
                }
                else
                {
                    Scrollbar scrollBar = eventSystem.currentSelectedGameObject.GetComponent<Scrollbar>();

                    if (scrollBar != null)
                    {
                        scrollBar.value += scrollAmount*ScrollSpeedMultiplier;
                    }
                }
            }
        }

        // Tab Handling
        if (eventSystem.currentSelectedGameObject != null && Input.GetKeyUp(KeyCode.Tab))
        {
            AxisEventData axisData = new AxisEventData(this.eventSystem);

            axisData.moveDir = MoveDirection.Down;

            ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisData, ExecuteEvents.moveHandler);
        }
    }
Esempio n. 55
0
 /// <summary>
 ///   <para>Determine in which of the 4 move directions the next selectable object should be found.</para>
 /// </summary>
 /// <param name="eventData">The EventData usually sent by the EventSystem.</param>
 public virtual void OnMove(AxisEventData eventData)
 {
   switch (eventData.moveDir)
   {
     case MoveDirection.Left:
       this.Navigate(eventData, this.FindSelectableOnLeft());
       break;
     case MoveDirection.Up:
       this.Navigate(eventData, this.FindSelectableOnUp());
       break;
     case MoveDirection.Right:
       this.Navigate(eventData, this.FindSelectableOnRight());
       break;
     case MoveDirection.Down:
       this.Navigate(eventData, this.FindSelectableOnDown());
       break;
   }
 }
Esempio n. 56
0
 public override void OnMove(AxisEventData eventData)
 {
     if (onPointerEnter != null) onPointerEnter(eventData.selectedObject, eventData);
 }
Esempio n. 57
0
 /// <summary>
 /// <para>Given some input data generate an AxisEventData that can be used by the event system.</para>
 /// </summary>
 /// <param name="x">X movement.</param>
 /// <param name="y">Y movement.</param>
 /// <param name="moveDeadZone">Dead Zone.</param>
 protected virtual AxisEventData GetAxisEventData(float x, float y, float moveDeadZone)
 {
     if (this.m_AxisEventData == null)
     {
         this.m_AxisEventData = new AxisEventData(this.eventSystem);
     }
     this.m_AxisEventData.Reset();
     this.m_AxisEventData.moveVector = new Vector2(x, y);
     this.m_AxisEventData.moveDir = DetermineMoveDirection(x, y, moveDeadZone);
     return this.m_AxisEventData;
 }
Esempio n. 58
0
 override public void OnMove(AxisEventData eventData) { if (OnMoveDelegate != null) OnMoveDelegate(gameObject, eventData); }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.EventSystems.AxisEventData o;
			UnityEngine.EventSystems.EventSystem a1;
			checkType(l,2,out a1);
			o=new UnityEngine.EventSystems.AxisEventData(a1);
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.AxisEventData o;
         UnityEngine.EventSystems.EventSystem a1;
         checkType(l,2,out a1);
         o=new UnityEngine.EventSystems.AxisEventData(a1);
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }