Core/GameEngine/Login/LaunchPostProcess.cs
@@ -29,6 +29,7 @@ try { InGameDownLoad.Instance.ParseRewardConfig(); ItemLogicUtility.Instance.Init(); ModelCenter.Instance.Init(); SkillHelper.Instance.Init(); StatusMgr.Instance.Init(); Lua/Gen/DelegatesGensBridge.cs
@@ -4422,7 +4422,7 @@ #endif } public Snxxz.UI.PackModelInterface __Gen_Delegate_Imp191(object p0) public Snxxz.UI.ItemLogicUtility __Gen_Delegate_Imp191(object p0) { #if THREAD_SAFE || HOTFIX_ENABLE lock (luaEnv.luaEnvLock) @@ -4436,7 +4436,7 @@ PCall(L, 1, 1, errFunc); Snxxz.UI.PackModelInterface __gen_ret = (Snxxz.UI.PackModelInterface)translator.GetObject(L, errFunc + 1, typeof(Snxxz.UI.PackModelInterface)); Snxxz.UI.ItemLogicUtility __gen_ret = (Snxxz.UI.ItemLogicUtility)translator.GetObject(L, errFunc + 1, typeof(Snxxz.UI.ItemLogicUtility)); LuaAPI.lua_settop(L, errFunc - 1); return __gen_ret; #if THREAD_SAFE || HOTFIX_ENABLE System/Achievement/AchievementModel.cs
@@ -17,7 +17,6 @@ Dictionary<int, Achievement> achievements = new Dictionary<int, Achievement>(); Dictionary<int, List<int>> achievementCategorys = new Dictionary<int, List<int>>(); PackModelInterface packModelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PlayerTaskDatas taskmodel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } } GetItemPathModel getItemPathModel { get { return ModelCenter.Instance.GetModel<GetItemPathModel>(); } } @@ -528,7 +527,7 @@ { if (_places.Contains(item.config.EquipPlace)) { if (!packModelInterface.IsOverdue(item.guid, item.itemId) if (!ItemLogicUtility.Instance.IsOverdue(item.guid, item.itemId) && (item.config.JobLimit == 0 || (item.config.JobLimit / 100) == job) && item.equipScore > score) { guid = item.guid; @@ -551,7 +550,7 @@ var equipPackage = playerPack.GetSinglePack(PackType.Equip); foreach (var item in allItems.Values) { var overdue = packModelInterface.IsOverdue(item.guid, item.itemId, item.useDataDict); var overdue = ItemLogicUtility.Instance.IsOverdue(item.guid, item.itemId, item.useDataDict); if (!overdue && _places.Contains(item.config.EquipPlace) && (item.config.JobLimit == 0 || (item.config.JobLimit / 100) == job)) { @@ -587,7 +586,7 @@ var equipedItem = equipPackage.GetItemByIndex(item.config.EquipPlace); var equipdItemScore = equipedItem == null ? 0 : equipedItem.equipScore; var overdue = packModelInterface.IsOverdue(item.guid, item.itemId, item.useDataDict); var overdue = ItemLogicUtility.Instance.IsOverdue(item.guid, item.itemId, item.useDataDict); if (!overdue && (item.config.JobLimit == 0 || (item.config.JobLimit / 100) == job) && item.equipScore > equipdItemScore && item.equipScore > score) { System/BetterItemGet/BetterEquipGetModel.cs
@@ -14,7 +14,6 @@ public class BetterEquipGetModel : Model, IBeforePlayerDataInitialize, ISwitchAccount { PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } public string currentEquipGuid { get; private set; } @@ -25,7 +24,7 @@ public override void Init() { modelInterface.GetBetterEquipEvent += OnGetBetterEquip; ItemLogicUtility.Instance.GetBetterEquipEvent += OnGetBetterEquip; playerPack.refrechPackEvent += OnPackageRefresh; playerPack.refreshItemCountEvent += OnPackageItemRefresh; KnapsackTimeCDMgr.Instance.RefresCoolTimeAct += UpdateCoolTime; @@ -34,7 +33,7 @@ public override void UnInit() { modelInterface.GetBetterEquipEvent -= OnGetBetterEquip; ItemLogicUtility.Instance.GetBetterEquipEvent -= OnGetBetterEquip; playerPack.refrechPackEvent -= OnPackageRefresh; playerPack.refreshItemCountEvent -= OnPackageItemRefresh; KnapsackTimeCDMgr.Instance.RefresCoolTimeAct -= UpdateCoolTime; System/BetterItemGet/BetterEquipGetModel.cs.orig
New file @@ -0,0 +1,374 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Saturday, January 20, 2018 //-------------------------------------------------------- using UnityEngine; using System.Collections; using System.Collections.Generic; using System; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class BetterEquipGetModel : Model, IBeforePlayerDataInitialize, ISwitchAccount { PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } public string currentEquipGuid { get; private set; } Dictionary<string, ItemModel> betterEquipModels = new Dictionary<string, ItemModel>(); public event Action showEquipRefreshEvent; public override void Init() { <<<<<<< origin/ItemReconstruction modelInterface.GetBetterEquipEvent += OnGetBetterEquip; playerPack.refrechPackEvent += OnPackageRefresh; playerPack.refreshItemCountEvent += OnPackageItemRefresh; ======= ItemLogicUtility.Instance.GetBetterEquipEvent += OnGetBetterEquip; playerPack.RefreshPackAct += OnPackageRefresh; playerPack.RefreshItemCountAct += OnPackageItemRefresh; >>>>>>> local KnapsackTimeCDMgr.Instance.RefresCoolTimeAct += UpdateCoolTime; ParseConfig(); } public override void UnInit() { <<<<<<< origin/ItemReconstruction modelInterface.GetBetterEquipEvent -= OnGetBetterEquip; playerPack.refrechPackEvent -= OnPackageRefresh; playerPack.refreshItemCountEvent -= OnPackageItemRefresh; ======= ItemLogicUtility.Instance.GetBetterEquipEvent -= OnGetBetterEquip; playerPack.RefreshPackAct -= OnPackageRefresh; playerPack.RefreshItemCountAct -= OnPackageItemRefresh; >>>>>>> local KnapsackTimeCDMgr.Instance.RefresCoolTimeAct -= UpdateCoolTime; } public void OnBeforePlayerDataInitialize() { } public void OnSwitchAccount() { currentEquipGuid = string.Empty; } #region 解析本地表 public int autoEquipLvLimit { get; private set; } public int autoEquipCoolTime { get; private set; } public void ParseConfig() { FuncConfigConfig equipAutoEquip = FuncConfigConfig.Get("EquipAutoEquip"); autoEquipLvLimit = int.Parse(equipAutoEquip.Numerical1); autoEquipCoolTime = int.Parse(equipAutoEquip.Numerical2); } #endregion private void UpdateCoolTime(string guid) { ItemModel _equip = null; if (TryGetBetterEquip(guid,out _equip)) { var coolData = KnapsackTimeCDMgr.Instance.GetItemCoolById(guid); bool isCoolEnd = coolData == null || coolData.GetRemainTime() <= 0 ? true : false; if(isCoolEnd) { DebugEx.Log("UpdateCoolTime:" + _equip.itemId); ItemOperateUtility.Instance.PutOnItem(ItemOperateType.putOn,guid); ReportConfirmBetterEquip(guid); } } } public bool TryGetBetterEquip(string _guid, out ItemModel _equip) { return betterEquipModels.TryGetValue(_guid, out _equip); } public void ReportConfirmBetterEquip(string _guid) { betterEquipModels.Remove(_guid); var tempGuid = GetOneEquip(); if (tempGuid != currentEquipGuid) { currentEquipGuid = tempGuid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } } } public int GetShowItemQuality() { if (string.IsNullOrEmpty(currentEquipGuid)) { return 0; } else { ItemModel item; if (TryGetBetterEquip(currentEquipGuid, out item)) { return item.config.ItemColor; } else { return 0; } } } public int GetShowEquipPlace() { if (string.IsNullOrEmpty(currentEquipGuid)) { return 0; } else { ItemModel item; if (TryGetBetterEquip(currentEquipGuid, out item)) { return item.config.EquipPlace; } else { return 0; } } } private void OnGetBetterEquip(string guid) { var betterModel = playerPack.GetItemByGuid(guid); ItemModel oldBetterEquip = null; if (TryGetEquipByPlace(betterModel.config.EquipPlace, out oldBetterEquip)) { var oldGrade = oldBetterEquip != null ? oldBetterEquip.equipScore : 0; if (betterModel.equipScore >= oldGrade) { RemoveItemByEquipPlace(betterModel.config.EquipPlace); } } betterEquipModels[guid] = betterModel; if (guid != currentEquipGuid) { if (!string.IsNullOrEmpty(guid)) { var sourcelist = betterModel.GetUseDataModel((int)ItemUseDataKey.source); if (sourcelist != null && sourcelist[0] == 4) { SnxxzGame.Instance.StartCoroutine(Co_DelayRefreshBetterEquip(guid)); } else { currentEquipGuid = guid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } } } else { currentEquipGuid = guid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } } } } public bool CheckIsAutoEquip(ItemModel itemModel) { if (itemModel == null || itemModel.config.EquipPlace > 12 || itemModel.config.EquipPlace == (int)RoleEquipType.Wing || itemModel.config.EquipPlace == (int)RoleEquipType.SpiritAnimal) return false; int playerLv = PlayerDatas.Instance.baseData.LV; if (playerLv > autoEquipLvLimit) return false; if (itemModel.config.ItemColor < 3) { return true; } return false; } IEnumerator Co_DelayRefreshBetterEquip(string _guid) { yield return WaitingForSecondConst.WaitMS2000; currentEquipGuid = _guid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } var betterModel = playerPack.GetItemByGuid(_guid); } private void OnPackageRefresh(PackType _packType) { var keys = new List<string>(betterEquipModels.Keys); for (int i = keys.Count - 1; i >= 0; i--) { var guid = keys[i]; var itemModel = playerPack.GetItemByGuid(guid); if (itemModel == null || (itemModel.packType != PackType.Item && itemModel.packType != PackType.JadeDynastyItem)) { betterEquipModels.Remove(guid); } } var tempGuid = GetOneEquip(); if (tempGuid != currentEquipGuid) { if (!string.IsNullOrEmpty(tempGuid)) { var itemModel = playerPack.GetItemByGuid(tempGuid); var sourcelist = itemModel.GetUseDataModel((int)ItemUseDataKey.source); if (sourcelist != null && sourcelist[0] == 4) { SnxxzGame.Instance.StartCoroutine(Co_DelayRefreshBetterEquip(tempGuid)); } else { currentEquipGuid = tempGuid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } } } else { currentEquipGuid = tempGuid; if (showEquipRefreshEvent != null) { showEquipRefreshEvent(); } } } } private void OnPackageItemRefresh(PackType _packType, int _index, int _itemId) { switch(_packType) { case PackType.Equip: case PackType.JadeDynastyEquip: //穿上装备的时候的处理 var item = playerPack.GetItemByIndex(_packType, _index); if (item != null) { RemoveLowGradeItemByEquipPlace(item.config.EquipPlace, item.equipScore); } break; default: var itemConfig = ItemConfig.Get(_itemId); var packType = GeneralDefine.GetPackTypeByItemType(itemConfig.Type); var itemModel = playerPack.GetItemByIndex(packType, _index); if (itemModel == null) { OnPackageRefresh(_packType); } break; } } private string GetOneEquip() { var guid = string.Empty; foreach (var key in betterEquipModels.Keys) { guid = key; break; } return guid; } private void RemoveItemByEquipPlace(int _place) { var place = _place == 10 ? 9 : _place; var keys = new List<string>(betterEquipModels.Keys); for (int i = keys.Count - 1; i >= 0; i--) { var item = betterEquipModels[keys[i]]; if (item != null && item.config.EquipPlace == place) { betterEquipModels.Remove(keys[i]); } } } private void RemoveLowGradeItemByEquipPlace(int _place, int _score) { var keys = new List<string>(betterEquipModels.Keys); for (int i = keys.Count - 1; i >= 0; i--) { var item = betterEquipModels[keys[i]]; if (item != null && item.config.EquipPlace == _place && item.equipScore <= _score) { betterEquipModels.Remove(keys[i]); } } } private bool TryGetEquipByPlace(int _place, out ItemModel _itemModel) { var place = _place == 10 ? 9 : _place; var keys = new List<string>(betterEquipModels.Keys); for (int i = keys.Count - 1; i >= 0; i--) { var item = betterEquipModels[keys[i]]; if (item != null && item.config.EquipPlace == place) { _itemModel = item; return true; } } _itemModel = null; return false; } public bool ShowBetterEquipAble() { var mapId = PlayerDatas.Instance.baseData.MapID; var lineId = PlayerDatas.Instance.baseData.dungeonLineId; var dungeonId = dungeonModel.GetDungeonId(dungeonModel.GetDataMapIdByMapId(mapId), lineId); if (dungeonId == 0) { return true; } else { var config = DungeonConfig.Get(dungeonId); return config.ShowNewItemTip == 1; } } } } System/BetterItemGet/ItemUseModel.cs
@@ -16,7 +16,6 @@ List<string> itemGuids = new List<string>(); PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } public UseItem currentShowItem { get; private set; } System/BetterItemGet/PreciousItemGetModel.cs
@@ -16,7 +16,6 @@ List<string> itemGuids = new List<string>(); PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } CrossServerOneVsOneModel crossOneVsOneModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } } @@ -25,14 +24,14 @@ public bool isGetNewItem { get;set; } public override void Init() { modelInterface.GetPreciousItemEvent += OnGetPreciousItem; ItemLogicUtility.Instance.GetPreciousItemEvent += OnGetPreciousItem; playerPack.refrechPackEvent += OnPackageRefresh; playerPack.refreshItemCountEvent += OnPackageItemRefresh; } public override void UnInit() { modelInterface.GetPreciousItemEvent -= OnGetPreciousItem; ItemLogicUtility.Instance.GetPreciousItemEvent -= OnGetPreciousItem; playerPack.refrechPackEvent -= OnPackageRefresh; playerPack.refreshItemCountEvent -= OnPackageItemRefresh; } @@ -124,7 +123,7 @@ return; } List<ItemModel> druglist = modelInterface.GetDruglistByRealm(); List<ItemModel> druglist = ItemLogicUtility.Instance.GetDruglistByRealm(); for(int i = 0; i < druglist.Count; i++) { OnGetPreciousItem(druglist[i].packType,druglist[i].guid); System/BetterItemGet/PreciousItemGetModel.cs.orig
New file @@ -0,0 +1,268 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Sunday, January 21, 2018 //-------------------------------------------------------- using System; using System.Collections.Generic; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class PreciousItemGetModel : Model, IBeforePlayerDataInitialize,ISwitchAccount,IPlayerLoginOk { Dictionary<string, PreciousItem> itemStack = new Dictionary<string, PreciousItem>(); List<string> itemGuids = new List<string>(); PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } CrossServerOneVsOneModel crossOneVsOneModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } } public PreciousItem currentShowItem { get; private set; } public event Action showItemRefreshEvent; public bool isGetNewItem { get;set; } public override void Init() { <<<<<<< origin/ItemReconstruction modelInterface.GetPreciousItemEvent += OnGetPreciousItem; playerPack.refrechPackEvent += OnPackageRefresh; playerPack.refreshItemCountEvent += OnPackageItemRefresh; ======= ItemLogicUtility.Instance.GetPreciousItemEvent += OnGetPreciousItem; playerPack.RefreshPackAct += OnPackageRefresh; playerPack.RefreshItemCountAct += OnPackageItemRefresh; >>>>>>> local } public override void UnInit() { <<<<<<< origin/ItemReconstruction modelInterface.GetPreciousItemEvent -= OnGetPreciousItem; playerPack.refrechPackEvent -= OnPackageRefresh; playerPack.refreshItemCountEvent -= OnPackageItemRefresh; ======= ItemLogicUtility.Instance.GetPreciousItemEvent -= OnGetPreciousItem; playerPack.RefreshPackAct -= OnPackageRefresh; playerPack.RefreshItemCountAct -= OnPackageItemRefresh; >>>>>>> local } public void OnBeforePlayerDataInitialize() { isGetNewItem = false; PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= RefreshRealm; CrossServerOneVsOnePlayerInfo.Instance.UpdateMatchNumEvent -= UpdateCrossOneVsOneMatchNum; } public void OnSwitchAccount() { currentShowItem = default(PreciousItem); } public void OnPlayerLoginOk() { PlayerDatas.Instance.PlayerDataRefreshInfoEvent += RefreshRealm; CrossServerOneVsOnePlayerInfo.Instance.UpdateMatchNumEvent += UpdateCrossOneVsOneMatchNum; } public bool TryGetItem(string _guid, out PreciousItem _itemModel) { return itemStack.TryGetValue(_guid, out _itemModel); } public void ReportConfirmPreciousItem(PreciousItem _preciousItem) { if (itemGuids.Contains(_preciousItem.guid)) { itemGuids.Remove(_preciousItem.guid); } if (itemStack.ContainsKey(_preciousItem.guid)) { itemStack.Remove(_preciousItem.guid); } RefreshCurrrentShowPreciousItem(); } public int GetShowItemId() { if (currentShowItem == default(PreciousItem)) { return 0; } else { var item = playerPack.GetItemByGuid(currentShowItem.guid); return item == null ? 0 : item.config.ID; } } private void UpdateCrossOneVsOneMatchNum() { if (!TryRemindMatchTick()) return; var itemModels = playerPack.GetItemsById(PackType.Item,1506); if(itemModels != null && itemModels.Count > 0) { var itemModel = itemModels[0]; var error = 0; var isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(itemModel.itemPlace ,1,out error); if(isHaveMakeNum) { OnGetPreciousItem(PackType.Item, itemModel.guid); } } } private bool TryRemindMatchTick() { if (NewBieCenter.Instance.inGuiding || !CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch) return false; int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum(); if (remainNum > 0) return false; return true; } private void RefreshRealm(PlayerDataRefresh type) { int realmLv = PlayerDatas.Instance.baseData.realmLevel; if (type != PlayerDataRefresh.OfficialRank || NewBieCenter.Instance.inGuiding) { return; } List<ItemModel> druglist = ItemLogicUtility.Instance.GetDruglistByRealm(); for(int i = 0; i < druglist.Count; i++) { OnGetPreciousItem(druglist[i].packType,druglist[i].guid); } } private void OnGetPreciousItem(PackType type, string guid) { var preciousItem = new PreciousItem(type, guid); if (!itemGuids.Contains(guid)) { itemGuids.Add(guid); } itemStack[guid] = preciousItem; RefreshCurrrentShowPreciousItem(); } private void OnPackageRefresh(PackType _type) { if (_type != PackType.Item) { return; } RefreshCurrrentShowPreciousItem(); } private void OnPackageItemRefresh(PackType _type, int _index, int _itemId) { OnPackageRefresh(_type); } private bool FindLatestItem(out PreciousItem _item) { if (itemGuids.Count == 0) { _item = default(PreciousItem); return false; } var guid = itemGuids[itemGuids.Count - 1]; _item = itemStack[guid]; return true; } private void Trim() { for (int i = itemGuids.Count - 1; i >= 0; i--) { var item = itemStack[itemGuids[i]]; if (playerPack.GetItemByGuid(item.guid) == null || playerPack.GetItemByGuid(item.guid).packType != PackType.Item) { itemGuids.RemoveAt(i); } } } private void RefreshCurrrentShowPreciousItem() { Trim(); PreciousItem tempItem; if (FindLatestItem(out tempItem)) { if (tempItem != currentShowItem) { currentShowItem = tempItem; } } else { currentShowItem = default(PreciousItem); } if (showItemRefreshEvent != null) { isGetNewItem = true; showItemRefreshEvent(); } } public bool ShowPreciousItemAble() { var mapId = PlayerDatas.Instance.baseData.MapID; var lineId = PlayerDatas.Instance.baseData.dungeonLineId; var dungeonId = dungeonModel.GetDungeonId(dungeonModel.GetDataMapIdByMapId(mapId), lineId); if (dungeonId == 0) { return true; } else { var config = DungeonConfig.Get(dungeonId); return config.ShowNewItemTip == 1; } } public struct PreciousItem { public PackType packType; public string guid; public PreciousItem(PackType _packType, string _guid) { this.packType = _packType; this.guid = _guid; } public static bool operator ==(PreciousItem _lhs, PreciousItem _rhs) { return _lhs.packType == _rhs.packType && _lhs.guid == _rhs.guid; } public static bool operator !=(PreciousItem _lhs, PreciousItem _rhs) { return _lhs.packType != _rhs.packType || _lhs.guid != _rhs.guid; } } } } System/BetterItemGet/RealmBetterEquipModel .cs
@@ -14,7 +14,6 @@ public class RealmBetterEquipModel : Model, IBeforePlayerDataInitialize, ISwitchAccount,IPlayerLoginOk { PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } public string currentEquipGuid { get; private set; } @@ -64,7 +63,7 @@ } LocalSave.SetInt(RealmRecordKey,realmLv); Dictionary<int, ItemModel> pairs = modelInterface.CheckBetterEquipByRealm(); Dictionary<int, ItemModel> pairs = ItemLogicUtility.Instance.CheckBetterEquipByRealm(); betterEquipModels.Clear(); currentEquipGuid = string.Empty; foreach (var model in pairs.Values) System/BlastFurnace/DanDrugRecycleTip.cs
@@ -26,7 +26,6 @@ { get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } BlastFurnaceModel blastFurnace { get { return ModelCenter.Instance.GetModel<BlastFurnaceModel>(); } } Dictionary<string, List<ItemModel>> recycleDict; System/BlastFurnace/GetEquipPathTips.cs
@@ -130,12 +130,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } Dictionary<AttrEnum, int> needPointDict = new Dictionary<AttrEnum, int>(); Color32 conditionColor = new Color32(255, 244, 205, 255); System/BlastFurnace/GetEquipPathWin.cs
@@ -138,12 +138,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } Dictionary<AttrEnum, int> needPointDict = new Dictionary<AttrEnum, int>(); Color32 conditionColor = new Color32(255, 244, 205, 255); System/Compose/New/ComposeTicketWin.cs
@@ -42,13 +42,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ComposeWinModel.ComposeFirstTypeData firstTypeData; ComposeWinModel.ComposeSecondTypeData secondTypeData; ComposeWinModel.ComposeThirdTypeData thirdTypeData; @@ -411,7 +404,7 @@ } } _moneyCountText.text = modelInterface.OnChangeCoinsUnit((ulong)compoundModel.money); _moneyCountText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)compoundModel.money); } private UIEffect GetPlayMatEffect() System/Compose/New/SelectEquipModel.cs
@@ -8,7 +8,6 @@ { ComposeWinModel composeWinModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } private FuncConfigConfig addonsTypeModel; private FuncConfigConfig addonsQualityModel; @@ -63,7 +62,7 @@ switch ((RoleEquipType)itemModel.config.EquipPlace) { case RoleEquipType.SpiritAnimal: bool isOverdue = modelInterface.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); if (isOverdue) { continue; @@ -107,7 +106,7 @@ switch ((RoleEquipType)itemModel.config.EquipPlace) { case RoleEquipType.SpiritAnimal: bool isOverdue = modelInterface.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); if (isOverdue) { continue; @@ -141,7 +140,7 @@ orderOneKeylist.Clear(); foreach (var key in _addonsItemDict.Keys) { int isFightUp = modelInterface.IsFightUp(_addonsItemDict[key].itemId, _addonsItemDict[key].equipScore); int isFightUp = ItemLogicUtility.Instance.IsFightUp(_addonsItemDict[key].itemId, _addonsItemDict[key].equipScore); if (isFightUp != 1) { if (_addonsItemDict[key].config.ItemColor >= noOneKeyPutCondis[0] System/DailyQuest/ResourcesBackBoxBack.cs
@@ -29,7 +29,6 @@ ResourcesBackModel resourcesBackModel { get { return m_ResourcesBackModel ?? (m_ResourcesBackModel = ModelCenter.Instance.GetModel<ResourcesBackModel>()); } } GetItemPathModel _GetItemPath; GetItemPathModel GetItemPath { get { return _GetItemPath ?? (_GetItemPath = ModelCenter.Instance.GetModel<GetItemPathModel>()); } } PackModelInterface packModelInterface = new PackModelInterface(); ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } public static bool isBool = false;//是否绑玉找回 @@ -41,7 +40,6 @@ } private void Start() { packModelInterface = ModelCenter.Instance.GetModel<PackModelInterface>(); m_FindButton.AddListener(OnClickFindButton); } @@ -140,14 +138,13 @@ if (resourcesBackClass.RecoverCnt <= 0 && resourcesBackClass.ExtraCnt > 0) { m_NumberText.text = packModelInterface.OnChangeCoinsUnit((ulong)resourcesBackClass.VipCostJade); m_NumberText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)resourcesBackClass.VipCostJade); } else { m_NumberText.text = packModelInterface.OnChangeCoinsUnit((ulong)resourcesBackClass.NormalCostJade); m_NumberText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)resourcesBackClass.NormalCostJade); } int playerlv = PlayerDatas.Instance.baseData.LV; @@ -178,7 +175,7 @@ double number = Equation.Instance.Eval<double>(resourcesBackClass.JadeReward.exp); string itemIcon = ItemConfig.Get(2103).IconKey; Icon.SetSprite(itemIcon); Number.text = packModelInterface.OnChangeCoinsUnit((ulong)number); Number.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)number); var Item_1 = ItemConfig.Get(2103); Image_1.SetItemBackGround(Item_1.ItemColor); Btn.RemoveAllListeners(); @@ -192,7 +189,7 @@ Icon.SetSprite(itemIcon); var Item_1 = ItemConfig.Get(2100); Image_1.SetItemBackGround(Item_1.ItemColor); Number.text = packModelInterface.OnChangeCoinsUnit((ulong)number); Number.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)number); Btn.RemoveAllListeners(); ItemAttrData attrData = new ItemAttrData(2100); Btn.AddListener(() => { itemTipsModel.SetItemTipsModel(attrData); }); @@ -216,7 +213,7 @@ ItemId = ReplaceItemID(ItemId, resourcesBackClass);//根据职业替换物品ID string itemIcon = ItemConfig.Get(ItemId).IconKey; Icon1.SetSprite(itemIcon); Number1.text = packModelInterface.OnChangeCoinsUnit((ulong)ItemCount); Number1.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)ItemCount); var Item_2 = ItemConfig.Get(ItemId); Image_2.SetItemBackGround(Item_2.ItemColor); ItemAttrData attrData1 = new ItemAttrData(ItemId); @@ -273,7 +270,7 @@ var itemConfig = ItemConfig.Get(2100); m_ItemIcon.gameObject.SetActive(false); //m_ItemIcon.SetSprite("Money_Type_3"); //m_NumberText.text = packModelInterface.OnChangeCoinsUnit((ulong)resourcesBackClass.CostCopper); //m_NumberText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)resourcesBackClass.CostCopper); int playerlv = PlayerDatas.Instance.baseData.LV; var config = PlayerLVConfig.Get(playerlv); @@ -324,7 +321,7 @@ Btn.RemoveAllListeners(); ItemAttrData attrData = new ItemAttrData(2103); Btn.AddListener(() => { itemTipsModel.SetItemTipsModel(attrData); }); Number.text = packModelInterface.OnChangeCoinsUnit((ulong)number); Number.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)number); } else if (resourcesBackClass.RewardList[i] == "money") @@ -337,7 +334,7 @@ Btn.RemoveAllListeners(); ItemAttrData attrData = new ItemAttrData(2100); Btn.AddListener(() => { itemTipsModel.SetItemTipsModel(attrData); }); Number.text = packModelInterface.OnChangeCoinsUnit((ulong)number); Number.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)number); } else if (resourcesBackClass.RewardList[i] == "item") { @@ -363,7 +360,7 @@ Btn1.RemoveAllListeners(); Btn1.AddListener(()=> { itemTipsModel.SetItemTipsModel(attrData1); }); Icon1.SetSprite(itemIcon); Number1.text = packModelInterface.OnChangeCoinsUnit((ulong)ItemCount); Number1.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)ItemCount); type += 1; } } System/DailyQuest/ResourcesBackPanel.cs
@@ -33,7 +33,6 @@ { get { return _GetItemPath ?? (_GetItemPath = ModelCenter.Instance.GetModel<GetItemPathModel>()); } } PackModelInterface packModelInterface = new PackModelInterface(); public static event Action IsAccordingRedPoint; List<ResourcesBackClass> _list = new List<ResourcesBackClass>();//用来控制进行排序 private bool IsBool = true; @@ -272,7 +271,7 @@ // } //} //int costCopper = (int)UIHelper.GetMoneyCnt(3); ;//铜钱 //string strLanguage = string.Format(Language.Get("NewResourceBack2"), packModelInterface.OnChangeCoinsUnit((ulong)NeedCoinsNumber)); //string strLanguage = string.Format(Language.Get("NewResourceBack2"), packItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)NeedCoinsNumber)); //ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), strLanguage, (bool isOk) => //{ // if (isOk) System/Dungeon/TrialDungeonModel.cs
@@ -320,7 +320,7 @@ if (itemModel.config.EquipPlace == config.EquipPlace && (itemModel.config.JobLimit / 100 == PlayerDatas.Instance.baseData.Job || itemModel.config.JobLimit == 0) && !ModelCenter.Instance.GetModel<PackModelInterface>().IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict)) && !ItemLogicUtility.Instance.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict)) { var compare = EquipCompare(itemModel, config); if (compare == 0) System/FairyAu/PlayerFairyAuTreasureData.cs
@@ -1,93 +1,91 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using Snxxz.UI; //仙盟宝库 public class FamilyStoreItem//家族仓库物品信息 { public int Index;//仓库格子索引 public int ItemID;//物品ID public ItemJsonData ItemData; public Dictionary<int, List<int>> _UserData; [Serializable] public class ItemJsonData { public string UserData; public int IsSuit; public int EquipGS; } } public class FamilyActionInfoClass//接收家族行为信息 { public int FamilyID;//家族ID public int ActionType;//类型 public int Time;//时间 public string Name;//玩家名 public int OperationType;//操作类型1-捐献,2-兑换,3-销毁 public int PlayerID;//操作的玩家ID; public int ItemID;//物品ID public ItemJsonData ItemData; public Dictionary<int, List<int>> _UserData; [Serializable] public class ItemJsonData { public int ItemID; public string UserData; public int IsSuit; public int EquipGS; } } public class PlayerFairyAuTreasureData : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public Dictionary<int, FamilyStoreItem> _DicfamilyStoreItem = new Dictionary<int, FamilyStoreItem>();//家族仓库物品信息 public List<FamilyActionInfoClass> _InformationList = new List<FamilyActionInfoClass>(); public delegate void OnFairyAuIntegral(); public static event OnFairyAuIntegral Event_FairyAuIntegral;//用于仙盟积分的刷新 public delegate void OnFamilyActionInfo(); public static event OnFamilyActionInfo Event_FamilyActionInfo;//家族行为信息的刷新 public delegate void OnFamilyStoreItemInfo(); public static event OnFamilyStoreItemInfo Event_FamilyStoreItemInfo;//仓库信息的刷新 using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using Snxxz.UI; //仙盟宝库 public class FamilyStoreItem//家族仓库物品信息 { public int Index;//仓库格子索引 public int ItemID;//物品ID public ItemJsonData ItemData; public Dictionary<int, List<int>> _UserData; [Serializable] public class ItemJsonData { public string UserData; public int IsSuit; public int EquipGS; } } public class FamilyActionInfoClass//接收家族行为信息 { public int FamilyID;//家族ID public int ActionType;//类型 public int Time;//时间 public string Name;//玩家名 public int OperationType;//操作类型1-捐献,2-兑换,3-销毁 public int PlayerID;//操作的玩家ID; public int ItemID;//物品ID public ItemJsonData ItemData; public Dictionary<int, List<int>> _UserData; [Serializable] public class ItemJsonData { public int ItemID; public string UserData; public int IsSuit; public int EquipGS; } } public class PlayerFairyAuTreasureData : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { public Dictionary<int, FamilyStoreItem> _DicfamilyStoreItem = new Dictionary<int, FamilyStoreItem>();//家族仓库物品信息 public List<FamilyActionInfoClass> _InformationList = new List<FamilyActionInfoClass>(); public delegate void OnFairyAuIntegral(); public static event OnFairyAuIntegral Event_FairyAuIntegral;//用于仙盟积分的刷新 public delegate void OnFamilyActionInfo(); public static event OnFamilyActionInfo Event_FamilyActionInfo;//家族行为信息的刷新 public delegate void OnFamilyStoreItemInfo(); public static event OnFamilyStoreItemInfo Event_FamilyStoreItemInfo;//仓库信息的刷新 public static event Action<List<int>> Del_FamilyStoreItemInfo;//仓库信息物品的删除 PlayerPackModel _playerPack; PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public int _FairyAuIntegral = 0;//获取仙盟积分 public List<int> JumpItemID = new List<int>();//从跳转到仙盟仓库需要选中高亮 List<int> EquipmentList = new List<int>();//关于装备位置 public int _FairyAuIntegral = 0;//获取仙盟积分 public List<int> JumpItemID = new List<int>();//从跳转到仙盟仓库需要选中高亮 List<int> EquipmentList = new List<int>();//关于装备位置 public bool IsShowPoint = false;//是否显示红点 private const int Redpoint_key1 = 1070103; public Redpoint redPointStre1 = new Redpoint(10701, Redpoint_key1);//仙盟仓库红点 public override void Init() { var funConfig = FuncConfigConfig.Get("StrengthenDisplay"); int[] List = ConfigParse.GetMultipleStr<int>(funConfig.Numerical1); EquipmentList.Clear(); public Redpoint redPointStre1 = new Redpoint(10701, Redpoint_key1);//仙盟仓库红点 public override void Init() { var funConfig = FuncConfigConfig.Get("StrengthenDisplay"); int[] List = ConfigParse.GetMultipleStr<int>(funConfig.Numerical1); EquipmentList.Clear(); for (int i = 0; i < List.Length; i++) { EquipmentList.Add(List[i]); } } public override void UnInit() } } public override void UnInit() { } public void OnBeforePlayerDataInitialize() } public void OnBeforePlayerDataInitialize() { _DicfamilyStoreItem.Clear(); _FairyAuIntegral = 0; _DicfamilyStoreItem.Clear(); _FairyAuIntegral = 0; } public void OnPlayerLoginOk() { @@ -99,99 +97,99 @@ public void FairyAuIntegral(int value)//获取仙盟积分 { _FairyAuIntegral = value; if (Event_FairyAuIntegral != null) Event_FairyAuIntegral(); } public void FamilyStoreItemInfo(HA406_tagGCFamilyStoreItemInfo info)//家族仓库信息 { if (!_DicfamilyStoreItem.ContainsKey(0)) { FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem(); _FamilyStoreItemP.Index = 0; FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange"); _FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1); _DicfamilyStoreItem.Add(0, _FamilyStoreItemP); public void FairyAuIntegral(int value)//获取仙盟积分 { _FairyAuIntegral = value; if (Event_FairyAuIntegral != null) Event_FairyAuIntegral(); } public void FamilyStoreItemInfo(HA406_tagGCFamilyStoreItemInfo info)//家族仓库信息 { if (!_DicfamilyStoreItem.ContainsKey(0)) { FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem(); _FamilyStoreItemP.Index = 0; FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange"); _FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1); _DicfamilyStoreItem.Add(0, _FamilyStoreItemP); } for (int i = 0; i < info.Count; i++) { if (_DicfamilyStoreItem.ContainsKey(info.StoreItemList[i].Index + 1)) continue; FamilyStoreItem _FamilyStoreItem = new FamilyStoreItem(); _FamilyStoreItem.ItemData = JsonUtility.FromJson<FamilyStoreItem.ItemJsonData>(info.StoreItemList[i].ItemData); _FamilyStoreItem.Index = info.StoreItemList[i].Index + 1; _FamilyStoreItem.ItemID = (int)info.StoreItemList[i].ItemID; _FamilyStoreItem._UserData = ConfigParse.Analysis(_FamilyStoreItem.ItemData.UserData); _DicfamilyStoreItem.Add((int)info.StoreItemList[i].Index + 1, _FamilyStoreItem); for (int i = 0; i < info.Count; i++) { if (_DicfamilyStoreItem.ContainsKey(info.StoreItemList[i].Index + 1)) continue; FamilyStoreItem _FamilyStoreItem = new FamilyStoreItem(); _FamilyStoreItem.ItemData = JsonUtility.FromJson<FamilyStoreItem.ItemJsonData>(info.StoreItemList[i].ItemData); _FamilyStoreItem.Index = info.StoreItemList[i].Index + 1; _FamilyStoreItem.ItemID = (int)info.StoreItemList[i].ItemID; _FamilyStoreItem._UserData = ConfigParse.Analysis(_FamilyStoreItem.ItemData.UserData); _DicfamilyStoreItem.Add((int)info.StoreItemList[i].Index + 1, _FamilyStoreItem); } if (Event_FamilyStoreItemInfo != null) { Event_FamilyStoreItemInfo(); } IsShowRedPoint(); } IsShowRedPoint(); } List<int> List = new List<int>(); public void WarehouseToRefresh(byte[] _list)//仓库刷新 List<int> List = new List<int>(); public void WarehouseToRefresh(byte[] _list)//仓库刷新 { List.Clear(); List.Clear(); for (int i = 0; i < _list.Length; i++) { List.Add(_list[i] + 1); } } if (Del_FamilyStoreItemInfo != null) { Del_FamilyStoreItemInfo(List); } } IsShowRedPoint(); } public void FamilyStoreDel(int _index, int ClearType)//家族仓库物品删除(清除的格子索引, 仅单格子清除时有效,从0开始代表第一格,0-单格子清除; 1-所有物品清除) { if (_DicfamilyStoreItem.ContainsKey(_index + 1) && ClearType == 0) { _DicfamilyStoreItem.Remove(_index + 1); } if (ClearType == 1) { _DicfamilyStoreItem.Clear(); if (!_DicfamilyStoreItem.ContainsKey(0)) { FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem(); _FamilyStoreItemP.Index = 0; FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange"); _FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1); _DicfamilyStoreItem.Add(0, _FamilyStoreItemP); } } public void FamilyStoreDel(int _index, int ClearType)//家族仓库物品删除(清除的格子索引, 仅单格子清除时有效,从0开始代表第一格,0-单格子清除; 1-所有物品清除) { if (_DicfamilyStoreItem.ContainsKey(_index + 1) && ClearType == 0) { _DicfamilyStoreItem.Remove(_index + 1); } } public void FamilyActionInfo(HA403_tagGCFamilyActionInfo info)//接收家族行为信息 { _InformationList.Clear(); for (int i = 0; i < info.Count; i++) { FamilyActionInfoClass _FamilyActionInfoClass = new FamilyActionInfoClass(); _FamilyActionInfoClass.FamilyID = (int)info.FamilyID; _FamilyActionInfoClass.ActionType = (int)info.ActionType; _FamilyActionInfoClass.Time = (int)info.FamilyActionList[i].Time; _FamilyActionInfoClass.Name = info.FamilyActionList[i].Name; _FamilyActionInfoClass.OperationType = (int)info.FamilyActionList[i].Value1; _FamilyActionInfoClass.PlayerID = (int)info.FamilyActionList[i].Value2; _FamilyActionInfoClass.ItemID = (int)info.FamilyActionList[i].Value3; _FamilyActionInfoClass.ItemData = JsonUtility.FromJson<FamilyActionInfoClass.ItemJsonData>(info.FamilyActionList[i].UseData); _FamilyActionInfoClass._UserData = ConfigParse.Analysis(_FamilyActionInfoClass.ItemData.UserData); if (ClearType == 1) { _DicfamilyStoreItem.Clear(); if (!_DicfamilyStoreItem.ContainsKey(0)) { FamilyStoreItem _FamilyStoreItemP = new FamilyStoreItem(); _FamilyStoreItemP.Index = 0; FuncConfigConfig _PetFoodExchange = FuncConfigConfig.Get("PetFoodExchange"); _FamilyStoreItemP.ItemID = int.Parse(_PetFoodExchange.Numerical1); _DicfamilyStoreItem.Add(0, _FamilyStoreItemP); } } } public void FamilyActionInfo(HA403_tagGCFamilyActionInfo info)//接收家族行为信息 { _InformationList.Clear(); for (int i = 0; i < info.Count; i++) { FamilyActionInfoClass _FamilyActionInfoClass = new FamilyActionInfoClass(); _FamilyActionInfoClass.FamilyID = (int)info.FamilyID; _FamilyActionInfoClass.ActionType = (int)info.ActionType; _FamilyActionInfoClass.Time = (int)info.FamilyActionList[i].Time; _FamilyActionInfoClass.Name = info.FamilyActionList[i].Name; _FamilyActionInfoClass.OperationType = (int)info.FamilyActionList[i].Value1; _FamilyActionInfoClass.PlayerID = (int)info.FamilyActionList[i].Value2; _FamilyActionInfoClass.ItemID = (int)info.FamilyActionList[i].Value3; _FamilyActionInfoClass.ItemData = JsonUtility.FromJson<FamilyActionInfoClass.ItemJsonData>(info.FamilyActionList[i].UseData); _FamilyActionInfoClass._UserData = ConfigParse.Analysis(_FamilyActionInfoClass.ItemData.UserData); _InformationList.Add(_FamilyActionInfoClass); } if (Event_FamilyActionInfo != null) Event_FamilyActionInfo();//家族行为信息的刷新 } if (Event_FamilyActionInfo != null) Event_FamilyActionInfo();//家族行为信息的刷新 } private bool IsEquipmentComparison() @@ -213,7 +211,7 @@ int ItemId = _DicfamilyStoreItem[key].ItemID; var itemConfig = ItemConfig.Get(ItemId); int RealmLevel = PlayerDatas.Instance.baseData.realmLevel; int equipScore = modelInterface.GetEquipScore(PackType.Equip, ItemId, _DicfamilyStoreItem[key]._UserData); int equipScore = ItemLogicUtility.Instance.GetEquipScore(PackType.Equip, ItemId, _DicfamilyStoreItem[key]._UserData); if (ItemModel.config.EquipPlace == Type && RealmLevel >= itemConfig.RealmLimit && equipScore >= ItemModel.equipScore) { IsBool = true; @@ -271,4 +269,4 @@ { IsShowRedPoint(); } } } System/FriendSystem/MailPanel.cs
@@ -88,12 +88,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } } VirtualPackModel virtualPackModel { get { return ModelCenter.Instance.GetModel<VirtualPackModel>(); } } @@ -354,9 +348,9 @@ { itemCell.gameObject.SetActive(false); } _goldText.text = modelInterface.OnChangeCoinsUnit(info.Silver).ToString(); _drillBoxeText.text = modelInterface.OnChangeCoinsUnit(info.GoldPaper).ToString(); _fairyJadeBoxText.text = modelInterface.OnChangeCoinsUnit(info.Gold).ToString(); _goldText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(info.Silver).ToString(); _drillBoxeText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(info.GoldPaper).ToString(); _fairyJadeBoxText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(info.Gold).ToString(); } else System/Guard/GuardModel.cs
@@ -17,7 +17,6 @@ PlayerPackModel pack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } } PackModelInterface packModelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } public override void Init() { @@ -113,7 +112,7 @@ { for (int k = 0; k < list.Count; k++) { bool isOverdue = packModelInterface.IsOverdue(list[k].guid, bool isOverdue = ItemLogicUtility.Instance.IsOverdue(list[k].guid, list[k].itemId, list[k].useDataDict); if (!isOverdue) System/HappyXB/XBStoreWin.cs
@@ -20,8 +20,6 @@ get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } List<StoreModel.StoreData> shoplist; int SingleLineCnt = 2; @@ -77,7 +75,7 @@ { if (refreshType != PlayerDataRefresh.CDBPlayerRefresh_TreasureScore) return; soreValueText.text = modelInterface.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(25)); soreValueText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(25)); } private void OnClickToolToggle(bool isOn) System/HappyXB/XBWarehouseWin.cs
@@ -20,10 +20,6 @@ PlayerPackModel _playerPack; PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } HappyXBModel XBModel { get { return ModelCenter.Instance.GetModel<HappyXBModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } int SingleLineCnt = 5; int logCreateCnt = 0; @@ -160,7 +156,7 @@ private void ClickSortBtn() { modelInterface.SendPackResetQuest(PackType.Treasure); ItemLogicUtility.Instance.SendPackResetQuest(PackType.Treasure); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.HappyXBWarehouse, 5.0f, RefreshTime); sortBtnText.text = Language.Get("BagWin_SortCDbtn_Text_1", 5); sortImage.SetSprite("BlackBtn"); System/JadeDynastyKnapSack/JadeDynastyDecomposeModel.cs
@@ -17,7 +17,6 @@ public List<string> allGuids { get; private set; } public event Action UpdateSelectItemEvent; PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } public override void Init() { @@ -133,7 +132,7 @@ { if (selectEquipLv != 0 && model.config.LV <= selectEquipLv && modelInterface.IsFightUp(model.itemId,model.equipScore) != 1) && ItemLogicUtility.Instance.IsFightUp(model.itemId,model.equipScore) != 1) { selectGuids.Add(model.guid); } System/JadeDynastyKnapSack/JadeDynastyEquipWin.cs
@@ -31,7 +31,6 @@ [SerializeField] int initCount = 100; PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } JadeDynastyEquipModel equipModel { get { return ModelCenter.Instance.GetModel<JadeDynastyEquipModel>(); } } #region Built-in @@ -310,7 +309,7 @@ public void OnClickSort() { modelInterface.SendPackResetQuest(PackType.JadeDynastyItem); ItemLogicUtility.Instance.SendPackResetQuest(PackType.JadeDynastyItem); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.BagSort, 5.0f, RefreshTime); sortText.text = Language.Get("BagWin_SortCDbtn_Text_1", 5); sortImage.SetSprite("BlackBtn"); System/KnapSack/Logic/BoxInfoWin.cs
@@ -63,12 +63,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } BoxGetItemModel boxModel; BoxGetItemModel BoxModel { System/KnapSack/Logic/EquipDevourWin.cs
@@ -50,7 +50,6 @@ PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } List<ItemModel> devourModellist; bool isOpen = true; @@ -590,7 +589,7 @@ public void SendEquipdevourQuest() { if (!modelInterface.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return; if (!ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return; playerPack.isAutoDecompose = false; SettingEffectMgr.Instance.isStartDecompose = true; System/KnapSack/Logic/EquipTip.cs
@@ -134,12 +134,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } JadeDynastyEquipModel equipModel { get { return ModelCenter.Instance.GetModel<JadeDynastyEquipModel>(); } } System/KnapSack/Logic/GuardOverdueWin.cs
@@ -36,12 +36,6 @@ get { return _itemOverdue ?? (_itemOverdue = ModelCenter.Instance.GetModel<ItemOverdueModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel _playerPack; PlayerPackModel playerPack { @@ -96,7 +90,7 @@ itemModel = playerPack.GetItemByGuid(guid); if (itemModel == null) return; itemBG.SetItemBackGround(modelInterface.GetItemQuality(itemModel.itemId,itemModel.useDataDict)); itemBG.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemModel.itemId,itemModel.useDataDict)); itemIcon.SetSprite(itemModel.config.IconKey); itemOverduelist = itemOverdue.GetRenewallist(itemModel.itemId); itemConfig = ItemConfig.Get(itemOverduelist[0]); System/KnapSack/Logic/GuardTip.cs
@@ -79,12 +79,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemAttrData itemAttrData; Color32 conditionColor = new Color32(255, 244, 205, 255); System/KnapSack/Logic/ItemInfoWin.cs
@@ -66,12 +66,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel _playerPack; PlayerPackModel playerPack { System/KnapSack/Logic/ItemLogicUtility.cs
File was renamed from System/KnapSack/Logic/PackModelInterface.cs @@ -1,1651 +1,1647 @@ using System; using System.Collections.Generic; using System.Linq; using LitJson; using UnityEngine; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class PackModelInterface : Model, IBeforePlayerDataInitialize { private string jadeDynastyGSFormula; private string dogzGSFormula; private string normalGSFormula; private int[] preciousItemTypes; private int[] drugIDs; private int[] onekeySellTypes; private int[] pushItemIds; private int[] pushBuffTypeIds; private List<int> equipBaseProperties = new List<int>(); private Dictionary<int, int> promptUseLimitDict; private Dictionary<int, List<int>> betterEquipExceptDungeonDict; PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } PlayerBuffDatas buffDatas { get { return ModelCenter.Instance.GetModel<PlayerBuffDatas>(); } } PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel<PlayerMountDatas>(); } } PlayerPetDatas petDatas { get { return ModelCenter.Instance.GetModel<PlayerPetDatas>(); } } PlayerStrengthengDatas strengthDatas { get { return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>(); } } MagicianModel magicianModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } TrialDungeonModel trialModel { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } } ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } public override void Init() { var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula"); jadeDynastyGSFormula = GSFormulaConfig.Numerical4; dogzGSFormula = GSFormulaConfig.Numerical3; normalGSFormula = GSFormulaConfig.Numerical1; var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2); if (baseAttr.IsArray) { for (int i = 0; i < baseAttr.Count; i++) { equipBaseProperties.Add(int.Parse(baseAttr[i].ToString())); } } preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1); promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1); drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1); onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1); pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1); pushBuffTypeIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical2); betterEquipExceptDungeonDict = new Dictionary<int, List<int>>(); var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1); foreach (var dungeonId in excEquipData.Keys) { var itemIds = new List<int>(); betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds); for (var i = 0; i < excEquipData[dungeonId].Count; i++) { var itemId = int.Parse(excEquipData[dungeonId][i].ToString()); itemIds.Add(itemId); } } } public void OnBeforePlayerDataInitialize() { isPackResetOk = true; ClearSortedBetterEquip(); } public override void UnInit() { } #region 计算装备评分 class EquipSorceProperties { Dictionary<int, int> properties = new Dictionary<int, int>(); public int this[int id] { get { return properties[id]; } } public List<int> Keys { get { return new List<int>(properties.Keys); } } void Add(int id, int value) { if (properties.ContainsKey(id)) { properties[id] += value; } else { properties[id] = value; } } public void AddRange(List<int> ids, List<int> values) { if (ids == null || values == null) { return; } var count = Mathf.Min(ids.Count, values.Count); for (int i = 0; i < count; i++) { Add(ids[i], values[i]); } } public void AddRange(int[] ids, int[] values) { if (ids == null || values == null) { return; } var length = Mathf.Min(ids.Length, values.Length); for (int i = 0; i < length; i++) { Add(ids[i], values[i]); } } public void AddRange(Dictionary<int, int> keyValues) { if (keyValues == null) { return; } foreach (var item in keyValues) { properties.Add(item.Key, item.Value); } } public void AddBaseProperties(int itemId, List<int> reference) { var config = ItemConfig.Get(itemId); if (config.Effect1 != 0 && reference.Contains(config.Effect1)) { properties.Add(config.Effect1, config.EffectValueA1); } if (config.Effect2 != 0 && reference.Contains(config.Effect2)) { properties.Add(config.Effect2, config.EffectValueA2); } if (config.Effect3 != 0 && reference.Contains(config.Effect3)) { properties.Add(config.Effect3, config.EffectValueA3); } if (config.Effect4 != 0 && reference.Contains(config.Effect4)) { properties.Add(config.Effect4, config.EffectValueA4); } if (config.Effect5 != 0 && reference.Contains(config.Effect5)) { properties.Add(config.Effect5, config.EffectValueA5); } } public void AddCustomProperties(int itemId) { if (AppointItemConfig.Has(itemId)) { return; } var config = AppointItemConfig.Get(itemId); AddRange(config.LegendAttrID, config.LegendAttrValue); AddRange(config.OutOfPrintAttr, config.OutOfPrintAttrValue); } } public int GetEquipScore(PackType type, int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false) { var config = ItemConfig.Get(itemId); var properties = new EquipSorceProperties(); if (IsCustomItem(itemId)) { properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties); properties.AddCustomProperties(itemId); return CalculateEquipScore(type, config.EffectValueA1, properties); } properties.AddBaseProperties(itemId, equipBaseProperties); if (isPreview) { switch (config.EquipPlace) { case 11: properties.AddRange(GetWingsLegendProperties(itemId)); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: properties.AddRange(GetEquipLegendProperties(itemId)); break; } var packType = GeneralDefine.GetPackTypeByItemType(config.Type); switch (packType) { case PackType.JadeDynastyItem: properties.AddRange(CalculateJadeDynastyLegendAttr(itemId)); break; } return CalculateEquipScore(type, itemId, properties); } if (useDataDic != null) { if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID)) { properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]); } if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID)) { properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]); } } return CalculateEquipScore(type, itemId, properties); } private Dictionary<int, int> GetEquipLegendProperties(int itemId) { var config = ItemConfig.Get(itemId); var legendIdlist = new List<int>(); if (LegendPropertyUtility.HasEquipPlace(config.EquipPlace)) { for (var i = 0; i < 3; i++) { var type = (LegendAttrType)i; var count = LegendPropertyUtility.GetEquipPropertyCount(config.ItemColor, config.StarLevel, type); if (count > 0) { var propertyIds = LegendPropertyUtility.GetEquipPlaceProperties(config.EquipPlace, type); legendIdlist.AddRange(propertyIds.GetRange(0, count)); } } } var properties = new Dictionary<int, int>(); for (int i = 0; i < legendIdlist.Count; i++) { var propertyId = legendIdlist[i]; var qualityPropertyValue = LegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, config.ItemColor); if (qualityPropertyValue != 0) { properties[propertyId] = qualityPropertyValue; } else { var levelPropertyValue = LegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, config.LV); if (levelPropertyValue != 0) { properties[propertyId] = levelPropertyValue; } } } return properties; } public Dictionary<int, int> GetWingsLegendProperties(int itemId) { var config = ItemConfig.Get(itemId); var properties = new Dictionary<int, int>(); var level = config.LV; var count = LegendPropertyUtility.GetWingPropertyCount(level); var ids = LegendPropertyUtility.GetWingProperties(level); if (ids != null) { for (var i = 0; properties.Count < count && i < properties.Count; i++) { var propertyId = ids[i]; properties[propertyId] = LegendPropertyUtility.GetWingPropertyValues(level, propertyId)[0]; } } return properties; } private Dictionary<int, int> CalculateJadeDynastyLegendAttr(int itemId) { Dictionary<int, int> attrDict = null; itemTipsModel.TryGetJadeDynastyLegendAttr(itemId, out attrDict); return attrDict; } bool IsCustomItem(int itemId) { if (!ItemConfig.Has(itemId)) { return false; } return ItemConfig.Get(itemId).Effect1 == 220; } /// <summary> /// 得到装备的评分 /// </summary> /// <param name="itemId"></param> /// <returns></returns> private Dictionary<AttrEnum, float> curEquipAttrDict = new Dictionary<AttrEnum, float>(); //存储当前装备属性对应的数值 key 属性 value 属性值 private int CalculateEquipScore(PackType type, int itemId, EquipSorceProperties properties) { var config = ItemConfig.Get(itemId); if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace)) { return 0; } Equation.Instance.Clear(); curEquipAttrDict.Clear(); var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.StarLevel); foreach (var key in properties.Keys) { var attrType = (AttrEnum)key; switch (attrType) { case AttrEnum.ATKSPEED: case AttrEnum.OnlyFinalHurt: case AttrEnum.PVPAtkBackHP: curEquipAttrDict.Add(attrType, properties[key]); break; default: if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType)) { var curProValue = properties[key] * GSProValueDict[attrType]; curEquipAttrDict.Add(attrType, curProValue); } else { curEquipAttrDict.Add(attrType, properties[key]); } break; } } foreach (var key in curEquipAttrDict.Keys) { var propertyConfig = PlayerPropertyConfig.Get((int)key); if (propertyConfig != null) { Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]); } } var gSParamModel = EquipGSParamConfig.GetGSModel(config.LV, config.ItemColor, config.StarLevel); if (gSParamModel != null) { Equation.Instance.AddKeyValue("AtkSpeedC", gSParamModel.AtkSpeedC); } else { Equation.Instance.AddKeyValue("AtkSpeedC", 0); } if (type == PackType.Deleted) { type = GeneralDefine.GetPackTypeByItemType(config.Type); } switch (type) { case PackType.DogzEquip: case PackType.DogzItem: return Equation.Instance.Eval<int>(dogzGSFormula); case PackType.JadeDynastyItem: case PackType.JadeDynastyEquip: return Equation.Instance.Eval<int>(jadeDynastyGSFormula); default: return Equation.Instance.Eval<int>(normalGSFormula); } } private void ConvertAttrId(int attrId, int attrValue, Dictionary<int, int> keyValues) { switch ((AttrEnum)attrId) { case AttrEnum.ATK: if (!keyValues.ContainsKey((int)AttrEnum.MinAtk)) { keyValues.Add(((int)AttrEnum.MinAtk), attrValue); } else { keyValues[(int)AttrEnum.MinAtk] += attrValue; } if (!keyValues.ContainsKey((int)AttrEnum.MaxAtk)) { keyValues.Add(((int)AttrEnum.MaxAtk), attrValue); } else { keyValues[(int)AttrEnum.MaxAtk] += attrValue; } break; default: if (!keyValues.ContainsKey(attrId)) { keyValues.Add(attrId, attrValue); } else { keyValues[attrId] += attrValue; } break; } } #endregion #region 主界面物品弹框展示 public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID public void RecommendItem(ItemModel item) { if (item.packType != PackType.Item) { return; } if (item.config.UseLV > PlayerDatas.Instance.baseData.LV) { return; } if (IsOverdue(item.guid, item.itemId, item.useDataDict)) { return; } if (!preciousItemTypes.Contains(item.config.Type)) { return; } if (!IsAbleToUse(item)) { return; } if (GetPreciousItemEvent != null) { GetPreciousItemEvent(item.packType, item.guid); } } bool IsAbleToUse(ItemModel item) { var windowSearch = WindowSearchConfig.Get(item.config.Jump); if (windowSearch != null) { if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0) { return false; } } if (pushItemIds.Contains(item.itemId)) { var itemCnt = playerPack.GetItemCountByID(PackType.Item, item.itemId) - item.count; if (itemCnt > 0) { return false; } else { if (item.preItemCount > 0) { return false; } } } if (promptUseLimitDict.ContainsKey(item.itemId)) { var playerLv = PlayerDatas.Instance.baseData.LV; if (playerLv < promptUseLimitDict[item.itemId]) { return false; } } ulong canUseCnt = 0; if (playerPack.IsReachUseLimit(item.guid, out canUseCnt)) { return false; } bool isBox = false; bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(item.itemId, out isBox); if (isBox) { if (!isCanOpen) { return false; } } if (trialModel.trialTokens.Contains(item.itemId)) { if (!trialModel.IsAnySatisfyExchangeBetter(item.itemId)) { return false; } } if (playerPack.CheckIsDrugById(item.itemId)) { if (item.config.RealmLimit > PlayerDatas.Instance.baseData.realmLevel) { return false; } } switch (item.config.Type) { case 8: if (buffDatas.BastBuff(item.itemId)) { return false; } break; case 20: if (magicianModel.IsGodWeaponMaxLevelByItem(item.itemId)) { return false; } break; case 21: if (!mountDatas.IsHint(HorseEnum.HorseDan, item.itemId)) { return false; } break; case 22: if (!mountDatas.IsHint(HorseEnum.HorseStone, item.itemId)) { return false; } break; case 41: if (!mountDatas.IsHint(HorseEnum.HorseDebris, item.itemId)) { return false; } break; case 26: if (!petDatas.IsHint(PetEnum.PetDebris, item.itemId)) { return false; } break; case 27: if (!petDatas.IsHint(PetEnum.PetDan, item.itemId)) { return false; } break; case 28: if (!petDatas.IsHint(PetEnum.PetStone, item.itemId)) { return false; } break; case 25: if (!ModelCenter.Instance.GetModel<GemModel>().SatisfyBetter(item.itemId)) { return false; } break; case 39: if (!IsBetterWings(item)) { return false; } break; case 52: if (!strengthDatas.IsHint(item.itemId)) { return false; } break; case 127: var error = 0; bool isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(item.itemPlace, 1, out error); int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum(); if (!CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch || remainNum > 0 || !isHaveMakeNum) { return false; } break; default: break; } switch (item.itemId) { case 951: if (!CheckIsExtendGrid(item.itemId)) { return false; } break; case 952: int willTime = HangUpSetModel.Instance.offlinePluginTime + item.config.EffectValueA1; if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime) { return false; } break; } return true; } private bool IsBetterWings(ItemModel item) { if (item == null) { return false; } var putModel = playerPack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.Wing); var singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) { return false; } int[] composeTypes = item.config.JumpComposeCondi; bool isOpenCompose = false; if (composeTypes != null && composeTypes.Length >= 3) { int first = composeTypes[0]; int second = composeTypes[1]; int third = composeTypes[2]; ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; composeModel.TryGetThirdTypeData(first, second, third, out thirdTypeData); if (thirdTypeData != null) { var itemCompound = thirdTypeData.itemCompound; if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV) { isOpenCompose = true; } } } if (!isOpenCompose) { return false; } if (putModel != null && putModel.config.LV >= item.config.LV) { return false; } var itemModels = singlePack.GetItemsByType((int)ItemType.Wings); if (itemModels != null) { for (int i = 0; i < itemModels.Count; i++) { if (itemModels[i].config.JobLimit / 100 == PlayerDatas.Instance.baseData.Job) { if (itemModels[i].config.LV >= item.config.LV) { return false; } } } } return true; } private bool CheckIsExtendGrid(int itemId) { SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return false; int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount; FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem"); int haveCount = playerPack.GetItemCountByID(PackType.Item, itemId); Equation.Instance.Clear(); Equation.Instance.AddKeyValue("index", startLockIndex + 1); int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2); if (haveCount >= needTool) { return true; } else { return false; } } public event Action<string> GetBetterEquipEvent; //得到更好的装备 value 物品的实例ID public void OnGetEquip(ItemModel item) { if (item == null) { return; } if (item.packType != PackType.Item && item.packType != PackType.JadeDynastyItem) { return; } if (!IsSameJob(item.config.JobLimit)) { return; } int equipPlace = item.config.EquipPlace; switch ((RoleEquipType)equipPlace) { case RoleEquipType.Weapon: case RoleEquipType.Weapon2: case RoleEquipType.Hat: case RoleEquipType.Clothes: case RoleEquipType.Belt: case RoleEquipType.Trousers: case RoleEquipType.Shoes: case RoleEquipType.Neck: case RoleEquipType.FairyCan: case RoleEquipType.FairyCan2: case RoleEquipType.Wing: case RoleEquipType.SpiritAnimal: case RoleEquipType.JadeDynasty_Cloak: case RoleEquipType.JadeDynasty_FaceMask: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Glove2: case RoleEquipType.JadeDynasty_Ruyi: case RoleEquipType.JadeDynasty_Pendant: case RoleEquipType.JadeDynasty_Ring1: case RoleEquipType.JadeDynasty_Ring2: case RoleEquipType.JadeDynasty_Sword1: case RoleEquipType.JadeDynasty_Sword2: case RoleEquipType.JadeDynasty_Sword3: case RoleEquipType.JadeDynasty_Sword4: if (betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID)) { if (betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(item.itemId)) { return; } } SetGetBetterEquipEvent(item); break; } } bool IsSameJob(int jobLimit) { return jobLimit == 0 || jobLimit / 100 == PlayerDatas.Instance.baseData.Job; } private void SetGetBetterEquipEvent(ItemModel model) { List<int> itemEffectTime = model.GetUseDataModel((int)ItemUseDataKey.createTime); if (itemEffectTime != null) { if (itemEffectTime[0] != 0) { ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.guid); double remainTime = 0; if (cool != null) { remainTime = cool.GetRemainTime(); } if (remainTime >= 0 && remainTime < 120 && model.config.ExpireTime > 0) { return; } } } int isFightUp = IsFightUp(model.itemId, model.equipScore); int equipPlace = model.config.EquipPlace; if (isFightUp == 1) { switch (equipPlace) { case 9: break; default: if (model.packType == PackType.Item) { var equipItemModel = playerPack.GetItemByIndex(PackType.Equip, model.config.EquipPlace); if (PlayerDatas.Instance.baseData.LV >= 200) { if (model.equipPlace > (int)RoleEquipType.Weapon2 && model.equipPlace < (int)RoleEquipType.Neck) { if (equipItemModel != null && equipItemModel.config.ItemColor > model.config.ItemColor) { return; } } } } break; } if (GetBetterEquipEvent != null) { GetBetterEquipEvent(model.guid); } } } public event Action<PackType, string> PickItemEvent; //捡起的物品 public void RefreshPickItem(PackType type, string guid) { if (type != PackType.Item) return; if (PickItemEvent != null) { PickItemEvent(type, guid); } } Dictionary<int, ItemModel> RealmBetterDict = new Dictionary<int, ItemModel>(); public Dictionary<int, ItemModel> CheckBetterEquipByRealm() { RealmBetterDict.Clear(); SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return RealmBetterDict; int realmLv = PlayerDatas.Instance.baseData.realmLevel; Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); foreach (var model in pairs.Values) { if (model.config.EquipPlace > 0 && model.config.EquipPlace != (int)RoleEquipType.SpiritAnimal && model.config.RealmLimit <= realmLv && !IsOverdue(model.guid, model.itemId, model.useDataDict) && IsFightUp(model.itemId, model.equipScore) == 1) { if (!RealmBetterDict.ContainsKey(model.equipPlace)) { RealmBetterDict.Add(model.equipPlace, model); } else { if (model.equipScore > RealmBetterDict[model.equipPlace].equipScore) { RealmBetterDict[model.equipPlace] = model; } } } } return RealmBetterDict; } List<ItemModel> RealmDruglist = new List<ItemModel>(); public List<ItemModel> GetDruglistByRealm() { RealmDruglist.Clear(); SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return RealmDruglist; int realmLv = PlayerDatas.Instance.baseData.realmLevel; Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); foreach (var model in pairs.Values) { if (playerPack.CheckIsDrugById(model.itemId)) { AttrFruitConfig fruitConfig = AttrFruitConfig.Get(model.itemId); if (!playerPack.IsReachMaxUseDrug(fruitConfig) && model.config.RealmLimit <= realmLv) { RealmDruglist.Add(model); } } } return RealmDruglist; } #endregion #region 物品处于CD中的逻辑处理 private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID /// <summary> /// 物品使用时间限制 /// </summary> public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime) { double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime)); if (time < 0) { time = 0; } ItemConfig itemConfig = ItemConfig.Get(itemID); if (time >= itemConfig.ExpireTime) { KnapsackTimeCDMgr.Instance.UnRegister(guid); return; } double remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time; KnapsackTimeCDMgr.Instance.Register(guid, itemID, remainTime); } public double GetTimeOffest(DateTime getTime) { DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "获得时间:" + getTime); //TimeUtility.SyncServerTime(); TimeSpan t = TimeUtility.ServerNow - getTime; DebugEx.Log("时间差:" + t.TotalSeconds); return t.TotalSeconds; } #endregion #region 设置可以一键出售的物品数据 private int playerLv; private Dictionary<int, List<ItemModel>> _lifePotionDict = new Dictionary<int, List<ItemModel>>(); //key 药水等级 private List<int> _sellItemScorelist = new List<int>(); private Dictionary<int, Dictionary<int, List<ItemModel>>> _sameIndexEquipDict = new Dictionary<int, Dictionary<int, List<ItemModel>>>(); //存储相同装备位的装备 // private _sameEquipScoreDict = new Dictionary<int, List<ItemModel>>(); //存储相同ID中相同装备评分的装备 private Dictionary<int, ItemModel> _packModelDict; private List<ItemModel> _sellItemlist = new List<ItemModel>(); public List<ItemModel> GetSellItemList() { GetOneKeySellModel(); _sellItemlist.Sort(SetSellItemOrder); return _sellItemlist; } public int SetSellItemOrder(ItemModel startModel, ItemModel endModel) { bool startIsEquip = IsEquip(startModel); bool endIsEquip = IsEquip(endModel); if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip); int order1 = startModel.config.Type; int order2 = endModel.config.Type; if (order1.CompareTo(order2) != 0) return order1.CompareTo(order2); int color1 = startModel.config.ItemColor; int color2 = endModel.config.ItemColor; if (color1.CompareTo(color2) != 0) return -color1.CompareTo(color2); int code1 = startModel.itemId; int code2 = endModel.itemId; if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2); return 0; } public bool IsEquip(ItemModel model) { return model.config.EquipPlace != 0; } public void GetOneKeySellModel() { SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return; _sellItemlist.Clear(); _lifePotionDict.Clear(); _sameIndexEquipDict.Clear(); _sellItemScorelist.Clear(); playerLv = PlayerDatas.Instance.baseData.LV; _packModelDict = singlePack.GetAllItems(); foreach (var key in _packModelDict.Keys) { GetCanSellEquipList(_packModelDict[key]); ItemModel itemModel = _packModelDict[key]; if (drugIDs.Contains(itemModel.itemId)) { if (!_lifePotionDict.ContainsKey(itemModel.config.LV)) { List<ItemModel> modellist = new List<ItemModel>(); modellist.Add(itemModel); _lifePotionDict.Add(itemModel.config.LV, modellist); } else { _lifePotionDict[itemModel.config.LV].Add(itemModel); } } } #region 得到可以出售的装备 foreach (var key in _sameIndexEquipDict.Keys) { _sellItemScorelist = _sameIndexEquipDict[key].Keys.ToList(); _sellItemScorelist.Sort(); if (_sellItemScorelist.Count > 0) { int score = 0; int curJob = PlayerDatas.Instance.baseData.Job; for (score = _sellItemScorelist.Count - 1; score > -1; score--) { SinglePack equipPack = playerPack.GetSinglePack(PackType.Equip); ItemModel model = null; if (equipPack != null) { model = equipPack.GetItemByIndex(key); } List<ItemModel> modellist = _sameIndexEquipDict[key][_sellItemScorelist[score]]; int i = 0; bool remainBetter = true; for (i = 0; i < modellist.Count; i++) { double joblimit = Math.Floor((double)modellist[i].config.JobLimit / 100); if (model != null) { if (remainBetter) { if (model.equipScore < _sellItemScorelist[score] && curJob == joblimit) { _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); remainBetter = false; break; } } } else { if (curJob == joblimit) { if (remainBetter) { _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); remainBetter = false; break; } } } } if (!remainBetter) { break; } } int j = 0; for (j = 0; j < _sellItemScorelist.Count; j++) { if (_sameIndexEquipDict[key].ContainsKey(_sellItemScorelist[j])) { int k = 0; List<ItemModel> sellModlelist = _sameIndexEquipDict[key][_sellItemScorelist[j]]; for (k = 0; k < sellModlelist.Count; k++) { _sellItemlist.Add(sellModlelist[k]); } } } } } #endregion List<int> drugLvlist = new List<int>(); drugLvlist.AddRange(_lifePotionDict.Keys.ToList()); drugLvlist.Sort(); for (int i = drugLvlist.Count - 1; i > -1; i--) { if (drugLvlist[i] > playerLv) { _lifePotionDict.Remove(drugLvlist[i]); } else { _lifePotionDict.Remove(drugLvlist[i]); break; } } foreach (var list in _lifePotionDict.Values) { for (int i = 0; i < list.Count; i++) { _sellItemlist.Add(list[i]); } } } //得到满足出售条件的装备列表 public void GetCanSellEquipList(ItemModel model) { if (model.config.EquipPlace == 0 || !onekeySellTypes.Contains(model.config.Type)) return; Dictionary<int, List<ItemModel>> sameScoreDict; List<ItemModel> sameScorelist; if (model.config.ItemColor < 3) { if (!_sameIndexEquipDict.ContainsKey(model.config.EquipPlace)) { sameScoreDict = new Dictionary<int, List<ItemModel>>(); sameScorelist = new List<ItemModel>(); sameScorelist.Add(model); sameScoreDict.Add(model.equipScore, sameScorelist); _sameIndexEquipDict.Add(model.config.EquipPlace, sameScoreDict); } else { if (_sameIndexEquipDict[model.config.EquipPlace].ContainsKey(model.equipScore)) { _sameIndexEquipDict[model.config.EquipPlace][model.equipScore].Add(model); } else { sameScorelist = new List<ItemModel>(); sameScorelist.Add(model); _sameIndexEquipDict[model.config.EquipPlace].Add(model.equipScore, sameScorelist); } } } } #endregion #region 发送请求 /// <summary> /// 一键出售物品的请求 /// </summary> /// <param name="_oneKeySelllist"></param> public void SendOneKeySellQuest(List<ItemModel> _oneKeySelllist) { if (!isPackResetOk || SettingEffectMgr.Instance.isStartOneKeySell) return; SettingEffectMgr.Instance.isStartOneKeySell = true; byte[] itemIndexs = new byte[_oneKeySelllist.Count]; int i = 0; for (i = 0; i < _oneKeySelllist.Count; i++) { itemIndexs[i] = (byte)_oneKeySelllist[i].itemPlace; } CA311_tagCMSellItem sellItem = new CA311_tagCMSellItem(); sellItem.PackType = (int)PackType.Item; sellItem.Count = (byte)_oneKeySelllist.Count; sellItem.ItemIndex = itemIndexs; GameNetSystem.Instance.SendInfo(sellItem); } /// <summary> /// 整理包裹物品 /// </summary> /// <param name="type"></param> public bool isPackResetOk { get; set; } public void SendPackResetQuest(PackType type) { if (lookLineIndex > -1) { SetLookIndex(null); } if (KnapSackWin.titleType == KnapsackFuncTitle.bag) { playerPack.isPlayBetterEquipEffect = true; } SinglePack singlePack = playerPack.GetSinglePack(type); if (singlePack != null) { C070F_tagCItemPackReset packReset = new C070F_tagCItemPackReset(); packReset.Type = (byte)type; packReset.ItemBeginIndex = 0; packReset.ItemEndIndex = (ushort)(singlePack.unlockedGridCount - 1); GameNetSystem.Instance.SendInfo(packReset); //整理物品 if (type == PackType.Item) { isPackResetOk = false; } } } #endregion #region 查看某个位置的物品 public event Action lookEquipEvent; private int _lookLineIndex = -1; public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } } public string lookItemGUID { get; private set; } public void SetLookIndex(string guid, int singleRowCount = 5) { if (string.IsNullOrEmpty(guid) || guid == "") { lookLineIndex = -1; } else { int index = playerPack.GetItemByGuid(guid).itemPlace; lookLineIndex = index / singleRowCount; lookItemGUID = guid; } if (lookEquipEvent != null) { lookEquipEvent(); } } #endregion #region 判断是否有更好的装备替换 /// <summary> /// 过滤装备位判断 /// </summary> /// <param name="ignoreType"></param> /// <returns></returns> public bool CheckBetterEquip(RoleEquipType ignoreType) { SinglePack singlePack = playerPack.GetSinglePack(PackType.Equip); if (singlePack != null) { Dictionary<int, ItemModel> putOnDic = singlePack.GetAllItems(); foreach (var key in putOnDic.Keys) { if ((RoleEquipType)key == ignoreType) { continue; } if (key < 13) { List<ItemModel> itemlist = GetSameEquipPlacelist(key); int i = 0; for (i = 0; i < itemlist.Count; i++) { bool isOverdue = IsOverdue(itemlist[i].guid, itemlist[i].itemId, itemlist[i].useDataDict); bool isRealm = PlayerDatas.Instance.baseData.realmLevel >= itemlist[i].config.RealmLimit ? true : false; if (itemlist[i].equipScore > putOnDic[key].equipScore && !isOverdue && isRealm) { return true; } } } } } else { int i = 1; for (i = 1; i < 13; i++) { List<ItemModel> itemlist = GetSameEquipPlacelist(i); if (itemlist.Count > 0) { return true; } } } return false; } private List<ItemModel> GetSameEquipPlacelist(int equipPlace) { List<ItemModel> modellist = new List<ItemModel>(); Dictionary<int, ItemModel> dic = null; SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack != null) { dic = singlePack.GetAllItems(); foreach (var model in dic.Values) { if (model.config.EquipPlace == equipPlace) { double equipJob = Math.Floor((double)model.config.JobLimit / 100); if (equipJob == 0 || equipJob == PlayerDatas.Instance.baseData.Job) { modellist.Add(model); } } } } return modellist; } /// <summary> /// 获取装备评分最高可提升战力的装备 /// </summary> /// <param name="_places"></param> /// <returns></returns> public string GetHighestScoreEquipByPlace(int equipPlace) { var itemPackage = playerPack.GetSinglePack(PackType.Item); var allItems = itemPackage.GetAllItems(); ItemModel putModel = playerPack.GetItemByIndex(PackType.Equip, equipPlace); equipPlace = (equipPlace == 9 || equipPlace == 10) ? 9 : equipPlace; var guid = string.Empty; var equips = new List<string>(); var score = putModel == null ? 0 : putModel.equipScore; var job = PlayerDatas.Instance.baseData.Job; foreach (var item in allItems.Values) { if (item.config.EquipPlace == equipPlace) { if (!IsOverdue(item.guid, item.itemId, item.useDataDict) && (item.config.JobLimit == 0 || (item.config.JobLimit / 100) == job) && item.equipScore > score) { guid = item.guid; score = item.equipScore; } } } return guid; } #endregion #region 背包整理后好的同类型最好的装备 Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>(); // key1 装备位置索引 key2 背包位置索引 public void ClearSortedBetterEquip() { itemModelDict.Clear(); } public void SetBagSortBetterEquipList(ItemModel itemModel) { if (itemModel == null || itemModel.packType != PackType.Item) return; if (!IsCanPutOn(itemModel)) return; int equipPlace = itemModel.config.EquipPlace; if (!itemModelDict.ContainsKey(equipPlace)) { Dictionary<int, ItemModel> dict = new Dictionary<int, ItemModel>(); if (IsFightUp(itemModel.itemId, itemModel.equipScore) == 1) { dict.Add(itemModel.itemPlace, itemModel); itemModelDict.Add(equipPlace, dict); } } else { if (IsFightUp(itemModel.itemId, itemModel.equipScore) == 1) { itemModelDict[equipPlace].Add(itemModel.itemPlace, itemModel); } } } public ItemModel GetBagSortBetterEquip(int equipPlace, int index) { ItemModel itemModel = null; if (itemModelDict.ContainsKey(equipPlace)) { itemModelDict[equipPlace].TryGetValue(index, out itemModel); } return itemModel; } public bool IsCanPutOn(ItemModel itemModel) { double equipJob = Math.Floor((double)itemModel.config.JobLimit / 100); int playerJob = PlayerDatas.Instance.baseData.Job; int equipPlace = itemModel.config.EquipPlace; if (equipPlace == 0 || equipPlace > 12) return false; if (equipJob != 0 && equipJob != playerJob) return false; List<int> putOnlimitList = itemModel.GetUseDataModel((int)ItemUseDataKey.cancelUseLimit); if (putOnlimitList != null) { if (putOnlimitList[0] == 1) { return true; } } return CheckPutOnRealm(itemModel.config); } private bool CheckPutOnRealm(ItemConfig config) { var _realmLv = config.RealmLimit; if (PlayerDatas.Instance.baseData.realmLevel < _realmLv) { return false; } return true; } #endregion #region 得到物品的品质颜色 private Dictionary<int, int> wingRefineQualityDict; private int[] wingsQualitys; private int[] wingsRefineExps; public int GetItemQuality(int itemId, Dictionary<int, List<int>> useDataDic = null) { wingsQualitys = null; wingsRefineExps = null; ItemConfig itemConfig = ItemConfig.Get(itemId); wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV); if (useDataDic != null) { if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null) { wingsQualitys = wingRefineQualityDict.Keys.ToArray(); wingsRefineExps = wingRefineQualityDict.Values.ToArray(); int i = 0; for (i = wingsRefineExps.Length - 1; i > -1; i--) { if (useDataDic[42][0] >= wingsRefineExps[i]) { return wingsQualitys[i]; } } } } return itemConfig.ItemColor; } #endregion //设置玩家货币显示 public string OnChangeCoinsUnit(ulong value) { string strCoins = value.ToString(); if (strCoins.Length > 4 && strCoins.Length < 9) { double coins = Math.Floor((double)value / 10000); strCoins = coins + Language.Get("KnapS114"); } else if (strCoins.Length >= 9 && strCoins.Length < 13) { double coins = Math.Floor((double)value / 100000000); strCoins = coins + Language.Get("KnapS115"); } else if (strCoins.Length >= 13 && strCoins.Length < 19) { double coins = Math.Floor((double)value / 1000000000000); strCoins = coins + Language.Get("KnapS126"); } else if (strCoins.Length >= 19) { ServerTipDetails.DisplayNormalTip(Language.Get("KnapS127")); } return strCoins; } /// <summary> /// 装备是否可以提升战力 /// </summary> /// <param name="_itemID"></param> /// <param name="_score"></param> /// <returns></returns> public int IsFightUp(int _itemID, int _score)//-1低级,0不是本职业,1更好 { ItemConfig chinItemModel = ItemConfig.Get(_itemID); if (chinItemModel != null) { ItemModel putOnModel = null; switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.Clothes: case RoleEquipType.FairyCan: case RoleEquipType.Belt: case RoleEquipType.Hat: case RoleEquipType.Neck: case RoleEquipType.Shoes: case RoleEquipType.SpiritAnimal: case RoleEquipType.Trousers: case RoleEquipType.Weapon: case RoleEquipType.Weapon2: case RoleEquipType.Wing: putOnModel = playerPack.GetItemByIndex(PackType.Equip, chinItemModel.EquipPlace); break; case RoleEquipType.JadeDynasty_Cloak: case RoleEquipType.JadeDynasty_FaceMask: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Pendant: case RoleEquipType.JadeDynasty_Ring1: case RoleEquipType.JadeDynasty_Ruyi: case RoleEquipType.JadeDynasty_Sword1: case RoleEquipType.JadeDynasty_Sword2: case RoleEquipType.JadeDynasty_Sword3: case RoleEquipType.JadeDynasty_Sword4: putOnModel = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, chinItemModel.EquipPlace); break; default: return 0; } ItemModel putOnModel2 = null; switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.FairyCan: putOnModel2 = playerPack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.FairyCan2); break; case RoleEquipType.JadeDynasty_Glove1: putOnModel2 = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, (int)RoleEquipType.JadeDynasty_Glove2); break; case RoleEquipType.JadeDynasty_Ring1: putOnModel2 = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, (int)RoleEquipType.JadeDynasty_Ring2); break; } switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.FairyCan: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Ring1: if (putOnModel2 != null) { if (putOnModel != null) { if (putOnModel2.equipScore < putOnModel.equipScore) { putOnModel = putOnModel2; } } } else { putOnModel = putOnModel2; } break; } int equipScore1 = 0; if (putOnModel != null) { equipScore1 = (int)putOnModel.equipScore; } int playerJob = PlayerDatas.Instance.baseData.Job; if (playerJob == Math.Floor((double)chinItemModel.JobLimit / 100) || chinItemModel.JobLimit == 0) { if (equipScore1 > _score) return -1; else if (equipScore1 < _score) return 1; else return 0; } else { return 0; } } return 0; } #region 物品是否过期 public bool IsOverdue(string guid, int itemId, Dictionary<int, List<int>> useDataDict = null) { ItemConfig itemConfig = ItemConfig.Get(itemId); if (itemConfig == null) return false; if (itemConfig.ExpireTime > 0) { ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(guid); switch ((EquipReduceType)itemConfig.EndureReduceType) { case EquipReduceType.Def_EquipReduceType_Time: if (guid != "") { List<int> itemEffectTime = null; if (useDataDict != null) { if (useDataDict.ContainsKey((int)ItemUseDataKey.createTime)) { itemEffectTime = useDataDict[(int)ItemUseDataKey.createTime]; } } if (itemEffectTime != null && itemEffectTime[0] != 0) { if (cool == null || cool.GetRemainTime() <= 0) { return true; } } } break; case EquipReduceType.Def_EquipReduceType_RTimeItem: if (guid != "") { if (cool == null || cool.GetRemainTime() <= 0) { return true; } } break; } } return false; } #endregion } } using System; using System.Collections.Generic; using System.Linq; using LitJson; using UnityEngine; namespace Snxxz.UI { [XLua.LuaCallCSharp] public class ItemLogicUtility : Singleton<ItemLogicUtility> { private string jadeDynastyGSFormula; private string dogzGSFormula; private string normalGSFormula; private int[] preciousItemTypes; private int[] drugIDs; private int[] onekeySellTypes; private int[] pushItemIds; private int[] pushBuffTypeIds; private List<int> equipBaseProperties = new List<int>(); private Dictionary<int, int> promptUseLimitDict; private Dictionary<int, List<int>> betterEquipExceptDungeonDict; PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } PlayerBuffDatas buffDatas { get { return ModelCenter.Instance.GetModel<PlayerBuffDatas>(); } } PlayerMountDatas mountDatas { get { return ModelCenter.Instance.GetModel<PlayerMountDatas>(); } } PlayerPetDatas petDatas { get { return ModelCenter.Instance.GetModel<PlayerPetDatas>(); } } PlayerStrengthengDatas strengthDatas { get { return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>(); } } MagicianModel magicianModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } TrialDungeonModel trialModel { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } } ComposeWinModel composeModel { get { return ModelCenter.Instance.GetModel<ComposeWinModel>(); } } public void Init() { var GSFormulaConfig = FuncConfigConfig.Get("EquipGSFormula"); jadeDynastyGSFormula = GSFormulaConfig.Numerical4; dogzGSFormula = GSFormulaConfig.Numerical3; normalGSFormula = GSFormulaConfig.Numerical1; var baseAttr = JsonMapper.ToObject(GSFormulaConfig.Numerical2); if (baseAttr.IsArray) { for (int i = 0; i < baseAttr.Count; i++) { equipBaseProperties.Add(int.Parse(baseAttr[i].ToString())); } } preciousItemTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("ItemPush").Numerical1); promptUseLimitDict = ConfigParse.GetDic<int, int>(FuncConfigConfig.Get("NoPromptUsetItem").Numerical1); drugIDs = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("LifePotionlist").Numerical1); onekeySellTypes = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("OneKeySellItemType").Numerical1); pushItemIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical1); pushBuffTypeIds = ConfigParse.GetMultipleStr<int>(FuncConfigConfig.Get("IntroductionItem").Numerical2); betterEquipExceptDungeonDict = new Dictionary<int, List<int>>(); var excEquipData = JsonMapper.ToObject(FuncConfigConfig.Get("GoodItemDungeon").Numerical1); foreach (var dungeonId in excEquipData.Keys) { var itemIds = new List<int>(); betterEquipExceptDungeonDict.Add(int.Parse(dungeonId), itemIds); for (var i = 0; i < excEquipData[dungeonId].Count; i++) { var itemId = int.Parse(excEquipData[dungeonId][i].ToString()); itemIds.Add(itemId); } } DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize; } void OnBeforePlayerDataInitialize() { isPackResetOk = true; ClearSortedBetterEquip(); } #region 计算装备评分 class EquipSorceProperties { Dictionary<int, int> properties = new Dictionary<int, int>(); public int this[int id] { get { return properties[id]; } } public List<int> Keys { get { return new List<int>(properties.Keys); } } void Add(int id, int value) { if (properties.ContainsKey(id)) { properties[id] += value; } else { properties[id] = value; } } public void AddRange(List<int> ids, List<int> values) { if (ids == null || values == null) { return; } var count = Mathf.Min(ids.Count, values.Count); for (int i = 0; i < count; i++) { Add(ids[i], values[i]); } } public void AddRange(int[] ids, int[] values) { if (ids == null || values == null) { return; } var length = Mathf.Min(ids.Length, values.Length); for (int i = 0; i < length; i++) { Add(ids[i], values[i]); } } public void AddRange(Dictionary<int, int> keyValues) { if (keyValues == null) { return; } foreach (var item in keyValues) { properties.Add(item.Key, item.Value); } } public void AddBaseProperties(int itemId, List<int> reference) { var config = ItemConfig.Get(itemId); if (config.Effect1 != 0 && reference.Contains(config.Effect1)) { properties.Add(config.Effect1, config.EffectValueA1); } if (config.Effect2 != 0 && reference.Contains(config.Effect2)) { properties.Add(config.Effect2, config.EffectValueA2); } if (config.Effect3 != 0 && reference.Contains(config.Effect3)) { properties.Add(config.Effect3, config.EffectValueA3); } if (config.Effect4 != 0 && reference.Contains(config.Effect4)) { properties.Add(config.Effect4, config.EffectValueA4); } if (config.Effect5 != 0 && reference.Contains(config.Effect5)) { properties.Add(config.Effect5, config.EffectValueA5); } } public void AddCustomProperties(int itemId) { if (AppointItemConfig.Has(itemId)) { return; } var config = AppointItemConfig.Get(itemId); AddRange(config.LegendAttrID, config.LegendAttrValue); AddRange(config.OutOfPrintAttr, config.OutOfPrintAttrValue); } } public int GetEquipScore(PackType type, int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false) { var config = ItemConfig.Get(itemId); var properties = new EquipSorceProperties(); if (IsCustomItem(itemId)) { properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties); properties.AddCustomProperties(itemId); return CalculateEquipScore(type, config.EffectValueA1, properties); } properties.AddBaseProperties(itemId, equipBaseProperties); if (isPreview) { switch (config.EquipPlace) { case 11: properties.AddRange(GetWingsLegendProperties(itemId)); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 12: properties.AddRange(GetEquipLegendProperties(itemId)); break; } var packType = GeneralDefine.GetPackTypeByItemType(config.Type); switch (packType) { case PackType.JadeDynastyItem: properties.AddRange(CalculateJadeDynastyLegendAttr(itemId)); break; } return CalculateEquipScore(type, itemId, properties); } if (useDataDic != null) { if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID)) { properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]); } if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID)) { properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]); } } return CalculateEquipScore(type, itemId, properties); } private Dictionary<int, int> GetEquipLegendProperties(int itemId) { var config = ItemConfig.Get(itemId); var legendIdlist = new List<int>(); if (LegendPropertyUtility.HasEquipPlace(config.EquipPlace)) { for (var i = 0; i < 3; i++) { var type = (LegendAttrType)i; var count = LegendPropertyUtility.GetEquipPropertyCount(config.ItemColor, config.StarLevel, type); if (count > 0) { var propertyIds = LegendPropertyUtility.GetEquipPlaceProperties(config.EquipPlace, type); legendIdlist.AddRange(propertyIds.GetRange(0, count)); } } } var properties = new Dictionary<int, int>(); for (int i = 0; i < legendIdlist.Count; i++) { var propertyId = legendIdlist[i]; var qualityPropertyValue = LegendPropertyUtility.GetEquipQualityPropertyValue(propertyId, config.ItemColor); if (qualityPropertyValue != 0) { properties[propertyId] = qualityPropertyValue; } else { var levelPropertyValue = LegendPropertyUtility.GetEquipLevelPropertyValue(propertyId, config.LV); if (levelPropertyValue != 0) { properties[propertyId] = levelPropertyValue; } } } return properties; } public Dictionary<int, int> GetWingsLegendProperties(int itemId) { var config = ItemConfig.Get(itemId); var properties = new Dictionary<int, int>(); var level = config.LV; var count = LegendPropertyUtility.GetWingPropertyCount(level); var ids = LegendPropertyUtility.GetWingProperties(level); if (ids != null) { for (var i = 0; properties.Count < count && i < properties.Count; i++) { var propertyId = ids[i]; properties[propertyId] = LegendPropertyUtility.GetWingPropertyValues(level, propertyId)[0]; } } return properties; } private Dictionary<int, int> CalculateJadeDynastyLegendAttr(int itemId) { Dictionary<int, int> attrDict = null; itemTipsModel.TryGetJadeDynastyLegendAttr(itemId, out attrDict); return attrDict; } bool IsCustomItem(int itemId) { if (!ItemConfig.Has(itemId)) { return false; } return ItemConfig.Get(itemId).Effect1 == 220; } /// <summary> /// 得到装备的评分 /// </summary> /// <param name="itemId"></param> /// <returns></returns> private Dictionary<AttrEnum, float> curEquipAttrDict = new Dictionary<AttrEnum, float>(); //存储当前装备属性对应的数值 key 属性 value 属性值 private int CalculateEquipScore(PackType type, int itemId, EquipSorceProperties properties) { var config = ItemConfig.Get(itemId); if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace)) { return 0; } Equation.Instance.Clear(); curEquipAttrDict.Clear(); var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.StarLevel); foreach (var key in properties.Keys) { var attrType = (AttrEnum)key; switch (attrType) { case AttrEnum.ATKSPEED: case AttrEnum.OnlyFinalHurt: case AttrEnum.PVPAtkBackHP: curEquipAttrDict.Add(attrType, properties[key]); break; default: if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType)) { var curProValue = properties[key] * GSProValueDict[attrType]; curEquipAttrDict.Add(attrType, curProValue); } else { curEquipAttrDict.Add(attrType, properties[key]); } break; } } foreach (var key in curEquipAttrDict.Keys) { var propertyConfig = PlayerPropertyConfig.Get((int)key); if (propertyConfig != null) { Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]); } } var gSParamModel = EquipGSParamConfig.GetGSModel(config.LV, config.ItemColor, config.StarLevel); if (gSParamModel != null) { Equation.Instance.AddKeyValue("AtkSpeedC", gSParamModel.AtkSpeedC); } else { Equation.Instance.AddKeyValue("AtkSpeedC", 0); } if (type == PackType.Deleted) { type = GeneralDefine.GetPackTypeByItemType(config.Type); } switch (type) { case PackType.DogzEquip: case PackType.DogzItem: return Equation.Instance.Eval<int>(dogzGSFormula); case PackType.JadeDynastyItem: case PackType.JadeDynastyEquip: return Equation.Instance.Eval<int>(jadeDynastyGSFormula); default: return Equation.Instance.Eval<int>(normalGSFormula); } } private void ConvertAttrId(int attrId, int attrValue, Dictionary<int, int> keyValues) { switch ((AttrEnum)attrId) { case AttrEnum.ATK: if (!keyValues.ContainsKey((int)AttrEnum.MinAtk)) { keyValues.Add(((int)AttrEnum.MinAtk), attrValue); } else { keyValues[(int)AttrEnum.MinAtk] += attrValue; } if (!keyValues.ContainsKey((int)AttrEnum.MaxAtk)) { keyValues.Add(((int)AttrEnum.MaxAtk), attrValue); } else { keyValues[(int)AttrEnum.MaxAtk] += attrValue; } break; default: if (!keyValues.ContainsKey(attrId)) { keyValues.Add(attrId, attrValue); } else { keyValues[attrId] += attrValue; } break; } } #endregion #region 主界面物品弹框展示 public event Action<PackType, string> GetPreciousItemEvent; //得到珍品 value 物品的实例ID public void RecommendItem(ItemModel item) { if (item.packType != PackType.Item) { return; } if (item.config.UseLV > PlayerDatas.Instance.baseData.LV) { return; } if (IsOverdue(item.guid, item.itemId, item.useDataDict)) { return; } if (!preciousItemTypes.Contains(item.config.Type)) { return; } if (!IsAbleToUse(item)) { return; } if (GetPreciousItemEvent != null) { GetPreciousItemEvent(item.packType, item.guid); } } bool IsAbleToUse(ItemModel item) { var windowSearch = WindowSearchConfig.Get(item.config.Jump); if (windowSearch != null) { if (!FuncOpen.Instance.IsFuncOpen(windowSearch.Lv) && windowSearch.Lv != 0) { return false; } } if (pushItemIds.Contains(item.itemId)) { var itemCnt = playerPack.GetItemCountByID(PackType.Item, item.itemId) - item.count; if (itemCnt > 0) { return false; } else { if (item.preItemCount > 0) { return false; } } } if (promptUseLimitDict.ContainsKey(item.itemId)) { var playerLv = PlayerDatas.Instance.baseData.LV; if (playerLv < promptUseLimitDict[item.itemId]) { return false; } } ulong canUseCnt = 0; if (playerPack.IsReachUseLimit(item.guid, out canUseCnt)) { return false; } bool isBox = false; bool isCanOpen = ModelCenter.Instance.GetModel<BoxGetItemModel>().CheckOpenBoxCondition(item.itemId, out isBox); if (isBox) { if (!isCanOpen) { return false; } } if (trialModel.trialTokens.Contains(item.itemId)) { if (!trialModel.IsAnySatisfyExchangeBetter(item.itemId)) { return false; } } if (playerPack.CheckIsDrugById(item.itemId)) { if (item.config.RealmLimit > PlayerDatas.Instance.baseData.realmLevel) { return false; } } switch (item.config.Type) { case 8: if (buffDatas.BastBuff(item.itemId)) { return false; } break; case 20: if (magicianModel.IsGodWeaponMaxLevelByItem(item.itemId)) { return false; } break; case 21: if (!mountDatas.IsHint(HorseEnum.HorseDan, item.itemId)) { return false; } break; case 22: if (!mountDatas.IsHint(HorseEnum.HorseStone, item.itemId)) { return false; } break; case 41: if (!mountDatas.IsHint(HorseEnum.HorseDebris, item.itemId)) { return false; } break; case 26: if (!petDatas.IsHint(PetEnum.PetDebris, item.itemId)) { return false; } break; case 27: if (!petDatas.IsHint(PetEnum.PetDan, item.itemId)) { return false; } break; case 28: if (!petDatas.IsHint(PetEnum.PetStone, item.itemId)) { return false; } break; case 25: if (!ModelCenter.Instance.GetModel<GemModel>().SatisfyBetter(item.itemId)) { return false; } break; case 39: if (!IsBetterWings(item)) { return false; } break; case 52: if (!strengthDatas.IsHint(item.itemId)) { return false; } break; case 127: var error = 0; bool isHaveMakeNum = ItemOperateUtility.Instance.CanUseItem(item.itemPlace, 1, out error); int remainNum = CrossServerOneVsOnePlayerInfo.Instance.GetDayRemainNum(); if (!CrossServerOneVsOnePKSeason.Instance.isSatisfyMatch || remainNum > 0 || !isHaveMakeNum) { return false; } break; default: break; } switch (item.itemId) { case 951: if (!CheckIsExtendGrid(item.itemId)) { return false; } break; case 952: int willTime = HangUpSetModel.Instance.offlinePluginTime + item.config.EffectValueA1; if (HangUpSetModel.Instance.offlinePluginTime >= HangUpSetModel.Instance.maxOfflinePluginTime) { return false; } break; } return true; } private bool IsBetterWings(ItemModel item) { if (item == null) { return false; } var putModel = playerPack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.Wing); var singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) { return false; } int[] composeTypes = item.config.JumpComposeCondi; bool isOpenCompose = false; if (composeTypes != null && composeTypes.Length >= 3) { int first = composeTypes[0]; int second = composeTypes[1]; int third = composeTypes[2]; ComposeWinModel.ComposeThirdTypeData thirdTypeData = null; composeModel.TryGetThirdTypeData(first, second, third, out thirdTypeData); if (thirdTypeData != null) { var itemCompound = thirdTypeData.itemCompound; if (itemCompound.levelNeed <= PlayerDatas.Instance.baseData.LV) { isOpenCompose = true; } } } if (!isOpenCompose) { return false; } if (putModel != null && putModel.config.LV >= item.config.LV) { return false; } var itemModels = singlePack.GetItemsByType((int)ItemType.Wings); if (itemModels != null) { for (int i = 0; i < itemModels.Count; i++) { if (itemModels[i].config.JobLimit / 100 == PlayerDatas.Instance.baseData.Job) { if (itemModels[i].config.LV >= item.config.LV) { return false; } } } } return true; } private bool CheckIsExtendGrid(int itemId) { SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return false; int startLockIndex = singlePack.unlockedGridCount - GeneralDefine.initBagGridCount; FuncConfigConfig _tagFuncModel = FuncConfigConfig.Get("OpenBagItem"); int haveCount = playerPack.GetItemCountByID(PackType.Item, itemId); Equation.Instance.Clear(); Equation.Instance.AddKeyValue("index", startLockIndex + 1); int needTool = Equation.Instance.Eval<int>(_tagFuncModel.Numerical2); if (haveCount >= needTool) { return true; } else { return false; } } public event Action<string> GetBetterEquipEvent; //得到更好的装备 value 物品的实例ID public void OnGetEquip(ItemModel item) { if (item == null) { return; } if (item.packType != PackType.Item && item.packType != PackType.JadeDynastyItem) { return; } if (!IsSameJob(item.config.JobLimit)) { return; } int equipPlace = item.config.EquipPlace; switch ((RoleEquipType)equipPlace) { case RoleEquipType.Weapon: case RoleEquipType.Weapon2: case RoleEquipType.Hat: case RoleEquipType.Clothes: case RoleEquipType.Belt: case RoleEquipType.Trousers: case RoleEquipType.Shoes: case RoleEquipType.Neck: case RoleEquipType.FairyCan: case RoleEquipType.FairyCan2: case RoleEquipType.Wing: case RoleEquipType.SpiritAnimal: case RoleEquipType.JadeDynasty_Cloak: case RoleEquipType.JadeDynasty_FaceMask: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Glove2: case RoleEquipType.JadeDynasty_Ruyi: case RoleEquipType.JadeDynasty_Pendant: case RoleEquipType.JadeDynasty_Ring1: case RoleEquipType.JadeDynasty_Ring2: case RoleEquipType.JadeDynasty_Sword1: case RoleEquipType.JadeDynasty_Sword2: case RoleEquipType.JadeDynasty_Sword3: case RoleEquipType.JadeDynasty_Sword4: if (betterEquipExceptDungeonDict.ContainsKey(PlayerDatas.Instance.baseData.MapID)) { if (betterEquipExceptDungeonDict[PlayerDatas.Instance.baseData.MapID].Contains(item.itemId)) { return; } } SetGetBetterEquipEvent(item); break; } } bool IsSameJob(int jobLimit) { return jobLimit == 0 || jobLimit / 100 == PlayerDatas.Instance.baseData.Job; } private void SetGetBetterEquipEvent(ItemModel model) { List<int> itemEffectTime = model.GetUseDataModel((int)ItemUseDataKey.createTime); if (itemEffectTime != null) { if (itemEffectTime[0] != 0) { ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(model.guid); double remainTime = 0; if (cool != null) { remainTime = cool.GetRemainTime(); } if (remainTime >= 0 && remainTime < 120 && model.config.ExpireTime > 0) { return; } } } int isFightUp = IsFightUp(model.itemId, model.equipScore); int equipPlace = model.config.EquipPlace; if (isFightUp == 1) { switch (equipPlace) { case 9: break; default: if (model.packType == PackType.Item) { var equipItemModel = playerPack.GetItemByIndex(PackType.Equip, model.config.EquipPlace); if (PlayerDatas.Instance.baseData.LV >= 200) { if (model.equipPlace > (int)RoleEquipType.Weapon2 && model.equipPlace < (int)RoleEquipType.Neck) { if (equipItemModel != null && equipItemModel.config.ItemColor > model.config.ItemColor) { return; } } } } break; } if (GetBetterEquipEvent != null) { GetBetterEquipEvent(model.guid); } } } public event Action<PackType, string> PickItemEvent; //捡起的物品 public void RefreshPickItem(PackType type, string guid) { if (type != PackType.Item) return; if (PickItemEvent != null) { PickItemEvent(type, guid); } } Dictionary<int, ItemModel> RealmBetterDict = new Dictionary<int, ItemModel>(); public Dictionary<int, ItemModel> CheckBetterEquipByRealm() { RealmBetterDict.Clear(); SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return RealmBetterDict; int realmLv = PlayerDatas.Instance.baseData.realmLevel; Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); foreach (var model in pairs.Values) { if (model.config.EquipPlace > 0 && model.config.EquipPlace != (int)RoleEquipType.SpiritAnimal && model.config.RealmLimit <= realmLv && !IsOverdue(model.guid, model.itemId, model.useDataDict) && IsFightUp(model.itemId, model.equipScore) == 1) { if (!RealmBetterDict.ContainsKey(model.equipPlace)) { RealmBetterDict.Add(model.equipPlace, model); } else { if (model.equipScore > RealmBetterDict[model.equipPlace].equipScore) { RealmBetterDict[model.equipPlace] = model; } } } } return RealmBetterDict; } List<ItemModel> RealmDruglist = new List<ItemModel>(); public List<ItemModel> GetDruglistByRealm() { RealmDruglist.Clear(); SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return RealmDruglist; int realmLv = PlayerDatas.Instance.baseData.realmLevel; Dictionary<int, ItemModel> pairs = singlePack.GetAllItems(); foreach (var model in pairs.Values) { if (playerPack.CheckIsDrugById(model.itemId)) { AttrFruitConfig fruitConfig = AttrFruitConfig.Get(model.itemId); if (!playerPack.IsReachMaxUseDrug(fruitConfig) && model.config.RealmLimit <= realmLv) { RealmDruglist.Add(model); } } } return RealmDruglist; } #endregion #region 物品处于CD中的逻辑处理 private List<string> itemEffectTimelist = new List<string>(); //key 物品实例ID /// <summary> /// 物品使用时间限制 /// </summary> public void SetItemEffectCDTime(string guid, int itemID, int getTime, int serverSurplusTime) { double time = GetTimeOffest(TimeUtility.GetTime((uint)getTime)); if (time < 0) { time = 0; } ItemConfig itemConfig = ItemConfig.Get(itemID); if (time >= itemConfig.ExpireTime) { KnapsackTimeCDMgr.Instance.UnRegister(guid); return; } double remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time; KnapsackTimeCDMgr.Instance.Register(guid, itemID, remainTime); } public double GetTimeOffest(DateTime getTime) { DebugEx.Log("现在时间:" + TimeUtility.ServerNow + "获得时间:" + getTime); //TimeUtility.SyncServerTime(); TimeSpan t = TimeUtility.ServerNow - getTime; DebugEx.Log("时间差:" + t.TotalSeconds); return t.TotalSeconds; } #endregion #region 设置可以一键出售的物品数据 private int playerLv; private Dictionary<int, List<ItemModel>> _lifePotionDict = new Dictionary<int, List<ItemModel>>(); //key 药水等级 private List<int> _sellItemScorelist = new List<int>(); private Dictionary<int, Dictionary<int, List<ItemModel>>> _sameIndexEquipDict = new Dictionary<int, Dictionary<int, List<ItemModel>>>(); //存储相同装备位的装备 // private _sameEquipScoreDict = new Dictionary<int, List<ItemModel>>(); //存储相同ID中相同装备评分的装备 private Dictionary<int, ItemModel> _packModelDict; private List<ItemModel> _sellItemlist = new List<ItemModel>(); public List<ItemModel> GetSellItemList() { GetOneKeySellModel(); _sellItemlist.Sort(SetSellItemOrder); return _sellItemlist; } public int SetSellItemOrder(ItemModel startModel, ItemModel endModel) { bool startIsEquip = IsEquip(startModel); bool endIsEquip = IsEquip(endModel); if (startIsEquip.CompareTo(endIsEquip) != 0) return -startIsEquip.CompareTo(endIsEquip); int order1 = startModel.config.Type; int order2 = endModel.config.Type; if (order1.CompareTo(order2) != 0) return order1.CompareTo(order2); int color1 = startModel.config.ItemColor; int color2 = endModel.config.ItemColor; if (color1.CompareTo(color2) != 0) return -color1.CompareTo(color2); int code1 = startModel.itemId; int code2 = endModel.itemId; if (code1.CompareTo(code2) != 0) return -code1.CompareTo(code2); return 0; } public bool IsEquip(ItemModel model) { return model.config.EquipPlace != 0; } public void GetOneKeySellModel() { SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack == null) return; _sellItemlist.Clear(); _lifePotionDict.Clear(); _sameIndexEquipDict.Clear(); _sellItemScorelist.Clear(); playerLv = PlayerDatas.Instance.baseData.LV; _packModelDict = singlePack.GetAllItems(); foreach (var key in _packModelDict.Keys) { GetCanSellEquipList(_packModelDict[key]); ItemModel itemModel = _packModelDict[key]; if (drugIDs.Contains(itemModel.itemId)) { if (!_lifePotionDict.ContainsKey(itemModel.config.LV)) { List<ItemModel> modellist = new List<ItemModel>(); modellist.Add(itemModel); _lifePotionDict.Add(itemModel.config.LV, modellist); } else { _lifePotionDict[itemModel.config.LV].Add(itemModel); } } } #region 得到可以出售的装备 foreach (var key in _sameIndexEquipDict.Keys) { _sellItemScorelist = _sameIndexEquipDict[key].Keys.ToList(); _sellItemScorelist.Sort(); if (_sellItemScorelist.Count > 0) { int score = 0; int curJob = PlayerDatas.Instance.baseData.Job; for (score = _sellItemScorelist.Count - 1; score > -1; score--) { SinglePack equipPack = playerPack.GetSinglePack(PackType.Equip); ItemModel model = null; if (equipPack != null) { model = equipPack.GetItemByIndex(key); } List<ItemModel> modellist = _sameIndexEquipDict[key][_sellItemScorelist[score]]; int i = 0; bool remainBetter = true; for (i = 0; i < modellist.Count; i++) { double joblimit = Math.Floor((double)modellist[i].config.JobLimit / 100); if (model != null) { if (remainBetter) { if (model.equipScore < _sellItemScorelist[score] && curJob == joblimit) { _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); remainBetter = false; break; } } } else { if (curJob == joblimit) { if (remainBetter) { _sameIndexEquipDict[key].Remove(_sellItemScorelist[score]); remainBetter = false; break; } } } } if (!remainBetter) { break; } } int j = 0; for (j = 0; j < _sellItemScorelist.Count; j++) { if (_sameIndexEquipDict[key].ContainsKey(_sellItemScorelist[j])) { int k = 0; List<ItemModel> sellModlelist = _sameIndexEquipDict[key][_sellItemScorelist[j]]; for (k = 0; k < sellModlelist.Count; k++) { _sellItemlist.Add(sellModlelist[k]); } } } } } #endregion List<int> drugLvlist = new List<int>(); drugLvlist.AddRange(_lifePotionDict.Keys.ToList()); drugLvlist.Sort(); for (int i = drugLvlist.Count - 1; i > -1; i--) { if (drugLvlist[i] > playerLv) { _lifePotionDict.Remove(drugLvlist[i]); } else { _lifePotionDict.Remove(drugLvlist[i]); break; } } foreach (var list in _lifePotionDict.Values) { for (int i = 0; i < list.Count; i++) { _sellItemlist.Add(list[i]); } } } //得到满足出售条件的装备列表 public void GetCanSellEquipList(ItemModel model) { if (model.config.EquipPlace == 0 || !onekeySellTypes.Contains(model.config.Type)) return; Dictionary<int, List<ItemModel>> sameScoreDict; List<ItemModel> sameScorelist; if (model.config.ItemColor < 3) { if (!_sameIndexEquipDict.ContainsKey(model.config.EquipPlace)) { sameScoreDict = new Dictionary<int, List<ItemModel>>(); sameScorelist = new List<ItemModel>(); sameScorelist.Add(model); sameScoreDict.Add(model.equipScore, sameScorelist); _sameIndexEquipDict.Add(model.config.EquipPlace, sameScoreDict); } else { if (_sameIndexEquipDict[model.config.EquipPlace].ContainsKey(model.equipScore)) { _sameIndexEquipDict[model.config.EquipPlace][model.equipScore].Add(model); } else { sameScorelist = new List<ItemModel>(); sameScorelist.Add(model); _sameIndexEquipDict[model.config.EquipPlace].Add(model.equipScore, sameScorelist); } } } } #endregion #region 发送请求 /// <summary> /// 一键出售物品的请求 /// </summary> /// <param name="_oneKeySelllist"></param> public void SendOneKeySellQuest(List<ItemModel> _oneKeySelllist) { if (!isPackResetOk || SettingEffectMgr.Instance.isStartOneKeySell) return; SettingEffectMgr.Instance.isStartOneKeySell = true; byte[] itemIndexs = new byte[_oneKeySelllist.Count]; int i = 0; for (i = 0; i < _oneKeySelllist.Count; i++) { itemIndexs[i] = (byte)_oneKeySelllist[i].itemPlace; } CA311_tagCMSellItem sellItem = new CA311_tagCMSellItem(); sellItem.PackType = (int)PackType.Item; sellItem.Count = (byte)_oneKeySelllist.Count; sellItem.ItemIndex = itemIndexs; GameNetSystem.Instance.SendInfo(sellItem); } /// <summary> /// 整理包裹物品 /// </summary> /// <param name="type"></param> public bool isPackResetOk { get; set; } public void SendPackResetQuest(PackType type) { if (lookLineIndex > -1) { SetLookIndex(null); } if (KnapSackWin.titleType == KnapsackFuncTitle.bag) { playerPack.isPlayBetterEquipEffect = true; } SinglePack singlePack = playerPack.GetSinglePack(type); if (singlePack != null) { C070F_tagCItemPackReset packReset = new C070F_tagCItemPackReset(); packReset.Type = (byte)type; packReset.ItemBeginIndex = 0; packReset.ItemEndIndex = (ushort)(singlePack.unlockedGridCount - 1); GameNetSystem.Instance.SendInfo(packReset); //整理物品 if (type == PackType.Item) { isPackResetOk = false; } } } #endregion #region 查看某个位置的物品 public event Action lookEquipEvent; private int _lookLineIndex = -1; public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } } public string lookItemGUID { get; private set; } public void SetLookIndex(string guid, int singleRowCount = 5) { if (string.IsNullOrEmpty(guid) || guid == "") { lookLineIndex = -1; } else { int index = playerPack.GetItemByGuid(guid).itemPlace; lookLineIndex = index / singleRowCount; lookItemGUID = guid; } if (lookEquipEvent != null) { lookEquipEvent(); } } #endregion #region 判断是否有更好的装备替换 /// <summary> /// 过滤装备位判断 /// </summary> /// <param name="ignoreType"></param> /// <returns></returns> public bool CheckBetterEquip(RoleEquipType ignoreType) { SinglePack singlePack = playerPack.GetSinglePack(PackType.Equip); if (singlePack != null) { Dictionary<int, ItemModel> putOnDic = singlePack.GetAllItems(); foreach (var key in putOnDic.Keys) { if ((RoleEquipType)key == ignoreType) { continue; } if (key < 13) { List<ItemModel> itemlist = GetSameEquipPlacelist(key); int i = 0; for (i = 0; i < itemlist.Count; i++) { bool isOverdue = IsOverdue(itemlist[i].guid, itemlist[i].itemId, itemlist[i].useDataDict); bool isRealm = PlayerDatas.Instance.baseData.realmLevel >= itemlist[i].config.RealmLimit ? true : false; if (itemlist[i].equipScore > putOnDic[key].equipScore && !isOverdue && isRealm) { return true; } } } } } else { int i = 1; for (i = 1; i < 13; i++) { List<ItemModel> itemlist = GetSameEquipPlacelist(i); if (itemlist.Count > 0) { return true; } } } return false; } private List<ItemModel> GetSameEquipPlacelist(int equipPlace) { List<ItemModel> modellist = new List<ItemModel>(); Dictionary<int, ItemModel> dic = null; SinglePack singlePack = playerPack.GetSinglePack(PackType.Item); if (singlePack != null) { dic = singlePack.GetAllItems(); foreach (var model in dic.Values) { if (model.config.EquipPlace == equipPlace) { double equipJob = Math.Floor((double)model.config.JobLimit / 100); if (equipJob == 0 || equipJob == PlayerDatas.Instance.baseData.Job) { modellist.Add(model); } } } } return modellist; } /// <summary> /// 获取装备评分最高可提升战力的装备 /// </summary> /// <param name="_places"></param> /// <returns></returns> public string GetHighestScoreEquipByPlace(int equipPlace) { var itemPackage = playerPack.GetSinglePack(PackType.Item); var allItems = itemPackage.GetAllItems(); ItemModel putModel = playerPack.GetItemByIndex(PackType.Equip, equipPlace); equipPlace = (equipPlace == 9 || equipPlace == 10) ? 9 : equipPlace; var guid = string.Empty; var equips = new List<string>(); var score = putModel == null ? 0 : putModel.equipScore; var job = PlayerDatas.Instance.baseData.Job; foreach (var item in allItems.Values) { if (item.config.EquipPlace == equipPlace) { if (!IsOverdue(item.guid, item.itemId, item.useDataDict) && (item.config.JobLimit == 0 || (item.config.JobLimit / 100) == job) && item.equipScore > score) { guid = item.guid; score = item.equipScore; } } } return guid; } #endregion #region 背包整理后好的同类型最好的装备 Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>(); // key1 装备位置索引 key2 背包位置索引 public void ClearSortedBetterEquip() { itemModelDict.Clear(); } public void SetBagSortBetterEquipList(ItemModel itemModel) { if (itemModel == null || itemModel.packType != PackType.Item) return; if (!IsCanPutOn(itemModel)) return; int equipPlace = itemModel.config.EquipPlace; if (!itemModelDict.ContainsKey(equipPlace)) { Dictionary<int, ItemModel> dict = new Dictionary<int, ItemModel>(); if (IsFightUp(itemModel.itemId, itemModel.equipScore) == 1) { dict.Add(itemModel.itemPlace, itemModel); itemModelDict.Add(equipPlace, dict); } } else { if (IsFightUp(itemModel.itemId, itemModel.equipScore) == 1) { itemModelDict[equipPlace].Add(itemModel.itemPlace, itemModel); } } } public ItemModel GetBagSortBetterEquip(int equipPlace, int index) { ItemModel itemModel = null; if (itemModelDict.ContainsKey(equipPlace)) { itemModelDict[equipPlace].TryGetValue(index, out itemModel); } return itemModel; } public bool IsCanPutOn(ItemModel itemModel) { double equipJob = Math.Floor((double)itemModel.config.JobLimit / 100); int playerJob = PlayerDatas.Instance.baseData.Job; int equipPlace = itemModel.config.EquipPlace; if (equipPlace == 0 || equipPlace > 12) return false; if (equipJob != 0 && equipJob != playerJob) return false; List<int> putOnlimitList = itemModel.GetUseDataModel((int)ItemUseDataKey.cancelUseLimit); if (putOnlimitList != null) { if (putOnlimitList[0] == 1) { return true; } } return CheckPutOnRealm(itemModel.config); } private bool CheckPutOnRealm(ItemConfig config) { var _realmLv = config.RealmLimit; if (PlayerDatas.Instance.baseData.realmLevel < _realmLv) { return false; } return true; } #endregion #region 得到物品的品质颜色 private Dictionary<int, int> wingRefineQualityDict; private int[] wingsQualitys; private int[] wingsRefineExps; public int GetItemQuality(int itemId, Dictionary<int, List<int>> useDataDic = null) { wingsQualitys = null; wingsRefineExps = null; ItemConfig itemConfig = ItemConfig.Get(itemId); wingRefineQualityDict = WingRefineAttrConfig.GetWingsQualityModel(itemConfig.LV); if (useDataDic != null) { if (useDataDic.ContainsKey(42) && wingRefineQualityDict != null) { wingsQualitys = wingRefineQualityDict.Keys.ToArray(); wingsRefineExps = wingRefineQualityDict.Values.ToArray(); int i = 0; for (i = wingsRefineExps.Length - 1; i > -1; i--) { if (useDataDic[42][0] >= wingsRefineExps[i]) { return wingsQualitys[i]; } } } } return itemConfig.ItemColor; } #endregion //设置玩家货币显示 public string OnChangeCoinsUnit(ulong value) { string strCoins = value.ToString(); if (strCoins.Length > 4 && strCoins.Length < 9) { double coins = Math.Floor((double)value / 10000); strCoins = coins + Language.Get("KnapS114"); } else if (strCoins.Length >= 9 && strCoins.Length < 13) { double coins = Math.Floor((double)value / 100000000); strCoins = coins + Language.Get("KnapS115"); } else if (strCoins.Length >= 13 && strCoins.Length < 19) { double coins = Math.Floor((double)value / 1000000000000); strCoins = coins + Language.Get("KnapS126"); } else if (strCoins.Length >= 19) { ServerTipDetails.DisplayNormalTip(Language.Get("KnapS127")); } return strCoins; } /// <summary> /// 装备是否可以提升战力 /// </summary> /// <param name="_itemID"></param> /// <param name="_score"></param> /// <returns></returns> public int IsFightUp(int _itemID, int _score)//-1低级,0不是本职业,1更好 { ItemConfig chinItemModel = ItemConfig.Get(_itemID); if (chinItemModel != null) { ItemModel putOnModel = null; switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.Clothes: case RoleEquipType.FairyCan: case RoleEquipType.Belt: case RoleEquipType.Hat: case RoleEquipType.Neck: case RoleEquipType.Shoes: case RoleEquipType.SpiritAnimal: case RoleEquipType.Trousers: case RoleEquipType.Weapon: case RoleEquipType.Weapon2: case RoleEquipType.Wing: putOnModel = playerPack.GetItemByIndex(PackType.Equip, chinItemModel.EquipPlace); break; case RoleEquipType.JadeDynasty_Cloak: case RoleEquipType.JadeDynasty_FaceMask: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Pendant: case RoleEquipType.JadeDynasty_Ring1: case RoleEquipType.JadeDynasty_Ruyi: case RoleEquipType.JadeDynasty_Sword1: case RoleEquipType.JadeDynasty_Sword2: case RoleEquipType.JadeDynasty_Sword3: case RoleEquipType.JadeDynasty_Sword4: putOnModel = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, chinItemModel.EquipPlace); break; default: return 0; } ItemModel putOnModel2 = null; switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.FairyCan: putOnModel2 = playerPack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.FairyCan2); break; case RoleEquipType.JadeDynasty_Glove1: putOnModel2 = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, (int)RoleEquipType.JadeDynasty_Glove2); break; case RoleEquipType.JadeDynasty_Ring1: putOnModel2 = playerPack.GetItemByIndex(PackType.JadeDynastyEquip, (int)RoleEquipType.JadeDynasty_Ring2); break; } switch ((RoleEquipType)chinItemModel.EquipPlace) { case RoleEquipType.FairyCan: case RoleEquipType.JadeDynasty_Glove1: case RoleEquipType.JadeDynasty_Ring1: if (putOnModel2 != null) { if (putOnModel != null) { if (putOnModel2.equipScore < putOnModel.equipScore) { putOnModel = putOnModel2; } } } else { putOnModel = putOnModel2; } break; } int equipScore1 = 0; if (putOnModel != null) { equipScore1 = (int)putOnModel.equipScore; } int playerJob = PlayerDatas.Instance.baseData.Job; if (playerJob == Math.Floor((double)chinItemModel.JobLimit / 100) || chinItemModel.JobLimit == 0) { if (equipScore1 > _score) return -1; else if (equipScore1 < _score) return 1; else return 0; } else { return 0; } } return 0; } #region 物品是否过期 public bool IsOverdue(string guid, int itemId, Dictionary<int, List<int>> useDataDict = null) { ItemConfig itemConfig = ItemConfig.Get(itemId); if (itemConfig == null) return false; if (itemConfig.ExpireTime > 0) { ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(guid); switch ((EquipReduceType)itemConfig.EndureReduceType) { case EquipReduceType.Def_EquipReduceType_Time: if (guid != "") { List<int> itemEffectTime = null; if (useDataDict != null) { if (useDataDict.ContainsKey((int)ItemUseDataKey.createTime)) { itemEffectTime = useDataDict[(int)ItemUseDataKey.createTime]; } } if (itemEffectTime != null && itemEffectTime[0] != 0) { if (cool == null || cool.GetRemainTime() <= 0) { return true; } } } break; case EquipReduceType.Def_EquipReduceType_RTimeItem: if (guid != "") { if (cool == null || cool.GetRemainTime() <= 0) { return true; } } break; } } return false; } #endregion } } System/KnapSack/Logic/ItemLogicUtility.cs.meta
System/KnapSack/Logic/ItemModel.cs
@@ -37,8 +37,6 @@ public int isSuite { get { return itemInfo == null ? 0 : itemInfo.isSuite; } } public int preItemCount { get; private set; } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } public ItemModel(PackType type) { packType = type; @@ -60,7 +58,7 @@ serverSurplusTime = useDataDict[48][0]; } this.equipScore = modelInterface.GetEquipScore(packType, itemId, useDataDict); this.equipScore = ItemLogicUtility.Instance.GetEquipScore(packType, itemId, useDataDict); if (GetUseDataModel((int)ItemUseDataKey.itemCount) != null) { itemInfo.count = GetUseDataModel((int)ItemUseDataKey.itemCount)[0]; @@ -78,7 +76,7 @@ case EquipReduceType.Def_EquipReduceType_ATK: break; case EquipReduceType.Def_EquipReduceType_Time: modelInterface.SetItemEffectCDTime(info.guid, info.itemId, itemEffectTime[0], serverSurplusTime); ItemLogicUtility.Instance.SetItemEffectCDTime(info.guid, info.itemId, itemEffectTime[0], serverSurplusTime); break; case EquipReduceType.Def_EquipReduceType_AttackValue: break; @@ -91,7 +89,7 @@ case EquipReduceType.Def_EquipReduceType_Horse: break; case EquipReduceType.Def_EquipReduceType_RTimeItem: modelInterface.SetItemEffectCDTime(info.guid, info.itemId, itemEffectTime[0], serverSurplusTime); ItemLogicUtility.Instance.SetItemEffectCDTime(info.guid, info.itemId, itemEffectTime[0], serverSurplusTime); break; case EquipReduceType.Def_EquipReduceType_Day: break; System/KnapSack/Logic/ItemOperateUtility.cs
@@ -13,7 +13,6 @@ ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } PlayerStrengthengDatas strengthModel { get { return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>(); } } EquipWashModel equipWashModel { get { return ModelCenter.Instance.GetModel<EquipWashModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } PlayerBuffDatas Buffmodel { get { return ModelCenter.Instance.GetModel<PlayerBuffDatas>(); } } ItemOverdueModel itemOverdue { get { return ModelCenter.Instance.GetModel<ItemOverdueModel>(); } } FairyModel fairyModel { get { return ModelCenter.Instance.GetModel<FairyModel>(); } } @@ -1208,7 +1207,7 @@ { if (attrData.itemConfig.EquipPlace > 0 && attrData.itemConfig.EquipPlace <= (int)RoleEquipType.SpiritAnimal) { bool isOverdue = modelInterface.IsOverdue(attrData.guid, attrData.itemConfig.ID, attrData.useDataDict); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(attrData.guid, attrData.itemConfig.ID, attrData.useDataDict); bool isLimit = Math.Floor((double)attrData.itemConfig.JobLimit / 100) == PlayerDatas.Instance.baseData.Job || attrData.itemConfig.JobLimit == 0 ? true : false; var putModel = playerPack.GetItemByIndex(PackType.Equip, attrData.itemConfig.EquipPlace); System/KnapSack/Logic/ItemOverdueModel.cs
@@ -20,10 +20,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public Dictionary<int, string> guardOverdueIconDict { get; private set; } Dictionary<string, OverdueItem> itemStack = new Dictionary<string, OverdueItem>(); @@ -262,7 +258,7 @@ models = pairs[idlist[i]]; for (int j = 0; j < models.Count; j++) { if (!modelInterface.IsOverdue(models[j].guid, models[j].itemId, models[j].useDataDict)) if (!ItemLogicUtility.Instance.IsOverdue(models[j].guid, models[j].itemId, models[j].useDataDict)) { isOverdue = false; break; @@ -325,7 +321,7 @@ models = allGuardDict[type][idlist[i]]; for (int j = 0; j < models.Count; j++) { if (!modelInterface.IsOverdue(models[j].guid, models[j].itemId, models[j].useDataDict)) if (!ItemLogicUtility.Instance.IsOverdue(models[j].guid, models[j].itemId, models[j].useDataDict)) { isOverdue = false; break; System/KnapSack/Logic/ItemTipsModel.cs
@@ -47,7 +47,6 @@ PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } StoreModel m_storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } FashionDressModel fashionDress { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } DogzModel dogzModel { get { return ModelCenter.Instance.GetModel<DogzModel>(); } } @@ -780,7 +779,7 @@ var horseModel = ModelCenter.Instance.GetModel<PlayerMountDatas>(); var petmodel = ModelCenter.Instance.GetModel<PlayerPetDatas>(); bool isOverdue = modelInterface.IsOverdue(attrData.guid, attrData.itemId, attrData.useDataDict); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(attrData.guid, attrData.itemId, attrData.useDataDict); HorseConfig horseConfig = null; PetInfoConfig petInfo = null; switch (attrData.itemConfig.Type) @@ -1038,7 +1037,7 @@ { if (attrData == null) return; bool isOverdue = modelInterface.IsOverdue(attrData.guid, attrData.itemId, attrData.useDataDict); 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); }); @@ -2634,7 +2633,6 @@ public bool isHavePutLimit { get; private set; } PlayerStrengthengDatas strengthengmodel { get { return ModelCenter.Instance.GetModel<PlayerStrengthengDatas>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } EquipWashModel washModel { get { return ModelCenter.Instance.GetModel<EquipWashModel>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } PlayerSuitModel SuitModel { get { return ModelCenter.Instance.GetModel<PlayerSuitModel>(); } } @@ -2769,7 +2767,7 @@ SetWingsRefineMat(GetUseDataModel((int)ItemUseDataKey.wingMaterialItemID), GetUseDataModel((int)ItemUseDataKey.wingMaterialItemCount)); } } this.score = modelInterface.GetEquipScore(type, id, useDataDict, isPreview); this.score = ItemLogicUtility.Instance.GetEquipScore(type, id, useDataDict, isPreview); PetEatEquipConfig petEatConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(itemConfig.ItemColor, itemConfig.LV);//仙盟仓库装备积分兑换表 this.unionWarehouseScore = 0; if (petEatConfig != null) @@ -3188,7 +3186,7 @@ int serverSurplusTime = serverSurplusTimes != null ? serverSurplusTimes[0] : 0; if (getTime > 0) { double time = modelInterface.GetTimeOffest(TimeUtility.GetTime((uint)getTime)); double time = ItemLogicUtility.Instance.GetTimeOffest(TimeUtility.GetTime((uint)getTime)); time = time > 0 ? time : 0; remainTime = (serverSurplusTime > 0 ? serverSurplusTime : itemConfig.ExpireTime) - time; } System/KnapSack/Logic/PlayerPackModels.cs
@@ -148,7 +148,6 @@ } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } public event Action<PackType> refrechPackEvent; //刷新整个背包数据 @@ -180,7 +179,7 @@ if (isPlayBetterEquipEffect) { modelInterface.ClearSortedBetterEquip(); ItemLogicUtility.Instance.ClearSortedBetterEquip(); } for (int i = 0; i < packInfo.ItemCount; i++) @@ -191,7 +190,7 @@ if (isPlayBetterEquipEffect) { modelInterface.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid)); ItemLogicUtility.Instance.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid)); } } @@ -280,8 +279,8 @@ { itemCntAddEvent(type, itemModel.itemPlace, itemModel.itemId); } modelInterface.RecommendItem(itemModel); modelInterface.RefreshPickItem(type, itemModel.guid); ItemLogicUtility.Instance.RecommendItem(itemModel); ItemLogicUtility.Instance.RefreshPickItem(type, itemModel.guid); } else { @@ -364,7 +363,7 @@ public void PackResetOk(H0316_tagPackResetOK packreset) { modelInterface.isPackResetOk = true; ItemLogicUtility.Instance.isPackResetOk = true; } public void UseItemSuccess(H0706_tagUseItemSuccess success) @@ -767,9 +766,9 @@ } if (!isOverdue) { modelInterface.RecommendItem(itemModel); modelInterface.OnGetEquip(itemModel); modelInterface.RefreshPickItem(itemModel.packType, itemModel.guid); ItemLogicUtility.Instance.RecommendItem(itemModel); ItemLogicUtility.Instance.OnGetEquip(itemModel); ItemLogicUtility.Instance.RefreshPickItem(itemModel.packType, itemModel.guid); } } @@ -1458,7 +1457,7 @@ { preciousCnt += itemModels[i].count; } else if (modelInterface.IsFightUp(itemModels[i].itemId, itemModels[i].equipScore) == 1) else if (ItemLogicUtility.Instance.IsFightUp(itemModels[i].itemId, itemModels[i].equipScore) == 1) { betterEquipCnt += itemModels[i].count; } @@ -1667,7 +1666,7 @@ PetEatEquipConfig eatEquipConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(model.config.ItemColor, model.config.LV); if (eatEquipConfig == null) return false; if (modelInterface.IsFightUp(model.itemId, model.equipScore) != 1) if (ItemLogicUtility.Instance.IsFightUp(model.itemId, model.equipScore) != 1) { if (model.config.ItemColor <= (int)colorType && model.config.LV <= (int)lvType @@ -1786,7 +1785,7 @@ public void SendEquipdevourQuest() { List<ItemModel> itemModels = GetCanDevourModellist(); if (itemModels == null || itemModels.Count < minDecomposeNum || !modelInterface.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return; if (itemModels == null || itemModels.Count < minDecomposeNum || !ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return; SettingEffectMgr.Instance.isStartDecompose = true; isAutoDecompose = true; System/KnapSack/Logic/SinglePack.cs
@@ -12,7 +12,6 @@ public int unlockedGridCount { get; private set; } private Dictionary<int, ItemModel> items = new Dictionary<int, ItemModel>(); //key 物品位置索引 PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public SinglePack(PackType type) System/KnapSack/Logic/UnionWarehouseEquipTip.cs
@@ -125,12 +125,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemAttrData itemAttrData; Color32 conditionColor = new Color32(255, 244, 205, 255); private int curAttrTypeNum = 0; System/KnapSack/Logic/WingsTip.cs
@@ -87,12 +87,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemAttrData itemAttrData; private int curAttrTypeNum = 0; @@ -154,7 +148,7 @@ { #region 设置TopUI titleText.text = itemTipsModel.GetItemTipsTitle(itemAttrData); titleText.color = UIHelper.GetUIColor(modelInterface.GetItemQuality(itemAttrData.itemId,itemAttrData.useDataDict)); titleText.color = UIHelper.GetUIColor(ItemLogicUtility.Instance.GetItemQuality(itemAttrData.itemId,itemAttrData.useDataDict)); ItemCellModel cellModel = new ItemCellModel(itemAttrData.itemId, itemAttrData.isPreview, (ulong)itemAttrData.count, itemAttrData.isBind, itemAttrData.guid,itemAttrData.packType ,itemAttrData.isCompare, itemAttrData.useDataDict); itemCell.Init(cellModel); System/KnapSack/New/BagWin.cs
@@ -39,11 +39,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } private GridCell _lookEquipCell = null; #region Built-in @@ -304,9 +299,9 @@ if (playerPack.isPlayBetterEquipEffect) { if (modelInterface.GetBagSortBetterEquip(itemModel.config.EquipPlace, itemModel.itemPlace) != null) if (ItemLogicUtility.Instance.GetBagSortBetterEquip(itemModel.config.EquipPlace, itemModel.itemPlace) != null) { bool isOverdue = modelInterface.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); bool isOverdue = ItemLogicUtility.Instance.IsOverdue(itemModel.guid, itemModel.itemId, itemModel.useDataDict); if (!isOverdue) { gridCell.uiEffect.Play(); System/KnapSack/New/CommonItemBaisc.cs
@@ -107,12 +107,6 @@ public ItemConfig itemConfig; PackModelInterface _modelInterface; protected PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel _playerPack; protected PlayerPackModel playerPack { @@ -149,7 +143,7 @@ itemIcon.gameObject.SetActive(true); bgIcon.gameObject.SetActive(true); itemIcon.SetSprite(itemConfig.IconKey); bgIcon.SetItemBackGround(modelInterface.GetItemQuality(itemId, useDataDic)); bgIcon.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemId, useDataDic)); int i = 0; for(i = 0; i < starlist.transform.childCount; i++) @@ -223,7 +217,7 @@ || type == PackType.JadeDynastyEquip))) return 0; ItemModel model = playerPack.GetItemByGuid(guid); if (model != null && modelInterface.IsOverdue(guid, itemId, model.useDataDict)) return 1; if (model != null && ItemLogicUtility.Instance.IsOverdue(guid, itemId, model.useDataDict)) return 1; if (playerJob != Math.Floor((double)config.JobLimit / 100) && config.JobLimit != 0) return 1; if (isCompare) @@ -331,12 +325,6 @@ public Dictionary<int, int> specAttrDic { get; private set; } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public ItemCellModel(int itemId,bool isPreview = false,ulong count = 0,int isBind = 0,string guid = "",PackType type = PackType.Deleted,bool isCompare = false, Dictionary<int, List<int>> useDataDic = null) { specAttrDic = new Dictionary<int, int>(); @@ -353,7 +341,7 @@ this.itemId = itemConfig.EffectValueA1; this.itemConfig = ItemConfig.Get(this.itemId); } this.score = modelInterface.GetEquipScore(type,itemId,useDataDic,isPreview); this.score = ItemLogicUtility.Instance.GetEquipScore(type,itemId,useDataDic,isPreview); } public bool CheckIsCustomItem() System/KnapSack/New/DepotWin.cs
@@ -49,12 +49,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } #region Built-in protected override void BindController() { @@ -229,7 +223,7 @@ public void OnClickSortBtn() { modelInterface.SendPackResetQuest(PackType.Item); ItemLogicUtility.Instance.SendPackResetQuest(PackType.Item); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.BagSort, 5.0f, RefreshBagSortTime); _timeBagDown.text = Language.Get("BagWin_SortCDbtn_Text_1", 5); _bagSortImage.SetSprite("BlackBtn"); @@ -237,7 +231,7 @@ } public void OnClickDepotSortBtn() { modelInterface.SendPackResetQuest(PackType.Warehouse); ItemLogicUtility.Instance.SendPackResetQuest(PackType.Warehouse); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.DepotSort, 5.0f, RefreshDepotSortTime); _timeDepotDown.text = Language.Get("BagWin_SortCDbtn_Text_1", 5); _depotSortImage.SetSprite("BlackBtn"); System/KnapSack/New/EquipPlaceCell.cs
@@ -14,11 +14,6 @@ { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel @@ -54,7 +49,7 @@ { playerPack.SaveRoleEquipToLocal(equipPlace,true); playerPack.UpdateRoleEquipRed(); string guid = modelInterface.GetHighestScoreEquipByPlace(equipPlace); string guid = ItemLogicUtility.Instance.GetHighestScoreEquipByPlace(equipPlace); if (string.IsNullOrEmpty(guid)) { int pathId = playerPack.GetRoleEquipPathId(equipPlace); System/KnapSack/New/GetWingsPathTips.cs
@@ -99,12 +99,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemAttrData itemAttrData; private int curAttrTypeNum = 0; @@ -165,7 +159,7 @@ { #region 设置TopUI titleText.text = itemTipsModel.GetItemTipsTitle(itemAttrData); titleText.color = UIHelper.GetUIColor(modelInterface.GetItemQuality(itemAttrData.itemId, itemAttrData.useDataDict)); titleText.color = UIHelper.GetUIColor(ItemLogicUtility.Instance.GetItemQuality(itemAttrData.itemId, itemAttrData.useDataDict)); ItemCellModel cellModel = new ItemCellModel(itemAttrData.itemId, itemAttrData.isPreview, (ulong)itemAttrData.count, itemAttrData.isBind, itemAttrData.guid, itemAttrData.packType, itemAttrData.isCompare, itemAttrData.useDataDict); itemCell.Init(cellModel); System/KnapSack/New/GridCell.cs
@@ -43,12 +43,6 @@ private ItemModel itemModel = null; PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public void SetModel(ItemModel itemModel) System/KnapSack/New/KnapSackWin.cs
@@ -53,7 +53,6 @@ PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } public static KnapsackFuncTitle titleType = KnapsackFuncTitle.bag; @@ -164,7 +163,7 @@ private void OnClickDevourTitle() { if (!modelInterface.isPackResetOk) return; if (!ItemLogicUtility.Instance.isPackResetOk) return; CloseSubWindows(); titleType = KnapsackFuncTitle.devour; System/KnapSack/New/OneKeySellWin.cs
@@ -39,11 +39,6 @@ get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } #region Built-in protected override void BindController() { @@ -88,7 +83,7 @@ private void InitModel() { _oneKeySelllist.Clear(); _oneKeySelllist = modelInterface.GetSellItemList(); _oneKeySelllist = ItemLogicUtility.Instance.GetSellItemList(); OnCreateGridLineCell(); _cellCtrl.JumpIndex(0); } @@ -187,7 +182,7 @@ private void OnClickSellBtn(List<ItemModel> _oneKeySelllist) { modelInterface.SendOneKeySellQuest(_oneKeySelllist); ItemLogicUtility.Instance.SendOneKeySellQuest(_oneKeySelllist); if(_oneKeySelllist.Count < 1) { OnClickCloseBtn(); @@ -201,7 +196,7 @@ if(obj.Result == 1) { modelInterface.SendPackResetQuest(PackType.Item); ItemLogicUtility.Instance.SendPackResetQuest(PackType.Item); } OnClickCloseBtn(); System/KnapSack/New/RoleEquipWin.cs
@@ -57,11 +57,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } private bool isUpdatePlayerLv; protected override void BindController() { @@ -239,7 +234,7 @@ public void OnClickSortBtn() { modelInterface.SendPackResetQuest(PackType.Item); ItemLogicUtility.Instance.SendPackResetQuest(PackType.Item); TimeDownMgr.Instance.Begin(TimeDownMgr.CoolTimeType.BagSort, 5.0f, RefreshTime); _timeDown.text = Language.Get("BagWin_SortCDbtn_Text_1", 5); _sortImage.SetSprite("BlackBtn"); @@ -269,7 +264,7 @@ { _moneyCount.text = PlayerDatas.Instance.baseData.Gold.ToString(); _bindDiamondCount.text = PlayerDatas.Instance.baseData.GoldPaper.ToString(); _flowDiamondCount.text = modelInterface.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allSliver); _flowDiamondCount.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allSliver); } else { @@ -282,9 +277,9 @@ private void OnClickOneKeySell() { if (!modelInterface.isPackResetOk) return; if (!ItemLogicUtility.Instance.isPackResetOk) return; if (modelInterface.GetSellItemList().Count > 0) if (ItemLogicUtility.Instance.GetSellItemList().Count > 0) { WindowCenter.Instance.Open<OneKeySellWin>(); } System/KnapSack/NewItemGetWin.cs
@@ -19,7 +19,6 @@ float nextShowTime = 0f; PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } #region Built-in protected override void BindController() @@ -33,7 +32,7 @@ protected override void OnPreOpen() { modelInterface.PickItemEvent += OnGetNewItem; ItemLogicUtility.Instance.PickItemEvent += OnGetNewItem; } protected override void OnAfterOpen() @@ -42,7 +41,7 @@ protected override void OnPreClose() { modelInterface.PickItemEvent -= OnGetNewItem; ItemLogicUtility.Instance.PickItemEvent -= OnGetNewItem; for (int i = 0; i < showingItems.Count; i++) { var item = showingItems[i]; @@ -90,7 +89,7 @@ var itemBehaviour = RequireBehaviour(); if (itemBehaviour != null) { var quality = modelInterface.GetItemQuality(itemId, model.useDataDict); var quality = ItemLogicUtility.Instance.GetItemQuality(itemId, model.useDataDict); itemBehaviour.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one); itemBehaviour.Begin(new Item(itemId, 1, false, quality), m_StartPoint.localPosition, m_EndPoint.localPosition, OnBehaviourFinished); showingItems.Add(itemBehaviour.gameObject); System/MainInterfacePanel/CoinTaskWin.cs
@@ -61,9 +61,6 @@ PlayerTaskDatas m_TaskModel; PlayerTaskDatas taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<PlayerTaskDatas>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } System/MainInterfacePanel/DungeonGuardCheckBehaviour.cs
@@ -15,7 +15,6 @@ [SerializeField] Button m_Close; GuardModel model { get { return ModelCenter.Instance.GetModel<GuardModel>(); } } PackModelInterface packModelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } private void Awake() { System/Market/MarketDealItemCell.cs
@@ -30,12 +30,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { @@ -66,7 +60,7 @@ m_ItemCount.gameObject.SetActive(_data.Count > 1); m_ItemCount.text = _data.Count.ToString(); m_ItemIcon.SetSprite(_itemCfg.IconKey); int fightUp = modelInterface.IsFightUp((int)_data.ItemTypeID, (int)_data.EquipGS); int fightUp = ItemLogicUtility.Instance.IsFightUp((int)_data.ItemTypeID, (int)_data.EquipGS); m_UpImg.gameObject.SetActive(fightUp == 1 || fightUp == -1); if (fightUp == 1) { System/Market/MarketRecordCell.cs
@@ -31,12 +31,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public override void Refresh(CellView cell) { int index = cell.index; @@ -62,7 +56,7 @@ } m_ItemIcon.SetSprite(_itemCfg.IconKey); m_ItemUp.gameObject.SetActive(true); int fightUp = modelInterface.IsFightUp((int)_data.itemdata.itemID, (int)_data.itemdata.equipGS); int fightUp = ItemLogicUtility.Instance.IsFightUp((int)_data.itemdata.itemID, (int)_data.itemdata.equipGS); if (fightUp == 1) { m_ItemUp.SetSprite("EquipUpIcon"); System/Message/HrefAnalysis.cs
@@ -159,7 +159,7 @@ Dictionary<int, List<int>> userdatadic = null; string userdata = array[1]; userdatadic = ConfigParse.Analysis(userdata); int _itemColor = ModelCenter.Instance.GetModel<PackModelInterface>().GetItemQuality(cfg.ID, userdatadic); int _itemColor = ItemLogicUtility.Instance.GetItemQuality(cfg.ID, userdatadic); var text = RichTextMgr.Inst.presentRichText; int colorType = 0; if (text != null) System/Message/RichTableEvent.cs
@@ -89,7 +89,7 @@ { string userdata = _dict["userdata"]; userdatadic = ConfigParse.Analysis(userdata); _itemColor = ModelCenter.Instance.GetModel<PackModelInterface>().GetItemQuality(cfg.ID, userdatadic); _itemColor = ItemLogicUtility.Instance.GetItemQuality(cfg.ID, userdatadic); } } var itemName = cfg.ItemName; System/NewBieGuidance/NewBieCenter.cs
@@ -41,7 +41,6 @@ bool inited = false; PlayerTaskDatas taskmodel { get { return ModelCenter.Instance.GetModel<PlayerTaskDatas>(); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } BetterEquipGetModel betterItemGetModel { get { return ModelCenter.Instance.GetModel<BetterEquipGetModel>(); } } PreciousItemGetModel preciousItemGetModel { get { return ModelCenter.Instance.GetModel<PreciousItemGetModel>(); } } TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } System/NewBieGuidance/NewBieTrigger.cs
@@ -18,7 +18,6 @@ Window m_Parent; public Window parent { get { return m_Parent ?? (m_Parent = this.transform.GetComponentInParent<Window>()); } } PackModelInterface modelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } BetterEquipGetModel betterItemGetModel { get { return ModelCenter.Instance.GetModel<BetterEquipGetModel>(); } } PreciousItemGetModel preciousItemGetModel { get { return ModelCenter.Instance.GetModel<PreciousItemGetModel>(); } } TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } System/Pet/PlayerPetDatas.cs
@@ -54,11 +54,6 @@ { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public Dictionary<int, string> petLvNameDict { get; private set; } public int curPetId { get; set; } System/RolePromote/RolePromoteModel.cs
@@ -27,7 +27,7 @@ petmodel.PlayerLoginOkData += OnRefreshPetData; equipWashModel.RefreshWashModelEvent += RefreshWashModelEvent; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; modelInterface.GetBetterEquipEvent += RefreshGetBetterEquipEvent; ItemLogicUtility.Instance.GetBetterEquipEvent += RefreshGetBetterEquipEvent; PlayerMountDatas.PlayerLoginOKData += PlayerLoginOKData; blastFurnaceModel.blastFurnacePromoteUpdate += BlastFurnacePromoteUpdate; PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent; @@ -486,12 +486,6 @@ RealmModel realmModel { get { return ModelCenter.Instance.GetModel<RealmModel>(); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } public Redpoint m_PromoteRedpoint = new Redpoint(31); private void RefreshGetBetterEquipEvent(string _str) @@ -570,7 +564,7 @@ switch (_type) { case PromoteDetailType.BetterEquip: var dict = modelInterface.CheckBetterEquipByRealm(); var dict = ItemLogicUtility.Instance.CheckBetterEquipByRealm(); return dict != null && dict.Count > 0; case PromoteDetailType.AddPoint: return rolePointModel.redpoint.state == RedPointState.Simple; System/Store/BagStoreWin.cs
@@ -27,12 +27,6 @@ private Text _sliverText; #endregion PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } StoreModel _storeModel; StoreModel m_storeModel { @@ -243,7 +237,7 @@ { _goldText.text = PlayerDatas.Instance.baseData.Gold.ToString(); _goldPaperText.text = PlayerDatas.Instance.baseData.GoldPaper.ToString(); _sliverText.text = modelInterface.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allSliver); _sliverText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(PlayerDatas.Instance.baseData.allSliver); } else { System/Store/RuneStoreWin.cs
@@ -37,11 +37,6 @@ get { return _storeModel ?? (_storeModel = ModelCenter.Instance.GetModel<StoreModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } #region Built-in protected override void BindController() { @@ -151,7 +146,7 @@ { if (PlayerDatas.Instance.baseData != null) { _runeChipText.text = modelInterface.OnChangeCoinsUnit((uint)runemodel.RuneChip); _runeChipText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((uint)runemodel.RuneChip); } else { System/Store/StoreWin.cs
@@ -57,12 +57,6 @@ [SerializeField] Button assistBtn; #endregion PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } StoreModel _storeModel; StoreModel m_storeModel { System/Store/UnionStoreWin.cs
@@ -37,12 +37,6 @@ private int _unionLv; PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } StoreModel _storeModel; StoreModel m_storeModel { @@ -146,7 +140,7 @@ private void RefreshUI() { _moneyNumText.text = modelInterface.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(15)); _moneyNumText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(15)); } private void OnRefreshPlayerInfo(PlayerDataRefresh refreshType) System/Strengthening/StrengtheningSripts.cs
@@ -73,7 +73,6 @@ private bool _effects = true; public Transform _TheningFloor; public IntensifySmoothSlider _SmoothSlider;//Slider PackModelInterface packModelInterface = new PackModelInterface(); GetItemPathModel _GetItemPath; GetItemPathModel GetItemPath { get { return _GetItemPath ?? (_GetItemPath = ModelCenter.Instance.GetModel<GetItemPathModel>()); } } @@ -204,7 +203,7 @@ public void Initialize() { ClearToArray(); m_Money_text.text = packModelInterface.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3)); m_Money_text.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3)); _locationSort = LocationSort();//装备位优先级数组 TheEquipment();//通过数组来份类是否穿戴 DynamicAssignment();//动态赋值名称 @@ -1061,7 +1060,7 @@ case PlayerDataRefresh.Silver: _money = PlayerDatas.Instance.baseData.allSliver; _moneyText.text = MoneyContrast(_money); m_Money_text.text = packModelInterface.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3)); m_Money_text.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(3)); break; default: break; System/Strengthening/WingsBouncedWin.cs
@@ -21,9 +21,6 @@ PlayerPackModel _playerPack; PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } private int _Job;//得到职业 private int _ReincarnationLv;//得到转生等级 @@ -93,7 +90,7 @@ WingButton _WingButton = cell.GetComponent<WingButton>(); ItemConfig tagItem = ItemConfig.Get((int)WingDic[Index].itemId); ItemModel model = playerPack.GetItemByIndex(PackType.Item, Index); int color = modelInterface.GetItemQuality(model.itemId, model.useDataDict); int color = ItemLogicUtility.Instance.GetItemQuality(model.itemId, model.useDataDict); _WingButton.IconBG.SetItemBackGround(color); _WingButton.Icon.SetSprite(tagItem.IconKey); _WingButton.WingsText.text = UIHelper.AppendStringColor((TextColType)color, tagItem.ItemName, true); System/Strengthening/WingsRefined.cs
@@ -43,9 +43,6 @@ ItemTipsModel _itemTipsModel; ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel _playerPack; PlayerPackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); } } @@ -570,7 +567,7 @@ { WingsImage.gameObject.SetActive(false); IconButton.gameObject.SetActive(true); WingsBG.SetItemBackGround(modelInterface.GetItemQuality(itemModel.itemId, itemModel.useDataDict)); WingsBG.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemModel.itemId, itemModel.useDataDict)); IconButton.GetComponent<Image>().SetSprite(itemModel.config.IconKey); IconButton.RemoveAllListeners(); IconButton.AddListener(() => @@ -699,7 +696,7 @@ ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, (int)RoleEquipType.Wing); ; int ItemColor = modelInterface.GetItemQuality(itemModel.itemId, itemModel.useDataDict); int ItemColor = ItemLogicUtility.Instance.GetItemQuality(itemModel.itemId, itemModel.useDataDict); WingsBG.SetItemBackGround(ItemColor); IconButton.GetComponent<Image>().SetSprite(itemModel.config.IconKey); int Number = Mathf.CeilToInt(((float)_currentRefining / _currentRefiningAll) * 100); System/SystemSetting/SettingEffectMgr.cs
@@ -24,10 +24,6 @@ } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } PlayerPackModel _playerPack; PlayerPackModel playerPack { @@ -193,13 +189,13 @@ /// </summary> private void DealBagItem() { if (playerPack.GetEmptyGridCount(PackType.Item) < 5 && modelInterface.isPackResetOk) if (playerPack.GetEmptyGridCount(PackType.Item) < 5 && ItemLogicUtility.Instance.isPackResetOk) { if (HangUpSetModel.Instance.GetBool(HangUpAutoBoolType.isAutoSell) && !isStartOneKeySell && modelInterface.GetSellItemList().Count > 0) && ItemLogicUtility.Instance.GetSellItemList().Count > 0) { modelInterface.SendOneKeySellQuest(modelInterface.GetSellItemList()); ItemLogicUtility.Instance.SendOneKeySellQuest(ItemLogicUtility.Instance.GetSellItemList()); return; } System/TaiChi/TaiChiRewardCell.cs
@@ -22,8 +22,6 @@ TaiChiModel taiChiModel{ get { return ModelCenter.Instance.GetModel<TaiChiModel>(); }} PackModelInterface modelInterface{get { return ModelCenter.Instance.GetModel<PackModelInterface>(); }} private void OnEnable() { SetDisplayModel(); @@ -39,15 +37,15 @@ { case TaiChiRewardType.box: itemConfig = GetItemConfigById(diceReward.itemID); numText.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.itemCount); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.itemCount); break; case TaiChiRewardType.gold: itemConfig = GetItemConfigById(diceReward.goldId); numText.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.gold); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.gold); break; case TaiChiRewardType.exp: itemConfig = GetItemConfigById(diceReward.expId); numText.text = modelInterface.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); break; } System/TaiChi/WytjGameWin.cs
@@ -62,11 +62,6 @@ get { return _taiChiModel ?? (_taiChiModel = ModelCenter.Instance.GetModel<TaiChiModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } private int remainFreeCnt; private int completedTimes; private int totalTimes; @@ -165,9 +160,9 @@ DiceReward diceReward = taiChiModel.GetDiceReward(taiChiModel.taiChiNum); if (diceReward != null) { reward1Text.text = modelInterface.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); reward2Text.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.gold); reward3Text.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.itemCount); reward1Text.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); reward2Text.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.gold); reward3Text.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.itemCount); for (int i = 0; i < awardbtnlist.Count; i++) { System/TaiChi/WytjRulesWin.cs
@@ -20,12 +20,6 @@ get { return _taiChiModel ?? (_taiChiModel = ModelCenter.Instance.GetModel<TaiChiModel>()); } } PackModelInterface _modelInterface; PackModelInterface modelInterface { get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); } } protected override void BindController() { @@ -73,15 +67,15 @@ { case 0: itemConfig = ItemConfig.Get(diceReward.itemID); numText.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.itemCount); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.itemCount); break; case 1: itemConfig = ItemConfig.Get(diceReward.goldId); numText.text = modelInterface.OnChangeCoinsUnit((ulong)diceReward.gold); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)diceReward.gold); break; case 2: itemConfig = ItemConfig.Get(diceReward.expId); numText.text = modelInterface.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); numText.text = ItemLogicUtility.Instance.OnChangeCoinsUnit((ulong)taiChiModel.GetDiceRewardExp(diceReward.exp)); break; } System/Vip/FirstTimeRechargeModel.cs
@@ -28,7 +28,6 @@ DateTime GetDateTime; //--------------------获取首冲试用数据 PackModelInterface packModelInterface { get { return ModelCenter.Instance.GetModel<PackModelInterface>(); } } PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public int IsTryOut = 0;//0-不可试用,1-可试用,2-已使用 @@ -115,7 +114,7 @@ { for (int k = 0; k < list.Count; k++) { bool isOverdue = packModelInterface.IsOverdue(list[k].guid, bool isOverdue = ItemLogicUtility.Instance.IsOverdue(list[k].guid, list[k].itemId, list[k].useDataDict); if (isOverdue) { System/WindowBase/ModelCenter.cs
@@ -142,7 +142,6 @@ RegisterModel<ResourcesBackModel>(); RegisterModel<PlayerPackModel>(); RegisterModel<ItemTipsModel>(); RegisterModel<PackModelInterface>(); RegisterModel<ActivityModel>(); RegisterModel<PlayerDeadModel>(); RegisterModel<BetterEquipGetModel>(); Utility/UIHelper.cs
@@ -695,7 +695,7 @@ _itemColor = _itemCfg.ItemColor; if (_itemCfg.Type == 111 && _dict != null) { _itemColor = ModelCenter.Instance.GetModel<PackModelInterface>().GetItemQuality(_itemCfg.ID, _dict); _itemColor = ItemLogicUtility.Instance.GetItemQuality(_itemCfg.ID, _dict); } } return _itemColor;