public static void ShowPropertyText(UILabel label, Dictionary <EAttr, int> dict, bool showAll = true) { if (dict == null) { return; } if (label == null) { return; } Dictionary <EAttr, int> .Enumerator em = dict.GetEnumerator(); label.text = string.Empty; while (em.MoveNext()) { EAttr e = em.Current.Key; int value = em.Current.Value; if (em.Current.Value <= 0 || ReadCfgProperty.ContainsKey(e) == false) { continue; } DProperty db = ReadCfgProperty.GetDataById(e); string s = GTTools.Format(db.Desc, value); switch (e) { case EAttr.AP: case EAttr.DF: case EAttr.HP: label.Append(s); break; case EAttr.CRIT: case EAttr.CRITDAMAGE: case EAttr.DODGE: case EAttr.HIT: case EAttr.SUCK: case EAttr.MP: if (showAll) { string str = GTTools.Format("[00ff00]装备:{0}[-]", s); label.Append(str); } break; } } }
public static void ShowGemPropertyText(UILabel label, int gemID, int level, bool showNext = false) { if (label.text == null) { return; } label.text = string.Empty; DGem gemDB = ReadCfgGem.GetDataById(gemID); DGemLevel db1 = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + level); DGemLevel db2 = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + level + 1); for (int i = 0; i < gemDB.Propertys.Count; i++) { DStrengthValue gp = gemDB.Propertys[i]; if (!ReadCfgProperty.ContainsKey(gp.Property)) { continue; } DProperty propertyDB = ReadCfgProperty.GetDataById(gp.Property); int ratio = level > 0 ? db1.PropertyRatio : 100; string s = GTTools.Format(propertyDB.Desc, (int)(gp.Value * ratio / 100f)); int add = (int)(gp.Value * (db2.PropertyRatio - ratio) / 100f); string str = string.Empty; if (level >= gp.UnlockLevel) { if (showNext) { str = GTTools.Format("[00ff00]{0}(+{1})[-]", s, add); } else { str = GTTools.Format("[00ff00]{0}[-]", s); } } else { str = GTTools.Format("[777777]{0} (宝石强化至{1}级生效)[-]", s, gp.UnlockLevel); } label.Append(str); } label.text = label.text.TrimEnd('\n'); }