|  |  |  | 
|---|
|  |  |  | string RoleEquipLocalSave = ""; | 
|---|
|  |  |  | List<int> LocalSavePlaceArray { get; set; } | 
|---|
|  |  |  | Dictionary<int, List<int>> sharedUseCountItemDict { get; set; } | 
|---|
|  |  |  | bool isUpdatePlayerLv = false; | 
|---|
|  |  |  | // bool isUpdatePlayerLv = false; | 
|---|
|  |  |  | bool isItemChange = false;  //延迟处理物品变化 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int[] gameCashShow;  //代金券特殊显示 除以100 | 
|---|
|  |  |  | public int[] autoUseItemIDs; | 
|---|
|  |  |  | 
|---|
|  |  |  | public void OnBeforePlayerDataInitialize() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | GlobalTimeEvent.Instance.secondEvent -= UpdateSecond; | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv; | 
|---|
|  |  |  | // PlayerDatas.Instance.playerDataRefreshEvent -= UpdatePlayerLv; | 
|---|
|  |  |  | LocalSave.DeleteKey(RecordKnapsackTitle); | 
|---|
|  |  |  | playerPackDict.Clear(); | 
|---|
|  |  |  | itemDayUseCntDict.Clear(); | 
|---|
|  |  |  | 
|---|
|  |  |  | LocalSavePlaceArray = null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | GlobalTimeEvent.Instance.secondEvent += UpdateSecond; | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv; | 
|---|
|  |  |  | isUpdatePlayerLv = true; | 
|---|
|  |  |  | // PlayerDatas.Instance.playerDataRefreshEvent += UpdatePlayerLv; | 
|---|
|  |  |  | // isUpdatePlayerLv = true; | 
|---|
|  |  |  | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | refrechPackEvent(packType); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UpdatePackRedpoint(packType); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DelayNotifyPackChange(packType); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void UpdateItem(H0704_tagRolePackRefresh serverItem) | 
|---|
|  |  |  | 
|---|
|  |  |  | //         ItemOperateUtility.Instance.ShowPutOnNewEquipRemind(itemInfo.itemId); | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UpdatePackRedpoint(type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DelayNotifyPackChange(type); | 
|---|
|  |  |  | //EquipDecomRedCtrl(); | 
|---|
|  |  |  | AutoUseItem(itemInfo.itemId, serverItem.ItemGUID); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | gridRefreshEvent(type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UpdatePackRedpoint(type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DelayNotifyPackChange(type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DelayNotifyPackChange(type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UpdatePackRedpoint(type); | 
|---|
|  |  |  | DelayNotifyPackChange(type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (GetItemByGuid(guid) == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void UpdateSecond() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (isUpdatePlayerLv) | 
|---|
|  |  |  | if (isItemChange) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isUpdatePlayerLv = false; | 
|---|
|  |  |  | isItemChange = false; | 
|---|
|  |  |  | DelayRefreshItemPackEvent(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void UpdatePlayerLv(PlayerDataType type) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (type != PlayerDataType.LV) return; | 
|---|
|  |  |  | // private void UpdatePlayerLv(PlayerDataType type) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     if (type != PlayerDataType.LV) return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isUpdatePlayerLv = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //     isUpdatePlayerLv = true; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return useCnt; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void GotoWashAttributePoint(string guid) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // ItemModel itemModel = GetItemByGuid(guid); | 
|---|
|  |  |  | // if (itemModel == null) return; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // WashAttrPointWin.itemModel = itemModel; | 
|---|
|  |  |  | // WindowCenter.Instance.Open<WashAttrPointWin>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 红点逻辑判断 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const int ITEMPACK_REDKEY = 102011003; | 
|---|
|  |  |  | Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY); | 
|---|
|  |  |  | Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_BagFuncKey); | 
|---|
|  |  |  | Redpoint redpointComposePack = new Redpoint(MainRedDot.RedPoint_MainPackKey, MainRedDot.RedPoint_ComposeFuncKey); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void UpdatePackRedpoint(PackType type) | 
|---|
|  |  |  | //延迟通知背包变化,避免在同一帧内多次通知 | 
|---|
|  |  |  | private void DelayNotifyPackChange(PackType type) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var singlePack = GetSinglePack(type); | 
|---|
|  |  |  | if (singlePack == null) | 
|---|
|  |  |  | if (type == PackType.Item) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | switch (type) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case PackType.Item: | 
|---|
|  |  |  | if (singlePack.GetEmptyGridCount() <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointItemPack.state = RedPointState.Full; | 
|---|
|  |  |  | //SysNotifyMgr.Instance.ShowTip("BagFull"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointItemPack.state = RedPointState.None; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isItemChange = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void DelayRefreshItemPackEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //合成红点 | 
|---|
|  |  |  | SinglePack singlePack = GetSinglePack(PackType.Item); | 
|---|
|  |  |  | var items = singlePack.GetAllItems(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (var item in items.Values) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ItemCompoundConfig.IsCompoundItem(item.itemId)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var config = ItemCompoundConfig.GetItemCompoundConfig(item.itemId); | 
|---|
|  |  |  | var targetID = config.itemID; | 
|---|
|  |  |  | var targetCnt = config.itemCount; | 
|---|
|  |  |  | if (GetItemCountByID(PackType.Item, targetID) >= targetCnt) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointComposePack.state = RedPointState.Simple; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //背包红点 | 
|---|
|  |  |  | if (singlePack.GetEmptyGridCount() <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointItemPack.state = RedPointState.Full; | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("BagFull"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointItemPack.state = RedPointState.None; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //无条件开启的宝箱红点 | 
|---|
|  |  |  | foreach (var item in items.Values) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var chestConfig = ChestsConfig.Get(item.itemId); | 
|---|
|  |  |  | if (chestConfig != null && chestConfig.ExpendItemID == 0 && chestConfig.OpenMoney == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | redpointItemPack.state = RedPointState.Simple; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void RefreshItemComposeList() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //收集合成物品 | 
|---|
|  |  |  | composeItemGuidList.Clear(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SinglePack singlePack = GetSinglePack(PackType.Item); | 
|---|
|  |  |  | var items = singlePack.GetAllItems(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (var item in items.Values) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ItemCompoundConfig.IsCompoundItem(item.itemId)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | composeItemGuidList.Add(item.guid); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | composeItemGuidList.Sort(SortItemCompose); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int SortItemCompose(string guidA, string guidB) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var itemA = GetItemByGuid(guidA); | 
|---|
|  |  |  | var itemB = GetItemByGuid(guidB); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var colorA = itemA.config.ItemColor; | 
|---|
|  |  |  | var colorB = itemB.config.ItemColor; | 
|---|
|  |  |  | if (colorA != colorB) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return colorB - colorA; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return itemA.itemId - itemB.itemId; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 查看某个位置的物品 | 
|---|