Пример #1
0
    void onMJChoosed(HandCardItem item)
    {
        int id = item.getId();

        if (_gangState == 0)
        {
            enterGangState(1, item.getId());
        }

        GameAction ac = _options;

        int cnt = ac.help.Count;

        if (cnt > 0)
        {
            List <HuPai> hus = null;
            for (int i = 0; i < cnt; i++)
            {
                if (ac.help [i].pai == id)
                {
                    hus = ac.help[i].hus;
                    break;
                }
            }

            showPrompt(hus);
        }

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

        Highlight(id, true);
    }
Пример #2
0
    public int GetIndexByItem(HandCardItem targetItem)
    {
        int index = -1;
        int key   = int.MaxValue;

        HandCardItem item = null;
        int          tid  = targetItem.getId();

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

            int id = item.getId();

            if (tid == id)
            {
                index = i;
                break;
            }
            else if (tid < id && key > id)
            {
                index = i;
                key   = id;
            }
        }

        if (index == -1)
        {
            index = _handCardList.Count;
        }

        return(index);
    }
Пример #3
0
    public void ChuPai(HandCardItem item, bool isMoNi)
    {
        item.setLayer("ZhuoPai");
        _RecyleHandCardList.Add(item);
        PlayChuPaiAnimation(isMoNi);

        AudioManager.GetInstance().PlayHandCardAudio(item.getId());
    }
Пример #4
0
 public void PlayChuPaiAnimation(HandCardItem item)
 {
     _currentObj = item.getObj();
     id          = item.getId();
     _currentObj.transform.SetParent(_handright_point);
     _currentObj.transform.localPosition = Vector3.zero;
     _currentObj.transform.localRotation = Quaternion.Euler(90, 0, 0);
 }
Пример #5
0
    public void checkTingPai()
    {
        Debug.Log("checkTingPai");

        List <int>          tingouts = _options.tingouts;
        DHM_HandCardManager hcm      = getHandCardManager();
        List <HandCardItem> list     = new List <HandCardItem>(hcm._handCardList);

        if (hcm._MoHand != null)
        {
            list.Add(hcm._MoHand);
        }

        for (int i = 0; i < list.Count; i++)
        {
            HandCardItem item  = list [i];
            bool         check = tingouts == null || tingouts.Contains(item.getId());
            item.setInteractable(check);
        }
    }
Пример #6
0
    void shoot(HandCardItem item)
    {
        int    mjid = item.getId();
        NetMgr nm   = NetMgr.GetInstance();

        if (_tingState == 0)
        {
            enterTingState(1, mjid);
        }
        else
        {
            if (hasOptions())
            {
                nm.send("guo");
            }

            //showTings(false);

            nm.send("chupai", "pai", mjid);
        }
    }
Пример #7
0
    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);
    }