void Init() { AssetBundle bundle = AssetBundleManager.GetAssetBundle(GameDefine.HallAssetbundleName); if (bundle == null) { return; } GameObject obj = (GameObject)bundle.LoadAsset("Lobby_video"); obj = Instantiate(obj); LobbyUITfm = obj.transform; LobbyUITfm.SetParent(GameMain.ddCanvas.transform.Find("Root"), false); LobbyUITfm.Find("Top/ButtonReturn").GetComponent <Button>().onClick.AddListener(() => OnClickReturn(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); }