private void Update() { if (lastAvatar != selectAvatar) { lastAvatar = selectAvatar; avatarBtn.GetComponent <Image>().sprite = Resources.Load <Sprite>("Avatar/avatar" + selectAvatar.avatarIdx); } nameText.text = GameController.manager.accountMan.selfInfo.name; quatoText.text = GameController.manager.accountMan.selfInfo.quato; }
void InitAvatar() { Util.DeleteChildren(avatarBtnParent); for (int i = 0; i < Util.avatarCount; i++) { AvatarBtn item = Instantiate(avatarBtnPrefab) as AvatarBtn; item.SetContent(i + 1, () => { SetPageIdx(-1); }); item.transform.SetParent(avatarBtnParent, false); } avatarImage.sprite = Resources.Load <Sprite>("Avatar/avatar" + GameController.manager.accountMan.selfInfo.avatar); }
private void Update() { if (lastBtn != IndexUI.selectAvatar) { lastBtn = IndexUI.selectAvatar; avatarImage.sprite = Resources.Load <Sprite>("Avatar/avatar" + IndexUI.selectAvatar.avatarIdx); } if (shouldUpdate) { AccountInfo info = GameController.manager.accountMan.selfInfo; nameText.text = info.name; quatoText.text = info.quato; ageText.text = (DateTime.Now.Year - int.Parse(info.birthday.Split('-')[0])).ToString(); sexText.text = info.sex == 0 ? "男" : "女"; yearInput.text = info.birthday.Split('-')[0]; monthInput.text = info.birthday.Split('-')[1]; dayInput.text = info.birthday.Split('-')[2]; nameInput.text = info.name; quatoInput.text = info.quato; quatoCountText.text = quatoInput.text.Length.ToString() + "/20"; shouldUpdate = false; } }