Exemplo n.º 1
0
 void Start()
 {
     UIEventTriggerListener.Get(this.gameObject).onClick = OnAlphaBgClick;
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     UIEventTriggerListener.Get(m_EnterBattle).onClick = OnClickEnterBattle;
 }
Exemplo n.º 3
0
        private void InitDragBeginEvent()
        {
            groundScrollRect.OnConstruct = (item) => { InitItemEvent(item, EChickenBagType.Ground); };
            bagScrollRect.OnConstruct    = (item) => { InitItemEvent(item, EChickenBagType.Bag); };

            for (int i = 1; i <= 4; i++)
            {
                var dragEnd = FindComponent <UIDrag>("GearIcon" + i);
                var i1      = i - 1;
                var key     = "3|" + ((int)equipTypeList[i1]).ToString();
                dragEnd.OnEndDragCallback = (data) =>
                {
                    SetDragStartPos(EChickenBagType.Equipment, key);
                };
                var listener = UIEventTriggerListener.Get(dragEnd.gameObject);
                listener.onClick += (UIEventTriggerListener arg1, PointerEventData arg2) =>
                {
                    if (arg2.button == PointerEventData.InputButton.Right)
                    {
                        UseItem(key);
                    }
                };
            }

            for (int i = 1; i <= 6; i++)
            {
                var dragEnd = FindComponent <UIDrag>("WearIcon" + i);
                var i1      = i - 1;
                var key     = "3|" + ((int)equipTypeList[i1 + 4]).ToString();
                dragEnd.OnEndDragCallback = (data) =>
                {
                    SetDragStartPos(EChickenBagType.Equipment, key);
                };
                var listener = UIEventTriggerListener.Get(dragEnd.gameObject);
                listener.onClick += (UIEventTriggerListener arg1, PointerEventData arg2) =>
                {
                    if (arg2.button == PointerEventData.InputButton.Right)
                    {
                        UseItem(key);
                    }
                };
            }

            for (int j = 1; j <= 3; j++)
            {
                for (int i = 0; i < 5; i++)
                {
                    var type    = weaponPartTypeList[i];
                    var dragEnd = FindComponent <UIDrag>(type.ToString() + "Icon" + j);
                    var j1      = j;
                    var key     = "5|" + ((j1) * 10 + (int)type).ToString();
                    dragEnd.OnEndDragCallback = (data) =>
                    {
                        SetDragStartPos(EChickenBagType.WeaponPart, key);
                    };
                    var listener = UIEventTriggerListener.Get(dragEnd.gameObject);
                    listener.onClick += (UIEventTriggerListener arg1, PointerEventData arg2) =>
                    {
                        if (arg2.button == PointerEventData.InputButton.Right)
                        {
                            UseItem(key);
                        }
                    };
                }
            }

            for (int i = 1; i <= _slotNum; i++)
            {
                var dragEnd = FindComponent <UIDrag>("WeaponIcon" + i);
                var i1      = i;
                var key     = "4|" + i1.ToString();
                dragEnd.OnEndDragCallback = (data) => { SetDragStartPos(EChickenBagType.Weapon, key); };
                dragEnd.CopyItemSize      = _copyWeaponIconSize;
                var listener = UIEventTriggerListener.Get(dragEnd.gameObject);
                listener.onClick += (UIEventTriggerListener arg1, PointerEventData arg2) =>
                {
                    if (arg2.button == PointerEventData.InputButton.Right)
                    {
                        UseItem(key);
                    }
                };
            }
        }