public XCharacter GetMainPartner(int id) { if (id == 0) { return(null); } XPartner data = DataDBSPartner.GetDataById(id); if (data == null) { return(null); } XCharacter c = new XCharacter(); DActor db = ReadCfgActor.GetDataById(id); c.Id = id; c.Level = data.Level; c.Sex = 0; c.Title = 0; c.Name = db.Name; c.BaseAttr.Clear(); c.CurrAttr.Clear(); c.BaseAttr.AddRange(AttrHelper.GetPropertys(data).Values); for (int i = 0; i < c.BaseAttr.Count; i++) { c.CurrAttr.Add(c.BaseAttr[i]); } return(c); }
private void ShowPropertys() { propertyTemplate.SetActive(false); XCharacter role = RoleModule.Instance.GetCurPlayer(); Dictionary <EAttr, int> propertys = AttrHelper.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 void ShowInfoByPos(EPosType posType, int pos) { this.mPos = pos; this.mPosType = posType; ShowDress(posType == EPosType.RoleEquip); XEquip equip = GTDataManager.Instance.GetEquipDataByPos(mPosType, mPos); if (equip == null) { return; } int itemID = equip.Id; ShowBaseView(itemID); equipFightValue.text = GTTools.Format("战斗力 {0}", AttrHelper.GetFightValue(equip)); equipAdvanceLevel.text = EquipModule.Instance.GetEquipAdvanceNameByLevel(equip.AdvanceLevel); Dictionary <EAttr, int> propertys = AttrHelper.GetPropertys(equip); title3.text = GTTools.Format("装备星级 {0}", equip.StarLevel); title2.text = GTTools.Format("进阶等级 {0}", equip.AdvanceLevel); title1.text = GTTools.Format("强化等级 {0}", equip.StrengthenLevel); GTItemHelper.ShowPropertyText(this.equipPropertys, propertys, true); GTItemHelper.ShowEquipStrengthText(text1, itemID, equip.StrengthenLevel); GTItemHelper.ShowEquipAdvanceText(text2, itemID, equip.AdvanceLevel); GTItemHelper.ShowEquipStarText(text3, itemID, equip.StarLevel); }
private void ShowAdvanceView() { XEquip equip = GTDataManager.Instance.GetEquipDataByPos(mPosType, mPos); if (equip == null) { return; } int itemID = equip.Id; if (EquipModule.Instance.IsFullStarLevel(equip)) { return; } GTItemHelper.ShowItemTexture(mEquipAdvance.nowEquipTexture, itemID); GTItemHelper.ShowItemQuality(mEquipAdvance.nowEquipQuality, itemID); GTItemHelper.ShowItemName(mEquipAdvance.nowEquipName, itemID); GTItemHelper.ShowItemTexture(mEquipAdvance.nexEquipTexture, itemID); GTItemHelper.ShowItemQuality(mEquipAdvance.nexEquipQuality, itemID); GTItemHelper.ShowItemName(mEquipAdvance.nexEquipName, itemID); Dictionary <EAttr, int> nowPropertys = AttrHelper.GetPropertys(equip); XEquip nexEquip = new XEquip(); GTTools.Copy(nexEquip, equip); nexEquip.AdvanceLevel++; Dictionary <EAttr, int> nexPropertys = AttrHelper.GetPropertys(nexEquip); GTItemHelper.ShowPropertyText(mEquipAdvance.nowEquipPropertys, nowPropertys, false); GTItemHelper.ShowPropertyText(mEquipAdvance.nexEquipPropertys, nexPropertys, false); mEquipAdvance.nowEquipFightValue.text = AttrHelper.GetFightValue(nowPropertys).ToString(); mEquipAdvance.nexEquipFightValue.text = AttrHelper.GetFightValue(nexPropertys).ToString(); DEquip equipDB = ReadCfgEquip.GetDataById(itemID); DEquipAdvanceCost db = ReadCfgEquipAdvanceCost.GetDataById(equipDB.Quality * 1000 + equip.AdvanceLevel + 1); int hasItemNum = GTDataManager.Instance.GetItemCountById(db.CostItemId); GTItemHelper.ShowItemTexture(mEquipAdvance.costItemTexture, db.CostItemId); GTItemHelper.ShowPriceText(mEquipAdvance.costItemNum, hasItemNum, db.CostItemNum); GTItemHelper.ShowItemQuality(mEquipAdvance.costItemQuality, itemID); if (db.CostEquipNum > 0) { mEquipAdvance.costEquipBtn.SetActive(true); GTItemHelper.ShowItemTexture(mEquipAdvance.costEquipTexture, itemID); GTItemHelper.ShowItemQuality(mEquipAdvance.costEquipQuality, itemID); int hasSameEquipNum = EquipModule.Instance.GetBagSameEquipList(equip).Count; GTItemHelper.ShowPriceText(mEquipAdvance.costEquipNum, hasSameEquipNum, db.CostEquipNum); } else { mEquipAdvance.costEquipBtn.SetActive(false); } GTItemHelper.ShowItemTexture(mEquipAdvance.costMoneyTexture, db.CostMoneyId); GTItemHelper.ShowItemNum(mEquipAdvance.costMoneyNum, db.CostMoneyNum); GTItemHelper.ShowEquipAdvanceText(mEquipAdvance.advanceText, itemID, equip.AdvanceLevel); }
private void ShowStrengthenView() { XEquip equip = GTDataManager.Instance.GetEquipDataByPos(mPosType, mPos); if (equip == null) { return; } if (EquipModule.Instance.IsFullStrengthenLevel(equip) == true) { return; } int itemID = equip.Id; GTItemHelper.ShowItemTexture(mEquipStrengthen.equipTexture, itemID); GTItemHelper.ShowItemQuality(mEquipStrengthen.equipQuality, itemID); GTItemHelper.ShowItemName(mEquipStrengthen.equipName, itemID); int costEquipNum = mStrengthenCostItems.Count; for (int i = 0; i < mEquipStrengthen.mStrengthenItems.Count; i++) { ItemStrengthen cell = mEquipStrengthen.mStrengthenItems[i]; if (i < costEquipNum) { XItem mat = mStrengthenCostItems[i]; cell.Show(true); int id = mStrengthenCostItems[i].Id; GTItemHelper.ShowItemTexture(cell.itemTexture, id); GTItemHelper.ShowItemQuality(cell.itemQuality, id); GTItemHelper.ShowItemNum(cell.itemNum, mat.Num); } else { cell.Show(false); } } DEquip equipDB = ReadCfgEquip.GetDataById(itemID); DEquipStrengLevel levelDB = ReadCfgEquipStrengLevel.GetDataById(equipDB.Quality * 1000 + equip.StrengthenLevel + 1); int addExpNum = EquipModule.Instance.GetStrengthenExpByMatList(mStrengthenCostItems); GTItemHelper.ShowItemTexture(mEquipStrengthen.costMoneyTexture, DEquip.EQUIP_STRENGTHEN_MONEY_ID_1); mEquipStrengthen.costMoneyNum.text = addExpNum.ToString(); mEquipStrengthen.equipStrengthLevel.text = GTTools.Format("强化等级 {0}", equip.StrengthenLevel); GTItemHelper.ShowProgressText(mEquipStrengthen.equipStrengthExp, equip.StrengthenExp, levelDB.RequireExp); GTItemHelper.ShowProgressSlider(mEquipStrengthen.equipStrengthExpBar, equip.StrengthenExp, levelDB.RequireExp); Dictionary <EAttr, int> propertys = AttrHelper.GetPropertys(equip); GTItemHelper.ShowEquipStrengthText(mEquipStrengthen.strengthText, itemID, equip.StrengthenLevel); GTItemHelper.ShowPropertyText(mEquipStrengthen.propertyText, propertys, true); }
public XCharacter GetMainPlayer() { XCharacter c = GetCurPlayer(); c.Equips.Clear(); Dictionary <int, XItem> .Enumerator em1 = DataDBSDressEquip.Dict.GetEnumerator(); while (em1.MoveNext()) { XEquip it = GTDataManager.Instance.GetEquipDataByPos(EPosType.RoleEquip, em1.Current.Value.Pos); if (it != null) { c.Equips.Add(it); } } em1.Dispose(); c.Gems.Clear(); Dictionary <int, XItem> .Enumerator em2 = DataDBSDressGem.Dict.GetEnumerator(); while (em2.MoveNext()) { XGem it = GTDataManager.Instance.GetGemDataByPos(EPosType.RoleGem, em1.Current.Value.Pos); if (it != null) { c.Gems.Add(it); } } em2.Dispose(); c.BaseAttr.Clear(); c.CurrAttr.Clear(); c.BaseAttr.AddRange(AttrHelper.GetPropertys(c).Values); for (int i = 0; i < c.BaseAttr.Count; i++) { c.CurrAttr.Add(c.BaseAttr[i]); } return(c); }