示例#1
0
    private void SetupUI()
    {
        detail.Time_Text.text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        ClearCard();
        PrefabUtils.ClearChild(detail.Grid_GridLayoutGroup);

        if (null != RoomMgr.huSyn)
        {
            detail.Title_TextMeshProUGUI.text = MJUtils.GetHuType(RoomMgr.huSyn.resultType);

            if (RoomMgr.huSyn.resultType == MJUtils.HU_LiuJu)
            {
                foreach (GameOperPlayerSettle settle in RoomMgr.huSyn.detail)
                {
                    if (settle.position == Game.MJMgr.MyPlayer.postion)
                    {
                        SetupSub(detail.RoundAccountSub0_RoundAccountSub, settle, RoomMgr.huSyn.card);
                    }
                    else
                    {
                        GameObject      child = PrefabUtils.AddChild(detail.Grid_GridLayoutGroup, detail.RoundAccountSub1_RoundAccountSub);
                        RoundAccountSub sub   = child.GetComponent <RoundAccountSub>();
                        SetupSub(sub, settle);
                    }
                }
            }
            else
            {
                foreach (GameOperPlayerSettle settle in RoomMgr.huSyn.detail)
                {
                    if (settle.position == RoomMgr.huSyn.position)
                    {
                        SetupSub(detail.RoundAccountSub0_RoundAccountSub, settle, RoomMgr.huSyn.card);
                    }
                    else
                    {
                        GameObject      child = PrefabUtils.AddChild(detail.Grid_GridLayoutGroup, detail.RoundAccountSub1_RoundAccountSub);
                        RoundAccountSub sub   = child.GetComponent <RoundAccountSub>();
                        SetupSub(sub, settle);
                    }
                }
            }
        }

        PrefabUtils.ClearChild(detail.SingleCard_UIItem);
        SpawnCard(detail.SingleCard_UIItem.transform, Game.MJMgr.cardHui); //TODO wxd 结算界面的显示

        detail.M0_UIItem.gameObject.SetActive(MJUtils.HasWanfa(MJUtils.MODE_DAIHUI));
        detail.M1_UIItem.gameObject.SetActive(false);
        detail.M2_UIItem.gameObject.SetActive(false);
        detail.M3_UIItem.gameObject.SetActive(false);

        detail.M4_UIItem.gameObject.SetActive(false);
        detail.M5_UIItem.gameObject.SetActive(false);
        detail.M6_UIItem.gameObject.SetActive(false);
        detail.M7_UIItem.gameObject.SetActive(false);

        // TODO 结算界面
    }
示例#2
0
    void SetupSub(RoundAccountSub sub, GameOperPlayerSettle settle, int huCard = -1)
    {
        MJPlayer mjPlayer = Game.MJMgr.GetPlayerByPosition(settle.position);
        MjData   data     = Game.MJMgr.MjData[settle.position];

        sub.detail.Name_Text.text = data.player.nickName;
        sub.detail.ID_Text.text   = "ID:" + data.player.playerId;
        if (settle.fanNum > 0)
        {
            sub.detail.Fan_TextMeshProUGUI.text = string.Format("+{0}分", settle.fanNum);
        }
        else
        {
            sub.detail.Fan_TextMeshProUGUI.text = string.Format("{0}分", settle.fanNum);
        }
        Game.MJMgr.MjData[settle.position].player.coin  = settle.coin;
        Game.MJMgr.MjData[settle.position].player.score = settle.score;

        //sub.detail.ResultType_Text.text = settle.resultType.ToString();

        string fans = "";

        foreach (string fan in settle.fanDetail)
        {
            //if (fan.Contains("庄家")) continue;
            fans += fan.Trim() + " ";
        }
        sub.detail.TingInfo_Text.text = fans;

        bool IsMakers = Game.MJMgr.MakersPosition == settle.position;

        sub.detail.ZhuangFlag_Image.gameObject.SetActive(IsMakers);

        foreach (int card in mjPlayer.tableCardLayout.TableCards)
        {
            SpawnCard(sub.detail.TableCards_GridLayoutGroup.transform, card);
        }

        foreach (int card in settle.handcard)
        {
            SpawnCard(sub.detail.Handcards_GridLayoutGroup.transform, card);
        }

        if (huCard > 0)
        {
            SpawnCard(sub.detail.Handcards_GridLayoutGroup.transform, huCard);
        }
    }