Notify() static public method

Generic notification function. Used in place of SendMessage to shorten the code and allow for more than one receiver.
static public Notify ( GameObject go, string funcName, object obj ) : void
go GameObject
funcName string
obj object
return void
Exemplo n.º 1
0
    protected virtual void OnPress(Boolean isDown)
    {
        if (this.KeyCommand != Control.None && UIKeyTrigger.IsOnlyTouchAndLeftClick())
        {
            if (isDown)
            {
                UIManager.Input.SendKeyCode(this.KeyCommand, false);
                PersistenSingleton <HonoInputManager> .Instance.SetInputDownSources(SourceControl.Touch, this.KeyCommand);

                Singleton <DialogManager> .Instance.PressMesId = PersistenSingleton <UIManager> .Instance.Dialogs.CurMesId;
            }
            else
            {
                this.isPress = false;
                Boolean flag = false;
                if (UICamera.currentTouchID == -1)
                {
                    flag = true;
                }
                else if (UICamera.currentTouchID > -1 && UICamera.currentTouchID < 2)
                {
                    flag = (!(this.buttonGroupState != (UnityEngine.Object)null) || this.buttonGroupState.ProcessTouch());
                }
                if (flag)
                {
                    UICamera.Notify(PersistenSingleton <UIManager> .Instance.gameObject, "OnScreenButtonPressed", base.gameObject);
                }
                UIManager.Input.ResetKeyCode();
                Singleton <DialogManager> .Instance.ReleaseMesId = PersistenSingleton <UIManager> .Instance.Dialogs.CurMesId;
            }
        }
    }
Exemplo n.º 2
0
 void OnInputCancel(InputManager.Info data)
 {
     if (data.state == InputManager.State.Pressed && UICamera.selectedObject != null)
     {
         UICamera.Notify(UICamera.selectedObject, "OnKey", KeyCode.Escape);
     }
 }
