Exemple #1
0
    void initGameState_Playing()
    {
        //隐藏退出和就位等按钮
        readyBtn.gameObject.SetActive(false);
        leaveBtn.gameObject.SetActive(false);
        changeRoomBtn.gameObject.SetActive(false);
        //显示麻将剩余数量
        numOfMJText.text = room.public_roomInfo.numOfMJ + "";
        print("庄家索引是" + room.public_roomInfo.button);
        print(room.public_roomInfo.playerInfo[1].userId + " 玩家手牌数量==" + room.public_roomInfo.playerInfo[1].holdsCount);
        //初始化打出牌,碰、杠、胡牌
        for (int i = 0; i < room.public_roomInfo.playerInfo.Count; i++)
        {
            PLAYER_PUBLIC_INFO pb = room.public_roomInfo.playerInfo[i];
            playerInfo         pi = GetPlayerInfoByServerIndex(i);
            realyPlayer.Add(pi);             //按照房间人数安排的玩家列表
            pi.initSeat(i);
            pi.upDataHandCards();            //初始化手中牌
            pi.upDataFlodsCard();            //更新打出的牌
            pi.upDataPengCard();             //更新碰的牌
            pi.upDataGangCard();             //更新杠的牌
        }
        //处理正在打出的牌
        int chuPai = room.public_roomInfo.chuPai;

        if (chuPai != -1)
        {
            GetPlayerInfoByServerIndex(room.public_roomInfo.turn).showChuPai(chuPai);
        }
        foreach (PLAYER_PUBLIC_INFO pb in room.public_roomInfo.playerInfo)
        {
        }
    }
