public bool IsCanBeUseAsStrengthenMatToAutoAdd(XItem item) { XGem gem = DataDBSGem.GetDataById(item.Instance); DGem gemDB = ReadCfgGem.GetDataById(gem.Id); return(gemDB.Quality < 3); }
public void ShowInfoByPos(EPosType posType, int pos) { this.mPos = pos; this.mPosType = posType; bool isDress = (posType == EPosType.RoleGem); ShowDress(isDress); XGem gem = GTDataManager.Instance.GetGemDataByPos(posType, pos); int itemID = gem.Id; DGem gemDB = ReadCfgGem.GetDataById(itemID); gemLevel.text = GTTools.Format("等级 {0}", gem.StrengthenLevel); gemFightValue.text = GTTools.Format("战斗力 {0}", AttrHelper.GetFightValue(gem)); ShowBaseView(itemID); GTItemHelper.ShowGemPropertyText(gemPropertys, itemID, gem.StrengthenLevel); DGemSuit suitDB = ReadCfgGemSuit.GetDataById(gemDB.Suit); int activeSuitNum = isDress ? GemModule.Instance.GetActiveSameSuitsCountByPos(pos) : 0; bool hasSuit = ReadCfgGemSuit.ContainsKey(gemDB.Suit); if (hasSuit) { ShowHasSuit(gemDB); ShowSuitPropertysView(activeSuitNum, suitDB); ShowSameSuitGemsView(gemDB.Id); } else { ShowNoSuit(); } }
public string GetGemTypeName(int itemID) { DGem db = ReadCfgGem.GetDataById(itemID); switch (db.Pos) { case 1: return("金"); case 2: return("木"); case 3: return("水"); case 4: return("火"); case 5: return("土"); default: return("空"); } }
public string GetGemSuitName(int itemID) { DGem gemDB = ReadCfgGem.GetDataById(itemID); if (gemDB.Suit == 0) { return(string.Empty); } return(ReadCfgGemSuit.GetDataById(gemDB.Suit).Name); }
public static Dictionary <EAttr, int> GetGemBasePropertys(int gemID) { DGem db = ReadCfgGem.GetDataById(gemID); Dictionary <EAttr, int> attrValues = New(); if (db.Propertys.Count > 0) { attrValues.Add(db.Propertys[0].Property, db.Propertys[0].Value); } CalcMaxAttrValue(ref attrValues); return(attrValues); }
public int GetExpByXGem(XGem gem) { DGem gemDB = ReadCfgGem.GetDataById(gem.Id); int exp = gem.StrengthenExp + gemDB.Exp; int lv = gem.StrengthenLevel; for (int i = 0; i < lv; i++) { DGemLevel db = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel); exp += db.RequireExp; } return(exp); }
private void OnReq_DressGem(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); ReqDressGem req = Serializer.Deserialize <ReqDressGem>(ms); XItem bagGem = DataDBSBagGem.GetDataById(req.SrcPos); DGem cfg = ReadCfgGem.GetDataById(bagGem.Id); AckDressGem ack = new AckDressGem(); ack.SrcPos = req.SrcPos; ack.Index = req.Index; ack.TarPos = cfg.Pos; NetworkManager.Instance.Send(MessageID.MSG_ACK_DRESS_GEM, ack, 0, 0); }
private void ShowView() { labMoneyNum1.text = GTDataManager.Instance.GetItemCountById(1).ToString(); labMoneyNum2.text = GTDataManager.Instance.GetItemCountById(2).ToString(); GTItemHelper.ShowItemTexture(moneyTexture1, 1); GTItemHelper.ShowItemTexture(moneyTexture2, 2); XGem gem = GTDataManager.Instance.GetGemDataByPos(mPosType, mPos); int itemID = gem.Id; GTItemHelper.ShowItemTexture(gemTexture, itemID); GTItemHelper.ShowItemQuality(gemQuality, itemID); GTItemHelper.ShowItemName(gemName, itemID); int costgemNum = mStrengthenMats.Count; for (int i = 0; i < mStrengthenItems.Count; i++) { ItemStrengthen cell = mStrengthenItems[i]; if (i < costgemNum) { XItem mat = mStrengthenMats[i]; cell.Show(true); int id = mStrengthenMats[i].Id; GTItemHelper.ShowItemTexture(cell.itemTexture, id); GTItemHelper.ShowItemQuality(cell.itemQuality, id); GTItemHelper.ShowItemNum(cell.itemNum, mat.Num); } else { cell.Show(false); } } if (GemModule.Instance.IsFullStrengthenLevel(gem) == true) { return; } DGem gemDB = ReadCfgGem.GetDataById(itemID); DGemLevel levelDB = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel + 1); int addExpNum = GemModule.Instance.GetExpByStrengthMatList(mStrengthenMats); GTItemHelper.ShowItemTexture(costMoneyTexture, levelDB.CostMoneyId); costMoneyNum.text = addExpNum.ToString(); gemLevel.text = GTTools.Format("强化等级 {0}", gem.StrengthenLevel); GTItemHelper.ShowProgressText(gemExpNum, gem.StrengthenExp, levelDB.RequireExp); GTItemHelper.ShowProgressSlider(gemExpBar, gem.StrengthenExp, levelDB.RequireExp); GTItemHelper.ShowGemPropertyText(gemProperty, itemID, gem.StrengthenLevel, true); gemSuit.text = GemModule.Instance.GetGemSuitName(itemID); gemType.text = GemModule.Instance.GetGemTypeName(itemID); }
private void OnAck_StrengthGem(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AckStrengthGem ack = Serializer.Deserialize <AckStrengthGem>(ms); XGem gem = ack.TarGem; List <XItem> list = ack.UseItems; DGem gemDB = ReadCfgGem.GetDataById(gem.Id); int addExpNum = MLGem.Instance.GetExpByStrengthMatList(list); int strengthenLevel = gem.StrengthenLevel; int levelID = gemDB.Quality * 1000 + strengthenLevel + 1; DGemLevel db = ReadCfgGemLevel.GetDataById(levelID); int expNum = db.RequireExp - gem.StrengthenExp; while (addExpNum >= expNum) { strengthenLevel++; levelID = gemDB.Quality * 1000 + strengthenLevel + 1; db = ReadCfgGemLevel.GetDataById(levelID); expNum += db.RequireExp; } gem.StrengthenLevel = strengthenLevel; gem.StrengthenExp = addExpNum + db.RequireExp - expNum; DataDBSGem.Update(gem.Instance, gem); GTDataManager.Instance.UseMoney(db.CostMoneyId, expNum); for (int i = 0; i < list.Count; i++) { XItem item = list[i]; EPosType posType = (EPosType)item.PosType; switch (posType) { case EPosType.BagItem: GTDataManager.Instance.UseItemById(item.Id, item.Num); break; case EPosType.BagGem: GTDataManager.Instance.DelBagGem(item.Pos); break; } } GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR); GTEventCenter.FireEvent(GTEventID.TYPE_BAG_STRENGTHEN_GEM); GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE); }
private void OnAck_DressGem(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AckDressGem ack = Serializer.Deserialize <AckDressGem>(ms); int srcPos = ack.SrcPos; int tarPos = ack.TarPos; int index = ack.Index; XItem sourceGem = DataDBSBagGem.GetDataById(srcPos); DGem gemDB = ReadCfgGem.GetDataById(sourceGem.Id); int pos = MLGem.Instance.GetDressGemPosByIndexAndTargetPos(index, gemDB.Pos); XItem dressGem = DataDBSDressGem.GetDataById(pos); if (dressGem != null) { int sourceInstanceID = sourceGem.Instance; int sourceId = sourceGem.Id; sourceGem.Instance = dressGem.Instance; sourceGem.Id = dressGem.Id; dressGem.Instance = sourceInstanceID; dressGem.Id = sourceId; DataDBSDressGem.Update(dressGem.Pos, dressGem); DataDBSBagGem.Update(sourceGem.Pos, sourceGem); } else { dressGem = new XItem(); dressGem.Instance = sourceGem.Instance; dressGem.Pos = pos; dressGem.PosType = (int)EPosType.RoleGem; dressGem.Id = sourceGem.Id; dressGem.Num = 1; DataDBSDressGem.Insert(pos, dressGem); DataDBSBagGem.Delete(sourceGem.Pos); } GTWorld.Instance.SyncMainPlayerData(ESyncDataType.TYPE_BASEATTR); GTEventCenter.FireEvent(GTEventID.TYPE_BAG_DRESS_GEM, srcPos, tarPos); GTEventCenter.FireEvent(GTEventID.TYPE_CHANGE_FIGHTVALUE); }
private void ShowSameSuitGemsView(int itemID) { List <int> list = GemModule.Instance.GetSameSuitIDListByID(itemID); Transform parent = transform.Find("Right/Grid"); for (int i = 0; i < list.Count; i++) { DGem gemDB = ReadCfgGem.GetDataById(list[i]); GameObject item = parent.Find((i + 1).ToString()).gameObject; item.SetActive(true); item.name = gemDB.Id.ToString(); UILabel itemName = item.transform.Find("Name").GetComponent <UILabel>(); UITexture itemTexture = item.transform.Find("Texture").GetComponent <UITexture>(); UISprite itemQuality = item.transform.Find("Quality").GetComponent <UISprite>(); GTItemHelper.ShowItemName(itemName, gemDB.Id); GTItemHelper.ShowItemTexture(itemTexture, gemDB.Id); GTItemHelper.ShowItemQuality(itemQuality, gemDB.Id); } }
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'); }
static void CalcGemStrenthLevel(Dictionary <EAttr, int> dict, XGem gem) { DGem gemDB = ReadCfgGem.GetDataById(gem.Id); DGemLevel db = ReadCfgGemLevel.GetDataById(gemDB.Quality * 1000 + gem.StrengthenLevel); for (int i = 0; i < gemDB.Propertys.Count; i++) { DStrengthValue gp = gemDB.Propertys[i]; if (gem.StrengthenLevel >= gp.UnlockLevel) { dict[gp.Property] += gp.Value; int ratio = gem.StrengthenLevel > 0 ? db.PropertyRatio : 100; dict[gp.Property] = (int)(dict[gp.Property] * ratio / 100f); } else { break; } } }
public int CompareXGem(XItem x1, XItem x2) { XGem e1 = DataDBSGem.GetDataById(x1.Instance); XGem e2 = DataDBSGem.GetDataById(x2.Instance); DGem db1 = ReadCfgGem.GetDataById(e1.Id); DGem db2 = ReadCfgGem.GetDataById(e2.Id); if (db1.Quality != db2.Quality) { return(db1.Quality - db2.Quality); } if (e1.StrengthenLevel != e2.StrengthenLevel) { return(e1.StrengthenLevel - e2.StrengthenLevel); } if (e1.StrengthenExp != e2.StrengthenExp) { return(e1.StrengthenExp - e2.StrengthenExp); } return(x2.Pos - x1.Pos); }
public List <int> GetSameSuitIDListByID(int itemID) { DGem gemDB = ReadCfgGem.GetDataById(itemID); if (gemDB.Suit == 0) { return(new List <int>()); } if (mGemSuits.ContainsKey(gemDB.Suit)) { return(mGemSuits[gemDB.Suit]); } Dictionary <int, DGem> .Enumerator em = ReadCfgGem.Dict.GetEnumerator(); while (em.MoveNext()) { DGem db = em.Current.Value; List <int> list; if (mGemSuits.ContainsKey(db.Suit)) { list = mGemSuits[db.Suit]; } else { list = new List <int>(); mGemSuits.Add(db.Suit, list); } if (!list.Contains(db.Id)) { list.Add(db.Id); } } if (mGemSuits.ContainsKey(gemDB.Suit)) { return(mGemSuits[gemDB.Suit]); } else { return(new List <int>()); } }
public override void Init() { ReadCfgLocalString.Read("Text/Local/Data_LocalString"); ReadCfgCurve.Read("Text/Local/Data_Curve"); ReadCfgStageMount.Read("Text/Local/Data_StageMount"); ReadCfgStagePartner.Read("Text/Local/Data_StagePartner"); ReadCfgStagePet.Read("Text/Local/Data_StagePet"); ReadCfgStageRelics.Read("Text/Local/Data_StageRelics"); ReadCfgStageRole.Read("Text/Local/Data_StageRole"); ReadCfgSearch.Read("Text/Local/Data_Search"); ReadCfgRandomName.Read("Text/Local/Data_RandomNames"); ReadCfgProperty.Read("Text/Data/Data_Property"); ReadCfgQuality.Read("Text/Data/Data_Quality"); ReadCfgItem.Read("Text/Data/Data_Item"); ReadCfgEquip.Read("Text/Data/Data_Equip"); ReadCfgAction.Read("Text/Data/Data_Action"); ReadCfgRole.Read("Text/Data/Data_Role"); ReadCfgRoleLevel.Read("Text/Data/Data_RoleLevel"); ReadCfgEquip.Read("Text/Data/Data_Equip"); ReadCfgEquipAdvance.Read("Text/Data/Data_EquipAdvance"); ReadCfgEquipAdvanceCost.Read("Text/Data/Data_EquipAdvanceCost"); ReadCfgEquipStreng.Read("Text/Data/Data_EquipStrengthen"); ReadCfgEquipStrengLevel.Read("Text/Data/Data_EquipStrengthenLevel"); ReadCfgEquipStar.Read("Text/Data/Data_EquipStar"); ReadCfgEquipSuit.Read("Text/Data/Data_EquipSuit"); ReadCfgGem.Read("Text/Data/Data_Gem"); ReadCfgGemLevel.Read("Text/Data/Data_GemLevel"); ReadCfgGemSuit.Read("Text/Data/Data_GemSuit"); ReadCfgAward.Read("Text/Data/Data_Award"); ReadCfgCopyMainChapter.Read("Text/Data/Data_CopyMainChapter"); ReadCfgCopy.Read("Text/Data/Data_Copy"); ReadCfgEffect.Read("Text/Data/Data_Effect"); ReadCfgRelics.Read("Text/Data/Data_Relics"); ReadCfgMachine.Read("Text/Data/Data_Machine"); ReadCfgActorGroup.Read("Text/Data/Data_ActorGroup"); ReadCfgActor.Read("Text/Data/Data_Actor"); ReadCfgActorRace.Read("Text/Data/Data_ActorRace"); ReadCfgActorModel.Read("Text/Data/Data_ActorModel"); ReadCfgStore.Read("Text/Data/Data_Store"); ReadCfgStoreType.Read("Text/Data/Data_StoreType"); ReadCfgPet.Read("Text/Data/Data_Pet"); ReadCfgPetLevel.Read("Text/Data/Data_PetLevel"); ReadCfgPartner.Read("Text/Data/Data_Partner"); ReadCfgPartnerLevel.Read("Text/Data/Data_PartnerLevel"); ReadCfgPartnerWake.Read("Text/Data/Data_PartnerWake"); ReadCfgPartnerAdvance.Read("Text/Data/Data_PartnerAdvance"); ReadCfgPartnerWash.Read("Text/Data/Data_PartnerWash"); ReadCfgPartnerFetter.Read("Text/Data/Data_PartnerFetter"); ReadCfgPartnerStar.Read("Text/Data/Data_PartnerStar"); ReadCfgTask.Read("Text/Data/Data_Task"); ReadCfgAdventure.Read("Text/Data/Data_Adventure"); ReadCfgSkillTalent.Read("Text/Data/Data_SkillTalent"); ReadCfgMine.Read("Text/Data/Data_Mine"); ReadCfgSkill.Read("Text/Data/Data_Skill"); ReadCfgVideo.Read("Text/Data/Data_Video"); ReadCfgDialogue.Read("Text/Data/Data_Dialogue"); ActBuffSystem.Read("Text/Buff/Buff"); }