Example #1
0
 private void EraseTimeOutPopupHistory(JSON_ShopListArray.Shops[] shops)
 {
     if (shops == null || shops.Length <= 0)
     {
         string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray());
         PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, json, false);
     }
     else
     {
         if (!PlayerPrefsUtility.HasKey(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT))
         {
             return;
         }
         ShopTimeOutItemInfoArray   outItemInfoArray        = (ShopTimeOutItemInfoArray)JsonUtility.FromJson <ShopTimeOutItemInfoArray>(PlayerPrefsUtility.GetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, string.Empty));
         List <ShopTimeOutItemInfo> shopTimeOutItemInfoList = new List <ShopTimeOutItemInfo>();
         if (outItemInfoArray.Infos != null)
         {
             foreach (ShopTimeOutItemInfo info1 in outItemInfoArray.Infos)
             {
                 ShopTimeOutItemInfo info = info1;
                 if (((IEnumerable <JSON_ShopListArray.Shops>)shops).Any <JSON_ShopListArray.Shops>((Func <JSON_ShopListArray.Shops, bool>)(sh => sh.gname == info.ShopId)))
                 {
                     shopTimeOutItemInfoList.Add(info);
                 }
             }
         }
         string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray(shopTimeOutItemInfoList.ToArray()));
         PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, json, false);
     }
 }
 private void ShowAndSaveTimeOutItem(List <LimitedShopItem> nearbyTimeout)
 {
     GlobalVars.TimeOutShopItems = new List <ShopItem>();
     if (nearbyTimeout.Count <= 0)
     {
         return;
     }
     if (PlayerPrefsUtility.HasKey(PlayerPrefsUtility.WARNED_LIMITEDSHOP_ITEM_TIMEOUT))
     {
         ShopTimeOutItemInfoArray outItemInfoArray         = (ShopTimeOutItemInfoArray)JsonUtility.FromJson <ShopTimeOutItemInfoArray>(PlayerPrefsUtility.GetString(PlayerPrefsUtility.WARNED_LIMITEDSHOP_ITEM_TIMEOUT, string.Empty));
         ShopTimeOutItemInfo[]    shopTimeOutItemInfoArray = outItemInfoArray.Infos != null ? ((IEnumerable <ShopTimeOutItemInfo>)outItemInfoArray.Infos).Where <ShopTimeOutItemInfo>((Func <ShopTimeOutItemInfo, bool>)(t => t.ShopId == GlobalVars.LimitedShopItem.shops.gname)).ToArray <ShopTimeOutItemInfo>() : new ShopTimeOutItemInfo[0];
         List <LimitedShopItem>   source1 = new List <LimitedShopItem>();
         List <LimitedShopItem>   source2 = new List <LimitedShopItem>();
         bool flag = false;
         using (List <LimitedShopItem> .Enumerator enumerator = nearbyTimeout.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 LimitedShopItem     item = enumerator.Current;
                 ShopTimeOutItemInfo shopTimeOutItemInfo = ((IEnumerable <ShopTimeOutItemInfo>)shopTimeOutItemInfoArray).FirstOrDefault <ShopTimeOutItemInfo>((Func <ShopTimeOutItemInfo, bool>)(t => t.ItemId == item.id));
                 if (shopTimeOutItemInfo != null)
                 {
                     if (item.end > shopTimeOutItemInfo.End)
                     {
                         source2.Add(item);
                         shopTimeOutItemInfo.End = item.end;
                         flag = true;
                     }
                 }
                 else
                 {
                     source2.Add(item);
                     source1.Add(item);
                     flag = true;
                 }
             }
         }
         if (flag)
         {
             JSON_ShopListArray.Shops          shop = GlobalVars.LimitedShopItem.shops;
             IEnumerable <ShopTimeOutItemInfo> shopTimeOutItemInfos = source1.Select <LimitedShopItem, ShopTimeOutItemInfo>((Func <LimitedShopItem, ShopTimeOutItemInfo>)(target => new ShopTimeOutItemInfo(shop.gname, target.id, target.end)));
             if (outItemInfoArray.Infos != null)
             {
                 shopTimeOutItemInfos = shopTimeOutItemInfos.Concat <ShopTimeOutItemInfo>((IEnumerable <ShopTimeOutItemInfo>)outItemInfoArray.Infos);
             }
             string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray(shopTimeOutItemInfos.ToArray <ShopTimeOutItemInfo>()));
             PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_LIMITEDSHOP_ITEM_TIMEOUT, json, false);
         }
         GlobalVars.TimeOutShopItems = source2.Cast <ShopItem>().ToList <ShopItem>();
         if (source2.Count <= 0)
         {
             return;
         }
         FlowNode_GameObject.ActivateOutputLinks((Component)this, 104);
     }
     else
     {
         JSON_ShopListArray.Shops shop = GlobalVars.LimitedShopItem.shops;
         string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray(nearbyTimeout.Select <LimitedShopItem, ShopTimeOutItemInfo>((Func <LimitedShopItem, ShopTimeOutItemInfo>)(item => new ShopTimeOutItemInfo(shop.gname, item.id, item.end))).ToArray <ShopTimeOutItemInfo>()));
         PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_LIMITEDSHOP_ITEM_TIMEOUT, json, false);
         GlobalVars.TimeOutShopItems = nearbyTimeout.Cast <ShopItem>().ToList <ShopItem>();
         FlowNode_GameObject.ActivateOutputLinks((Component)this, 104);
     }
 }