public static void ShowEquipStrengthText(UILabel label, int equipID, int strengthLevel) { if (label == null) { return; } DEquipStreng strengthDB = ReadCfgEquipStreng.GetDataById(equipID); label.text = string.Empty; for (int i = 0; i < strengthDB.Propertys.Count; i++) { DStrengthValue data = strengthDB.Propertys[i]; if (data.Value <= 0 || data.Property == 0) { continue; } DProperty propertyDB = ReadCfgProperty.GetDataById(data.Property); string desc = GTTools.Format(propertyDB.Desc, data.Value); string v = string.Empty; if (data.UnlockLevel <= strengthLevel) { v = GTTools.Format("[00ff00]{0}[-]", desc); } else { v = GTTools.Format("[777777]{0} (强化至{1}级生效)[-]", desc, data.UnlockLevel); } label.Append(v); } }
public static void ShowEquipAdvanceText(UILabel label, int equipID, int advanceLevel) { if (label == null) { return; } DEquipAdvance advanceDB = ReadCfgEquipAdvance.GetDataById(equipID); label.text = string.Empty; for (int i = 0; i < advanceDB.Propertys.Count; i++) { KeyValuePair <EAttr, int> data = advanceDB.Propertys[i]; if (data.Value <= 0 || data.Key == 0) { continue; } DProperty propertyDB = ReadCfgProperty.GetDataById(data.Key); string desc = GTTools.Format(propertyDB.Desc, data.Value); string v = string.Empty; if (advanceLevel >= (i + 1)) { v = GTTools.Format("[00ff00]{0}[-]", desc); } else { v = GTTools.Format("[777777]{0} (进阶至{1}级生效)[-]", desc, i + 1); } label.Append(v); } }
private void ShowPropertys() { propertyTemplate.SetActive(false); XCharacter role = GTGlobal.Main; Dictionary <EAttr, int> propertys = GTAttrHelper.GetPropertys(role); Dictionary <EAttr, int> .Enumerator em = propertys.GetEnumerator(); while (em.MoveNext()) { EAttr e = em.Current.Key; if ((int)e > 10) { continue; } ItemProperty item; if (!mPropertyItems.ContainsKey(e)) { item = new ItemProperty(); GameObject go = NGUITools.AddChild(propertyGrid.gameObject, propertyTemplate); item.propertyNum = go.transform.Find("Num").GetComponent <UILabel>(); item.propertyName = go.transform.Find("Name").GetComponent <UILabel>(); go.SetActive(true); mPropertyItems.Add(e, item); } else { item = mPropertyItems[e]; } DProperty db = ReadCfgProperty.GetDataById(em.Current.Key); item.propertyName.text = db.Name; item.propertyNum.text = db.IsPercent == false?em.Current.Value.ToString() : (em.Current.Value / 100f).ToPercent(); } }
public static int GetFightValue(Dictionary <EAttr, int> attrValues) { int value = 0; Dictionary <EAttr, int> .Enumerator em = attrValues.GetEnumerator(); while (em.MoveNext()) { DProperty db = ReadCfgProperty.GetDataById(em.Current.Key); value += db.Factor * em.Current.Value; } em.Dispose(); return(value); }
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'); }
private void ShowPropertyView(int id, int level) { DActor db = ReadCfgActor.GetDataById(id); currPropertyText1.text = string.Empty; currPropertyText2.text = string.Empty; mainPropertyText1.text = string.Empty; mainPropertyText2.text = string.Empty; DPetLevel levelDB = ReadCfgPetLevel.GetDataById(db.Quality * 1000 + level); for (int i = 0; i < levelDB.PropertyNums.Length; i++) { EAttr propertyID = (EAttr)(i + 1); DProperty propertyDB = ReadCfgProperty.GetDataById(propertyID); currPropertyText1.Append(propertyDB.Name); currPropertyText2.Append("+" + levelDB.PropertyNums[i].ToString()); mainPropertyText1.Append(propertyDB.Name); int extendNum = (int)(levelDB.PropertyNums[i] * levelDB.Ratio / 100f); mainPropertyText2.Append("+" + extendNum.ToString()); } }
private void ShowPropertyView() { DRelics db = ReadCfgRelics.GetDataById(centerID); XRelics relics = DataDBSRelics.GetDataById(centerID); for (int i = 0; i < 3; i++) { RelicsProperty tab1 = mNowPropertys[i]; RelicsProperty tab2 = mNexPropertys[i]; DProperty propertyDB = ReadCfgProperty.GetDataById(db.PropertyID[i]); tab1.propertyName.text = propertyDB.Name; tab2.propertyName.text = propertyDB.Name.ToString(); float ratio1 = 1; float ratio2 = ratio1 * (20 / 100f + 1); float num1 = 0; float num2 = 0; if (relics == null) { num1 = ratio1 * db.PropertyNum[i]; num2 = ratio2 * db.PropertyNum[i]; if (propertyDB.IsPercent) { tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent(); tab2.propertyNum.text = "+" + (num2 / 100f).ToPercent(); } else { tab1.propertyNum.text = "+" + ((int)num1).ToString(); tab2.propertyNum.text = "+" + ((int)num2).ToString(); } } else { ratio1 = Mathf.Pow(20 / 100f + 1, relics.Level + 1); ratio2 = ratio1 * (20 / 100f + 1); num1 = (db.PropertyNum[i] * ratio1); num2 = (db.PropertyNum[i] * ratio2); if (relics.Level == db.LevelExp.Length) { if (propertyDB.IsPercent) { tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent(); tab2.propertyNum.text = string.Empty; } else { tab1.propertyNum.text = "+" + ((int)num1).ToString(); tab2.propertyNum.text = string.Empty; } nowAttr.transform.localPosition = new Vector3(100, -50, 0); nexAttr.SetActive(false); attrRow.SetActive(false); } else { if (propertyDB.IsPercent) { tab1.propertyNum.text = "+" + (num1 / 100f).ToPercent(); tab2.propertyNum.text = "+" + (num2 / 100f).ToPercent(); } else { tab1.propertyNum.text = "+" + ((int)num1).ToString(); tab2.propertyNum.text = "+" + ((int)num2).ToString(); } nexAttr.SetActive(true); attrRow.SetActive(true); nowAttr.transform.localPosition = new Vector3(-20, -60, 0); nexAttr.transform.localPosition = new Vector3(200, -60, 0); } } } }