Exemplo n.º 3
0
 void OnInputEnter(InputManager.Info data)
 {
     if (data.state == InputManager.State.Pressed && (!checkSelected || UICamera.selectedObject == gameObject))
     {
         UICamera.Notify(gameObject, "OnClick", null);
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    public virtual UIDragDropItem StartDragging()
    {
        if (!interactable || !transform || !transform.parent)
        {
            return(null);
        }

        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                mPressed = false;
                var clone = transform.parent.gameObject.AddChild(gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;

                var bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                var item = clone.GetComponent <UIDragDropItem>();
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.Start();
                item.OnClone(gameObject);
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
                return(item);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
                return(this);
            }
        }
        return(null);
    }
Exemplo n.º 5
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    protected virtual void StartDragging()
    {
        if (!interactable)
        {
            return;
        }

        if (!mDragging)
        {
            if (cloneOnDrag)
            {
                mPressed = false;
                GameObject clone = NGUITools.AddChild(transform.parent.gameObject, gameObject);
                clone.transform.localPosition = transform.localPosition;
                clone.transform.localRotation = transform.localRotation;
                clone.transform.localScale    = transform.localScale;

                UIButtonColor bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                UIDragDropItem item = clone.GetComponent <UIDragDropItem>();
                if (onDosomething != null)
                {
                    onDosomething(item);
                }
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.Start();
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
    }
Exemplo n.º 6
0
 private void onHover(GameObject go, Boolean isHover)
 {
     if (isHover && this.currentHoverIndex != go.GetComponent <ModelButton>().index)
     {
         this.currentHoverIndex = go.GetComponent <ModelButton>().index;
         UICamera.Notify(PersistenSingleton <UIManager> .Instance.gameObject, "OnItemSelect", go);
     }
 }
Exemplo n.º 7
0
        protected override void StartDragging()
        {
            if (!interactable)
            {
                return;
            }
            if (mDragging)
            {
                return;
            }
            var icon = mTrans.FindChild("Icon").GetComponent <UISprite>();

            if (icon.spriteName == "equip_weapon")
            {
                return;
            }

            if (cloneOnDrag)
            {
                mPressed = false;
                var pressPos = mTouch.pressedCam.ScreenToWorldPoint(mTouch.pos);
                var clone    = NGUITools.AddChild(mTrans.parent.gameObject, Ico);
                var t        = clone.transform;
                t.localPosition = mTrans.parent.InverseTransformPoint(pressPos);
                t.localRotation = mTrans.localRotation;
                t.localScale    = mTrans.localScale;

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                var item = clone.GetComponent <EquipMentDragDropItem1>();
                item.mTouch    = mTouch;
                item.mPressed  = true;
                item.mDragging = true;
                item.Start();
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
            else
            {
                mDragging = true;
                OnDragDropStart();
            }
        }
Exemplo n.º 8
0
 public void ShowTooltip(bool val)
 {
     this.mTooltipTime = 0f;
     UICamera.Notify(this.mTooltip, "OnTooltip", val);
     if (!val)
     {
         this.mTooltip = null;
     }
 }
Exemplo n.º 9
0
        protected override void StartDragging()
        {
            if (!interactable)
            {
                return;
            }

            if (skillID == -1)
            {
                return;
            }

            if (!mDragging)
            {
                mPressed = false;
                var clone = NGUITools.AddChild(mTrans.parent.gameObject, gameObject);
                var t     = clone.transform;
                t.localPosition = mTrans.localPosition;
                t.localRotation = mTrans.localRotation;
                t.localScale    = mTrans.localScale;

                var sp = clone.GetComponent <UISprite>();
                sp.SetRect(-45, -45, 90, 90);

                var bc = clone.GetComponent <UIButtonColor>();
                if (bc != null)
                {
                    bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
                }

                if (mTouch != null && mTouch.pressed == gameObject)
                {
                    mTouch.current = clone;
                    mTouch.pressed = clone;
                    mTouch.dragged = clone;
                    mTouch.last    = clone;
                }

                var item = clone.GetComponent <SkillDragEquip>();
                item.itemLogic.Index = itemLogic.Index;
                item.mTouch          = mTouch;
                item.mPressed        = true;
                item.mDragging       = true;
                item.Start();
                item.OnDragDropStart();

                if (UICamera.currentTouch == null)
                {
                    UICamera.currentTouch = mTouch;
                }

                mTouch = null;

                UICamera.Notify(gameObject, "OnPress", false);
                UICamera.Notify(gameObject, "OnHover", false);
            }
        }
    /// <summary>
    /// Process the key binding.
    /// </summary>

    void Update()
    {
        if (keyCode == KeyCode.None || !IsModifierActive())
        {
            return;
        }

        if (action == Action.PressAndClick || action == Action.All)
        {
            if (UICamera.inputHasFocus)
            {
                return;
            }

            UICamera.currentTouch         = UICamera.controller;
            UICamera.currentScheme        = UICamera.ControlScheme.Mouse;
            UICamera.currentTouch.current = gameObject;

            if (Input.GetKeyDown(keyCode))
            {
                mPress = true;
                UICamera.Notify(gameObject, "OnPress", true);
            }

            if (Input.GetKeyUp(keyCode))
            {
                UICamera.Notify(gameObject, "OnPress", false);

                if (mPress)
                {
                    UICamera.Notify(gameObject, "OnClick", null);
                    mPress = false;
                }
            }
            UICamera.currentTouch.current = null;
        }

        if (action == Action.Select || action == Action.All)
        {
            if (Input.GetKeyUp(keyCode))
            {
                if (mIsInput)
                {
                    if (!mIgnoreUp && !UICamera.inputHasFocus)
                    {
                        UICamera.selectedObject = gameObject;
                    }
                    mIgnoreUp = false;
                }
                else
                {
                    UICamera.selectedObject = gameObject;
                }
            }
        }
    }
Exemplo n.º 11
0
    static int Notify(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 1, typeof(GameObject));
        string     arg1 = LuaScriptMgr.GetLuaString(L, 2);
        object     arg2 = LuaScriptMgr.GetVarObject(L, 3);

        UICamera.Notify(arg0, arg1, arg2);
        return(0);
    }
Exemplo n.º 12
0
 void OnEnable()
 {
     if (startsSelected)
     {
         if (UICamera.selectedObject == null || !NGUITools.GetActive(UICamera.selectedObject))
         {
             UICamera.selectedObject = gameObject;
             UICamera.Notify(gameObject, "OnHover", true);
         }
     }
 }
Exemplo n.º 13
0
 private void OnDragStart()
 {
     if (!base.enabled || this.mTouchID != -2147483648)
     {
         return;
     }
     if (this.restriction != UIDragDropItem.Restriction.None)
     {
         if (this.restriction == UIDragDropItem.Restriction.Horizontal)
         {
             Vector2 totalDelta = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta.x) < Mathf.Abs(totalDelta.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.Vertical)
         {
             Vector2 totalDelta2 = UICamera.currentTouch.totalDelta;
             if (Mathf.Abs(totalDelta2.x) > Mathf.Abs(totalDelta2.y))
             {
                 return;
             }
         }
         else if (this.restriction == UIDragDropItem.Restriction.PressAndHold && this.mPressTime + 1f > RealTime.time)
         {
             return;
         }
     }
     if (this.cloneOnDrag)
     {
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
         }
         UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
         UICamera.currentTouch.pressed = gameObject;
         UICamera.currentTouch.dragged = gameObject;
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.Start();
         component2.OnDragDropStart();
     }
     else
     {
         this.OnDragDropStart();
     }
 }
Exemplo n.º 14
0
        protected override void OnUpdate()
        {
            base.OnUpdate();

            if (HasLock())
            {
                var device = SteamVR_Controller.Input((int)_Controller.Tracking.index);
                if (device.GetHairTriggerUp())
                {
                    UICamera.Notify(UICamera.selectedObject, "OnClick", null);
                }
            }
        }
Exemplo n.º 15
0
 public virtual void StartDragging()
 {
     if (!this.interactable)
     {
         return;
     }
     if (!this.mDragging)
     {
         if (this.cloneOnDrag)
         {
             this.mPressed = false;
             GameObject gameObject = base.transform.parent.gameObject.AddChild(base.gameObject);
             gameObject.transform.localPosition = base.transform.localPosition;
             gameObject.transform.localRotation = base.transform.localRotation;
             gameObject.transform.localScale    = base.transform.localScale;
             UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
             if (component != null)
             {
                 component.defaultColor = base.GetComponent <UIButtonColor>().defaultColor;
             }
             if (this.mTouch != null && this.mTouch.pressed == base.gameObject)
             {
                 this.mTouch.current = gameObject;
                 this.mTouch.pressed = gameObject;
                 this.mTouch.dragged = gameObject;
                 this.mTouch.last    = gameObject;
             }
             UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
             component2.mTouch    = this.mTouch;
             component2.mPressed  = true;
             component2.mDragging = true;
             component2.Start();
             component2.OnClone(base.gameObject);
             component2.OnDragDropStart();
             if (UICamera.currentTouch == null)
             {
                 UICamera.currentTouch = this.mTouch;
             }
             this.mTouch = null;
             UICamera.Notify(base.gameObject, "OnPress", false);
             UICamera.Notify(base.gameObject, "OnHover", false);
         }
         else
         {
             this.mDragging = true;
             this.OnDragDropStart();
         }
     }
 }
Exemplo n.º 16
0
 // Token: 0x060030C8 RID: 12488 RVA: 0x000EF4CC File Offset: 0x000ED8CC
 private void Update()
 {
     if (this.keyCode == KeyCode.None || !this.IsModifierActive())
     {
         return;
     }
     if (this.action == UIKeyBinding.Action.PressAndClick || this.action == UIKeyBinding.Action.All)
     {
         if (UICamera.inputHasFocus)
         {
             return;
         }
         UICamera.currentTouch         = UICamera.controller;
         UICamera.currentScheme        = UICamera.ControlScheme.Mouse;
         UICamera.currentTouch.current = base.gameObject;
         if (Input.GetKeyDown(this.keyCode))
         {
             this.mPress = true;
             UICamera.Notify(base.gameObject, "OnPress", true);
         }
         if (Input.GetKeyUp(this.keyCode))
         {
             UICamera.Notify(base.gameObject, "OnPress", false);
             if (this.mPress)
             {
                 UICamera.Notify(base.gameObject, "OnClick", null);
                 this.mPress = false;
             }
         }
         UICamera.currentTouch.current = null;
     }
     if ((this.action == UIKeyBinding.Action.Select || this.action == UIKeyBinding.Action.All) && Input.GetKeyUp(this.keyCode))
     {
         if (this.mIsInput)
         {
             if (!this.mIgnoreUp && !UICamera.inputHasFocus)
             {
                 UICamera.selectedObject = base.gameObject;
             }
             this.mIgnoreUp = false;
         }
         else
         {
             UICamera.selectedObject = base.gameObject;
         }
     }
 }
Exemplo n.º 17
0
 protected virtual void StartDragging()
 {
     if (!interactable || mDragging)
     {
         return;
     }
     if (cloneOnDrag)
     {
         mPressed = false;
         GameObject gameObject = NGUITools.AddChild(base.transform.parent.gameObject, base.gameObject);
         gameObject.transform.localPosition = base.transform.localPosition;
         gameObject.transform.localRotation = base.transform.localRotation;
         gameObject.transform.localScale    = base.transform.localScale;
         UIButtonColor component = gameObject.GetComponent <UIButtonColor>();
         if (component != null)
         {
             component.defaultColor = GetComponent <UIButtonColor>().defaultColor;
         }
         if (mTouch != null && mTouch.pressed == base.gameObject)
         {
             mTouch.current = gameObject;
             mTouch.pressed = gameObject;
             mTouch.dragged = gameObject;
             mTouch.last    = gameObject;
         }
         UIDragDropItem component2 = gameObject.GetComponent <UIDragDropItem>();
         component2.mTouch    = mTouch;
         component2.mPressed  = true;
         component2.mDragging = true;
         component2.Start();
         component2.OnDragDropStart();
         if (UICamera.currentTouch == null)
         {
             UICamera.currentTouch = mTouch;
         }
         mTouch = null;
         UICamera.Notify(base.gameObject, "OnPress", false);
         UICamera.Notify(base.gameObject, "OnHover", false);
     }
     else
     {
         mDragging = true;
         OnDragDropStart();
     }
 }
Exemplo n.º 18
0
	/// <summary>
	/// Start the dragging operation.
	/// </summary>

	void OnDragStart ()
	{
		if (!enabled || mTouchID != int.MinValue) return;

		// If we have a restriction, check to see if its condition has been met first
		if (restriction != Restriction.None)
		{
			if (restriction == Restriction.Horizontal)
			{
				Vector2 delta = UICamera.currentTouch.totalDelta;
				if (Mathf.Abs(delta.x) < Mathf.Abs(delta.y)) return;
			}
			else if (restriction == Restriction.Vertical)
			{
				Vector2 delta = UICamera.currentTouch.totalDelta;
				if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y)) return;
			}
			else if (restriction == Restriction.PressAndHold)
			{
				if (mPressTime + 1f > RealTime.time) return;
			}
		}

		if (cloneOnDrag)
		{
			GameObject clone = NGUITools.AddChild(transform.parent.gameObject, gameObject);
			clone.transform.localPosition = transform.localPosition;
			clone.transform.localRotation = transform.localRotation;
			clone.transform.localScale = transform.localScale;

			UIButtonColor bc = clone.GetComponent<UIButtonColor>();
			if (bc != null) bc.defaultColor = GetComponent<UIButtonColor>().defaultColor;

			UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);

			UICamera.currentTouch.pressed = clone;
			UICamera.currentTouch.dragged = clone;

			UIDragDropItem item = clone.GetComponent<UIDragDropItem>();
			item.Start();
			item.OnDragDropStart();
		}
		else OnDragDropStart();
	}
