private static int SortVipCellData(StoreCellData a, StoreCellData b) { var v1 = 0; var v2 = 0; var curVipLevel = PlayerDataManager.Instance.GetRes((int)eResourcesType.VipLevel); {//数据A var _tbStoreA = Table.GetStore(a.StoreIndex); var _tbConditionA = Table.GetConditionTable(_tbStoreA.BuyCondition); var VipLimitA = _tbConditionA.ExdataMin[0]; if (VipLimitA == curVipLevel) { v1 += 1000000; } else if (VipLimitA == curVipLevel + 1) { v1 += 100000; } else if (VipLimitA < curVipLevel) { v1 += 10000; } } {//数据B var _tbStoreB = Table.GetStore(b.StoreIndex); var _tbConditionB = Table.GetConditionTable(_tbStoreB.BuyCondition); var VipLimitB = _tbConditionB.ExdataMin[0]; if (VipLimitB == curVipLevel) { v2 += 1000000; } else if (VipLimitB == curVipLevel + 1) { v2 += 100000; } else if (VipLimitB < curVipLevel) { v2 += 10000; } } if (v1 > v2) { return(-1); } if (v1 < v2) { return(1); } return(a.nSort - b.nSort); }
public void IsCanUse(StoreRecord tbStore, StoreCellData item) { if (item.Limit == 0) { item.CanUse = false; return; } if (tbStore.ItemId < 0) { item.CanUse = false; return; } var tbItemBase = Table.GetItemBase(tbStore.ItemId); item.CanUse = PlayerDataManager.Instance.ItemOrEquipCanUse(tbItemBase); }
public IEnumerator ApplyStoresCoroutine(int type, int serviceType = -1) { using (new BlockingLayerHelper(0)) { if (mStoreCache.ContainsKey(type)) { SetsStoreCellDatas(type); yield break; } var msg = NetManager.Instance.ApplyStores(type, serviceType); //106 yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { var itemList = new List <StoreCellData>(); { var __list1 = msg.Response.items; var __listCount1 = __list1.Count; for (var __i1 = 0; __i1 < __listCount1; ++__i1) { var item = __list1[__i1].itemid; { var cell = new StoreCellData { StoreIndex = item }; var tbStore = Table.GetStore(cell.StoreIndex); var limit = tbStore.DayCount; if (limit == -1) { limit = tbStore.WeekCount; } if (limit == -1) { limit = tbStore.MonthCount; } cell.ExData = limit; if (limit == -1) { cell.Limit = -1; } else { cell.Limit = PlayerDataManager.Instance.GetExData(limit) + VipModifyCount(cell.StoreIndex); } // 只要发限购数量了 就覆盖掉扩展计数的数量 不走扩展计数了 if (__list1[__i1].itemcount >= 0) { cell.Limit = __list1[__i1].itemcount; cell.ExData = -1; } cell.ItemId = tbStore.ItemId; itemList.Add(cell); } } } mStoreCache.Add(type, itemList); SetsStoreCellDatas(type); } else { Logger.Error("ApplyStores............ErrorCode..." + msg.ErrorCode); } } else { Logger.Error("ApplyStores............State..." + msg.State); } } }
private void SetShopData(int type, List <StoneItem> shopItems) { var _itemList = new List <StoreCellData>(); { var _list1 = shopItems; var _listCount1 = _list1.Count; for (var __i1 = 0; __i1 < _listCount1; ++__i1) { var _item = _list1[__i1].itemid; { var _cell = new StoreCellData { StoreIndex = _item }; var _tbStore = Table.GetStore(_cell.StoreIndex); if (_tbStore.BuyCondition == -1) { _cell.BuyLimit = ""; } else { var _tbCondition = Table.GetConditionTable(_tbStore.BuyCondition); var VipLimit = _tbCondition.ExdataMin[0]; _cell.BuyLimit = string.Format(GameUtils.GetDictionaryText(100001383), VipLimit); var VIPLevel = PlayerDataManager.Instance.GetRes((int)eResourcesType.VipLevel); if (VIPLevel >= VipLimit) { _cell.LimitColor = GameUtils.GetTableColor(24); } else { _cell.LimitColor = GameUtils.GetTableColor(25); } } var _limit = _tbStore.DayCount; if (_limit == -1) { _limit = _tbStore.WeekCount; } if (_limit == -1) { _limit = _tbStore.MonthCount; } if (type == 1106)//珍宝商人特殊处理 { _limit = _list1[__i1].itemcount; _cell.ExData = _limit; _cell.Limit = _limit; } else { _cell.ExData = _limit; if (_limit == -1) { _cell.Limit = -1; } else { _cell.Limit = PlayerDataManager.Instance.GetExData(_limit) + VipAlterCount(_cell.StoreIndex); } } //// 只要发限购数量了 就覆盖掉扩展计数的数量 不走扩展计数了 //if (_list1[__i1].itemcount >= 0) //{ // _cell.Limit = _list1[__i1].itemcount; // _cell.ExData = -1; //} _cell.ItemId = _tbStore.ItemId; _itemList.Add(_cell); } } } if (mStoreCache.ContainsKey(type)) { mStoreCache[type] = _itemList; } else { mStoreCache.Add(type, _itemList); } SetShopCellDatum(type); }