コード例 #1
0
    public IEnumerator _Fapai()
    {
        AudioManager am = AudioManager.GetInstance();
        RoomMgr      rm = RoomMgr.GetInstance();

        ResetCards();

        SeatInfo seat  = rm.seats[seatindex];
        bool     valid = seat.isHoldsValid();

        List <int> holds = new List <int>(seat.holds);
        int        cnt   = seat.getHoldsLen();
        int        mopai = 0;

        if (!valid)
        {
            for (int i = 0; i < cnt; i++)
            {
                holds.Add(INVALID_ID);
            }
        }

        if (cnt % 3 == 2)
        {
            mopai = holds[cnt - 1];
            holds.RemoveAt(cnt - 1);
        }

        bool replay = ReplayMgr.GetInstance().isReplay();

        if (!isMyself() && replay)
        {
            _HandCardPlace.transform.Translate(0, 0, 0.04f);
            _HandCardPlace.transform.Rotate(-90, 0, 0);

            _MoHandPos.transform.Rotate(-90, 0, 0);
        }

        holds.Sort((a, b) => a - b);
        idArray = holds;

        for (int i = 0; i < holds.Count; i++)
        {
            int        id  = holds[i];
            float      x   = holds.Count / 2.0f - i;
            GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id);
            Transform  tm  = obj.transform;

            obj.layer          = m_handCard_layer;
            obj.gameObject.tag = tagValue;
            tm.SetParent(_HandCardPlace);

            HandCardItem item = new HandCardItem(id, obj);

            item.setInteractable(false, false);
            _handCardList.Add(item);

            tm.localPosition = Vector3.zero;
            tm.localRotation = Quaternion.Euler(Vector3.zero);
            tm.Translate(offSetX * x, 0, 0);

            am.PlayEffectAudio("dice");

            yield return(new WaitForSeconds(0.05f));
        }

        _MoHandPos.localPosition = !isMyself() && replay ? new Vector3(0, 0, 0.04f) : Vector3.zero;
        _MoHandPos.Translate(-(holds.Count / 2.0f + 0.5f) * offSetX, 0, 0);

        if (mopai > 0)
        {
            SetMoHandCard(mopai);
            _MoHand.setInteractable(false, false);
        }

        Dance();
    }
コード例 #2
0
ファイル: RoomMgr.cs プロジェクト: isoundy000/shmj3d
    public int getHoldsLen(int si)
    {
        SeatInfo st = seats[si];

        return(st.getHoldsLen());
    }
コード例 #3
0
    public void sync()
    {
        RoomMgr rm = RoomMgr.GetInstance();

        ResetInfo();

        SeatInfo seat = rm.seats[seatindex];

        bool valid = seat.isHoldsValid();

        List <int> holds = new List <int>(seat.holds);
        int        cnt   = seat.getHoldsLen();
        int        mopai = 0;

        if (!valid)
        {
            for (int i = 0; i < cnt; i++)
            {
                holds.Add(INVALID_ID);
            }
        }

        if (cnt % 3 == 2)
        {
            mopai = holds[cnt - 1];
            holds.RemoveAt(cnt - 1);
        }

        bool replay = ReplayMgr.GetInstance().isReplay();

        if (!isMyself() && replay)
        {
            _HandCardPlace.transform.Translate(0, 0, 0.04f);
            _HandCardPlace.transform.Rotate(-90, 0, 0);

            _MoHandPos.transform.Rotate(-90, 0, 0);
        }

        holds.Sort((a, b) => a - b);
        idArray = holds;

        for (int i = 0; i < holds.Count; i++)
        {
            int        id  = holds[i];
            GameObject obj = ResourcesMgr.GetInstance().LoadMJ(id);

            obj.layer          = m_handCard_layer;
            obj.gameObject.tag = tagValue;
            obj.transform.SetParent(_HandCardPlace);
            obj.transform.Rotate(90, 0, 0);
            HandCardItem item = new HandCardItem(id, obj);
            _handCardList.Add(item);
        }

        UpdateHandCard(true);

        if (seat.tingpai)
        {
            Ting(true);
        }

        showFlowers();

        cnt = rm.seats[seatindex].getCPGCnt();
        m_pengOrGangMoveCount = cnt < 3 ? cnt : 3;
        if (cnt > 0)
        {
            _HandCardPlace.transform.Translate(-1.5f * cnt * offSetX, 0, 0);
            transform.Translate(-1.5f * cnt * offSetX, 0, 0);
        }

        if (mopai > 0)
        {
            SetMoHandCard(mopai);
        }
    }