public void OnUpdate() { for (int i = 0; i < view.childCount; i++) { int id = i; Transform tf = view.GetChild(id); tf.SetParent(view, false); tf.Find("idx").GetComponent <Text>().text = id.ToString(); bool has_save = Tools.HasSave(id); Transform info = tf.Find("Info"); Transform create = tf.Find("BtnCreate"); info.gameObject.SetActive(has_save); create.gameObject.SetActive(!has_save); if (has_save) { GameData.instance.save_id = id; // 读取存档数据显示 string quick_save_path = Tools.SavePath("quick_save.data"); byte[] byt = Tools.ReadAllBytes(quick_save_path); QuickSave quick_data = Tools.DeserializeObject <QuickSave>(byt); info.Find("grilHead").gameObject.SetActive(quick_data.sex == Sex.Girl); info.Find("boyHead").gameObject.SetActive(quick_data.sex == Sex.Boy); info.Find("TextName").GetComponent <Text>().text = quick_data.name; info.Find("TextTime").GetComponent <Text>().text = Tools.ShowTime(new System.DateTime(quick_data.time)); info.Find("TextLevel").GetComponent <Text>().text = LevelConfigData.GetName(quick_data.level); } } }
void UpdateUI() { t_name.text = roleData.name; t_pope.text = MessageData.GetMessage(108); // 无 t_race.text = MessageData.GetMessage(109); // 人族 t_identity.text = MessageData.GetMessage(163); // 身份 t_sex.text = MessageData.GetMessage(160 + (int)roleData.sex); // 性别 t_level.text = LevelConfigData.GetName(roleData.GetAttr(RoleAttribute.level)); t_interest.text = "笛子、萧"; t_intrinsic.text = MessageData.GetMessage(110 + roleData.intrinsic_disposition[0]); // 内在性格 t_intrinsic.GetComponent <BtnScale>().show_id = 56 + roleData.intrinsic_disposition[0]; for (int i = 0; i < 2; i++) { t_external[i].text = MessageData.GetMessage(130 + roleData.external_disposition[i]); // 外在性格 t_external[i].GetComponent <BtnScale>().show_id = 63 + roleData.external_disposition[i]; } for (int i = 0; i < t_xiantian.Length; i++) { XiantianQiyun data = XiantianQiyunData.dataList[roleData.xiantianqiyun[i]]; t_xiantian[i].text = data.name; t_xiantian[i].transform.parent.GetChild(0).GetComponent <Image>().sprite = UIAssets.instance.itemColor[data.color]; t_xiantian[i].GetComponent <BtnScale>().show_str = data.des; } for (int i = 0; i < t_houtian.Length; i++) { Tools.SetActive(t_houtian[i].transform.parent.gameObject, false); } }
public void UpdateInfo() { RoleData roleData = RoleData.mainRole; level_name.text = LevelConfigData.GetName(roleData.GetAttr(RoleAttribute.level)); hp.text = string.Format("{0}/{1}", roleData.GetAttr(RoleAttribute.hp), roleData.GetMaxAttr(RoleAttribute.hp)); mp.text = string.Format("{0}/{1}", roleData.GetAttr(RoleAttribute.mp), roleData.GetMaxAttr(RoleAttribute.mp)); nl.text = string.Format("{0}/{1}", roleData.GetAttr(RoleAttribute.spirit), roleData.GetMaxAttr(RoleAttribute.spirit)); role_name.text = roleData.name; show_coin.text = roleData.GetAttr(RoleAttribute.coin).ToString();; show_contributions.text = roleData.GetAttr(RoleAttribute.contributions).ToString();; show_city_token.text = roleData.GetAttr(RoleAttribute.city_token).ToString();; gril_head.SetActive(roleData.sex == Sex.Girl); boy_head.SetActive(roleData.sex == Sex.Boy); }