Exemplo n.º 19
0
 private static void ActiveButtonChanged(GameObject go, Boolean setSelect)
 {
     ButtonGroupState.PrevActiveButton = ((!ButtonGroupState.activeButtonList.ContainsKey(ButtonGroupState.activeGroup) || !(ButtonGroupState.activeButtonList[ButtonGroupState.activeGroup] != (UnityEngine.Object)null)) ? PersistenSingleton <UIManager> .Instance.gameObject : ButtonGroupState.activeButtonList[ButtonGroupState.activeGroup]);
     ButtonGroupState.activeButtonList[ButtonGroupState.activeGroup] = go;
     if (setSelect)
     {
         UICamera.selectedObject = ButtonGroupState.activeButtonList[ButtonGroupState.activeGroup];
     }
     if (go == (UnityEngine.Object)null)
     {
         return;
     }
     ButtonGroupState.UpdateActiveButton();
     if (ButtonGroupState.PrevActiveButton != go && ButtonGroupState.activeGroup != Dialog.DialogGroupButton && !ButtonGroupState.muteActiveSound)
     {
         FF9Sfx.FF9SFX_Play(103);
     }
     UICamera.Notify(PersistenSingleton <UIManager> .Instance.gameObject, "OnItemSelect", go);
 }
Exemplo n.º 20
0
 private static void Highlight(GameObject go, bool highlighted)
 {
     if (go != null)
     {
         int i = UICamera.mHighlighted.Count;
         while (i > 0)
         {
             UICamera.Highlighted highlighted2 = UICamera.mHighlighted[--i];
             if (highlighted2 == null || highlighted2.go == null)
             {
                 UICamera.mHighlighted.RemoveAt(i);
             }
             else if (highlighted2.go == go)
             {
                 if (highlighted)
                 {
                     highlighted2.counter++;
                 }
                 else if (--highlighted2.counter < 1)
                 {
                     UICamera.mHighlighted.Remove(highlighted2);
                     UICamera.Notify(go, "OnHover", false);
                 }
                 return;
             }
         }
         if (highlighted)
         {
             UICamera.Highlighted highlighted3 = new UICamera.Highlighted();
             highlighted3.go      = go;
             highlighted3.counter = 1;
             UICamera.mHighlighted.Add(highlighted3);
             UICamera.Notify(go, "OnHover", true);
         }
     }
 }
