Пример #1
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);
    }
Пример #2
0
    public void sync()
    {
        List <int> folds = RoomMgr.GetInstance().seats [seatindex].folds;

        ResetInfo();

        for (int i = 0; i < folds.Count; i++)
        {
            int          id   = folds [i] % 100;
            bool         ting = folds [i] > 100;
            GameObject   ob   = ResourcesMgr.GetInstance().LoadMJ(id);
            HandCardItem item = new HandCardItem(id, ob);

            int row = getRow(i);
            int col = getCol(i);

            ob.layer = LayerMask.NameToLayer("ZhuoPai");
            ob.transform.SetParent(this.transform);
            ob.transform.localRotation = Quaternion.Euler(new Vector3(-90, 0, 0));
            ob.transform.localPosition = new Vector3(offSetX * col, 0, offSetZ * row + 0.0098f);
            //ob.transform.Translate(offSetX * col, 0, offSetZ * row);

            if (ting)
            {
                item.setTing(true);
            }

            _RecyleHandCardList.Add(item);
        }
    }