public override void Init() { base.Init(); idLb.text = UserInfoModel.userInfo.userId.ToString(); agLb.text = UserInfoModel.userInfo.walletAgNum.ToString(); goldLb.text = UserInfoModel.userInfo.walletGoldBarNum.ToString(); roomCardLb.text = UserInfoModel.userInfo.roomCardNum.ToString(); nameLb.text = UserInfoModel.userInfo.nickName; cityLb.text = UserInfoModel.userInfo.province; headIcon.sprite = UserInfoModel.userInfo.headIconSprite; JsonData curLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level); string levelDes = curLvJson["designation"].ToString(); lvLb.text = "Lv:" + UserInfoModel.userInfo.level + "(" + levelDes + ")"; try {//没到最大等级 JsonData nextLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level + 1); long allExp = long.Parse(nextLvJson["exp"].ToString()); SetExpSlider(false, allExp); } catch {//到了最大等级 SetExpSlider(true, 0); } boy.isOn = UserInfoModel.userInfo.sex == 0; girl.isOn = UserInfoModel.userInfo.sex == 1; }
/// <summary> /// 设置数据 /// </summary> private void SetValue() { addBtn.gameObject.SetActive(UserInfoModel.userInfo.userId != _data.userId); sexIcon.sprite = BundleManager.Instance.GetSprite("Common/normal_btn_" + _data.gender); playName.text = _data.nickName; LvText.text = "Lv" + _data.level; playId.text = "ID:" + _data.userId; playicon.sprite = _data.iconSprite; agNum.text = _data.ag.ToString(); goldNum.text = _data.gold.ToString(); LitJson.JsonData nextLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level + 1); long allExp = long.Parse(nextLvJson["exp"].ToString()); exeSlider.fillAmount = (float)(_data.curExp / allExp); print("玩家经验:" + _data.curExp + "——" + allExp); }
void SetLv() { JsonData curLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level); lvLb.text = "LV" + curInfo.level; try {//没到最大等级 JsonData nextLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level + 1); long allExp = long.Parse(nextLvJson["exp"].ToString()); SetExpSlider(false, allExp); } catch {//到了最大等级 SetExpSlider(true, 0); } }
public void Init(BasePlayerInfo info, bool isFriend) { curInfo = info; StartCoroutine(MiscUtils.DownloadImage(info.icon, spr => { headIcon.sprite = spr; })); idLb.text = info.uid; nameLb.text = info.userNickname; sixIcon.sprite = BundleManager.Instance.GetSprite(info.six == Six.boy ? "friend/haoyou_pic_nan" : "friend/haoyou_pic_nv"); sixIcon.SetNativeSize(); yinbiLb.text = info.money.ToString(); vipObj.SetActive(info.vip > 0); try {//没到最大等级 JsonData nextLvJson = UserInfoModel.GetLvJsonData(UserInfoModel.userInfo.level + 1); long allExp = long.Parse(nextLvJson["exp"].ToString()); SetExpSlider(false, allExp); } catch {//到了最大等级 SetExpSlider(true, 0); } if (isFriend) { delBtn.SetActive(true); chatBtn.SetActive(true); jubaoBtn.SetActive(false); addFriendBtn.gameObject.SetActive(false); UGUIEventListener.Get(delBtn).onClick = delegate { Del(); }; UGUIEventListener.Get(chatBtn).onClick = delegate { Chat(); }; } else { SetBtnState(info.relation); delBtn.SetActive(false); chatBtn.SetActive(false); jubaoBtn.SetActive(true); addFriendBtn.gameObject.SetActive(true); UGUIEventListener.Get(jubaoBtn).onClick = delegate { Jubao(); }; UGUIEventListener.Get(addFriendBtn.gameObject).onClick = delegate { AddFriend(); }; } }