Exemplo n.º 21
0
 protected virtual void OnBindingClick()
 {
     //IL_0001: Unknown result type (might be due to invalid IL or missing references)
     //IL_000c: Expected O, but got Unknown
     UICamera.Notify(this.get_gameObject(), "OnClick", null);
 }
Exemplo n.º 22
0
    public void ProcessTouch(bool pressed, bool unpressed)
    {
        bool  flag = UICamera.currentTouch == UICamera.mMouse[0] || UICamera.currentTouch == UICamera.mMouse[1] || UICamera.currentTouch == UICamera.mMouse[2];
        float num  = (!flag) ? this.touchDragThreshold : this.mouseDragThreshold;
        float num2 = (!flag) ? this.touchClickThreshold : this.mouseClickThreshold;

        if (pressed)
        {
            if (this.mTooltip != null)
            {
                this.ShowTooltip(false);
            }
            UICamera.currentTouch.pressStarted = true;
            UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
            UICamera.currentTouch.pressed           = UICamera.currentTouch.current;
            UICamera.currentTouch.dragged           = UICamera.currentTouch.current;
            UICamera.currentTouch.clickNotification = ((!flag) ? UICamera.ClickNotification.Always : UICamera.ClickNotification.BasedOnDelta);
            UICamera.currentTouch.totalDelta        = Vectors.v2zero;
            UICamera.currentTouch.dragStarted       = false;
            UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", true);
            if (UICamera.currentTouch.pressed != UICamera.mSel)
            {
                if (this.mTooltip != null)
                {
                    this.ShowTooltip(false);
                }
                UICamera.selectedObject = null;
            }
        }
        else
        {
            if (UICamera.currentTouch.clickNotification != UICamera.ClickNotification.None && !this.stickyPress && !unpressed && UICamera.currentTouch.pressStarted && UICamera.currentTouch.pressed != UICamera.hoveredObject)
            {
                UICamera.isDragging = true;
                UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
                UICamera.currentTouch.pressed = UICamera.hoveredObject;
                UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", true);
                UICamera.isDragging = false;
            }
            if (UICamera.currentTouch.pressed != null)
            {
                float magnitude = UICamera.currentTouch.delta.magnitude;
                if (magnitude != 0f)
                {
                    UICamera.currentTouch.totalDelta += UICamera.currentTouch.delta;
                    magnitude = UICamera.currentTouch.totalDelta.magnitude;
                    if (!UICamera.currentTouch.dragStarted && num < magnitude)
                    {
                        UICamera.currentTouch.dragStarted = true;
                        UICamera.currentTouch.delta       = UICamera.currentTouch.totalDelta;
                    }
                    if (UICamera.currentTouch.dragStarted)
                    {
                        if (this.mTooltip != null)
                        {
                            this.ShowTooltip(false);
                        }
                        UICamera.isDragging = true;
                        bool flag2 = UICamera.currentTouch.clickNotification == UICamera.ClickNotification.None;
                        UICamera.Notify(UICamera.currentTouch.dragged, "OnDrag", UICamera.currentTouch.delta);
                        UICamera.isDragging = false;
                        if (flag2)
                        {
                            UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
                        }
                        else if (UICamera.currentTouch.clickNotification == UICamera.ClickNotification.BasedOnDelta && num2 < magnitude)
                        {
                            UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;
                        }
                    }
                }
            }
        }
        if (unpressed)
        {
            UICamera.currentTouch.pressStarted = false;
            if (this.mTooltip != null)
            {
                this.ShowTooltip(false);
            }
            if (UICamera.currentTouch.pressed != null)
            {
                UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);
                if (this.useMouse && UICamera.currentTouch.pressed == UICamera.mHover)
                {
                    UICamera.Notify(UICamera.currentTouch.pressed, "OnHover", true);
                }
                if (UICamera.currentTouch.dragged == UICamera.currentTouch.current || (UICamera.currentTouch.clickNotification != UICamera.ClickNotification.None && UICamera.currentTouch.totalDelta.magnitude < num))
                {
                    if (UICamera.currentTouch.pressed != UICamera.mSel)
                    {
                        UICamera.mSel = UICamera.currentTouch.pressed;
                        UICamera.Notify(UICamera.currentTouch.pressed, "OnSelect", true);
                    }
                    else
                    {
                        UICamera.mSel = UICamera.currentTouch.pressed;
                    }
                    if (UICamera.currentTouch.clickNotification != UICamera.ClickNotification.None)
                    {
                        float realtimeSinceStartup = Time.realtimeSinceStartup;
                        UICamera.Notify(UICamera.currentTouch.pressed, "OnClick", null);
                        if (UICamera.currentTouch.clickTime + 0.35f > realtimeSinceStartup)
                        {
                            UICamera.Notify(UICamera.currentTouch.pressed, "OnDoubleClick", null);
                        }
                        UICamera.currentTouch.clickTime = realtimeSinceStartup;
                    }
                }
                else
                {
                    UICamera.Notify(UICamera.currentTouch.current, "OnDrop", UICamera.currentTouch.dragged);
                }
            }
            UICamera.currentTouch.dragStarted = false;
            UICamera.currentTouch.pressed     = null;
            UICamera.currentTouch.dragged     = null;
        }
    }
