Exemplo n.º 1
0
    public void RemoveGameObj(int id, int Number)
    {
        id = id % 100;

        int          count = 0;
        HandCardItem item  = null;

        for (int i = _handCardList.Count - 1; i >= 0; i--)
        {
            item = _handCardList[i];
            if (item.checkId(id))
            {
                count++;
                item.destroy();
                _handCardList.RemoveAt(i);
                if (count == Number)
                {
                    UpdateHandCard();
                    return;
                }
            }
        }

        item = _MoHand;

        if (item != null && item.checkId(id))
        {
            count++;
            item.destroy();
            _MoHand = null;
        }
        else
        {
            Debug.LogError("mohand id != " + id.ToString());
        }

        if (count != Number)
        {
            Debug.LogError("count < number!!!!");
        }

        UpdateHandCard();
    }
Exemplo n.º 2
0
    public void ChuPai(int pai, Action cb)
    {
        GameObject   ob   = currentObj;
        HandCardItem item = null;

        int  id   = pai % 100;
        bool ting = pai > 100;

        if (ob != null)
        {
            item = GetHandCardItemByObj(ob);

            if (item != null && item.checkId(id))
            {
                item.setTing(ting);

                item.setCB(cb);
                chuPaiEvent(item, true);
                currentObj = null;
                return;
            }
            else if (item == null)
            {
                Debug.LogError("id not found");
            }
            else
            {
                Debug.LogError("id wrong");
            }
        }

        currentObj = null;

        bool valid = isHoldsValid();

        if (valid)
        {
            item = GetHandCardItemById(id);
        }
        else
        {
            item = GetRandomHandCardItem(id);
        }

        if (item != null)
        {
            item.setTing(ting);

            item.setCB(cb);
            chuPaiEvent(item, true);
            return;
        }

        Debug.LogError("chupai not found: " + id);
    }
Exemplo n.º 3
0
    HandCardItem GetHandCardItemById(int id)
    {
        HandCardItem item = null;

        item = _MoHand;
        if (item != null && item.checkId(id))
        {
            return(item);
        }

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

            if (item != null && item.checkId(id))
            {
                return(item);
            }
        }

        return(null);
    }