コード例 #1
0
ファイル: ItemAgent.cs プロジェクト: pengeel/Project-ZT
    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.button == PointerEventData.InputButton.Left && agentType == ItemAgentType.Making)
        {
            ItemWindowManager.Instance.SetItemAndOpenWindow(this);
            return;
        }
#if UNITY_STANDALONE
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (DragableManager.Instance.IsDraging && (agentType == ItemAgentType.Backpack || agentType == ItemAgentType.Warehouse))
            {
                ItemAgent source = DragableManager.Instance.Current as ItemAgent;
                if (source)
                {
                    source.SwapInfoTo(this);
                }
            }
            else
            {
                if (!IsEmpty && agentType != ItemAgentType.None && agentType != ItemAgentType.Loot && agentType != ItemAgentType.Purchasing)
                {
                    BeginDrag();
                }
            }
        }
        else if (eventData.button == PointerEventData.InputButton.Right && !IsEmpty)
        {
            OnRightClick();
        }
#elif UNITY_ANDROID
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (clickCount < 1)
            {
                isClick = true;
            }
            if (clickTime <= 0.2f)
            {
                clickCount++;
            }
            if (!IsEmpty)
            {
                if (clickCount > 1)
                {
                    OnRightClick();
                    isClick    = false;
                    clickCount = 0;
                    clickTime  = 0;
                }
                else if (clickCount == 1 && touchTime < 0.5f)
                {
                    ItemWindowManager.Instance.SetItemAndOpenWindow(this);
                }
            }
        }
#endif
    }