Exemplo n.º 23
0
 protected virtual void OnBindingPress(bool pressed)
 {
     //IL_0001: Unknown result type (might be due to invalid IL or missing references)
     //IL_0011: Expected O, but got Unknown
     UICamera.Notify(this.get_gameObject(), "OnPress", pressed);
 }
Exemplo n.º 24
0
    /// <summary>
    /// Start the dragging operation.
    /// </summary>

    void OnDragStart()
    {
        if (!enabled || mTouchID != int.MinValue)
        {
            return;
        }

        // If we have a restriction, check to see if its condition has been met first
        if (restriction != Restriction.None)
        {
            if (restriction == Restriction.Horizontal)
            {
                UnityEngine.Vector2 delta = UICamera.currentTouch.totalDelta;
                if (UnityEngine.Mathf.Abs(delta.x) < UnityEngine.Mathf.Abs(delta.y))
                {
                    return;
                }
            }
            else if (restriction == Restriction.Vertical)
            {
                UnityEngine.Vector2 delta = UICamera.currentTouch.totalDelta;
                if (UnityEngine.Mathf.Abs(delta.x) > UnityEngine.Mathf.Abs(delta.y))
                {
                    return;
                }
            }
            else if (restriction == Restriction.PressAndHold)
            {
                if (mPressTime + 1f > RealTime.time)
                {
                    return;
                }
            }
        }

        if (cloneOnDrag)
        {
            UnityEngine.Vector3 screenPos = new UnityEngine.Vector3(UICamera.currentTouch.pos.x, UICamera.currentTouch.pos.y, 0);
            UnityEngine.Vector3 pos       = UICamera.mainCamera.ScreenToWorldPoint(screenPos);
            //将clone放在UISkillSetting或者UISkillStorage下
            UnityEngine.GameObject clone        = null;
            UISkillSetting         skillSetting = NGUITools.FindInParents <UISkillSetting>(gameObject);
            if (skillSetting != null)
            {
                clone = NGUITools.AddChild(skillSetting.gameObject, gameObject);
            }
            else
            {
                UISkillStorage skillStorage = NGUITools.FindInParents <UISkillStorage>(gameObject);
                if (skillStorage != null)
                {
                    clone = NGUITools.AddChild(skillStorage.gameObject, gameObject);
                }
            }
            clone.transform.position      = pos;
            clone.transform.localRotation = transform.localRotation;
            clone.transform.localScale    = transform.localScale;

            UIButtonColor bc = clone.GetComponent <UIButtonColor>();
            if (bc != null)
            {
                bc.defaultColor = GetComponent <UIButtonColor>().defaultColor;
            }

            UICamera.Notify(UICamera.currentTouch.pressed, "OnPress", false);

            UICamera.currentTouch.pressed = clone;
            UICamera.currentTouch.dragged = clone;

            UIDragDropForSkill item      = clone.GetComponent <UIDragDropForSkill>();
            UISkillSlot        skillSlot = this.GetComponent <UISkillSlot>();
            if (null != skillSlot)
            {
                //如果拖动的Slot内不含有任何技能,则不允许拖动
                if (skillSlot.SkillId == -1 || (!skillSlot.m_IsUnlock && skillSlot.slotType == SlotType.SkillStorage))
                {
                    NGUITools.DestroyImmediate(clone);
                    return;
                }
                else
                {
                    skillSlot.SetIcon("");
                }
            }
            UISkillSlot cloneSlot = clone.GetComponent <UISkillSlot>();
            cloneSlot.SkillId  = skillSlot.SkillId;
            cloneSlot.slotType = skillSlot.slotType;
            item.Start();
            item.OnDragDropStart();
        }
        else
        {
            OnDragDropStart();
        }
    }