Exemple #2
0
    public void upDataHuCard()
    {
        PLAYER_PUBLIC_INFO si = MJpanel.instance.room.public_roomInfo.playerInfo[ServerIndex];

        for (int i = 0; i < si.hus.Count; i++)
        {
            MonoBehaviour.print("--hupai--" + si.hus[i]);
            int        pai  = si.hus[i];
            GameObject item = getMJPrfb(huPrf.gameObject, huRoot, i);
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            item.transform.Find("hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            item.transform.SetParent(huRoot, false);
            item.transform.localPosition = new Vector3(flodsCardWeight * i, 0, 0);
            item.gameObject.SetActive(true);
        }
    }
Exemple #3
0
    //刷新打出的牌
    public void upDataFlodsCard()
    {
        PLAYER_PUBLIC_INFO _seatInfo = MJpanel.instance.room.public_roomInfo.playerInfo[ServerIndex];

        MonoBehaviour.print(_seatInfo.userId);
        int cardCount = _seatInfo.holdsCount;
        int index     = ServerIndex;

        MonoBehaviour.print(_seatInfo.folds.Count);
        for (int i = 0; i < _seatInfo.folds.Count; i++)
        {
            GameObject item;
            if (i > foldsMaxMJCount_a_line)
            {
                item = getMJPrfb(flodsCardPrfb.gameObject, flodsRoot2, i - foldsMaxMJCount_a_line + 1);
            }
            else
            {
                item = getMJPrfb(flodsCardPrfb.gameObject, flodsRoot, i);
            }

            int pai = (int)(sbyte)_seatInfo.folds[i];
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            item.transform.Find("hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            if (i > foldsMaxMJCount_a_line)
            {
                item.transform.SetParent(flodsRoot2, false);
                item.transform.localPosition = new Vector3(flodsCardWeight * (i - foldsMaxMJCount_a_line - 1), 0, 0);
            }
            else
            {
                item.transform.SetParent(flodsRoot, false);
                item.transform.localPosition = new Vector3(flodsCardWeight * i, 0, 0);
            }
            item.gameObject.SetActive(true);
        }
    }
Exemple #4
0
    public void upDataPengCard()
    {
        PLAYER_PUBLIC_INFO si = MJpanel.instance.room.public_roomInfo.playerInfo[ServerIndex];

        for (int i = 0; i < si.pengs.Count; i++)
        {
            int        pai  = si.pengs[i];
            GameObject item = getMJPrfb(pengPrfb.gameObject, pengRoot, i);
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            for (int j = 0; j < item.transform.childCount; j++)
            {
                item.transform.GetChild(j).Find("hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            }
            item.transform.SetParent(pengRoot, false);
            item.transform.localPosition = new Vector3(pengRootWeight * i + (i * 20), 0, 0);
            item.gameObject.SetActive(true);
        }
    }
Exemple #5
0
    //刷新手牌
    public void upDataHandCards()
    {
        if (isPlayer)
        {
            upDataPlayerHandCards();
        }
        else
        {
            PLAYER_PUBLIC_INFO si = MJpanel.instance.room.public_roomInfo.playerInfo[ServerIndex];
            bool isPlay           = (MJpanel.instance.room.public_roomInfo.turn == ServerIndex && MJpanel.instance.room.public_roomInfo.chuPai == -1) ? true : false;
            int  cardCount        = si.holdsCount;

            if (holdsRoot.childCount > cardCount)
            {
                for (int i = holdsRoot.childCount - 1; i >= cardCount; i--)
                {
                    MonoBehaviour.Destroy(holdsRoot.GetChild(i).gameObject);
                }
            }
            int index = 0;
            for (int i = 0; i < cardCount; i++)
            {
                GameObject item = getMJPrfb(holdsCardPrfb.gameObject, holdsRoot, i);
                item.name = i + "";
                item.transform.SetParent(holdsRoot, false);
                if (isPlay && i == cardCount - 1)
                {
                    item.transform.localPosition = new Vector3(holdsStartPos.x - (holdsCardWeight * 1.5f), holdsStartPos.y, 0);
                }
                else
                {
                    item.transform.localPosition = new Vector3(holdsStartPos.x + ((holdsCardWeight - 3) * index), holdsStartPos.y, 0);
                }
                item.gameObject.SetActive(true);
                index++;
            }
        }
    }
Exemple #6
0
    void initGameState_Playing()
    {
        //隐藏退出和就位等按钮
        readyBtn.gameObject.SetActive(false);
        leaveBtn.gameObject.SetActive(false);
        changeRoomBtn.gameObject.SetActive(false);
        //显示麻将剩余数量
        numOfMJText.text = room.public_roomInfo.numOfMJ + "";
        //初始化打出牌,碰、杠、胡牌
        for (int i = 0; i < room.public_roomInfo.playerInfo.Count; i++)
        {
            PLAYER_PUBLIC_INFO pb = room.public_roomInfo.playerInfo[i];
            playerInfo         pi = GetPlayerInfoByServerIndex(i);
            realyPlayer.Add(pi);              //按照房间人数安排的玩家列表
            pi.initSeat(i);
            //隐藏准备的图片
            pi.changeReady(0);
            pi.upDataHandCards();         //初始化手中牌
            pi.upDataFlodsCard();         //更新打出的牌
            pi.upDataPengCard();          //更新碰的牌
            pi.upDataGangCard();          //更新杠的牌
            pi.upDataHuCard();            //更新胡的牌
        }

        //处理正在打出的牌
        int chuPai = room.public_roomInfo.chuPai;

        if (chuPai != -1)
        {
            GetPlayerInfoByServerIndex(room.public_roomInfo.turn).showChuPai(chuPai);
        }
        //处理操作信息
        if (account.actionData.gang == 1 || account.actionData.peng == 1 || account.actionData.hu == 1)
        {
            account.showActionData();
            _actionData.UpDataActionData();
        }
    }
Exemple #7
0
    public void upDataGangCard()
    {
        PLAYER_PUBLIC_INFO si = MJpanel.instance.room.public_roomInfo.playerInfo[ServerIndex];
        int stratPosInt       = si.pengs.Count;

        //处理点杆
        for (int i = 0; i < si.diangangs.Count; i++)
        {
            MonoBehaviour.print("si.diangangs == " + si.diangangs[i]);
            int        pai  = si.diangangs[i];
            GameObject item = getMJPrfb(diangangsPrf.gameObject, diangangsRoot, i);
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            for (int j = 0; j < item.transform.childCount; j++)
            {
                item.transform.GetChild(j).Find("hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            }
            item.transform.SetParent(diangangsRoot, false);
            item.transform.localPosition = new Vector3(pengRootWeight * (i + stratPosInt) + ((i + stratPosInt) * 20), 0, 0);
            item.gameObject.SetActive(true);
        }
        stratPosInt += si.diangangs.Count;
        //处理wanGang
        for (int i = 0; i < si.wangangs.Count; i++)
        {
            MonoBehaviour.print("si.wangangs == " + si.wangangs[i]);
            int        pai  = si.wangangs[i];
            GameObject item = getMJPrfb(wangangsPrf.gameObject, wangangsRoot, i);
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            for (int j = 0; j < item.transform.childCount; j++)
            {
                item.transform.GetChild(j).Find("hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            }
            item.transform.SetParent(wangangsRoot, false);
            item.transform.localPosition = new Vector3(pengRootWeight * (i + stratPosInt) + ((i + stratPosInt) * 20), 0, 0);
            item.gameObject.SetActive(true);
        }
        stratPosInt += si.wangangs.Count;
        //处理暗杆
        for (int i = 0; i < si.angangs.Count; i++)
        {
            MonoBehaviour.print("si.angangs == " + si.angangs[i]);
            int        pai  = si.angangs[i];
            GameObject item = getMJPrfb(angangsPrf.gameObject, angangsRoot, i);
            if (item.name == pai + "")
            {
                continue;
            }
            item.name = pai + "";
            item.transform.Find("4/hs").GetComponent <Image>().sprite = MJpanel.instance.getUISprite("UI/MJSprite/" + MJpanel.instance.getMJType(pai));
            item.transform.SetParent(angangsRoot, false);
            item.transform.localPosition = new Vector3(pengRootWeight * (i + stratPosInt) + ((i + stratPosInt) * 20), 0, 0);
            item.gameObject.SetActive(true);
        }
    }