using Snxxz.UI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using LitJson; using UnityEngine; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class ItemTipsModel : Model, IBeforePlayerDataInitialize { FuncConfigConfig exhaustedFunc; public Dictionary> guardDesDict { get; private set; } public Dictionary unlockPetDict { get; private set; } public Dictionary unlockMountDict { get; private set; } private Dictionary> petSkillDict = new Dictionary>(); // 编号 解锁阶级 技能 private Dictionary>> mountSkillDict = new Dictionary>>(); // 编号 解锁阶级 技能 Dictionary petAndMountQualityDict = new Dictionary(); string expValueFormula = ""; Dictionary exhaustedAttrFormula { get; set; } Dictionary exhaustedMaxLvDict { get; set; } int[] guardAutoDrops; public int[] gemOpenLvs { get; private set; } public int[] jadeDynastyGemOpenLvs { get; private set; } public int gemOpenVipLv { get; private set; } public int[] gemType1s { get; private set; } public int[] gemType2s { get; private set; } public int[] equipMidHeights { get; private set; } public int[] wingsMidHeights { get; private set; } public int[] jumpAndUseTypes { get; private set; } public int equipSuitStar { get; private set; } public int[] ItemRenewalIds { get; private set; } public int[] tryPutOnEquipIds { get; private set; } public int[] randomRuneIds { get; private set; } public int[] PeerlessEquipIds { get; private set; } //绝世装备列表 PackModel playerPack { get { return ModelCenter.Instance.GetModel(); } } StoreModel m_storeModel { get { return ModelCenter.Instance.GetModel(); } } FashionDressModel fashionDress { get { return ModelCenter.Instance.GetModel(); } } DogzModel dogzModel { get { return ModelCenter.Instance.GetModel(); } } public override void Init() { m_storeModel.RefreshTCBPlayerDataEvent += RefreshOfflinePluginTime; exhaustedFunc = FuncConfigConfig.Get("OutOfPrintValue"); exhaustedAttrFormula = new Dictionary(); JsonData exhaustedJsonData = JsonMapper.ToObject(exhaustedFunc.Numerical2); foreach (var key in exhaustedJsonData.Keys) { int attrId = int.Parse(key); exhaustedAttrFormula.Add(attrId, exhaustedJsonData[key].ToString()); } FuncConfigConfig OutOfPrintValueDes = FuncConfigConfig.Get("OutOfPrintValueDes"); exhaustedMaxLvDict = ConfigParse.GetDic(OutOfPrintValueDes.Numerical1); FuncConfigConfig suitlimitModel = FuncConfigConfig.Get("EquipSuitLimit"); equipSuitStar = int.Parse(suitlimitModel.Numerical2); FuncConfigConfig bagUseItem = FuncConfigConfig.Get("BagUseItem"); jumpAndUseTypes = ConfigParse.GetMultipleStr(bagUseItem.Numerical1); FuncConfigConfig renewalFunc = FuncConfigConfig.Get("ItemRepayButton"); ItemRenewalIds = ConfigParse.GetMultipleStr(renewalFunc.Numerical1); tryPutOnEquipIds = ConfigParse.GetMultipleStr(renewalFunc.Numerical2); FuncConfigConfig EquipOutWordID = FuncConfigConfig.Get("EquipOutWordID"); PeerlessEquipIds = ConfigParse.GetMultipleStr(EquipOutWordID.Numerical1); guardDesDict = new Dictionary>(); FuncConfigConfig guardDesFunc = FuncConfigConfig.Get("GuardianTips"); FuncConfigConfig guardAutoDropFunc = FuncConfigConfig.Get("GuardianPickUpID"); guardAutoDrops = ConfigParse.GetMultipleStr(guardAutoDropFunc.Numerical1); JsonData guardDesData = JsonMapper.ToObject(guardDesFunc.Numerical1); foreach (var key in guardDesData.Keys) { List list = new List(); for (int i = 0; i < guardDesData[key].Count; i++) { list.Add(guardDesData[key][i].ToString()); } guardDesDict.Add(int.Parse(key), list); } gemOpenLvs = null; gemOpenVipLv = 0; jadeDynastyGemOpenLvs = null; FuncConfigConfig gemOpenModel = FuncConfigConfig.Get("GemOpen"); FuncConfigConfig gemOpenVipModel = FuncConfigConfig.Get("GemOpenVip"); gemOpenLvs = ConfigParse.GetMultipleStr(gemOpenModel.Numerical1); gemOpenVipLv = int.Parse(gemOpenVipModel.Numerical1); jadeDynastyGemOpenLvs = ConfigParse.GetMultipleStr(gemOpenModel.Numerical2); FuncConfigConfig gemtype1 = FuncConfigConfig.Get("GemType1"); gemType1s = ConfigParse.GetMultipleStr(gemtype1.Numerical1); FuncConfigConfig gemtype2 = FuncConfigConfig.Get("GemType2"); gemType2s = ConfigParse.GetMultipleStr(gemtype2.Numerical1); FuncConfigConfig equipMidFunc = FuncConfigConfig.Get("EquipPartLength"); equipMidHeights = ConfigParse.GetMultipleStr(equipMidFunc.Numerical1); FuncConfigConfig wingsMidFunc = FuncConfigConfig.Get("WingsPartLength"); wingsMidHeights = ConfigParse.GetMultipleStr(wingsMidFunc.Numerical1); FuncConfigConfig expFormula = FuncConfigConfig.Get("ExpValueDes"); expValueFormula = expFormula.Numerical1; #region 灵宠坐骑解锁 unlockPetDict = new Dictionary(); petSkillDict.Clear(); List petInfolist = PetInfoConfig.GetValues(); for (int i = 0; i < petInfolist.Count; i++) { if (!unlockPetDict.ContainsKey(petInfolist[i].UnLockNeedItemID)) { unlockPetDict.Add(petInfolist[i].UnLockNeedItemID, petInfolist[i]); } Dictionary skillDict = new Dictionary(); petSkillDict.Add(petInfolist[i].ID, skillDict); int[] skillIds = petInfolist[i].SkillID; int[] skillUnlocks = petInfolist[i].SkillUnLock; if (skillIds != null) { for (int j = 0; j < skillIds.Length; j++) { skillDict.Add(skillUnlocks[j], skillIds[j]); } } } unlockMountDict = new Dictionary(); mountSkillDict.Clear(); List horselist = HorseConfig.GetValues(); for (int i = 0; i < horselist.Count; i++) { if (!unlockMountDict.ContainsKey(horselist[i].UnlockItemID)) { unlockMountDict.Add(horselist[i].UnlockItemID, horselist[i]); } Dictionary> skillDict = new Dictionary>(); mountSkillDict.Add(horselist[i].HorseID, skillDict); List mountlist = HorseUpConfig.GetMountlistById(horselist[i].HorseID); if (mountlist != null) { for (int j = 0; j < mountlist.Count; j++) { int[] skills = mountlist[j].SkillID; List skilllist = new List(); if (skills != null) { for (int k = 0; k < skills.Length; k++) { if (skills[k] != 0) { skilllist.Add(skills[k]); skillDict.Add(mountlist[j].LV, skilllist); } } } } } } #endregion FuncConfigConfig randomRuneConfig = FuncConfigConfig.Get("RandomRuneIDList"); randomRuneIds = ConfigParse.GetMultipleStr(randomRuneConfig.Numerical1); FuncConfigConfig petQuality = FuncConfigConfig.Get("PetQuality"); int[] qualitys = ConfigParse.GetMultipleStr(petQuality.Numerical1); string[] qualityNames = ConfigParse.GetMultipleStr(petQuality.Numerical2); if (qualitys != null && qualityNames != null && qualitys.Length == qualityNames.Length) { for (int i = 0; i < qualitys.Length; i++) { petAndMountQualityDict.Add(qualitys[i], qualityNames[i]); } } ParseFuncConfig(); ParseJadeDynastyEquipLegendAttr(); } public void OnBeforePlayerDataInitialize() { } public override void UnInit() { } #region 解析本地数据 public Dictionary> atkSpeedColorDict { get; private set; } private void ParseFuncConfig() { atkSpeedColorDict = new Dictionary>(); var equipYPAtkSpeedColor = FuncConfigConfig.Get("EquipYPAtkSpeedColor"); JsonData atkSpeedData = JsonMapper.ToObject(equipYPAtkSpeedColor.Numerical1); foreach (var color in atkSpeedData.Keys) { List list = new List(); atkSpeedColorDict.Add(color, list); if (atkSpeedData[color].IsArray) { for (int i = 0; i < atkSpeedData[color].Count; i++) { int range = 0; int.TryParse(atkSpeedData[color][i].ToString(), out range); list.Add(range); } } } } public bool TryGetAtkSpeedColor(int atkSpeed, out string color) { color = string.Empty; foreach (var key in atkSpeedColorDict.Keys) { var rangelist = atkSpeedColorDict[key]; if (rangelist.Count > 1) { if (atkSpeed >= rangelist[0] && atkSpeed <= rangelist[1]) { color = key; return true; } } } return false; } #region 解析诛仙装备传奇属性 public Dictionary> jadeDynastyLegendCountDict { get; private set; } //key 阶数 +星级 随机条数 public Dictionary> jadeDynastyLegendGroupDict { get; private set; } //key 物品类型 群组列表 public Dictionary> jadeDynastyLegendIdDict { get; private set; } //key 群组id 属性Id列表 public Dictionary> jadeDynastyLegendColorDict { get; private set; } //key s属性id 属性value范围 颜色值 public Dictionary jadeDynastyColorDict { get; private set; } //key 色值类型 public Dictionary jadeDynastyLegendValueDict { get; private set; } //key 属性id 最大属性value private void ParseJadeDynastyEquipLegendAttr() { jadeDynastyColorDict = new Dictionary(); jadeDynastyLegendCountDict = new Dictionary>(); jadeDynastyLegendGroupDict = new Dictionary>(); jadeDynastyLegendColorDict = new Dictionary>(); jadeDynastyLegendIdDict = new Dictionary>(); jadeDynastyLegendValueDict = new Dictionary(); var legendAttrColor = FuncConfigConfig.Get("LegendAttrColor"); JsonData colorData = JsonMapper.ToObject(legendAttrColor.Numerical4); foreach (var key in colorData.Keys) { int colorType = int.Parse(key); string color = colorData[key].ToString(); jadeDynastyColorDict.Add(colorType, color); } JsonData legendColorData = JsonMapper.ToObject(legendAttrColor.Numerical3); foreach (var key in legendColorData.Keys) { int attrId = int.Parse(key); var colorDict = new Dictionary(); jadeDynastyLegendColorDict.Add(attrId, colorDict); var attrValueData = legendColorData[key]; foreach (var value in attrValueData.Keys) { int attrValue = int.Parse(value); int colorType = int.Parse(attrValueData[value].ToString()); colorDict.Add(attrValue, colorType); } } var legendAttrRandRule = FuncConfigConfig.Get("LegendAttrRandRule"); JsonData legendCountData = JsonMapper.ToObject(legendAttrRandRule.Numerical3); foreach (var key in legendCountData.Keys) { var rangeData = legendCountData[key]; int equipLv = int.Parse(key); foreach (var star in rangeData.Keys) { var countData = rangeData[star]; int equipStar = int.Parse(star); string guid = StringUtility.Contact(equipLv, equipStar); List list = new List(); jadeDynastyLegendCountDict.Add(guid, list); if (countData.IsArray) { for (int i = 0; i < countData.Count; i++) { int count = int.Parse(countData[i].ToString()); list.Add(count); } } } } JsonData legendGroupData = JsonMapper.ToObject(legendAttrRandRule.Numerical2); foreach (var type in legendGroupData.Keys) { var groupData = legendGroupData[type]; int itemType = int.Parse(type); List list = new List(); jadeDynastyLegendGroupDict.Add(itemType, list); if (groupData.IsArray) { for (int i = 0; i < groupData.Count; i++) { int groupType = int.Parse(groupData[i].ToString()); list.Add(groupType); } } } JsonData legendIdData = JsonMapper.ToObject(legendAttrRandRule.Numerical1); foreach (var key in legendIdData.Keys) { var attrIdData = legendIdData[key]; int groupId = int.Parse(key); List list = new List(); jadeDynastyLegendIdDict.Add(groupId, list); if (attrIdData.IsArray) { for (int i = 0; i < attrIdData.Count; i++) { int attrId = int.Parse(attrIdData[i].ToString()); list.Add(attrId); } } } JsonData legendValueData = JsonMapper.ToObject(legendAttrRandRule.Numerical4); foreach (var key in legendValueData.Keys) { int attrId = int.Parse(key); var valueData = legendValueData[key]; if (valueData.IsArray && valueData.Count > 0) { int attrValue = int.Parse(valueData[0].ToString()); jadeDynastyLegendValueDict.Add(attrId, attrValue); } } } public bool TryGetJadeDynastyLegendCount(int itemId, out int minCount, out int maxCount) { minCount = 0; maxCount = 0; var config = ItemConfig.Get(itemId); if (config == null) return false; int equipLv = config.LV; int equipStar = config.StarLevel; string guid = StringUtility.Contact(equipLv, equipStar); if (jadeDynastyLegendCountDict.ContainsKey(guid)) { var list = jadeDynastyLegendCountDict[guid]; if (list.Count > 1) { minCount = list[0]; maxCount = list[1]; return true; } else if (list.Count > 0) { maxCount = list[0]; return true; } } return false; } public bool TryGetJadeDynastyLegendAttr(int itemId, out Dictionary attrDict) { attrDict = new Dictionary(); var config = ItemConfig.Get(itemId); if (config == null) return false; if (jadeDynastyLegendGroupDict.ContainsKey(config.Type)) { var grouplist = jadeDynastyLegendGroupDict[config.Type]; foreach (var groupId in grouplist) { if (jadeDynastyLegendIdDict.ContainsKey(groupId)) { var attrIds = jadeDynastyLegendIdDict[groupId]; foreach (var attrId in attrIds) { int attrValue = 0; if (jadeDynastyLegendValueDict.ContainsKey(attrId)) { attrValue = jadeDynastyLegendValueDict[attrId]; } attrDict.Add(attrId, attrValue); } return true; } } } return false; } public bool TryGetJadeDyanastyLegendColorType(int attrId, int attrValue, out int colorType) { colorType = 0; if (jadeDynastyLegendColorDict.ContainsKey(attrId)) { var colorRanges = jadeDynastyLegendColorDict[attrId]; foreach (var key in colorRanges.Keys) { if (attrValue <= key) { colorType = colorRanges[key]; return true; } } } return false; } public bool TryGetJadeDyanastyLegendColor(int colorType, out string color) { color = string.Empty; return jadeDynastyColorDict.TryGetValue(colorType, out color); } public int GetJadeDynastyLegendValue(int attrId) { int attrValue = 0; jadeDynastyLegendValueDict.TryGetValue(attrId, out attrValue); return attrValue; } #endregion #endregion /// /// 刷新脱机外挂时间 /// /// private void RefreshOfflinePluginTime(PlayerDataRefresh refresh) { if (refresh != PlayerDataRefresh.HappyPoint) return; HangUpSetModel.Instance.SetOfflinePluginTime(m_storeModel.GetTCBPlayerData(refresh)); } public ItemAttrData curAttrData { get; private set; } public ItemAttrData compareAttrData { get; private set; } /// ///从背包类型中得到物品展示 /// public void SetItemTipsModel(PackType type, string guid, bool isShowUINow = true, bool isCompare = false, ItemTipChildType childType = ItemTipChildType.Normal) { curAttrData = null; compareAttrData = null; curTips = null; compareTips = null; ItemModel itemModel = playerPack.GetItemByGuid(guid); if (itemModel != null) { curAttrData = new ItemAttrData(itemModel.itemId, false, (ulong)itemModel.count , itemModel.itemPlace, itemModel.isBind, isCompare , type, guid, ConfigParse.Analysis(itemModel.itemInfo.userData), childType); if (isCompare) { switch (type) { case PackType.DogzItem: SetCompareAttrData(PackType.DogzEquip, itemModel.config.EquipPlace); break; case PackType.JadeDynastyItem: SetCompareAttrData(PackType.JadeDynastyEquip, itemModel.config.EquipPlace); break; default: SetCompareAttrData(PackType.Equip, itemModel.config.EquipPlace); break; } } } if (isShowUINow) { ShowUICtrl(); } } /// /// 预览物品信息 /// /// public void SetItemTipsModel(ItemAttrData itemAttrData, bool isShowUINow = true) { compareAttrData = null; curTips = null; compareTips = null; curAttrData = itemAttrData; if (itemAttrData == null) return; if (itemAttrData.isCompare) { switch (itemAttrData.packType) { case PackType.DogzItem: SetCompareAttrData(PackType.DogzEquip, itemAttrData.itemConfig.EquipPlace); break; case PackType.JadeDynastyItem: SetCompareAttrData(PackType.JadeDynastyEquip, itemAttrData.itemConfig.EquipPlace); break; default: SetCompareAttrData(PackType.Equip, itemAttrData.itemConfig.EquipPlace); break; } } if (isShowUINow) { ShowUICtrl(); } } public void SetCurrentAttrData(ItemModel itemModel, bool isCompare) { curAttrData = new ItemAttrData(itemModel.itemId, false, (ulong)itemModel.count , itemModel.itemPlace, itemModel.isBind, isCompare , itemModel.packType, itemModel.guid, ConfigParse.Analysis(itemModel.itemInfo.userData), ItemTipChildType.Normal); } public void SetCompareAttrData(ItemModel itemModel) { compareAttrData = new ItemAttrData(itemModel.itemId, false, (ulong)itemModel.count , itemModel.itemPlace, itemModel.isBind, true , itemModel.packType, itemModel.guid, ConfigParse.Analysis(itemModel.itemInfo.userData)); } private void SetCompareAttrData(PackType type, int equipPlace) { compareAttrData = null; ItemModel itemModel = null; switch (type) { case PackType.Equip: itemModel = playerPack.GetItemByIndex(type, equipPlace); break; case PackType.DogzEquip: var dogzModel = ModelCenter.Instance.GetModel(); dogzModel.TryGetDogzEquip(dogzModel.presentSelectDogz, equipPlace, out itemModel); break; case PackType.JadeDynastyEquip: itemModel = playerPack.GetItemByIndex(type, equipPlace); break; } if (itemModel == null) return; ItemModel fairyModel2 = null; switch ((RoleEquipType)equipPlace) { case RoleEquipType.FairyCan: fairyModel2 = playerPack.GetItemByIndex(type, (int)RoleEquipType.FairyCan2); if (fairyModel2 != null) { if (itemModel != null) { if (fairyModel2.equipScore < itemModel.equipScore) { itemModel = fairyModel2; } } } else { itemModel = fairyModel2; } break; case RoleEquipType.JadeDynasty_Glove1: fairyModel2 = playerPack.GetItemByIndex(type, (int)RoleEquipType.JadeDynasty_Glove2); if (fairyModel2 != null) { if (itemModel != null) { if (fairyModel2.equipScore < itemModel.equipScore) { itemModel = fairyModel2; } } } else { itemModel = fairyModel2; } break; case RoleEquipType.JadeDynasty_Ring1: fairyModel2 = playerPack.GetItemByIndex(type, (int)RoleEquipType.JadeDynasty_Ring2); if (fairyModel2 != null) { if (itemModel != null) { if (fairyModel2.equipScore < itemModel.equipScore) { itemModel = fairyModel2; } } } else { itemModel = fairyModel2; } break; } if (itemModel != null) { compareAttrData = new ItemAttrData(itemModel.itemId, false, (ulong)itemModel.count , itemModel.itemPlace, itemModel.isBind, true , type, itemModel.guid, ConfigParse.Analysis(itemModel.itemInfo.userData)); } } public void ShowUICtrl() { if (curAttrData == null) return; #if UNITY_EDITOR string itemInfo = StringUtility.Contact("物品ID:", curAttrData.itemId, "物品名称:", curAttrData.itemConfig.ItemName); DebugEx.Log(itemInfo); #endif switch (curAttrData.winType) { case ItemWinType.itemWin: WindowCenter.Instance.Open(); break; case ItemWinType.boxWin: WindowCenter.Instance.Open(); break; case ItemWinType.equipWin: WindowCenter.Instance.Open(); break; case ItemWinType.wingsWin: WindowCenter.Instance.Open(); break; case ItemWinType.guardWin: WindowCenter.Instance.Open(); break; case ItemWinType.buyItemWin: WindowCenter.Instance.Open(); break; case ItemWinType.buyBoxWin: WindowCenter.Instance.Open(); break; case ItemWinType.petMatWin: WindowCenter.Instance.Open(); break; case ItemWinType.buyPetMatWin: WindowCenter.Instance.Open(); break; case ItemWinType.gatherSoul: WindowCenter.Instance.Open(); break; case ItemWinType.kingTreasure: var kingTreasureShow = ModelCenter.Instance.GetModel(); kingTreasureShow.SetInitData(curAttrData.itemId); break; } } private StringBuilder attrSB = new StringBuilder(); private PlayerPropertyConfig playerProModel; #region 设置装备基础信息 /// /// 得到弹框标题 /// /// public string GetItemTipsTitle(ItemAttrData attrData) { string equipName = ""; if (attrData == null) return equipName; List useDatalist = attrData.GetUseDataModel(30); if (useDatalist != null) { if (useDatalist[0] == 1) { equipName = Language.Get("EquipSuit109"); } else if (useDatalist[0] == 2) { equipName = Language.Get("EquipSuit110"); } } if (attrData.StrengthLV > 0) { equipName = StringUtility.Contact(equipName, attrData.itemConfig.ItemName, "+", attrData.StrengthLV); } else { equipName = StringUtility.Contact(equipName, attrData.itemConfig.ItemName); } return equipName; } /// /// 得到装备的职业 /// /// /// = equipJob) { jobName = UIHelper.AppendStringColor(TextColType.White, jobNameConfig.name); } else { jobName = UIHelper.AppendStringColor(TextColType.Red, jobNameConfig.name); } } else { jobName = UIHelper.AppendStringColor(TextColType.White, Language.Get("StoreWin110")); } } #endregion #region 设置弹框按钮 /// /// 设置背包的弹框按钮 /// /// public void SetBagTipsBtn(ItemAttrData attrData) { if (attrData == null) return; var horseModel = ModelCenter.Instance.GetModel(); var petmodel = ModelCenter.Instance.GetModel(); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(attrData.guid, attrData.itemId, attrData.useDataDict); HorseConfig horseConfig = null; PetInfoConfig petInfo = null; switch (attrData.itemConfig.Type) { case 26: petInfo = unlockPetDict[attrData.itemId]; if (petmodel._DicPetBack.ContainsKey(petInfo.ID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } } break; case 41: horseConfig = unlockMountDict[attrData.itemId]; if (horseModel._DicHorse.ContainsKey(horseConfig.HorseID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } } break; case 124: horseConfig = unlockMountDict[attrData.itemConfig.EffectValueA1]; if (horseModel._DicHorse.ContainsKey(horseConfig.HorseID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } } break; case 125: petInfo = unlockPetDict[attrData.itemConfig.EffectValueA1]; if (petmodel._DicPetBack.ContainsKey(petInfo.ID)) { if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } } break; default: if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } break; } List dismantleReturnlist = attrData.GetUseDataModel((int)ItemUseDataKey.itemDecompound); if (dismantleReturnlist != null && dismantleReturnlist.Count > 0) { attrData.SetTipsFuncBtn(ItemOperateType.dismantle, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.DismantleItem(attrData); }); } if (!isOverdue) { if (attrData.itemConfig.JumpComposeCondi != null && attrData.itemConfig.JumpComposeCondi.Length > 0) { attrData.SetTipsFuncBtn(ItemOperateType.compose, (ItemWinBtnType, ItemAttrData) => { int jumpId = 0; bool isUnlock = ModelCenter.Instance.GetModel().CheckComposeItemById(attrData.itemId, out jumpId); if (isUnlock) { ItemOperateUtility.Instance.GotoComposeItem(jumpId); } }); } if (attrData.itemConfig.Type == 25 && attrData.itemConfig.Effect1 == 225) { attrData.SetTipsFuncBtn(ItemOperateType.inlay, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.GotoInlayItem(attrData.guid); }); } if (attrData.itemConfig.CanTrade == 1 && attrData.isBind == 0) { attrData.SetTipsFuncBtn(ItemOperateType.putAway, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutAwayItem(attrData.guid); }); } if ((ItemType)attrData.itemConfig.Type == ItemType.WingsMat) { attrData.SetTipsFuncBtn(ItemOperateType.refine, (ItemWinBtnType, ItemAttrData) => { // BoxGetItemModel.Instance.SetModel(attrData.guid); WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StrengthFunc3); }); } } if (attrData.count > 1) { attrData.SetTipsFuncBtn(ItemOperateType.split, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.OnClickSplitBtn(attrData.guid); }); } if (!isOverdue) { switch (attrData.winType) { case ItemWinType.equipWin: case ItemWinType.wingsWin: case ItemWinType.guardWin: attrData.SetTipsFuncBtn(ItemOperateType.putOn, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutOnItem(ItemOperateType.putOn, attrData.guid); }); break; } if (attrData.itemConfig.UseTag == 1) { attrData.SetTipsFuncBtn(ItemOperateType.makeUse, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.GotoUseItem(attrData.index); }); } } for (int i = 0; i < ItemRenewalIds.Length; i++) { if (ItemRenewalIds[i] == attrData.itemId) { if (isOverdue) { attrData.SetTipsFuncBtn(ItemOperateType.renewal, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.RenewalItem(attrData.guid); }); } } } for (int i = 0; i < tryPutOnEquipIds.Length; i++) { if (tryPutOnEquipIds[i] == attrData.itemId) { if (PlayerDatas.Instance.baseData.coinPointTotal <= 0) { attrData.SetTipsFuncBtn(ItemOperateType.renewal, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.FirstRecharge); }); } } } } /// /// 设置仓库弹框按钮 /// /// public void SetDepotTipsBtn(ItemAttrData attrData) { if (attrData == null) return; attrData.SetTipsFuncBtn(ItemOperateType.putOut, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.TakeOutFromWarehouse(ItemOperateType.putOut, attrData.guid); }); } public void SetDogzItemBtn(ItemAttrData attrData) { if (attrData == null) return; if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } switch (attrData.winType) { case ItemWinType.equipWin: attrData.SetTipsFuncBtn(ItemOperateType.putOn, (ItemWinBtnType, ItemAttrData) => { if (dogzModel.CheckIsPutOn(attrData.itemId)) { List indexlist = new List(); indexlist.Add(attrData.index); dogzModel.SendPutOnEquip(indexlist); } }); break; } } public void SetDogzEquipBtn(ItemAttrData attrData) { if (attrData == null) return; attrData.SetTipsFuncBtn(ItemOperateType.putOff, (ItemWinBtnType, ItemAttrData) => { dogzModel.CheckPutOff(dogzModel.GetDogzEquipPlaceByIndex(attrData.index)); }); if (dogzModel.TryGetAssistDogzState(dogzModel.presentSelectDogz)) { attrData.SetTipsFuncBtn(ItemOperateType.strength, (ItemWinBtnType, ItemAttrData) => { dogzModel.OpenDogzFuncEvent(1, attrData.index); }); } } /// /// 设置仓库弹框按钮 /// /// public void SetDepotBagTipsBtn(ItemAttrData attrData) { if (attrData == null) return; attrData.SetTipsFuncBtn(ItemOperateType.putIn, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutInWareHouse(attrData.guid); } ); } /// /// 设置装备弹框按钮 /// /// public void SetPutOnTipsBtn(ItemAttrData attrData) { if (attrData == null) { return; } RoleEquipType equipType = (RoleEquipType)attrData.itemConfig.EquipPlace; if (equipType == RoleEquipType.Wing) { attrData.SetTipsFuncBtn(ItemOperateType.refine, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StrengthFunc3); }); } else if (equipType != RoleEquipType.SpiritAnimal) { attrData.SetTipsFuncBtn(ItemOperateType.strength, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StrengthFunc1); }); } attrData.SetTipsFuncBtn(ItemOperateType.putOff, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutOffEquip(attrData.guid); }); for (int i = 0; i < tryPutOnEquipIds.Length; i++) { if (tryPutOnEquipIds[i] == attrData.itemId) { if (PlayerDatas.Instance.baseData.coinPointTotal <= 0) { attrData.SetTipsFuncBtn(ItemOperateType.renewal, (ItemWinBtnType, ItemAttrData) => { WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.FirstRecharge); }); } } } } public void SetJadeDynastyItemTipsBtn(ItemAttrData attrData) { if (attrData == null) return; bool isOverdue = ItemLogicUtility.Instance.IsOverdue(attrData.guid, attrData.itemId, attrData.useDataDict); if (attrData.itemConfig.CanSell == 1) { attrData.SetTipsFuncBtn(ItemOperateType.sell, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.SellItem(attrData); }); } if (!isOverdue) { if (attrData.itemConfig.JumpComposeCondi != null && attrData.itemConfig.JumpComposeCondi.Length > 0) { attrData.SetTipsFuncBtn(ItemOperateType.compose, (ItemWinBtnType, ItemAttrData) => { int jumpId = 0; bool isUnlock = ModelCenter.Instance.GetModel().CheckComposeItemById(attrData.itemId, out jumpId); if (isUnlock) { ItemOperateUtility.Instance.GotoComposeItem(jumpId); } }); } if (attrData.itemConfig.Effect1 == 225) { attrData.SetTipsFuncBtn(ItemOperateType.inlay, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.GotoInlayItem(attrData.guid); }); } if (!isOverdue) { switch (attrData.winType) { case ItemWinType.equipWin: attrData.SetTipsFuncBtn(ItemOperateType.putOn, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutOnItem(ItemOperateType.putOn, attrData.guid); }); break; } } } } public void SetJadeDynastyPutOnTipsBtn(ItemAttrData attrData) { if (attrData == null) { return; } var equipType = (RoleEquipType)attrData.itemConfig.EquipPlace; attrData.SetTipsFuncBtn(ItemOperateType.putOff, (ItemWinBtnType, ItemAttrData) => { ItemOperateUtility.Instance.PutOffEquip(attrData.guid); }); } #endregion #region 设置获取途径列表 private List getWayslist = new List(); public List GetWaysList(ItemAttrData attrData) { getWayslist.Clear(); if (attrData != null) { int[] waysArray = attrData.itemConfig.GetWay; if (waysArray != null) { int i = 0; for (i = 0; i < waysArray.Length; i++) { var config = GetItemWaysConfig.Get(waysArray[i]); if (config != null) { getWayslist.Add(config); } } } } return getWayslist; } #endregion #region 设置基础属性 public string GetBasicAttr(ItemAttrData attrData) { switch ((RoleEquipType)attrData.itemConfig.EquipPlace) { case RoleEquipType.Wing: return SetWingsBasicAttr(attrData); case RoleEquipType.SpiritAnimal: return SetGuardBasicAttr(attrData); default: return SetEquipBasicAttr(attrData); } } private string SetEquipBasicAttr(ItemAttrData attrData) { if (attrData == null) return ""; Dictionary itemEffectDict = SetItemEffectDict(attrData.itemConfig); attrSB.Length = 0; string atkStr = ""; string otherStr = ""; foreach (var key in itemEffectDict.Keys) { PlayerPropertyConfig playerProModel = PlayerPropertyConfig.Get(key); if (playerProModel != null) { if (key == (int)AttrEnum.MinAtk) { playerProModel = PlayerPropertyConfig.Get((int)AttrEnum.ATK); atkStr = StringUtility.Contact(playerProModel.Name, ":", GetProValueTypeStr(playerProModel, itemEffectDict[key])); } else if (key == (int)AttrEnum.MaxAtk) { playerProModel = PlayerPropertyConfig.Get((int)AttrEnum.ATK); atkStr = StringUtility.Contact(atkStr, "-", GetProValueTypeStr(playerProModel, itemEffectDict[key])); if (attrData.strengthDataDict != null) { if (attrData.strengthDataDict.ContainsKey((int)AttrEnum.ATK)) { atkStr = StringUtility.Contact(atkStr, Language.Get("KnapS116", GetProValueTypeStr(playerProModel, attrData.strengthDataDict[(int)AttrEnum.ATK]))); } } if (attrSB.Length <= 0) { attrSB.Append(atkStr); } else { attrSB.Append("\n" + atkStr); } } else { otherStr = StringUtility.Contact(playerProModel.Name, ":", GetProValueTypeStr(playerProModel, itemEffectDict[key])); if (attrData.strengthDataDict != null) { if (attrData.strengthDataDict.ContainsKey(key)) { otherStr = StringUtility.Contact(otherStr, Language.Get("KnapS116", GetProValueTypeStr(playerProModel, attrData.strengthDataDict[key]))); } } if (key == (int)AttrEnum.ATKSPEED) { int attrValue = GetProValueType(playerProModel.ISPercentage, itemEffectDict[key]); otherStr = SetAttrColor(otherStr, attrValue, attrData.itemConfig.EquipPlace); } if (attrSB.Length <= 0) { attrSB.Append(otherStr); } else { attrSB.Append("\n" + otherStr); } } } } return attrSB.ToString(); } private string SetWingsBasicAttr(ItemAttrData attrData) { if (attrData == null) return ""; WingRefineAttrConfig wingRefine = WingRefineAttrConfig.GetWingRefineModel(attrData.itemConfig.LV); if (wingRefine == null) return ""; attrSB.Length = 0; int maxHp = 0; int maxHurt = 0; int curHp = 0; int curHurt = 0; Dictionary itemEffectDict = SetItemEffectDict(attrData.itemConfig); Dictionary wingAttrModelDict = ConfigParse.GetDic(wingRefine.attrupper); foreach (var key in itemEffectDict.Keys) { playerProModel = PlayerPropertyConfig.Get(key); string rangeStr = ""; if (key == 23) { rangeStr = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, itemEffectDict[key]); } else if (key == 6) { if (wingAttrModelDict.ContainsKey(key)) { maxHp = itemEffectDict[key] + wingAttrModelDict[key]; } if (attrData.GetUseDataModel(42) != null) { curHp = itemEffectDict[key] + (int)strengthengmodel.BackpackWings(attrData.itemId, attrData.GetUseDataModel(42)[0])[1]; } else { curHp = itemEffectDict[key]; } rangeStr = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, curHp) + "[" + GetProValueTypeStr(playerProModel, itemEffectDict[key]) + "-" + GetProValueTypeStr(playerProModel, maxHp) + "]"; } else if (key == 19) { if (wingAttrModelDict.ContainsKey(key)) { maxHurt = itemEffectDict[key] + wingAttrModelDict[key]; } if (attrData.GetUseDataModel(42) != null) { curHurt = itemEffectDict[key] + (int)strengthengmodel.BackpackWings(attrData.itemId, attrData.GetUseDataModel(42)[0])[0]; } else { curHurt = itemEffectDict[key]; } rangeStr = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, curHurt) + "[" + GetProValueTypeStr(playerProModel, itemEffectDict[key]) + "-" + GetProValueTypeStr(playerProModel, maxHurt) + "]"; } if (rangeStr != "") { if (attrSB.Length <= 0) { attrSB.Append(rangeStr); } else { attrSB.Append("\n" + rangeStr); } } } return attrSB.ToString(); } private string SetGuardBasicAttr(ItemAttrData attrData) { string s = ""; if (guardAutoDrops.Contains(attrData.itemId)) { s = StringUtility.Contact(SetEquipBasicAttr(attrData), "\n", Language.Get("GuardTips101")); } else { s = SetEquipBasicAttr(attrData); } return s; } private string SetAttrColor(string attrStr, int atkSpeed, int equipPlace) { if ((RoleEquipType)equipPlace != RoleEquipType.FairyCan && (RoleEquipType)equipPlace != RoleEquipType.FairyCan2) { return attrStr; } string color = string.Empty; bool isColor = TryGetAtkSpeedColor(atkSpeed, out color); if (isColor) { return StringUtility.Contact("", attrStr, ""); } return attrStr; } public int GetProValueType(int precentType, int value) { switch (precentType) { case 1: case 2: return Mathf.RoundToInt(value / 100); default: return value; } } #endregion #region 设置传奇属性 private Dictionary attrDict = new Dictionary(); public string GetLegendAttr(ItemAttrData attrData) { if (!attrData.isPreview) { return SetLegendAttr(attrData.legendDataDict.Keys.ToList(), attrData.legendDataDict.Values.ToList(), attrData.itemConfig); } else { return SetLegendAttr(attrData.legendDataDict.Keys.ToList(), attrData.legendDataDict.Values.ToList(), attrData.itemConfig, true, attrData.isCustom); } } public string GetEquipLegendAttrCntPreview(ItemAttrData attrData) { string s = ""; if (attrData.isCustom) { s = Language.Get("LegendAttPreview_MustTitle", attrData.legendDataDict.Count); } else { var quality = attrData.itemConfig.ItemColor; var starLevel = attrData.itemConfig.StarLevel; var count = LegendPropertyUtility.GetEquipPropertyCount(quality, starLevel); if (starLevel > 2) { s = Language.Get("LegendAttPreview_MustTitle", count); } else { s = Language.Get("LegendAttPreview_MightTitle", count); } } return s; } public string GetJadeDynastyAttrCntPreview(ItemAttrData attrData) { int minCount = 0; int maxCount = 0; TryGetJadeDynastyLegendCount(attrData.itemId, out minCount, out maxCount); string countSB = StringUtility.Contact(minCount, "-", maxCount); string s = Language.Get("LegendAttPreview_MightTitle", countSB); return s; } public string GetDogzLegendAttrCntPreview(ItemAttrData attrData) { string s = ""; if (attrData.isCustom) { s = Language.Get("LegendAttPreview_MustTitle", attrData.legendDataDict.Count); } else { var quality = attrData.itemConfig.ItemColor; var starLevel = attrData.itemConfig.StarLevel; var count = LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Normal); count += LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Pursuit); count += LegendPropertyUtility.GetDogzPropertyCount(quality, starLevel, LegendAttrType.Fixed); if (attrData.itemConfig.StarLevel > 2) { s = Language.Get("LegendAttPreview_MustTitle", count); } else { s = Language.Get("LegendAttPreview_MightTitle", count); } } return s; } public string GetWingsLegendAttrCntPreview(ItemAttrData attrData) { var description = ""; if (attrData.isCustom) { description = Language.Get("LegendAttPreview_MustTitle", attrData.legendDataDict.Count); } else { int attrCnt = LegendPropertyUtility.GetWingPropertyCount(attrData.itemConfig.LV); if (attrCnt > 0) { if (attrCnt > 1) { description = Language.Get("LegendAttPreview_MustTitle", attrCnt); } else { description = Language.Get("LegendAttPreview_MightTitle", attrCnt); } } } return description; } //即将丢弃 public string GetLegendAttr(List idlist, List valuelist, ItemConfig itemConfig) { return SetLegendAttr(idlist, valuelist, itemConfig); } //即将丢弃 public string GetPreviewLegendAttr(List idlist, List valuelist, ItemConfig itemConfig, bool isCustom) { return SetLegendAttr(idlist, valuelist, itemConfig, true, isCustom); } private string SetLegendAttr(List idlist, List valuelist, ItemConfig itemConfig, bool isPreview = false, bool isCustom = false) { if (idlist == null) return ""; attrDict.Clear(); int i = 0; attrSB.Length = 0; for (i = 0; i < idlist.Count; i++) { int attrId = idlist[i]; int attrValue = valuelist[i]; attrDict.Add(attrId, attrValue); } switch (itemConfig.EquipPlace) { case 11: break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: idlist.Sort(CompareLegendAttrType); break; case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: case 130: case 131: case 132: idlist.Sort(CompareJadeDynastyLegendColorType); break; case 101: case 102: case 103: case 104: case 105: idlist.Sort(CompareDogzLegendAttrType); break; } for (i = 0; i < idlist.Count; i++) { var attrId = idlist[i]; var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type); switch (packType) { case PackType.JadeDynastyItem: SetJadeDynastyLengend(itemConfig, attrId); break; default: SetNormalPackLengend(itemConfig, attrId, isCustom, isPreview); break; } } return attrSB.ToString(); } private void SetNormalPackLengend(ItemConfig itemConfig, int attrId, bool isCustom, bool isPreview) { playerProModel = PlayerPropertyConfig.Get(attrId); if (playerProModel != null) { string s = ""; if (playerProModel.Name.Contains("%s")) { if (!isPreview) { s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])); } else { if (itemConfig.EquipPlace != (int)RoleEquipType.Wing) { if (isCustom || itemConfig.StarLevel >= 3) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId]))); } else { s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId]))); } } else { if (isCustom) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId]))); } else { var count = LegendPropertyUtility.GetWingPropertyCount(itemConfig.LV); if (count > 0) { int minValue = LegendPropertyUtility.GetWingPropertyMinValue(itemConfig.LV, attrId); int maxValue = LegendPropertyUtility.GetWingPropertyMaxValue(itemConfig.LV, attrId); var minDescription = GetProValueTypeStr(playerProModel, minValue); var maxDescription = GetProValueTypeStr(playerProModel, maxValue); var description = StringUtility.Contact("[", minDescription, "~", maxDescription, "]"); if (count > 1) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name.Replace("%s", description)); } else { s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name.Replace("%s", description)); } } } } } } else { if (!isPreview) { s = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, attrDict[attrId]); } else { if (itemConfig.EquipPlace != (int)RoleEquipType.Wing) { if (isCustom || itemConfig.StarLevel >= 3) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId])); } else { s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId])); } } else { if (isCustom) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrDict[attrId])); } else { var count = LegendPropertyUtility.GetWingPropertyCount(itemConfig.LV); if (count > 0) { int minValue = LegendPropertyUtility.GetWingPropertyMinValue(itemConfig.LV, attrId); int maxValue = LegendPropertyUtility.GetWingPropertyMaxValue(itemConfig.LV, attrId); var minDescription = GetProValueTypeStr(playerProModel, minValue); var maxDescription = GetProValueTypeStr(playerProModel, maxValue); var description = StringUtility.Contact("[+", minDescription, "~", maxDescription, "]"); if (count > 1) { s = StringUtility.Contact(Language.Get("LegendAttPreview_Must"), playerProModel.Name, description); } else { s = StringUtility.Contact(Language.Get("LegendAttPreview_Might"), playerProModel.Name, description); } } } } } } switch (itemConfig.EquipPlace) { case 11: s = string.Format("{1}", LegendPropertyUtility.GetWingPropertyColor(attrId, attrDict[attrId]), s); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: s = GetTextColorByLegendType(GetLegendType(attrId), s); break; case 101: case 102: case 103: case 104: case 105: s = GetTextColorByLegendType(GetDogzLegendType(attrId), s); break; } if (attrSB.Length <= 0) { attrSB.Append(s); } else { attrSB.Append("\n" + s); } } } private void SetJadeDynastyLengend(ItemConfig itemConfig, int attrId) { playerProModel = PlayerPropertyConfig.Get(attrId); if (playerProModel != null) { string s = ""; if (playerProModel.Name.Contains("%s")) { s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrDict[attrId])); } else { s = playerProModel.Name + "+" + GetProValueTypeStr(playerProModel, attrDict[attrId]); } int colorType = 0; TryGetJadeDyanastyLegendColorType(attrId, attrDict[attrId], out colorType); s = GetTextColorByColorType(colorType, s); if (attrSB.Length <= 0) { attrSB.Append(s); } else { attrSB.Append("\n" + s); } } } private int CompareLegendAttrType(int start, int end) { int type1 = GetLegendType(start); int type2 = GetLegendType(end); if (type1.CompareTo(type2) != 0) return type1.CompareTo(type2); return 0; } private int CompareJadeDynastyLegendColorType(int start, int end) { int value1 = attrDict[start]; int value2 = attrDict[end]; int colorType1 = 0; int colorType2 = 0; TryGetJadeDyanastyLegendColorType(start, value1, out colorType1); TryGetJadeDyanastyLegendColorType(end, value2, out colorType2); if (colorType1.CompareTo(colorType2) != 0) return -colorType1.CompareTo(colorType2); return 0; } private int CompareDogzLegendAttrType(int start, int end) { int type1 = GetDogzLegendType(start); int type2 = GetDogzLegendType(end); if (type1.CompareTo(type2) != 0) return -type1.CompareTo(type2); return 0; } private int GetLegendType(int id) { return (int)LegendPropertyUtility.GetEquipPropertyType(id); } private int GetDogzLegendType(int id) { return (int)LegendPropertyUtility.GetDogzPropertyType(id); } private string GetTextColorByLegendType(int type, string msg) { switch (type) { case 1: return string.Format("{0}", msg); case 2: return string.Format("{0}", msg); case 3: return string.Format("{0}", msg); } return msg; } private string GetTextColorByColorType(int colorType, string msg) { string colorSB = string.Empty; TryGetJadeDyanastyLegendColor(colorType, out colorSB); string s = StringUtility.Contact("", msg, ""); return s; } #endregion #region 设置翅膀精炼材料 public string GetWingsRefineMatStr(ItemAttrData attrData) { if (attrData.wingsRefineMatDict == null) return ""; attrSB.Length = 0; foreach (var id in attrData.wingsRefineMatDict.Keys) { ItemConfig itemConfig = ItemConfig.Get(id); if (itemConfig != null) { string des = StringUtility.Contact(itemConfig.ItemName, "X", attrData.wingsRefineMatDict[id]); if (attrSB.Length <= 0) { attrSB.Append(des); } else { attrSB.Append("\n" + des); } } } return attrSB.ToString(); } #endregion #region 设置洗练属性 public string GetWashAttr(ItemAttrData attrData) { if (attrData == null) return ""; attrSB.Length = 0; if (attrData.washDataDict != null) { foreach (var attr in attrData.washDataDict.Keys) { playerProModel = PlayerPropertyConfig.Get(attr); if (playerProModel != null) { string s = ""; if (playerProModel.Name.Contains("%s")) { s = playerProModel.Name.Replace("%s", GetProValueTypeStr(playerProModel, attrData.washDataDict[attr])); } else { s = StringUtility.Contact(playerProModel.Name, "+", GetProValueTypeStr(playerProModel, attrData.washDataDict[attr])); } if (attrSB.Length <= 0) { attrSB.Append(s); } else { attrSB.Append("\n" + s); } } } } return attrSB.ToString(); } #endregion #region 设置绝版属性 public string GetExhaustedAtrr(ItemAttrData attrData) { return SetExhaustedAttr(attrData, attrData.exhaustedMaxDataDict.Keys.ToList(), attrData.exhaustedMaxDataDict.Values.ToList()); } //即将丢弃 public string GetEquipExhaustedAtrr(List idlist, List valuelist) { //return SetExhaustedAttr(idlist, valuelist); return ""; } private string SetExhaustedAttr(ItemAttrData attrData, List idlist, List valuelist) { if (idlist == null) return ""; int i = 0; attrSB.Length = 0; for (i = 0; i < idlist.Count; i++) { playerProModel = PlayerPropertyConfig.Get(idlist[i]); if (playerProModel != null) { string s = ""; switch ((AttrEnum)idlist[i]) { case AttrEnum.OnlyFinalHurt: s = Language.Get("EquipTip_ExtraDamage", GetExhaustedAttrValue(idlist[i], valuelist[i]), GetExhaustedMaxLv(attrData.itemConfig.LV), valuelist[i]); break; case AttrEnum.PVPAtkBackHP: s = Language.Get("EquipTip_ExtraHpBack", GetExhaustedAttrValue(idlist[i], valuelist[i]), GetExhaustedMaxLv(attrData.itemConfig.LV), valuelist[i]); break; } if (attrSB.Length <= 0) { attrSB.Append(s); } else { attrSB.Append("\n" + s); } } } return attrSB.ToString(); } private int GetExhaustedAttrValue(int attrId, int value) { Equation.Instance.Clear(); Equation.Instance.AddKeyValue("maxOOPValue", value); Equation.Instance.AddKeyValue("lv", PlayerDatas.Instance.baseData.LV); string formula = string.Empty; if (exhaustedAttrFormula.ContainsKey(attrId)) { formula = exhaustedAttrFormula[attrId]; } return Equation.Instance.Eval(formula); } public int GetExhaustedMaxLv(int equipLV) { int maxLv = 0; exhaustedMaxLvDict.TryGetValue(equipLV, out maxLv); return maxLv; } #endregion public string GetProValueTypeStr(PlayerPropertyConfig playerproModel, int value) { string s = ""; if (playerproModel.ISPercentage == 0) { s = value.ToString(); } else if (playerproModel.ISPercentage == 1) { s = (float)Math.Round(value / 100f, 1) + "%"; } else if (playerproModel.ISPercentage == 2) { s = ((float)Math.Round(value / 100f, 1)).ToString(); } return s; } public Dictionary SetItemEffectDict(ItemConfig config) { Dictionary itemEffectDict = new Dictionary(); if (config == null) return itemEffectDict; try { if (config.Effect1 != 0) itemEffectDict.Add(config.Effect1, config.EffectValueA1); if (config.Effect2 != 0) itemEffectDict.Add(config.Effect2, config.EffectValueA2); if (config.Effect3 != 0) itemEffectDict.Add(config.Effect3, config.EffectValueA3); if (config.Effect4 != 0) itemEffectDict.Add(config.Effect4, config.EffectValueA4); if (config.Effect5 != 0) itemEffectDict.Add(config.Effect5, config.EffectValueA5); } catch (Exception ex) { DebugEx.Log(ex.ToString()); } return itemEffectDict; } #region 设置弹框位置 private RectTransform curTips = null; private RectTransform compareTips = null; public void SetCurTips(RectTransform rect) { curTips = rect; SetTipsPos(); } public void SetCompareTips(RectTransform rect) { compareTips = rect; SetTipsPos(); } public void SetTipsPos() { if (compareAttrData == null) { if (curTips != null) { curTips.anchoredPosition3D = new Vector3(curTips.rect.width / 2, curTips.rect.height / 2, 0); } } else { if (curTips != null && compareTips != null) { if (curTips.rect.height >= compareTips.rect.height) { curTips.anchoredPosition3D = new Vector3(curTips.rect.width, curTips.rect.height / 2, 0); compareTips.anchoredPosition3D = new Vector3(0, curTips.rect.height / 2, 0); } else { curTips.anchoredPosition3D = new Vector3(curTips.rect.width, compareTips.rect.height / 2, 0); compareTips.anchoredPosition3D = new Vector3(0, compareTips.rect.height / 2, 0); } } } } public void SetCommonTipPos(RectTransform rect) { float y = -750 / 2 + rect.sizeDelta.y / 2; rect.anchoredPosition3D = new Vector3(rect.anchoredPosition3D.x, y, 0); } #endregion #region 解锁背包格子数据 public int OpenCount { get; private set; } public PackType packType { get; private set; } public int Index { get; private set; } public void SetExtendGirdModel(int openCount = 0, int index = -1, PackType type = PackType.Deleted) { this.OpenCount = openCount; this.packType = type; this.Index = index; } #endregion #region 计算增加经验 public ulong GetAddExpValue(int timeValue, int maxExpLv) { PlayerLVConfig playerLVConfig = PlayerLVConfig.Get(PlayerDatas.Instance.baseData.LV); PlayerLVConfig maxLvConfig = PlayerLVConfig.Get(maxExpLv); int playerReExp = 0; int maxReExp = 0; if (playerLVConfig != null) { playerReExp = playerLVConfig.ReExp; } if (maxLvConfig != null) { maxReExp = maxLvConfig.ReExp; } else { if (maxExpLv <= 0) { maxReExp = playerReExp; } } Equation.Instance.Clear(); Equation.Instance.AddKeyValue("PlayerReExp", playerReExp); Equation.Instance.AddKeyValue("MaxReExp", maxReExp); Equation.Instance.AddKeyValue("TimeValue", timeValue); return Equation.Instance.Eval(expValueFormula); } #endregion #region 设置宠物和坐骑数据 public Dictionary GetPetSkillDict(int unlockId) { if (unlockPetDict.ContainsKey(unlockId)) { if (petSkillDict.ContainsKey(unlockPetDict[unlockId].ID)) { return petSkillDict[unlockPetDict[unlockId].ID]; } } return null; } public string GetQualityName(int quality) { string nameStr = string.Empty; petAndMountQualityDict.TryGetValue(quality, out nameStr); return nameStr; } public Dictionary> GetMountSkillDict(int unlockId) { if (unlockMountDict.ContainsKey(unlockId)) { if (mountSkillDict.ContainsKey(unlockMountDict[unlockId].HorseID)) { return mountSkillDict[unlockMountDict[unlockId].HorseID]; } } return null; } public void SetPetAttrStr(int attrId, int attrValue, out string attrName, out string attrValueStr, string contanctStr = "") { attrName = ""; attrValueStr = ""; PlayerPropertyConfig playerProModel = null; if (attrId == (int)AttrEnum.MaxAtk || attrId == (int)AttrEnum.PetMaxAtk) { playerProModel = PlayerPropertyConfig.Get((int)AttrEnum.ATK); } else { playerProModel = PlayerPropertyConfig.Get(attrId); } if (playerProModel != null) { attrName = playerProModel.Name; if (contanctStr == "") { attrValueStr = GetProValueTypeStr(playerProModel, attrValue); } else { attrValueStr = StringUtility.Contact(contanctStr, "-", GetProValueTypeStr(playerProModel, attrValue)); } } } #endregion #region 设置物品使用的限制条件 #endregion #region 物品增加战斗力 PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel(); } } public PlayerStrengthengDatas strengthengmodel { get { return ModelCenter.Instance.GetModel(); } } public bool TryGetFightPowerByItemId(int itemId, out int fightPower) { fightPower = 0; ItemConfig itemConfig = ItemConfig.Get(itemId); if (itemConfig == null) return false; var attrIdlist = PlayerPropertyConfig.GetKeys(); var fruitlist = AttrFruitConfig.GetKeys(); Dictionary attrDict = new Dictionary(); Dictionary itemEffectDict = SetItemEffectDict(itemConfig); int atk = 0; int hp = 0; int def = 0; foreach (var attrId in itemEffectDict.Keys) { var attrValue = itemEffectDict[attrId]; switch ((AttrEnum)attrId) { case AttrEnum.ATK: atk += attrValue; break; case AttrEnum.HP: hp += attrValue; break; case AttrEnum.DEF: def += attrValue; break; case AttrEnum.HorseAtkPer: float mountAtk = mountDatas.GetAllMountAttack(); atk += Mathf.RoundToInt(mountAtk * ((float)attrValue / 10000)); break; case AttrEnum.StoneBasePer: var stoneDict = GetStoneAttrDict(); foreach (var key in stoneDict.Keys) { var stoneValue = stoneDict[key]; switch ((AttrEnum)key) { case AttrEnum.ATK: atk += Mathf.RoundToInt(stoneValue * ((float)attrValue / 10000)); break; case AttrEnum.HP: hp += Mathf.RoundToInt(stoneValue * ((float)attrValue / 10000)); break; case AttrEnum.DEF: def += Mathf.RoundToInt(stoneValue * ((float)attrValue / 10000)); break; } } break; case AttrEnum.RealmBasePer: var realmDict = GetRealmAttrDict(); foreach (var key in realmDict.Keys) { var realmValue = realmDict[key]; switch ((AttrEnum)key) { case AttrEnum.ATK: atk += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000)); break; case AttrEnum.HP: hp += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000)); break; case AttrEnum.DEF: def += Mathf.RoundToInt(realmValue * ((float)attrValue / 10000)); break; } } break; case AttrEnum.PetSkillAtkRate: break; case AttrEnum.PlusBaseAtkPer: var strengthDict = GetStrengthAttrDict(); if (strengthDict.ContainsKey((int)AttrEnum.ATK)) { var strengthValue = strengthDict[(int)AttrEnum.ATK]; atk += Mathf.RoundToInt(strengthValue * ((float)attrValue / 10000)); } break; default: if (attrIdlist.Contains(attrId.ToString())) { attrDict.Add(attrId, attrValue); } break; } } if (atk > 0) { attrDict.Add((int)AttrEnum.ATK, atk); } if (def > 0) { attrDict.Add((int)AttrEnum.DEF, def); } if (hp > 0) { attrDict.Add((int)AttrEnum.HP, hp); } fightPower = UIHelper.GetFightPower(attrDict); if (fruitlist.Contains(itemId.ToString())) { var fruitConfig = AttrFruitConfig.Get(itemId); fightPower += fruitConfig.FightPowerEx; } return fightPower > 0; } private Dictionary GetStoneAttrDict() { Dictionary attrDict = new Dictionary(); var stoneDict = PlayerStoneData.Instance.GetAllStone(); foreach (var key in stoneDict.Keys) { var stoneIds = stoneDict[key]; var itemModel = playerPack.GetItemByIndex(PackType.Equip, key); if (itemModel != null && stoneIds != null) { for (int i = 0; i < stoneIds.Length; i++) { int stoneId = (int)stoneIds[i]; ItemConfig itemConfig = ItemConfig.Get(stoneId); if (itemConfig != null) { var itemEffectDict = SetItemEffectDict(itemConfig); foreach (var attrId in itemEffectDict.Keys) { var attrValue = itemEffectDict[attrId]; if (!attrDict.ContainsKey(attrId)) { attrDict.Add(attrId, attrValue); } else { attrDict[attrId] += attrValue; } } } } } } return attrDict; } private Dictionary GetRealmAttrDict() { Dictionary attrDict = new Dictionary(); int realmLv = PlayerDatas.Instance.baseData.realmLevel; var realmConfig = RealmConfig.Get(realmLv); if (realmConfig != null) { var attrIds = realmConfig.AddAttrType; var attrValues = realmConfig.AddAttrNum; if (attrIds != null && attrValues != null && attrIds.Length == attrValues.Length) { for (int i = 0; i < attrIds.Length; i++) { var attrId = attrIds[i]; var attrValue = attrValues[i]; if (attrValue > 0) { if (!attrDict.ContainsKey(attrId)) { attrDict.Add(attrId, attrValue); } else { attrDict[attrId] += attrValue; } } } } } return attrDict; } private Dictionary GetStrengthAttrDict() { Dictionary attrDict = new Dictionary(); var strengthDict = strengthengmodel._EqInfo; foreach (var index in strengthDict.Keys) { var itemModel = playerPack.GetItemByIndex(PackType.Equip, index); if (itemModel != null) { int lv = strengthengmodel.StrengthenTheCeiling(index); int type = strengthengmodel.GameDefineIndex(index); var itemPlus = ItemPlusConfig.GetItemPlusData(type, lv); if (itemPlus != null) { int[] attrIDs = itemPlus.attrIds; int[] attrValues = itemPlus.attrValues; for (int i = 0; i < attrIDs.Length; i++) { var attrId = attrIDs[i]; var attrValue = attrValues[i]; if (attrValue > 0) { if (!attrDict.ContainsKey(attrId)) { attrDict.Add(attrId, attrValue); } else { attrDict[attrId] += attrValue; } } } } } } return attrDict; } #endregion #region 绝版武器战力 public bool IsPeerlessEquip(int itemId) { if (PeerlessEquipIds == null) return false; return PeerlessEquipIds.Contains(itemId); } public int GetEquipFightPower(int equipScore) { var funcConfig = FuncConfigConfig.Get("FightpowerFormula"); Equation.Instance.Clear(); if (funcConfig != null) { Equation.Instance.AddKeyValue("equipScoreTotal", equipScore); return Equation.Instance.Eval(funcConfig.Numerical2); } return 0; } #endregion #region 共享开启次数 public string GetShareNumItemDes(int itemId) { string shareNumDes = string.Empty; List idlist = null; bool isShare = playerPack.TryGetShareNumItem(itemId, out idlist); if (isShare) { foreach (var id in idlist) { ItemConfig itemConfig = ItemConfig.Get(id); TextColType colType = itemConfig.ItemColor < 2 ? TextColType.White : (TextColType)itemConfig.ItemColor; string des = UIHelper.AppendStringColor(colType, itemConfig.ItemName); if (shareNumDes.Length > 0) { shareNumDes = StringUtility.Contact(shareNumDes, "", des); } else { shareNumDes = des; } } } return shareNumDes; } #endregion #region 判断是否展示模型 public Dictionary showModelAttrDict = new Dictionary(); public bool IsShowModel(int itemId, ModelShowPerfab showPerfab) { var config = ItemConfig.Get(itemId); if (config == null) return false; int fightPower = 0; switch (config.Type) { case 125: PetInfoConfig petInfo = unlockPetDict[config.EffectValueA1]; fightPower = petInfo.ShowFightPower; showPerfab.SetModelShow(petInfo.ID, ModelShowType.pet, Language.Get("TreasureEffect103"), fightPower); return true; case 124: HorseConfig horseConfig = unlockMountDict[config.EffectValueA1]; fightPower = horseConfig.ShowFightPower; showPerfab.SetModelShow(horseConfig.Model, ModelShowType.mount, Language.Get("TreasureEffect103"), fightPower); return true; } bool isFashion = TryGetFashionFightPower(config, out fightPower); if (isFashion) { showPerfab.SetModelShow(itemId, ModelShowType.FashionDress, Language.Get("TreasureEffect103"), fightPower); return true; } bool isMagic = TryGetMagicFightPower(config, out fightPower); if (isMagic) { showPerfab.SetModelShow(itemId, ModelShowType.Magic, Language.Get("TreasureEffect103"), fightPower); return true; } return false; } private bool TryGetFashionFightPower(ItemConfig itemConfig, out int fightPower) { showModelAttrDict.Clear(); fightPower = 0; if (itemConfig == null) return false; int fashionType = 0; int fashionId = 0; bool isFashion = TryGetItemFashionData(itemConfig.ID, out fashionType, out fashionId); if (isFashion) { List fashionIds = null; fashionDress.TryGetFashionIds(fashionType, out fashionIds); if (fashionId == 0) { if (fashionIds != null) { foreach (var id in fashionIds) { Dictionary dict = null; fashionDress.TryGetFashionDressProperty(id, 1, out dict); if (dict != null) { foreach (var attrId in dict.Keys) { var attrValue = dict[attrId]; if (!showModelAttrDict.ContainsKey(attrId)) { showModelAttrDict.Add(attrId, attrValue); } else { showModelAttrDict[attrId] += attrValue; } } } } } } else { Dictionary dict = null; fashionDress.TryGetFashionDressProperty(fashionId, 1, out dict); if (dict != null) { foreach (var attrId in dict.Keys) { var attrValue = dict[attrId]; if (!showModelAttrDict.ContainsKey(attrId)) { showModelAttrDict.Add(attrId, attrValue); } else { showModelAttrDict[attrId] += attrValue; } } } } fightPower = UIHelper.GetFightPower(showModelAttrDict); return true; } return false; } public bool TryGetItemFashionData(int itemId, out int fashionType, out int fashionId) { fashionType = 0; fashionId = 0; Dictionary> effectDict = null; GetItemEffectDict(itemId, out effectDict); foreach (var key in effectDict.Keys) { var valueList = effectDict[key]; if (key == 244) { fashionType = valueList[0]; fashionId = valueList[1]; return true; } } return false; } public bool TryGetMagicFightPower(ItemConfig itemConfig, out int fightPower) { fightPower = 0; var model = ModelCenter.Instance.GetModel(); int magicType = 0; bool isMagic = model.TryGetMagicType(itemConfig.ID, out magicType); if (!isMagic) return false; List stages = null; var requirePreview = model.TryGetGodWeaponStages(magicType, out stages); if (!requirePreview) return false; var magicConfigs = GodWeaponConfig.GetConfigs(magicType); int magicEffectStage = model.GetGodWeaponStage(magicType) + 1; magicEffectStage = magicEffectStage > 3 ? 3 : magicEffectStage; int magicEffectLevel = model.GetGodWeaponStageRequireLevel(magicType, magicEffectStage); var magicInfo = model.GetGodWeaponInfo(magicType); int magicLevel = magicEffectLevel; int magicEffectPower = model.GetEffectRealFightPower(magicType, magicEffectStage); if (magicConfigs != null && magicInfo != null && magicEffectStage == 3) { int maxLevel = magicConfigs[magicConfigs.Count - 1].Lv; if (magicInfo.level >= magicEffectLevel) { magicLevel = maxLevel; } } int attrFightPower = 0; var magicConfig = GodWeaponConfig.GetConfig(magicType, magicLevel); var attrDict = new Dictionary(); if (magicConfig != null) { int[] attrIds = magicConfig.AttrType; int[] attrValues = magicConfig.AttrNum; for (int i = 0; i < attrIds.Length; i++) { int attrId = attrIds[i]; int attrValue = attrValues[i]; attrDict.Add(attrId, attrValue); } } attrFightPower = UIHelper.GetFightPower(attrDict); fightPower = attrFightPower + magicEffectPower; return true; } private void GetItemEffectDict(int itemId, out Dictionary> dict) { var config = ItemConfig.Get(itemId); dict = new Dictionary>(); if (config == null) return; if (config.Effect1 != 0) { List valuelist = new List(); valuelist.Add(config.EffectValueA1); valuelist.Add(config.EffectValueB1); valuelist.Add(config.EffectValueC1); dict.Add(config.Effect1, valuelist); } if (config.Effect2 != 0) { List valuelist = new List(); valuelist.Add(config.EffectValueA2); valuelist.Add(config.EffectValueB2); valuelist.Add(config.EffectValueC2); dict.Add(config.Effect2, valuelist); } if (config.Effect3 != 0) { List valuelist = new List(); valuelist.Add(config.EffectValueA3); valuelist.Add(config.EffectValueB3); valuelist.Add(config.EffectValueC3); dict.Add(config.Effect3, valuelist); } if (config.Effect4 != 0) { List valuelist = new List(); valuelist.Add(config.EffectValueA4); valuelist.Add(config.EffectValueB4); valuelist.Add(config.EffectValueC4); dict.Add(config.Effect4, valuelist); } if (config.Effect5 != 0) { List valuelist = new List(); valuelist.Add(config.EffectValueA5); valuelist.Add(config.EffectValueB5); valuelist.Add(config.EffectValueC5); dict.Add(config.Effect5, valuelist); } } #endregion } public class ItemAttrData { public PackType packType { get; private set; } public string guid { get; private set; } public int itemId { get; private set; } public int index { get; private set; } public ulong count { get; private set; } public int isBind { get; private set; } public int unionWarehouseScore { get; private set; } public uint[] stones { get; private set; } //可镶嵌宝石数组 长度为0 未镶嵌 数值为0 未镶嵌 public int score { get; private set; } public bool isCompare { get; private set; } //是否进行装备比较 public bool isPreview { get; private set; }//是否预览 public ItemConfig itemConfig { get; private set; } public bool isCustom { get; private set; } //是否是定制物品 public int level { get; private set; }//等级 public int equipHole { get; private set; }//聚魂孔 public ItemTipChildType ChildType { get; private set; } //决定当前面板打开哪个 public Dictionary> useDataDict { get; private set; } public Dictionary strengthDataDict { get; private set; } public Dictionary washDataDict { get; private set; } public Dictionary legendDataDict { get; private set; } public Dictionary exhaustedMaxDataDict { get; private set; } public Dictionary wingsRefineMatDict { get; private set; } public Dictionary> tipsFuncBtnDic { get; private set; } public Dictionary suitAttrDataDict { get; private set; } public Dictionary suitTypeCntDict { get; private set; } public bool isHavePutLimit { get; private set; } PlayerStrengthengDatas strengthengmodel { get { return ModelCenter.Instance.GetModel(); } } EquipWashModel washModel { get { return ModelCenter.Instance.GetModel(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel(); } } PlayerSuitModel SuitModel { get { return ModelCenter.Instance.GetModel(); } } RuneModel runeModel { get { return ModelCenter.Instance.GetModel(); } } GodBeastModel beastModel { get { return ModelCenter.Instance.GetModel(); } } public ItemAttrData(int id, bool isPreview = false, ulong count = 0, int index = -1, int isBind = 0, bool isCompare = false, PackType type = PackType.Deleted, string guid = "", Dictionary> useDataDict = null, ItemTipChildType childType = ItemTipChildType.Normal) { this.packType = type; this.itemConfig = ItemConfig.Get(id); this.tipsFuncBtnDic = new Dictionary>(); this.guid = guid; this.itemId = id; this.count = count; this.index = index; this.isBind = isBind; this.isPreview = isPreview; this.isCompare = isCompare; this.useDataDict = useDataDict; this.StrengthLV = 0; this.ChildType = childType; this.isCustom = false; this.extraInfos = null; isHavePutLimit = true; this.level = 1; this.equipHole = -1; this.isCustom = CheckIsCustomItem(); if (isCustom) { AppointItemConfig appointItemConfig = AppointItemConfig.Get(itemId); if (appointItemConfig != null) { if (appointItemConfig.CancelUseLimit == 1) { isHavePutLimit = false; } SetCustomAttrData(appointItemConfig); } this.itemId = itemConfig.EffectValueA1; this.itemConfig = ItemConfig.Get(this.itemId); } else { if (isPreview) { List legendIdlist = null; List legendValuelist = null; switch (itemConfig.EquipPlace) { case 11: SetWingsLegendAttrPreview(out legendIdlist, out legendValuelist); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: SetEquipLegendAttrPreview(out legendIdlist, out legendValuelist); break; case 101: case 102: case 103: case 104: case 105: SetDogzEquipLegendAttrPreview(out legendIdlist, out legendValuelist); break; } var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type); switch (packType) { case PackType.JadeDynastyItem: SetJadeDynastyEquipLegendAttrPreview(out legendIdlist, out legendValuelist); break; } if (legendIdlist != null && legendValuelist != null) { if (legendIdlist.Count == legendValuelist.Count) { SetLegendData(legendIdlist, legendValuelist); } } } else { if (GetUseDataModel(20) != null) { if (GetUseDataModel(20)[0] == 1) { isHavePutLimit = false; } } if (type == PackType.Equip) { Dictionary p_strengInfoDict = strengthengmodel._EqInfo; if (p_strengInfoDict.ContainsKey(index)) { SetStrengthData(strengthengmodel.StrengthenTheCeiling(index), strengthengmodel.GameDefineIndex(index)); } WashProCount washPro = washModel.GetWashEquipInfo(index); if (washPro != null) { SetWashModel(washModel.OnGetWashType(index), washPro.XLAttrLV, washModel.WashProValues(index)); } SetSuitData(itemId, index); } switch (type) { case PackType.Equip: SetGemModel(PlayerStoneData.Instance.GetStoneInfo(index)); break; case PackType.JadeDynastyEquip: JadeDynastyGemModel.GemEquipData equipData; var model = ModelCenter.Instance.GetModel(); var existGem = model.TryGetEquipGems(index + 121, out equipData); SetGemModel(existGem ? equipData.items : null); break; } SetLegendData(GetUseDataModel(17), GetUseDataModel(19)); SetExhaustedData(GetUseDataModel(21), GetUseDataModel(23)); SetWingsRefineMat(GetUseDataModel((int)ItemUseDataKey.wingMaterialItemID), GetUseDataModel((int)ItemUseDataKey.wingMaterialItemCount)); } } this.score = ItemLogicUtility.Instance.GetEquipScore(type, id, useDataDict, isPreview); PetEatEquipConfig petEatConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(itemConfig.ItemColor, itemConfig.LV);//仙盟仓库装备积分兑换表 this.unionWarehouseScore = 0; if (petEatConfig != null) { this.unionWarehouseScore = petEatConfig.integrate; } if (itemTipsModel.randomRuneIds.Contains(this.itemId)) { Dictionary> unlockRuneDict = runeModel.GetAllUnlockRuneIdlist(); List extraInfos = new List(); if (unlockRuneDict != null) { foreach (var key in unlockRuneDict.Keys) { int runeId = unlockRuneDict[key][0]; ItemConfig runeConfig = ItemConfig.Get(runeId); string effectDes = StringUtility.Contact(UIHelper.AppendStringColor(TextColType.Green, runeConfig.ItemName), ":", Language.Get(StringUtility.Contact("RuneTypeDesc_", runeConfig.Effect1))); extraInfos.Add(effectDes); } } SetExtraInfos(extraInfos.ToArray()); } if (type == PackType.DogzEquip || type == PackType.DogzItem) { strengthDataDict = new Dictionary(); if (GetUseDataModel((int)ItemUseDataKey.dogzEquipPlus) != null) { StrengthLV = GetUseDataModel((int)ItemUseDataKey.dogzEquipPlus)[0]; } Dictionary getStregthDict = beastModel.SiteEnhancementAttribute(type, index); foreach (var key in getStregthDict.Keys) { strengthDataDict.Add(key, getStregthDict[key]); } } SetWinType(); } public string[] extraInfos { get; private set; } public void SetExtraInfos(params string[] extraInfos) { this.extraInfos = extraInfos; } private void SetWingsLegendAttrPreview(out List ids, out List values) { ids = new List(); values = new List(); var level = itemConfig.LV; var count = LegendPropertyUtility.GetWingPropertyCount(level); var properties = LegendPropertyUtility.GetWingProperties(level); if (properties != null) { for (var i = 0; ids.Count < count && i < properties.Count; i++) { var propertyId = properties[i]; ids.Add(propertyId); values.Add(LegendPropertyUtility.GetWingPropertyValues(level, propertyId)[0]); } } } private void SetEquipLegendAttrPreview(out List ids, out List values) { ids = new List(); values = new List(); var equipPlace = itemConfig.EquipPlace; if (LegendPropertyUtility.HasEquipPlace(equipPlace)) { ids.AddRange(LegendPropertyUtility.GetEquipPlaceProperties(equipPlace)); } for (var i = ids.Count - 1; i >= 0; i--) { var propertyId = ids[i]; if (LegendPropertyUtility.GetEquipPropertyType(propertyId) == LegendAttrType.Normal) { ids.RemoveAt(i); } } for (var i = 0; i < ids.Count; i++) { var propertyId = ids[i]; var qualityPropertyValue = LegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, itemConfig.ItemColor); if (qualityPropertyValue != 0) { values.Add(qualityPropertyValue); } else { var levelPropertyValue = LegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, itemConfig.LV); if (levelPropertyValue != 0) { values.Add(levelPropertyValue); } } } } private void SetDogzEquipLegendAttrPreview(out List legendIdlist, out List legendValuelist) { legendIdlist = new List(); legendValuelist = new List(); var place = itemConfig.EquipPlace; if (LegendPropertyUtility.HasDogzPlace(place)) { var ids = LegendPropertyUtility.GetDogzPlaceProperties(place); for (var i = ids.Count - 1; i >= 0; i--) { if (LegendPropertyUtility.GetDogzPropertyType(ids[i]) == LegendAttrType.Normal) { ids.RemoveAt(i); } } legendIdlist.AddRange(ids); } for (var i = 0; i < legendIdlist.Count; i++) { var propertyId = legendIdlist[i]; var value = LegendPropertyUtility.GetDogzQualityPropertyValue(propertyId, itemConfig.ItemColor); legendValuelist.Add(value); } } private void SetJadeDynastyEquipLegendAttrPreview(out List legendIdlist, out List legendValuelist) { Dictionary attrDict = null; itemTipsModel.TryGetJadeDynastyLegendAttr(itemId, out attrDict); legendIdlist = attrDict.Keys.ToList(); legendValuelist = attrDict.Values.ToList(); } private StringBuilder _extraInfoBuider = new StringBuilder(); private StringBuilder _allInfoDesBuider = new StringBuilder(); public string GetExtraInfos() { _extraInfoBuider.Length = 0; if (extraInfos == null) return ""; int i = 0; for (i = 0; i < extraInfos.Length; i++) { _extraInfoBuider.Append(extraInfos[i] + "\n"); } return _extraInfoBuider.ToString(); } public string GetAllInfoDes() { _allInfoDesBuider.Length = 0; if (itemConfig == null) return ""; if (itemTipsModel.randomRuneIds.Contains(itemConfig.ID)) { return itemConfig.Description.Replace("{Rune}", GetExtraInfos()); } else { _allInfoDesBuider.Append(itemConfig.Description + "\n"); _allInfoDesBuider.Append(GetExtraInfos()); } return _allInfoDesBuider.ToString(); } /// /// 设置强化数据 /// private ItemPlusConfig.ItemPlusData itemPlus; public int StrengthLV { get; private set; } public void SetStrengthData(int lv, int type) { this.StrengthLV = lv; strengthDataDict = null; if (lv <= 0) return; strengthDataDict = new Dictionary(); itemPlus = ItemPlusConfig.GetItemPlusData(type, lv); if (itemPlus != null) { int[] attrIDs = itemPlus.attrIds; int[] attrValues = itemPlus.attrValues; int i = 0; for (i = 0; i < attrIDs.Length; i++) { strengthDataDict.Add(attrIDs[i], attrValues[i]); } } } /// /// 设置传奇属性数据 /// /// /// private void SetLegendData(List ids, List values) { legendDataDict = null; if (ids == null || ids.Count < 1) return; legendDataDict = new Dictionary(); int i = 0; for (i = 0; i < ids.Count; i++) { legendDataDict.Add(ids[i], values[i]); } } private void SetWingsRefineMat(List ids, List nums) { wingsRefineMatDict = null; if (ids == null || ids.Count < 1) return; wingsRefineMatDict = new Dictionary(); for (int i = 0; i < ids.Count; i++) { wingsRefineMatDict.Add(ids[i], nums[i]); } } /// /// 设置绝版属性数据 /// /// /// private void SetExhaustedData(List ids, List values) { exhaustedMaxDataDict = null; if (ids == null || ids.Count < 1) return; exhaustedMaxDataDict = new Dictionary(); int i = 0; for (i = 0; i < ids.Count; i++) { exhaustedMaxDataDict.Add(ids[i], values[i]); } } /// /// 设置弹框的洗练数据 /// /// /// /// private EquipWashConfig.EquipWashData tagWashModel; public void SetWashModel(int type, int lv, int[] values) { washDataDict = null; bool isWash = false; int i = 0; for (i = 0; i < values.Length; i++) { if (values[i] > 0) { isWash = true; break; } } if (!isWash) { return; } washDataDict = new Dictionary(); this.tagWashModel = EquipWashConfig.GetEquipWashData(type, lv); if (this.tagWashModel != null) { for (i = 0; i < values.Length; i++) { switch (i) { case 0: washDataDict.Add(tagWashModel.washConfig.attType1, values[0]); break; case 1: washDataDict.Add(tagWashModel.washConfig.attType2, values[1]); break; case 2: washDataDict.Add(tagWashModel.washConfig.attType3, values[2]); break; } } } } //设置弹框的宝石数据 public void SetGemModel(params uint[] stones) { this.stones = stones; } /// /// 设置套装数据 /// /// public void SetSuitData(int itemId, int equipPlace) { suitAttrDataDict = null; suitTypeCntDict = null; Dictionary suitTypeDict = SuitModel.GetServerSuitModelByPlace(index); if (suitTypeDict == null) return; suitAttrDataDict = new Dictionary(); suitTypeCntDict = new Dictionary(); int groupType = SuitModel.GetGroupType(index); int equipJob = SuitModel.GetEquipJob(itemId); foreach (var type in suitTypeDict.Keys) { bool isMaker = SuitModel.IsMakerSuit((SuitType)type, itemConfig.ItemColor, itemConfig.StarLevel); if (suitTypeDict[type] > 0 && isMaker) { List placelist = null; int suitCnt = 0; ItemSuitAttrData suitAttrData = default(ItemSuitAttrData); if (this.itemConfig.LV < suitTypeDict[type]) { suitAttrData = new ItemSuitAttrData(groupType, type, this.itemConfig.LV, equipJob); suitCnt = SuitModel.GetSameSuitCnt((SuitType)type, equipPlace, this.itemConfig.LV, out placelist, equipJob); } else { suitAttrData = new ItemSuitAttrData(groupType, type, suitTypeDict[type], equipJob); suitCnt = SuitModel.GetSameSuitCnt((SuitType)type, equipPlace, suitTypeDict[type], out placelist, equipJob); } suitAttrDataDict.Add((SuitType)type, suitAttrData); suitTypeCntDict.Add((SuitType)type, suitCnt); } } } //设置其他玩家的套装数据 public void SetOtherSuitData(int itemId, int equipPlace, Dictionary suitTypeDict, Dictionary suitCntDict) { this.suitAttrDataDict = null; this.suitTypeCntDict = null; if (suitTypeDict == null || suitCntDict == null) return; suitAttrDataDict = new Dictionary(); suitTypeCntDict = new Dictionary(); int groupType = SuitModel.GetGroupType(equipPlace); int equipJob = SuitModel.GetEquipJob(itemId); ItemConfig curConfig = ItemConfig.Get(itemId); foreach (var type in suitTypeDict.Keys) { bool isMaker = SuitModel.IsMakerSuit((SuitType)type, curConfig.ItemColor, curConfig.StarLevel); if (suitTypeDict[type] > 0 && isMaker) { List placelist = null; int suitCnt = 0; ItemSuitAttrData suitAttrData = default(ItemSuitAttrData); if (curConfig.LV < suitTypeDict[type]) { suitAttrData = new ItemSuitAttrData(groupType, type, curConfig.LV, equipJob); suitCnt = SuitModel.GetSameSuitCnt((SuitType)type, equipPlace, curConfig.LV, out placelist, equipJob); } else { suitAttrData = new ItemSuitAttrData(groupType, type, suitTypeDict[type], equipJob); suitCnt = SuitModel.GetSameSuitCnt((SuitType)type, equipPlace, suitTypeDict[type], out placelist, equipJob); } suitAttrDataDict.Add((SuitType)type, suitAttrData); this.suitTypeCntDict = suitCntDict; } } } public int GetSuitCntByType(SuitType suitType) { int cnt = 0; if (this.suitTypeCntDict != null) { this.suitTypeCntDict.TryGetValue(suitType, out cnt); } return cnt; } public bool TryGetItemRemainTime(out double remainTime) { ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(guid); if (cool != null) { remainTime = cool.GetRemainTime(); return true; } else { remainTime = itemConfig.ExpireTime; var getTimes = GetUseDataModel((int)ItemUseDataKey.createTime); var serverSurplusTimes = GetUseDataModel((int)ItemUseDataKey.totalTime); if (remainTime > 0) { if (getTimes != null) { int getTime = getTimes[0]; int serverSurplusTime = serverSurplusTimes != null ? serverSurplusTimes[0] : 0; if (getTime > 0) { double time = ItemLogicUtility.Instance.GetTimeOffest(TimeUtility.GetTime((uint)getTime)); time = time > 0 ? time : 0; remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time; } } return true; } } return false; } #region 预览定制属性逻辑处理 public bool CheckIsCustomItem() { if (itemConfig == null) return false; if (itemConfig.Effect1 == 220) { return true; } return false; } /// /// 设置定制属性的数据 /// private void SetCustomAttrData(AppointItemConfig appointItemConfig) { if (appointItemConfig == null) return; List legendIdlist = null; List legendValuelist = null; List exhaustedIdlist = null; List exhaustedValuelist = null; int i = 0; if (appointItemConfig.LegendAttrID.Length > 0) { legendIdlist = new List(); legendValuelist = new List(); for (i = 0; i < appointItemConfig.LegendAttrID.Length; i++) { if (appointItemConfig.LegendAttrID[i] != 0) { legendIdlist.Add(appointItemConfig.LegendAttrID[i]); legendValuelist.Add(appointItemConfig.LegendAttrValue[i]); } } } if (appointItemConfig.OutOfPrintAttr.Length > 0) { exhaustedIdlist = new List(); exhaustedValuelist = new List(); for (i = 0; i < appointItemConfig.OutOfPrintAttr.Length; i++) { if (appointItemConfig.OutOfPrintAttr[i] != 0) { exhaustedIdlist.Add(appointItemConfig.OutOfPrintAttr[i]); exhaustedValuelist.Add(appointItemConfig.OutOfPrintAttrValue[i]); } } } SetLegendData(legendIdlist, legendValuelist); SetExhaustedData(exhaustedIdlist, exhaustedValuelist); //SetSuitData(appointItemConfig.SuiteLv); } #endregion public List GetUseDataModel(int key) { List list = null; if (useDataDict != null) { useDataDict.TryGetValue(key, out list); } return list; } /// /// 设置弹框功能按钮 /// /// /// public void SetTipsFuncBtn(ItemOperateType type, Action func) { tipsFuncBtnDic.Add(type, func); } public void SetGatherSoul(int level, int equipHole, PackType packType = PackType.Deleted, int index = -1) { this.level = level; this.equipHole = equipHole; this.packType = packType; this.index = index; } /// /// 设置该物品的弹框类型 /// public ItemWinType winType { get; private set; } public void SetWinType() { if (this.itemConfig == null) return; switch (this.itemConfig.Template.Trim()) { case "ItemInfoPanel": switch (ChildType) { case ItemTipChildType.Normal: winType = ItemWinType.itemWin; break; case ItemTipChildType.Buy: winType = ItemWinType.buyItemWin; break; } break; case "BoxInfoWin": switch (ChildType) { case ItemTipChildType.Normal: winType = ItemWinType.boxWin; break; case ItemTipChildType.Buy: winType = ItemWinType.buyBoxWin; break; } break; case "PetMatInfoWin": switch (ChildType) { case ItemTipChildType.Normal: winType = ItemWinType.petMatWin; break; case ItemTipChildType.Buy: winType = ItemWinType.buyPetMatWin; break; } break; case "EquipPanel": winType = ItemWinType.equipWin; break; case "WingsPanel": winType = ItemWinType.wingsWin; break; case "GuardPanel": winType = ItemWinType.guardWin; break; case "GatherSoul": winType = ItemWinType.gatherSoul; break; case "KingTreasureShow": winType = ItemWinType.kingTreasure; break; default: DebugEx.Log("没有此物品的弹框类型" + this.itemConfig.Template.Trim()); break; } } } public struct ItemSuitAttrData { public EquipSuitAttrConfig suitAttrConfig { get; private set; } public int[] firstSuitAttrs { get; private set; } public int[] firstSuitAttrValues { get; private set; } public int[] secondSuitAttrs { get; private set; } public int[] secondSuitAttrValues { get; private set; } public int[] thirdSuitAttrs { get; private set; } public int[] thirdSuitAttrValues { get; private set; } public ItemSuitAttrData(int groupType, int suitType, int suitLv, int equipJob) { var suitAttrData = EquipSuitAttrConfig.GetSuitAttrData(groupType, suitType, suitLv, equipJob); if (suitAttrData != null) { this.suitAttrConfig = suitAttrData.attrConfig; this.firstSuitAttrs = suitAttrData.attr1Ids; this.firstSuitAttrValues = suitAttrData.attr1Values; this.secondSuitAttrs = suitAttrData.attr2Ids; this.secondSuitAttrValues = suitAttrData.attr2Values; this.thirdSuitAttrs = suitAttrData.attr3Ids; this.thirdSuitAttrValues = suitAttrData.attr3Values; } else { this.suitAttrConfig = null; this.firstSuitAttrs = null; this.firstSuitAttrValues = null; this.secondSuitAttrs = null; this.secondSuitAttrValues = null; this.thirdSuitAttrs = null; this.thirdSuitAttrValues = null; } } } }