void SetPlayerView(ref PlayerView view, UserInfo info) { NUserInfo userInfo = userPackage.GetUserInfo(info.Uid); view.name.text = userInfo.name; view.level.text = string.Format("Lv.{0}", userPackage.GetLevel(info.Contribution)); view.bloodMax = 20 + 2 * info.Health; view.blood.value = (float)info.Blood / (float)view.bloodMax; }
void InitPlayerInfo() { PlayerState state = userPackage.GetPlayerState(); bloodProgess.value = (float)state.blood / (float)(20 + 2 * state.health); bloodLabel.text = string.Format("{0}/{1}", state.blood, 20 + 2 * state.health); hungerProgress.value = (float)state.hunger / (float)(20 + 2 * state.health); hungerLabel.text = string.Format("{0}/{1}", state.hunger, 20 + 2 * state.health); thirstProgress.value = (float)state.thirst / (float)(20 + 2 * state.health); thirstLabel.text = string.Format("{0}/{1}", state.thirst, 20 + 2 * state.health); interestLabel.text = string.Format("分配比例:{0:f}%", (float)userPackage.GetPlayerInterest() * 100); resLabel.text = GlobalFunction.NumberFormat(itemPackage.GetResourceTotolNumber()); moneyLabel.text = GlobalFunction.NumberFormat(itemPackage.GetGoldNumber()); elecLabel.text = string.Format("{0}/h", GlobalFunction.NumberFormat(sanctuaryPackage.GetTotalProEfficiency())); attackLabel.text = state.attack.ToString(); defenseLable.text = state.defense.ToString(); agileLabel.text = state.agile.ToString(); speedLabel.text = state.speed.ToString(); intellectLabel.text = state.intellect.ToString(); healthLabel.text = state.health.ToString(); moodLabel.text = state.mood.ToString(); loadLabel.text = "0"; float progress; userPackage.GetPlayerLevel(out progress); expProgress.value = progress; levelLabel.text = string.Format("Lv.{0}", userPackage.GetPlayerLevel()); expLabel.text = string.Format("个人实力:{0}", userPackage.GetPersonContribution()); nameLabel.text = userPackage.GetUserInfo(userPackage.UserID).name; }
void InitView() { long userID = userPackage.GetSelectionUserID(); NUserInfo info = userPackage.GetUserInfo(userID); if (info == null) { return; } nameLabel.text = info.name; contributionLabel.text = info.contribution.ToString(); idLabel.text = info.uID.ToString(); }
void RefreshUserState(NDictionary data = null) { PlayerState playerState = userPackage.GetPlayerState(); if (playerState == null) { return; } coinLabel.text = GlobalFunction.NumberFormat(itemPackage.GetGoldNumber()); resLabel.text = GlobalFunction.NumberFormat(itemPackage.GetResourceTotolNumber()); elecLabel.text = string.Format("{0}/h", GlobalFunction.NumberFormat(sanctuaryPackage.GetTotalProEfficiency())); taskLabel.text = userPackage.GetUserInfo(userPackage.UserID).name; healthProgressBar.value = (float)playerState.blood / (float)(20 + 2 * playerState.health); hungerProgressBar.value = (float)playerState.hunger / (float)(20 + 2 * playerState.health); thirstProgressBar.value = (float)playerState.thirst / (float)(20 + 2 * playerState.health); RefreshPlayerLevel(); }
void OnCraft(NetMsgDef msg) { TSCProcess process = TSCProcess.ParseFrom(msg.mBtsData); if (process.Uid != 0) { NDictionary data = new NDictionary(); data.Add("content", string.Format("玩家{0}正在使用中", userPackage.GetUserInfo(process.Uid).name)); data.Add("title", "加工失败"); data.Add("method", 1); FacadeSingleton.Instance.OpenUtilityPanel("UIMsgBoxPanel"); SendEvent("OpenMsgBox", data); return; } sanctuaryPackage.StartCraft(process); long remainTime = 0; if (GlobalFunction.GetRemainTime(process.FinishTime, out remainTime)) { StartCoroutine(CraftTimer(process.BuildingId, remainTime)); SendEvent("RefreshCraftPanel"); } FacadeSingleton.Instance.InvokeService("RPCGetResourceInfo", ConstVal.Service_Sanctuary); }