Exemplo n.º 25
0
 protected virtual void OnBindingClick()
 {
     UICamera.Notify(base.get_gameObject(), "OnClick", null);
 }
Exemplo n.º 26
0
    void OnFinish()
    {
        if (eventType == GuidePlayerEvetnType.EnterTrigger && sdGameLevel.instance != null &&
            sdGameLevel.instance.GetFingerControl() != null)
        {
            sdGameLevel.instance.GetFingerControl().StopMove_ClearPath();
        }

        sdGameLevel.instance.guideDialogueEnd -= OnFinish;

        if (isLock)
        {
            sdUICharacter.Instance.ShowMask(false, null);
        }
        else
        {
            sdUICharacter.Instance.HideMask();
        }

        sdUICharacter.Instance.HideArrow();
        if (opType != (int)GuideOperationType.SmallWord && sdGameLevel.instance != null && sdGameLevel.instance.gameObject.GetComponent <sdGuideDialogue>() != null)
        {
            sdGameLevel.instance.gameObject.GetComponent <sdGuideDialogue>().Hide();
        }

        if ((eventType == GuidePlayerEvetnType.Click && eventParam.ToString() != "0") &&
            (opType == (int)GuideOperationType.ShowPoint || opType == (int)GuideOperationType.PointEquip || opType == (int)GuideOperationType.PointItemUp))
        {
            GameObject obj = null;
            if (opType == (int)GuideOperationType.PointEquip || opType == (int)GuideOperationType.PointItemUp)
            {
                obj = tempObj;
            }
            else
            {
                obj = GameObject.Find(eventParam.ToString());
            }

            if (obj != null)
            {
                if (obj.GetComponent <sdShortCutIcon>() != null)
                {
                    UICamera.Notify(obj, "OnPress", true);
                    UICamera.Notify(obj, "OnPress", false);
                }
                else if (obj.GetComponent <sdSkillIcon>() != null)
                {
                    UICamera.Notify(obj, "OnPress", true);
                    UICamera.Notify(obj, "OnPress", false);
                }
                else if (obj.GetComponent <sdSlotIcon>() != null && obj.GetComponent <sdSlotIcon>().panel == PanelType.Panel_Bag)
                {
                    UICamera.Notify(obj, "OnGuideClick", null);
                }
                else
                {
                    UICamera.Notify(obj, "OnClick", null);
                }
            }
        }

        sdGuideMgr.Instance.isOperation = false;
        if (isSave)
        {
            sdConfDataMgr.Instance().SetRoleSetting("guide" + classId.ToString(), id.ToString());
            if (classId == 1)
            {
                sdConfDataMgr.Instance().SetSetting("FinishGuide", "1");
            }
        }
    }
