protected override void OnFreshView() { base.OnFreshView(); var info = (UserInfo)Data; if (info == null) { return; } if (NickLabel != null) { NickLabel.text = info.NickM; } if (StatusLabel != null) { StatusLabel.text = info.IsOnLine? "在线" : "离线"; } name = info.Id.ToString(); if (UserIdLabel != null) { UserIdLabel.text = string.Format("ID:{0}", info.UserId); } if (Protrail == null) { return; } var avatar = info.AvatarX; int sex; int.TryParse(info.SexI.ToString(), out sex); PortraitRes.SetPortrait(avatar, Protrail, sex); }
protected override void OnFreshView() { var roomData = GetData <RoomInfoData>(); if (roomData == null) { return; } RealRoomId = roomData.RoomId; RoomId.text = TeaUtil.SubId(roomData.RoomId); RealGameName = roomData.GameName; RealGameRound = roomData.GameRound; GameNameAndRound.text = roomData.GameName + " " + roomData.GameRound + (roomData.IsQuan?"圈":"局"); UseNum = roomData.UseNum; InfoStr = roomData.InfoStr; DatalLabel.text = roomData.CreateDt; bool overIconShow = roomData.OverIcon; OverIcon.SetActive(overIconShow); Ids = new string[roomData.UserInfos.Length]; Golds = new string[roomData.UserInfos.Length]; for (int i = 0; i < roomData.UserInfos.Length; i++) { Avatars[i].gameObject.SetActive(true); Names[i].text = roomData.UserInfos[i].UserName; string url = roomData.UserInfos[i].Avatar; PortraitRes.SetPortrait(url, Avatars[i], 1); Golds[i] = roomData.UserInfos[i].Gold; Ids[i] = roomData.UserInfos[i].Id; } if (HeadLayout != null) { HeadLayout.ResetLayout(); } }
protected override void OnAwake() { base.OnAwake(); YxMsgCenterHandler.GetIntance().AddListener(string.Format("{0}_OnChange", UserInfoModel.Instance.GetType().Name), delegate { var userInfo = UserInfoModel.Instance.UserInfo; PortraitRes.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI); }); }
protected virtual void OnBindDate() { var userInfo = UserInfoModel.Instance.UserInfo; var loginName = userInfo.LoginM; if (UserId != null) { UserId.text = string.Format("{0}{1}", IdForm, App.UserId); } if (UserName != null) { UserName.text = string.IsNullOrEmpty(loginName) ? "游客" : loginName; } if (Sex != null) { switch (userInfo.SexI) { case 0: Sex.text = "女"; break; case 1: Sex.text = "男"; break; default: Sex.text = "保密"; break; } } YxTools.TrySetComponentValue(UserCoin, userInfo.CoinA.ToString()); YxTools.TrySetComponentValue(UserGold, userInfo.CashA.ToString()); YxTools.TrySetComponentValue(UserCoinAdapter, userInfo.CoinA, "1"); if (ClienIp != null) { ClienIp.text = userInfo.ClientIP; } if (NikeName != null) { NikeName.text = userInfo.NickM; } if (PhoneNumber != null) { PhoneNumber.text = userInfo.MobileN; } if (SpreadBtn != null) { var needShow = userInfo.Promoter != null && userInfo.Promoter == false; SpreadBtn.SetActive(needShow); } PortraitRes.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI); }
protected override void OnFreshView() { if (Data == null) { return; } if (!(Data is Dictionary <string, object>)) { return; } var userData = Data as Dictionary <string, object>; if (UserId != null) { UserId.text = userData.ContainsKey("id") ? userData["id"].ToString() : ""; } if (UserName != null) { UserName.text = userData.ContainsKey("name") ? userData["name"].ToString() : ""; } var avatar = userData.ContainsKey("avatar_x") ? userData["avatar_x"].ToString() : ""; var sex = userData.ContainsKey("sex_i") ? int.Parse(userData["sex_i"].ToString()) : 1; if (UserHead != null) { PortraitRes.SetPortrait(avatar, UserHead, sex); } var glod = userData.ContainsKey("gold") ? int.Parse(userData["gold"].ToString()) : 0; if (UserGold != null) { UserGold.text = glod >= 0 ? "[BA412DFF]+" + glod : "[599239FF]" + glod; } var bigWin = userData.ContainsKey("dayingjia") && bool.Parse(userData["dayingjia"].ToString()); if (!bigWin && Kuang != null) { Kuang.spriteName = "lose"; } if (BigWinner != null) { BigWinner.gameObject.SetActive(bigWin); } var owner = userData.ContainsKey("owner") && bool.Parse(userData["owner"].ToString()); if (RoomOwner != null) { RoomOwner.gameObject.SetActive(owner); } }
public void SetData(DbsmjPlayerRecordData data, bool roomType) { _playerName.text = data.PlayerName; _playerScore.text = data.ScoreNum.ToString();// + (roomType ? "金币" : "积分"); if (_playerID != null) { _playerID.gameObject.SetActive(!data.ID.Equals(0)); _playerID.text = string.Format("ID:{0}", data.ID); } if (!string.IsNullOrEmpty(data.Icon)) { int sex = data.Sex >= 0 ? data.Sex : 0; PortraitRes.SetPortrait(data.Icon, _playerIcon, sex); } }
private void RefreshItem(Dictionary <string, object> dic) { _data = new HeadData(dic); YxTools.TrySetComponentValue(ShowUserName, _data.UserName); YxTools.TrySetComponentValue(ShowId, _data.UserId); YxTools.TrySetComponentValue(ShowTotalScore, _data.UserScore); if (SelfSpecialColorl) { if (_data.UserId.Equals(App.UserId)) { if (ShowUserName) { ShowUserName.color = SelfColor; } } } PortraitRes.SetPortrait(_data.HeadUrl, ShowHead, _data.UserSex); }
protected override void OnStart() { EffectVolume.value = MusicManager.Instance.EffectVolume; BackMusicVolume.value = MusicManager.Instance.MusicVolume; if (VersionLabel != null) { VersionLabel.text = Application.version; } var userInfo = UserInfoModel.Instance.UserInfo; if (UserNickLabel != null) { UserNickLabel.text = userInfo.NickM; } if (Portrait != null) { PortraitRes.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI); } }
protected override void OnFreshView() { base.OnFreshView(); var info = (UserInfo)Data; if (info == null) { return; } if (NickLabel != null) { NickLabel.text = info.NickM; } if (StatusLabel != null) { StatusLabel.text = info.IsOnLine ? "在线" : "离线"; } name = info.UserId.ToString(); if (UserIdLabel != null) { UserIdLabel.text = string.Format("ID:{0}", info.UserId); } if (Protrail == null) { return; } var avatar = info.AvatarX; int sex; int.TryParse(info.SexI.ToString(), out sex); PortraitRes.SetPortrait(avatar, Protrail, sex); if (App.UserId != info.UserId && info.FriendMsgStatusI != 2) { AddBtn.gameObject.SetActive(true); AddBtn.isEnabled = info.FriendMsgStatusI != 1; } else { AddBtn.gameObject.SetActive(false); } }
protected override void OnBindDate(bool isChange = false) { if (!isChange) { return; } var userInfo = UserInfoModel.Instance.UserInfo; if (UserName != null) { UserName.text = userInfo.NickM; } if (IdLabel != null) { IdLabel.text = App.UserId; } if (UserGold != null) { UserGold.text = userInfo.CoinA.ToString(); } if (UserGoldAdapter) { UserGoldAdapter.Text(userInfo.CoinA); } if (UserCash != null) { UserCash.text = userInfo.CashA.ToString(); } if (CustomLabel != null) { CustomLabel.text = LoginInfo.Instance.G_MobileHallServerText; } if (Portrait != null) { PortraitRes.SetPortrait(userInfo.AvatarX, Portrait, userInfo.SexI); } OnBindBackDate(null); RefreshTopMenu(); ShowVersion(VerLabel); }
protected override void OnFreshView() { if (Data == null) { return; } var rankData = Data as RankItemData; if (rankData == null) { return; } if (Medal != null) { var isSpecialRank = rankData.RankNum <= FirstFew && rankData.RankNum != 0; if (isSpecialRank) { if (!string.IsNullOrEmpty(SpecialRankBg)) { Medal.spriteName = string.Format("{0}{1}", SpecialRankBg, rankData.RankNum); } Medal.gameObject.SetActive(true); Medal.MakePixelPerfect(); if (SpecialRankNeedLabel) { RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } else { RankNum.gameObject.SetActive(false); } } else { if (!string.IsNullOrEmpty(NormalRankBg)) { Medal.spriteName = NormalRankBg; } Medal.gameObject.SetActive(false); Medal.MakePixelPerfect(); RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } } else { RankNum.gameObject.SetActive(true); RankNum.text = rankData.RankNum <= TotalCount && rankData.RankNum != 0 ? string.Format(FormatRank, rankData.RankNum) : SpecialRankNotice; } Nick.text = rankData.Nick; YxTools.TrySetComponentValue(Value, rankData.Value.ToString(FormatCoin)); YxTools.TrySetComponentValue(ValueAdapter, rankData.Value, RankType); if (ID) { ID.text = rankData.ID; } if (RankIcon) { RankIcon.spriteName = RankType; } if (Protrail != null) { PortraitRes.SetPortrait(rankData.Avator, Protrail, rankData.Sex); } if (ItemNoticeLabel) { if (!string.IsNullOrEmpty(ItemNotice)) { ItemNoticeLabel.text = ItemNotice; } } if (AffiliateNoticeLabel) { if (rankData.Affiliate == 0) { AffiliateNoticeLabel.text = NoAffiliateContent; } else { AffiliateNoticeLabel.text = string.Format("{0}{1}", AffiliateFormat, rankData.Affiliate); } } }
protected override void OnFreshView() { var roomData = GetData <RoomInfoData>(); if (roomData == null) { return; } Reset(); InfoStr = roomData.InfoStr; RealRoomId = roomData.RoomId; RoomId.text = TeaUtil.SubId(roomData.RoomId); GameName.text = roomData.GameName; GameRound.text = roomData.GameRound + (roomData.IsQuan? "圈":"局"); CostShow(roomData); if (Layout) { Layout.SetLayoutByNum(roomData.UserNum); } if (roomData.UserNum > 0) { for (int i = 0; i < EmptySeat.Length; i++) { if (roomData.UserNum > i) { EmptySeat[i].gameObject.SetActive(true); } else { EmptySeat[i].gameObject.SetActive(false); } } } for (int i = 0; i < roomData.UserInfos.Length; i++) { if (string.IsNullOrEmpty(roomData.UserInfos[i].UserName)) { continue; } UserNames[i].text = roomData.UserInfos[i].UserName; string url = roomData.UserInfos[i].Avatar; if (!string.IsNullOrEmpty(url)) { PortraitRes.SetPortrait(url, Avatars[i], 1); } Avatars[i].gameObject.SetActive(true); } if (TeaPanel.TableGameKey.Contains(roomData.GameKey)) { for (int i = 0; i < TeaPanel.TableGameKey.Length; i++) { if (roomData.GameKey == TeaPanel.TableGameKey[i]) { ColorSprite.color = TeaPanel.TableColor[i]; } } } if (roomData.status > 0) { yxz.SetActive(true); } }
public void InitPlayerData(string playerName, string playerGold, string avatar = "") { PlayerName.text = playerName; PlayerGold.text = playerGold; PortraitRes.SetPortrait(avatar, HeadTexture, 1); }