コード例 #1
0
    HandCardItem GetHandCardItemByObj(GameObject obj)
    {
        if (obj == null)
        {
            return(null);
        }

        HandCardItem item = null;

        for (int i = 0; i < _handCardList.Count; i++)
        {
            item = _handCardList[i];

            if (item != null && item.checkObj(obj))
            {
                return(item);
            }
        }

        item = _MoHand;
        if (item != null && item.checkObj(obj))
        {
            return(item);
        }

        return(null);
    }
コード例 #2
0
ファイル: InteractMgr.cs プロジェクト: isoundy000/shmj3d
    public void onMJClicked(HandCardItem item)
    {
        if (item == null || !item.valid())
        {
            return;
        }

        RoomMgr rm = RoomMgr.GetInstance();

        if (_gangState == 0)
        {
            onMJChoosed(item);
            return;
        }

        if (!rm.isMyTurn() || shot)
        {
            return;
        }

        HandCardItem old = selected;
        GameObject   ob  = item.getObj();

        if (old != null && item.checkObj(old))
        {
            if (_tingState != 0)
            {
                old.choosed(false);
            }

            Highlight(old.getId(), false);

            ob.transform.position = selPos;
            selected = null;
            selPos   = Vector3.zero;

            shoot(item);
            shot = true;
            hidePrompt();
            return;
        }

        if (old != null && old.valid())
        {
            ob = old.getObj();

            // NOTE: old maybe in recycle
            if (old.getLayer() == "Self")
            {
                ob.transform.position = selPos;

                if (_tingState != 0)
                {
                    old.choosed(false);
                }

                Highlight(old.getId(), false);
            }

            selected = null;
        }

        ob       = item.getObj();
        selPos   = ob.transform.position;
        selected = item;

        ob.transform.Translate(0, 0.01f, 0);

        onMJChoosed(item);
    }