| | |
| | | bool isUpdatePlayerLv = false; |
| | | |
| | | BlastFurnaceModel FurnaceModel { get { return ModelCenter.Instance.GetModel<BlastFurnaceModel>(); } } |
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | SetRoleEquipRedpoint(); |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | |
| | | itemGUIDDict.Clear(); |
| | | showDropItem = false; |
| | | isPlayBetterEquipEffect = false; |
| | | equipAttrActiveDict.Clear(); |
| | | colorType = EquipColorType.Purple; |
| | | lvType = EquipLvType.All; |
| | | starType = EquipStarType.None; |
| | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | ItemOperateUtility.Instance.RequestWarehouseData(); |
| | | SetPlayerAttrActiveRedPoint(); |
| | | EquipDecomRedCtrl(); |
| | | RoleEquipLocalSave = StringUtility.Contact("RoleEquipLocalSave", PlayerDatas.Instance.baseData.PlayerID); |
| | | StrengthAttrShift_RecordKey = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StrengthAttrShift"); |
| | |
| | | { |
| | | |
| | | } |
| | | |
| | | ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } |
| | | |
| | | public event Action<PackType> refrechPackEvent; //刷新整个背包数据 |
| | | public event Action<PackType, int, int> refreshItemCountEvent; //(单个)最新物品数量刷新(旧的弃用)在得到新物品、物品数量的改变,清理该物品时均会触发 int 位置索引 int物品id |
| | |
| | | itemCntAddEvent(type, itemInfo.index, itemInfo.itemId); |
| | | } |
| | | |
| | | if (type == PackType.Equip) |
| | | { |
| | | SetPlayerAttrActiveRedPoint(); |
| | | } |
| | | |
| | | UpdatePackRedpoint(type); |
| | | EquipDecomRedCtrl(); |
| | | } |
| | |
| | | PackType type = (PackType)refresh.PackType; |
| | | SinglePack singlePack = null; |
| | | playerPackDict.TryGetValue(type, out singlePack); |
| | | |
| | | if (singlePack != null) |
| | | { |
| | | ItemModel itemModel = singlePack.GetItemByIndex(refresh.ItemIndex); |
| | |
| | | { |
| | | singlePack.Clear(); |
| | | } |
| | | |
| | | if (type == PackType.Equip) |
| | | { |
| | | SetPlayerAttrActiveRedPoint(); |
| | | } |
| | | //if (RefreshPackAct != null) |
| | | //{ |
| | | // RefreshPackAct(type); |
| | | //} |
| | | |
| | | //RedPointPackCtrl(type); |
| | | } |
| | | |
| | | public void RemoveItem(H0709_tagClearItem clearItem) |
| | |
| | | ItemModel itemModel = singlePack.GetItemByIndex(clearItem.ItemIndex); |
| | | guid = itemModel.guid; |
| | | int itemId = itemModel.itemId; |
| | | DeleteItemDictByGUID(type, itemModel.guid); |
| | | |
| | | DeleteItemDictByGUID( itemModel.guid); |
| | | |
| | | singlePack.RemoveItem(clearItem.ItemIndex); |
| | | if (refreshItemCountEvent != null) |
| | | { |
| | |
| | | itemCntReduceEvent(type, clearItem.ItemIndex, itemId); |
| | | } |
| | | } |
| | | if (type == PackType.Equip) |
| | | { |
| | | SetPlayerAttrActiveRedPoint(); |
| | | } |
| | | |
| | | UpdatePackRedpoint(type); |
| | | EquipDecomRedCtrl(); |
| | | |
| | |
| | | isPlayBetterEquipEffect = false; |
| | | SetLookIndex(null); |
| | | if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | ItemConfig itemConfig = ItemConfig.Get((int)success.ItemID); |
| | | MakeUseItemSuccess(success.ItemIndex, (int)success.ItemID); |
| | | |
| | | switch (success.ItemID) |
| | | { |
| | | case 221: |
| | |
| | | } |
| | | else |
| | | { |
| | | PackType prePack = itemGUIDDict[itemModel.guid].packType; |
| | | var prePack = itemGUIDDict[itemModel.guid].packType; |
| | | |
| | | itemGUIDDict[itemModel.guid] = itemModel; |
| | | |
| | | if (prePack != itemModel.packType) |
| | | { |
| | | GetItemEventCtrl(itemModel); |
| | |
| | | } |
| | | } |
| | | |
| | | void DeleteItemDictByGUID(PackType type, string guid) |
| | | void DeleteItemDictByGUID(string guid) |
| | | { |
| | | |
| | | if (itemGUIDDict.ContainsKey(guid)) |
| | | { |
| | | if (itemGUIDDict[guid].packType == type) |
| | | { |
| | | itemGUIDDict.Remove(guid); |
| | | } |
| | | itemGUIDDict.Remove(guid); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | refreshItemSumUseCountEvent(itemId); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | #region 接收全身星级,强化属性激活 |
| | | public event Action RefreshActiveAttrAct; |
| | | private Dictionary<int, int> equipAttrActiveDict = new Dictionary<int, int>(); |
| | | public void UpdatePlayerEquipAttrActiveInfo(HA317_tagMCAllEquipAttrActiveInfo info) |
| | | { |
| | | for (int i = 0; i < info.Count; i++) |
| | | { |
| | | int type = info.ActiveInfo[i].Type; |
| | | int cnt = (int)info.ActiveInfo[i].Cnt; |
| | | if (type == 1) |
| | | { |
| | | cnt = RoleEquipStarsConfig.GetActiveStars(cnt); |
| | | } |
| | | if (!equipAttrActiveDict.ContainsKey(type)) |
| | | { |
| | | equipAttrActiveDict.Add(type, cnt); |
| | | } |
| | | else |
| | | { |
| | | equipAttrActiveDict[type] = cnt; |
| | | } |
| | | } |
| | | |
| | | if (RefreshActiveAttrAct != null) |
| | | { |
| | | RefreshActiveAttrAct(); |
| | | } |
| | | |
| | | SetPlayerAttrActiveRedPoint(); |
| | | } |
| | | |
| | | public void SendActiveAttrQuest(int type, int cnt) |
| | | { |
| | | var equipAttr = new CA503_tagCMActiveAllEquipAttr(); |
| | | equipAttr.Type = (byte)type; |
| | | equipAttr.Cnt = (uint)cnt; |
| | | GameNetSystem.Instance.SendInfo(equipAttr); |
| | | } |
| | | |
| | | public int GetActiveCntByType(int type) |
| | | { |
| | | int cnt = 0; |
| | | equipAttrActiveDict.TryGetValue(type, out cnt); |
| | | return cnt; |
| | | } |
| | | |
| | | public List<int> GetAddAttrIdByStars(int _curStarsCount, out int starsCount) |
| | | { |
| | | starsCount = 0; |
| | | List<int> activeIdlist = new List<int>(); |
| | | List<int> addIdlist = new List<int>(); |
| | | List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist(); |
| | | if (starslist == null || starslist.Count < 1) return addIdlist; |
| | | int activeStars = GetActiveCntByType(1); |
| | | int realActiveStars = _curStarsCount > activeStars ? activeStars : _curStarsCount; |
| | | for (int i = starslist.Count - 1; i > -1; i--) |
| | | { |
| | | if (i == 0 && starslist[i] > realActiveStars) |
| | | { |
| | | realActiveStars = 0; |
| | | break; |
| | | } |
| | | if (starslist[i] <= realActiveStars) |
| | | { |
| | | realActiveStars = starslist[i]; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | RoleEquipStarsConfig activeStarsConfig = RoleEquipStarsConfig.GetEquipStarsModel(realActiveStars); |
| | | if (activeStarsConfig != null) |
| | | { |
| | | for (int i = 0; i < activeStarsConfig.attType.Length; i++) |
| | | { |
| | | activeIdlist.Add(activeStarsConfig.attType[i]); |
| | | } |
| | | } |
| | | List<RoleEquipStarsConfig> starsConfigs = RoleEquipStarsConfig.GetValues(); |
| | | for (int i = 0; i < starsConfigs.Count; i++) |
| | | { |
| | | bool isAddId = false; |
| | | RoleEquipStarsConfig starsConfig = starsConfigs[i]; |
| | | if (realActiveStars < starsConfig.countNeed) |
| | | { |
| | | for (int j = 0; j < starsConfig.attType.Length; j++) |
| | | { |
| | | int attrId = starsConfig.attType[j]; |
| | | if (!activeIdlist.Contains(attrId)) |
| | | { |
| | | isAddId = true; |
| | | addIdlist.Add(attrId); |
| | | } |
| | | } |
| | | } |
| | | if (isAddId) |
| | | { |
| | | starsCount = starsConfig.countNeed; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | return addIdlist; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | if (!isOverdue) |
| | | { |
| | | ItemLogicUtility.Instance.RecommendItem(itemModel); |
| | |
| | | } |
| | | } |
| | | |
| | | public List<ItemModel> GetItems( PackType packType, SinglePack.FilterParams param) |
| | | public List<ItemModel> GetItems(PackType packType, SinglePack.FilterParams param) |
| | | { |
| | | if (playerPackDict.ContainsKey(packType)) |
| | | { |
| | |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | |
| | | public bool CheckBagIsPutNewItem(int itemId) |
| | | { |
| | | var singlePack = GetSinglePack(PackType.Item); |
| | | if (singlePack == null) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | var config = ItemConfig.Get(itemId); |
| | | var items = singlePack.GetItemsById(itemId); |
| | | var count = singlePack.GetCountById(itemId); |
| | | |
| | | int sumPutCnt = config.PackCount * items.Count; |
| | | if (sumPutCnt > count) |
| | | { |
| | | return true; |
| | | } |
| | | else if (GetEmptyGridCount(PackType.Item) > 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public int GetEmptyGridCount(PackType type) |
| | |
| | | } |
| | | |
| | | #region 红点逻辑判断 |
| | | private Dictionary<int, Redpoint> roleEquipRedDict = new Dictionary<int, Redpoint>(); |
| | | public void SetRoleEquipRedpoint() |
| | | { |
| | | roleEquipRedDict.Clear(); |
| | | for (int i = 1; i < 13; i++) |
| | | { |
| | | int redKey = ITEMPACK_REDKEY + i; |
| | | Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_BagFuncKey, redKey); |
| | | roleEquipRedDict.Add(i, redpoint); |
| | | } |
| | | } |
| | | |
| | | public void UpdateRoleEquipRed() |
| | | { |
| | | foreach (var key in roleEquipRedDict.Keys) |
| | | { |
| | | var item = GetItemByIndex(PackType.Equip, key); |
| | | switch ((RoleEquipType)key) |
| | | { |
| | | case RoleEquipType.FairyCan1: |
| | | if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key) |
| | | && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan2].state == RedPointState.None) |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.Simple; |
| | | } |
| | | else |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.None; |
| | | } |
| | | break; |
| | | case RoleEquipType.FairyCan2: |
| | | if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key) |
| | | && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan1].state == RedPointState.None) |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.Simple; |
| | | } |
| | | else |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.None; |
| | | } |
| | | break; |
| | | case RoleEquipType.Wing: |
| | | if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && !TryGetRoleEquipLocalSave(key) |
| | | && item == null) |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.Simple; |
| | | } |
| | | else |
| | | { |
| | | roleEquipRedDict[key].state = RedPointState.None; |
| | | } |
| | | break; |
| | | default: |
| | | roleEquipRedDict[key].state = RedPointState.None; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private bool TryGetRoleEquipLocalSave(int equipPlace) |
| | | { |
| | | if (LocalSavePlaceArray != null) |
| | | { |
| | | for (int i = 0; i < LocalSavePlaceArray.Count; i++) |
| | | { |
| | | if (equipPlace == 9 || equipPlace == 10) |
| | | { |
| | | if (LocalSavePlaceArray[i] == 9 || LocalSavePlaceArray[i] == 10) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (LocalSavePlaceArray[i] == equipPlace) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | const int ITEMPACK_REDKEY = 102011003; |
| | | Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); |
| | |
| | | |
| | | const int PLAYERSUMSTAR_REDKEY = 102011002; |
| | | Redpoint redpointSTAR = new Redpoint(MainRedDot.RedPoint_BagFuncKey, PLAYERSUMSTAR_REDKEY); |
| | | |
| | | public event Action<int, bool> RefreshAttrActiveAct; |
| | | public void SetPlayerAttrActiveRedPoint() |
| | | { |
| | | if (IsActiveStarAttr()) |
| | | { |
| | | if (redpointSTAR.state != RedPointState.Simple) |
| | | { |
| | | redpointSTAR.state = RedPointState.Simple; |
| | | if (RefreshAttrActiveAct != null) |
| | | { |
| | | RefreshAttrActiveAct(1, true); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (redpointSTAR.state != RedPointState.None) |
| | | { |
| | | redpointSTAR.state = RedPointState.None; |
| | | if (RefreshAttrActiveAct != null) |
| | | { |
| | | RefreshAttrActiveAct(1, false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool IsActiveStarAttr() |
| | | { |
| | | List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist(); |
| | | SinglePack singlePack = GetSinglePack(PackType.Equip); |
| | | if (singlePack == null || starslist == null || starslist.Count < 1) return false; |
| | | |
| | | Dictionary<int, ItemModel> _itemDict = singlePack.GetAllItems(); |
| | | int playerSumStars = 0; |
| | | foreach (var model in _itemDict.Values) |
| | | { |
| | | playerSumStars += model.config.StarLevel; |
| | | } |
| | | int cnt = GetActiveCntByType(1); |
| | | int nextActiveStars = 0; |
| | | for (int i = 0; i < starslist.Count; i++) |
| | | { |
| | | if (cnt == 0) |
| | | { |
| | | nextActiveStars = starslist[0]; |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | if (starslist[i] == cnt) |
| | | { |
| | | if (i < starslist.Count - 1) |
| | | { |
| | | nextActiveStars = starslist[i + 1]; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (nextActiveStars != 0 && playerSumStars >= nextActiveStars) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public bool IsActiveSTRAttr() |
| | | { |
| | | List<string> strenlist = ItemPlusSumAttrConfig.GetKeys(); |
| | | if (strenlist == null || strenlist.Count < 1) return false; |
| | | int playerSumSTR = 0; |
| | | //Dictionary<int, EquipmentInitialization> strenInfoDict = ModelCenter.Instance.GetModel<StrengthenModel>()._EqInfo; |
| | | //foreach (var value in strenInfoDict.Values) |
| | | //{ |
| | | // ItemModel itemModel = GetItemByIndex(PackType.Equip, value.EquipIndex); |
| | | // if (itemModel != null) |
| | | // { |
| | | // playerSumSTR += value.EquipPartStarLV; |
| | | // } |
| | | //} |
| | | int cnt = GetActiveCntByType(0); |
| | | int nextActiveSTR = 0; |
| | | for (int i = 0; i < strenlist.Count; i++) |
| | | { |
| | | if (cnt == 0) |
| | | { |
| | | nextActiveSTR = int.Parse(strenlist[0]); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | if (int.Parse(strenlist[i]) == cnt) |
| | | { |
| | | if (i < strenlist.Count - 1) |
| | | { |
| | | nextActiveSTR = int.Parse(strenlist[i + 1]); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (nextActiveSTR != 0 && playerSumSTR >= nextActiveSTR) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | public const int EquipDecompose_RedKey = 10205; |
| | | public Redpoint redpointEquipDecom = new Redpoint(MainRedDot.RedPoint_MainPackKey, EquipDecompose_RedKey); |
| | |
| | | { |
| | | lookEquipEvent(); |
| | | } |
| | | |
| | | } |
| | | |
| | | public event Action RefreshBagEvent; |
| | |
| | | { |
| | | count = (ulong)remainDayCnt; |
| | | } |
| | | |
| | | } |
| | | |
| | | int remainSumCnt = 0; |
| | |
| | | public bool IsMaxDecomLv(int decomLv, out int realLv) |
| | | { |
| | | realLv = decomLv; |
| | | List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues(); |
| | | var decomlist = EquipDeComposeConfig.GetValues(); |
| | | if (decomLv > decomlist[decomlist.Count - 1].LV) |
| | | { |
| | | realLv = decomlist[decomlist.Count - 1].LV; |
| | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public List<ItemModel> selectDevourlist = new List<ItemModel>(); |
| | | public void GetSelectDevourList() |
| | |
| | | |
| | | public void SendEquipDevourRecordQuest() |
| | | { |
| | | string record = StringUtility.Contact((int)colorType + 1, (int)lvType + 1, (int)starType + 1); |
| | | CA32D_tagCMDecomposeSeting decomSet = new CA32D_tagCMDecomposeSeting(); |
| | | var record = StringUtility.Contact((int)colorType + 1, (int)lvType + 1, (int)starType + 1); |
| | | var decomSet = new CA32D_tagCMDecomposeSeting(); |
| | | decomSet.Seting = uint.Parse(record); |
| | | GameNetSystem.Instance.SendInfo(decomSet); |
| | | } |
| | |
| | | { |
| | | for (int i = decomposeLv; i <= realLv; i++) |
| | | { |
| | | EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(i); |
| | | var deComposeConfig = EquipDeComposeConfig.Get(i); |
| | | if (i == decomposeLv) |
| | | { |
| | | addDecomposeExp = deComposeConfig.UpNeedExp - decomposeExp; |