Exemplo n.º 27
0
 protected virtual void OnBindingPress(bool pressed)
 {
     UICamera.Notify(gameObject, "OnPress", pressed);
 }
Exemplo n.º 28
0
    public void ProcessOthers()
    {
        UICamera.currentTouchID = -100;
        UICamera.currentTouch   = UICamera.mController;
        UICamera.inputHasFocus  = (UICamera.mSel != null && UICamera.mSel.GetComponent <UIInput>() != null);
        bool flag  = (this.submitKey0 != KeyCode.None && Input.GetKeyDown(this.submitKey0)) || (this.submitKey1 != KeyCode.None && Input.GetKeyDown(this.submitKey1));
        bool flag2 = (this.submitKey0 != KeyCode.None && Input.GetKeyUp(this.submitKey0)) || (this.submitKey1 != KeyCode.None && Input.GetKeyUp(this.submitKey1));

        if (flag || flag2)
        {
            UICamera.currentTouch.current = UICamera.mSel;
            this.ProcessTouch(flag, flag2);
            UICamera.currentTouch.current = null;
        }
        int num  = 0;
        int num2 = 0;

        if (this.useKeyboard)
        {
            if (UICamera.inputHasFocus)
            {
                num  += UICamera.GetDirection(KeyCode.UpArrow, KeyCode.DownArrow);
                num2 += UICamera.GetDirection(KeyCode.RightArrow, KeyCode.LeftArrow);
            }
            else
            {
                num  += UICamera.GetDirection(KeyCode.W, KeyCode.UpArrow, KeyCode.S, KeyCode.DownArrow);
                num2 += UICamera.GetDirection(KeyCode.D, KeyCode.RightArrow, KeyCode.A, KeyCode.LeftArrow);
            }
        }
        if (this.useController)
        {
            if (!string.IsNullOrEmpty(this.verticalAxisName))
            {
                num += UICamera.GetDirection(this.verticalAxisName);
            }
            if (!string.IsNullOrEmpty(this.horizontalAxisName))
            {
                num2 += UICamera.GetDirection(this.horizontalAxisName);
            }
        }
        if (num != 0)
        {
            UICamera.Notify(UICamera.mSel, "OnKey", (num <= 0) ? KeyCode.DownArrow : KeyCode.UpArrow);
        }
        if (num2 != 0)
        {
            UICamera.Notify(UICamera.mSel, "OnKey", (num2 <= 0) ? KeyCode.LeftArrow : KeyCode.RightArrow);
        }
        if (this.useKeyboard && Input.GetKeyDown(KeyCode.Tab))
        {
            UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Tab);
        }
        if (this.cancelKey0 != KeyCode.None && Input.GetKeyDown(this.cancelKey0))
        {
            UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Escape);
        }
        if (this.cancelKey1 != KeyCode.None && Input.GetKeyDown(this.cancelKey1))
        {
            UICamera.Notify(UICamera.mSel, "OnKey", KeyCode.Escape);
        }
        UICamera.currentTouch = null;
    }
