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 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(); }