void UpdateStatsUI() { Stats.text = "Lvl " + MPC.Getlvl() + " : " + MPC.GetExp() + "/" + MPC.GetNextLvlExp();//Just for now for (int i = 0; i < Values.Length; i++) { Values[i].text = MPC.GetCurrStats((STATSTYPE)i) + StatsType.GetStatsTypeString(i).S; } }
// Use this for initialization void Start() { MPC = transform.parent.GetComponent <Tab_0>().MPC; Stats = transform.Find("Stats").GetComponent <Text>(); Labels = transform.Find("Labels").GetComponentsInChildren <Text>(); Values = transform.Find("Values").GetComponentsInChildren <Text>(); for (int i = 0; i < Labels.Length; i++) { Labels[i].text = StatsType.GetStatsTypeString(i).F; } }
void UpDateSet(Equipment E) { if (E.Set != EQUIPSET.None) { int count = 0; SetName.text = E.Set.ToString(); Set s = ((GameObject)Resources.Load("SetPrefabs/" + E.Set.ToString())).GetComponent <Set>(); List <string> EquippedNameList = new List <string>(); for (int i = 0; i < System.Enum.GetValues(typeof(EQUIPTYPE)).Length; i++) { Equipment equipment = MPC.GetEquippedItem((EQUIPTYPE)i); if (equipment != null) { EquippedNameList.Add(equipment.Name); } } foreach (var e in s.SetList) { if (EquippedNameList.Contains(e.E.Name)) { SetList.text += MyText.Colofied(e.E.Name, "lime"); count++; } else { SetList.text += MyText.Colofied(e.E.Name, "grey"); } if (e != s.SetList.Last()) { SetList.text += "\n"; } } foreach (Bounus b in s.Bounuses) { string b_info = ""; b_info += "Set(" + b.condiction + "): "; switch (b.bounus_type) { case Bounus.BounusType.Stats: StringPair sp = StatsType.GetStatsTypeString(b.stats_bounus.stats_type); b_info += "Add " + sp.F + " "; switch (b.stats_bounus.value_type) { case SetStatsField.ValueType.Raw: b_info += b.stats_bounus.value; break; case SetStatsField.ValueType.Percentage: b_info += b.stats_bounus.value + "%"; break; } break; case Bounus.BounusType.Passive: b.passive_bounus.GenerateDescription(); b_info += b.passive_bounus.Name + " (" + b.passive_bounus.Description + ")"; break; } if (count >= b.condiction) { SetInfo.text += MyText.Colofied(b_info, "lime"); } else { SetInfo.text += MyText.Colofied(b_info, "grey"); } if (b != s.Bounuses.Last()) { SetInfo.text += "\n"; } } transform.Find("Set").gameObject.SetActive(true); } else { transform.Find("Set").gameObject.SetActive(false); } }
private void UpdateStats(Equipment E, Mode mode) { if (mode == Mode.Inventory) { if (MPC.GetEquippedItem(E.EquipType) == null) { List <int> FieldsToShow = new List <int>(); for (int s = 0; s < Stats.Size; s++) { if (E.Stats.stats[s] > 0) { FieldsToShow.Add(s); } } foreach (int s in FieldsToShow) { StringPair sp = StatsType.GetStatsTypeString(s); Stats_Labels.text += sp.F; Stats_Values.text += MyText.Colofied("+ " + E.Stats.Get(s) + sp.S, "lime"); if (s != FieldsToShow.Last()) { Stats_Labels.text += "\n"; Stats_Values.text += "\n"; } } } else { Equipment To_Compare = MPC.GetEquippedItem(E.EquipType); List <int> FieldsToShow = new List <int>(); for (int s = 0; s < Stats.Size; s++) { if (E.Stats.stats[s] > 0) { FieldsToShow.Add(s); } } for (int s = 0; s < Stats.Size; s++) { if (!FieldsToShow.Contains(s) && To_Compare.Stats.stats[s] > 0) { FieldsToShow.Add(s); } } foreach (int s in FieldsToShow) { StringPair sp = StatsType.GetStatsTypeString(s); Stats_Labels.text += sp.F; float difference = E.Stats.Get(s) - To_Compare.Stats.Get(s); if (difference > 0) { Stats_Values.text += MyText.Colofied("+" + E.Stats.Get(s) + sp.S + " (+" + difference.ToString("F1") + sp.S + ")", "lime"); } else if (difference < 0) { Stats_Values.text += MyText.Colofied("+" + E.Stats.Get(s) + sp.S + " (" + difference.ToString("F1") + sp.S + ")", "red"); } else { Stats_Values.text += MyText.Colofied("+" + E.Stats.Get(s) + sp.S + " (+" + difference.ToString("F1") + sp.S + ")", "white"); } if (s != FieldsToShow.Last()) { Stats_Labels.text += "\n"; Stats_Values.text += "\n"; } } } } else { List <int> FieldsToShow = new List <int>(); for (int s = 0; s < Stats.Size; s++) { if (E.Stats.stats[s] > 0) { FieldsToShow.Add(s); } } foreach (int s in FieldsToShow) { StringPair sp = StatsType.GetStatsTypeString(s); Stats_Labels.text += sp.F; Stats_Values.text += MyText.Colofied("+ " + E.Stats.Get(s) + sp.S, "white"); if (s != FieldsToShow.Last()) { Stats_Labels.text += "\n"; Stats_Values.text += "\n"; } } } }