Exemplo n.º 29
0
 protected virtual void OnBindingClick()
 {
     UICamera.Notify(gameObject, "OnClick", null);
 }
Exemplo n.º 30
0
        void Update()
        {
            if (mInputActive)
            {
                if (UICamera.selectedObject != null)
                {
                    float time  = Time.realtimeSinceStartup;
                    float delta = time - mNextTime;

                    InputManager input = InputManager.instance;

                    if (axisX != InputManager.ActionInvalid)
                    {
                        float x = input.GetAxis(player, axisX);
                        if (x < -axisThreshold)
                        {
                            if (delta >= axisDelay || mAxisXState == AxisState.Up)
                            {
                                mNextTime = time;
                                UICamera.Notify(UICamera.selectedObject, "OnKey", KeyCode.LeftArrow);
                            }

                            mAxisXState = AxisState.Down;
                        }
                        else if (x > axisThreshold)
                        {
                            if (delta >= axisDelay || mAxisXState == AxisState.Up)
                            {
                                mNextTime = time;
                                UICamera.Notify(UICamera.selectedObject, "OnKey", KeyCode.RightArrow);
                            }

                            mAxisXState = AxisState.Down;
                        }
                        else
                        {
                            mAxisXState = AxisState.Up;
                        }
                    }

                    if (axisY != InputManager.ActionInvalid)
                    {
                        float y = input.GetAxis(player, axisY);
                        if (y < -axisThreshold)
                        {
                            if (delta >= axisDelay || mAxisYState == AxisState.Up)
                            {
                                mNextTime = time;
                                UICamera.Notify(UICamera.selectedObject, "OnKey", KeyCode.DownArrow);
                            }

                            mAxisYState = AxisState.Down;
                        }
                        else if (y > axisThreshold)
                        {
                            if (delta >= axisDelay || mAxisYState == AxisState.Up)
                            {
                                mNextTime = time;
                                UICamera.Notify(UICamera.selectedObject, "OnKey", KeyCode.UpArrow);
                            }

                            mAxisYState = AxisState.Down;
                        }
                        else
                        {
                            mAxisYState = AxisState.Up;
                        }
                    }
                }
            }
        }