Example #1
0
    public void ShowTable(bool show, Dictionary <byte, AppointmentRecordPlayer> players = null, byte roomId = 0, uint deskId = 0)
    {
        if (TableTfm == null)
        {
            return;
        }

        InitDesks();
        Button btn = TableTfm.Find("bottom/Button_Ready").GetComponent <Button>();

        btn.interactable = true;
        TableTfm.gameObject.SetActive(show);
        foreach (ChairInfo ci in m_ChairList)
        {
            ci.Show(false);
        }

        if (show && players != null)
        {
            uint localUserId = GameMain.hall_.GetPlayerId();
            foreach (var v in players)
            {
                if (v.Key >= m_ChairList.Count)
                {
                    continue;
                }
                AppointmentRecordPlayer player = v.Value;
                m_ChairList[v.Key].Show(true, player.playerName, player.url, player.playerid, player.faceid);
                m_ChairList[v.Key].SetReady(player.ready == 1);
                if (player.playerid == localUserId)
                {
                    btn.interactable = (player.ready == 0);
                }
            }

            if (roomId != 0)
            {
                TableTfm.Find("Top/ImageBG/Text_Room/Text_Num").GetComponent <Text>().text = roomId.ToString();
            }
            if (deskId != 0)
            {
                TableTfm.Find("Top/ImageBG/Text_table/Text_Num").GetComponent <Text>().text = deskId.ToString();
            }

            CustomAudio.GetInstance().PlayCustomAudio(1001, true);
        }
    }
Example #2
0
    bool HandleEnterDesk(uint _msgType, UMessage _ms)
    {
        if (m_nDeskNum == 0)
        {
            return(false);
        }

        CCustomDialog.CloseCustomWaitUI();

        byte state = _ms.ReadByte();

        if (state > 0)
        {
            if (state == 7)
            {
                //int coin = _ms.ReadInt();
                CCustomDialog.OpenCustomConfirmUI(1652);
            }
            else if (state == 8)//进入旁观
            {
                m_nBystanderRoom = _ms.ReadUInt();
                GameMain.hall_.GameBaseObj.StartLoad();
            }
            else
            {
                uint code = 2005;
                if (state == 6)
                {
                    code = 1704;
                }
                CCustomDialog.OpenCustomConfirmUI(code);
            }
            return(false);
        }

        Dictionary <byte, AppointmentRecordPlayer> players = new Dictionary <byte, AppointmentRecordPlayer>();
        AppointmentRecordPlayer player;
        byte num = _ms.ReadByte();

        for (int i = 0; i < num; i++)
        {
            player = new AppointmentRecordPlayer();
            byte sit = _ms.ReadByte();
            player.playerid   = _ms.ReadUInt();
            player.faceid     = _ms.ReadInt();
            player.url        = _ms.ReadString();
            player.coin       = _ms.ReadLong();
            player.playerName = _ms.ReadString();
            player.master     = _ms.ReadSingle();
            player.sex        = _ms.ReadByte();
            player.ready      = _ms.ReadByte();
            players[sit]      = player;
        }
        byte roomId = _ms.ReadByte();
        uint deskId = _ms.ReadUInt();

        ShowTable(true, players, roomId, deskId);

        GameMain.hall_.GameBaseObj.StartLoad();

        return(true);
    }
Example #3
0
    bool HandleGetRoundScore(uint _msgType, UMessage _ms)
    {
        long videoId = _ms.ReadLong();
        byte res     = _ms.ReadByte();//是否成功 1成功有数据 0没有

        if (res == 0)
        {
            return(false);
        }

        AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName);

        if (bundle == null)
        {
            return(false);
        }

        if (!ShowRoundScore(true))
        {
            return(false);
        }

        Transform  parent = LobbyUITfm.Find("middle/Viewport_video/Content_video");
        GameObject assetObj = (GameObject)bundle.LoadAsset("video_record");
        Transform  tfm, child;
        long       time;
        Color      winCol  = new Color(0.851f, 0.231f, 0.165f);
        Color      loseCol = new Color(0.349f, 0.51f, 0.737f);

        byte nRoundNum = _ms.ReadByte(); //打了几局
        byte nRoleNum  = _ms.ReadByte(); //几个人

        for (byte i = 1; i <= nRoundNum; i++)
        {
            time = _ms.ReadLong();
            tfm  = (Instantiate(assetObj)).transform;
            tfm.SetParent(parent, false);
            Text t = tfm.Find("Textju").GetComponent <Text>();
            t.text = i.ToString();
            t      = tfm.Find("TextTime").GetComponent <Text>();
            System.DateTime sdt = GameCommon.ConvertLongToDateTime(time);
            t.text = sdt.ToString("yyyy年MM月dd日HH:mm");
            uint[] playerIds = new uint[nRoleNum];
            byte   k         = 0;
            for (; k < nRoleNum; ++k)
            {
                uint nUseid = (uint)_ms.ReadInt();
                int  nScore = _ms.ReadInt();//积分
                byte sit    = _ms.ReadByte();

                if (!m_CurData.result.ContainsKey(nUseid))
                {
                    continue;
                }

                playerIds[sit] = nUseid;

                AppointmentRecordPlayer player = m_CurData.result[nUseid];

                child = tfm.Find("playerinfo_" + (k + 1));
                Image img = child.Find("Image_HeadBG/Image_HeadMask/Image_HeadImage").GetComponent <Image>();
                img.sprite = GameMain.hall_.GetIcon(player.url, nUseid, player.faceid);
                t          = child.Find("TextName").GetComponent <Text>();
                t.text     = player.playerName;
                t          = child.Find("TextJifen").GetComponent <Text>();
                t.text     = GameFunction.FormatCoinText(nScore, true, false);
                t.color    = nScore > 0 ? winCol : loseCol;
            }

            m_IndexPlayers.Add(i, new List <uint>(playerIds));

            for (; k < tfm.childCount; k++)
            {
                child = tfm.Find("playerinfo_" + (k + 1));
                if (child == null)
                {
                    break;
                }
                child.gameObject.SetActive(false);
            }

            byte temp = i;
            tfm.Find("Button_start").GetComponent <Button>().onClick.AddListener(() => OnClickStart(videoId, temp));
            //tfm.FindChild("Button_share").GetComponent<Button>().onClick.AddListener(() => OnClickShare(videoId, temp));
            tfm.Find("Button_share").gameObject.SetActive(false);
        }

        return(true);
    }