public void SetShopList(JSON_ShopListArray.Shops shops, Json_ShopMsgResponse msg) { this.EventShopInfo.shops = shops; if (msg != null) { this.EventShopInfo.banner_sprite = msg.banner; this.EventShopInfo.shop_cost_iname = msg.costiname; if (msg.update != null) { this.EventShopInfo.btn_update = msg.update.Equals("on"); } } GachaTabSprites gachaTabSprites = AssetManager.Load <GachaTabSprites>(this.EventShopSpritePath); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gachaTabSprites, (UnityEngine.Object)null) && gachaTabSprites.Sprites != null && gachaTabSprites.Sprites.Length > 0) { Sprite[] sprites = gachaTabSprites.Sprites; for (int index = 0; index < sprites.Length; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object)sprites[index], (UnityEngine.Object)null) && ((UnityEngine.Object)sprites[index]).get_name() == this.EventShopInfo.banner_sprite) { this.banner.set_sprite(sprites[index]); } } } EventCoinData data = MonoSingleton <GameManager> .Instance.Player.EventCoinList.Find((Predicate <EventCoinData>)(f => f.iname.Equals(this.EventShopInfo.shop_cost_iname))); if (data == null) { data = new EventCoinData(); data.param = MonoSingleton <GameManager> .Instance.MasterParam.Items.Find((Predicate <ItemParam>)(f => f.iname.Equals(this.EventShopInfo.shop_cost_iname))); } DataSource.Bind <ItemParam>(this.mPaidCoinIcon, data.param); DataSource.Bind <EventCoinData>(this.mPaidCoinNum, data); if (shops.unlock == null || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mLockObject, (UnityEngine.Object)null) || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.mLockText, (UnityEngine.Object)null)) { return; } bool flag = shops.unlock.flg == 1; Button component = (Button)((Component)this).GetComponent <Button>(); if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)component)) { return; } if (flag) { ((Selectable)component).set_interactable(true); this.mLockObject.SetActive(false); this.mLockText.set_text(string.Empty); } else { ((Selectable)component).set_interactable(false); this.mLockObject.SetActive(true); this.mLockText.set_text(shops.unlock.message != null ? shops.unlock.message : string.Empty); } }
public static Json_ShopMsgResponse ParseMsg(JSON_ShopListArray.Shops shops) { try { return(JSONParser.parseJSONObject <Json_ShopMsgResponse>(shops.info.msg)); } catch (Exception ex) { Debug.LogError((object)("Parse failed: " + shops.info.msg)); return((Json_ShopMsgResponse)null); } }
public void SetShopList(JSON_ShopListArray.Shops shops) { this.shops = shops; if (shops.info != null) { if (shops.info.msg != null) { Json_ShopMsgResponse jsonShopMsgResponse; try { jsonShopMsgResponse = JSONParser.parseJSONObject <Json_ShopMsgResponse>(shops.info.msg); } catch (Exception ex) { Debug.LogError((object)("Parse failed: " + shops.info.msg)); jsonShopMsgResponse = (Json_ShopMsgResponse)null; } if (jsonShopMsgResponse != null) { this.banner_sprite = jsonShopMsgResponse.banner; if (jsonShopMsgResponse.update != null) { this.btn_update = jsonShopMsgResponse.update.Equals("on"); } } } } GachaTabSprites gachaTabSprites = AssetManager.Load <GachaTabSprites>(this.LimitedShopSpritePath); if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)gachaTabSprites, (UnityEngine.Object)null) || gachaTabSprites.Sprites == null || gachaTabSprites.Sprites.Length <= 0) { return; } Sprite[] sprites = gachaTabSprites.Sprites; for (int index = 0; index < sprites.Length; ++index) { if (UnityEngine.Object.op_Inequality((UnityEngine.Object)sprites[index], (UnityEngine.Object)null) && ((UnityEngine.Object)sprites[index]).get_name() == this.banner_sprite) { this.banner.set_sprite(sprites[index]); } } }
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); } }
private BannerParam[] makeValidBannerParams() { GameManager instance = MonoSingleton <GameManager> .Instance; BannerParam[] banners = instance.MasterParam.Banners; if (banners == null) { return(new BannerParam[0]); } List <BannerParam> bannerParamList = new List <BannerParam>(); GachaParam[] gachas = instance.Gachas; QuestParam[] availableQuests = instance.Player.AvailableQuests; QuestParam questParam1 = (QuestParam)null; QuestParam lastStoryQuest = instance.Player.FindLastStoryQuest(); long serverTime = Network.GetServerTime(); DateTime now = TimeManager.FromUnixTime(serverTime); for (int index = 0; index < banners.Length; ++index) { BannerParam banner = banners[index]; if (!string.IsNullOrEmpty(banner.banner) && bannerParamList.FindIndex((Predicate <BannerParam>)(p => p.iname == banner.iname)) == -1 && banner.IsHomeBanner) { if (banner.type == BannerType.shop) { if (instance.IsLimitedShopOpen) { if (instance.LimitedShopList != null && !string.IsNullOrEmpty(banner.sval)) { JSON_ShopListArray.Shops shops = Array.Find <JSON_ShopListArray.Shops>(instance.LimitedShopList, (Predicate <JSON_ShopListArray.Shops>)(p => p.gname == banner.sval)); if (shops != null) { banner.begin_at = TimeManager.FromUnixTime(shops.start).ToString(); banner.end_at = TimeManager.FromUnixTime(shops.end).ToString(); if (!banner.IsAvailablePeriod(now)) { continue; } } else { continue; } } else if (!banner.IsAvailablePeriod(now)) { continue; } } else { continue; } } else if (banner.type == BannerType.storyQuest) { if (lastStoryQuest != null) { if (string.IsNullOrEmpty(banner.sval)) { questParam1 = lastStoryQuest; if (!banner.IsAvailablePeriod(now)) { continue; } } else { QuestParam questParam2 = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == banner.sval)); if (questParam2 == null || questParam2.iname != lastStoryQuest.iname && questParam2.state == QuestStates.New) { questParam2 = lastStoryQuest; } if (!questParam2.IsDateUnlock(serverTime)) { continue; } } } else { continue; } } else if (banner.type == BannerType.eventQuest || banner.type == BannerType.multiQuest) { if (!string.IsNullOrEmpty(banner.sval)) { QuestParam questParam2 = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == banner.sval)); if (questParam2 == null || !questParam2.IsDateUnlock(serverTime)) { continue; } } else if (!banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.gacha) { if (!string.IsNullOrEmpty(banner.sval)) { GachaParam gachaParam = Array.Find <GachaParam>(gachas, (Predicate <GachaParam>)(p => p.iname == banner.sval)); if (gachaParam != null) { banner.begin_at = TimeManager.FromUnixTime(gachaParam.startat).ToString(); banner.end_at = TimeManager.FromUnixTime(gachaParam.endat).ToString(); if (!banner.IsAvailablePeriod(now)) { continue; } } else { continue; } } else if (!banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.url) { if (string.IsNullOrEmpty(banner.sval) || !banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.towerQuest) { if (!banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.arena) { if (!banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.pvp) { if (!banner.IsAvailablePeriod(now)) { continue; } } else if (banner.type == BannerType.ordealQuest) { if (!string.IsNullOrEmpty(banner.sval)) { QuestParam questParam2 = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == banner.sval)); if (questParam2 == null || !questParam2.IsDateUnlock(serverTime)) { continue; } } else if (!banner.IsAvailablePeriod(now)) { continue; } } bannerParamList.Add(banner); } } for (int index1 = 0; index1 < bannerParamList.Count - 1; ++index1) { for (int index2 = index1 + 1; index2 < bannerParamList.Count; ++index2) { if (bannerParamList[index1].priority > bannerParamList[index2].priority) { BannerParam bannerParam = bannerParamList[index1]; bannerParamList[index1] = bannerParamList[index2]; bannerParamList[index2] = bannerParam; } } } return(bannerParamList.ToArray()); }
public static BannerParam[] MakeValidBannerParams(bool _is_home_banner = true) { List <BannerParam> bannerParamList = new List <BannerParam>(); GameManager instance = MonoSingleton <GameManager> .Instance; BannerParam[] banners = instance.MasterParam.Banners; if (banners == null) { DebugUtility.LogError("バナーの設定がありません、有効なバナーを1つ以上設定してください"); return((BannerParam[])null); } QuestParam lastStoryQuest = instance.Player.FindLastStoryQuest(); QuestParam[] availableQuests = instance.Player.AvailableQuests; long serverTime = Network.GetServerTime(); DateTime now = TimeManager.FromUnixTime(serverTime); for (int index = 0; index < banners.Length; ++index) { BannerParam param = banners[index]; bool flag = true; if (param != null && !string.IsNullOrEmpty(param.banner) && bannerParamList.FindIndex((Predicate <BannerParam>)(p => p.iname == param.iname)) == -1 && (!_is_home_banner || param.IsHomeBanner)) { if (param.type == BannerType.shop) { if (instance.IsLimitedShopOpen) { if (instance.LimitedShopList != null && !string.IsNullOrEmpty(param.sval)) { JSON_ShopListArray.Shops shops = Array.Find <JSON_ShopListArray.Shops>(instance.LimitedShopList, (Predicate <JSON_ShopListArray.Shops>)(p => p.gname == param.sval)); if (shops != null) { param.begin_at = TimeManager.FromUnixTime(shops.start).ToString(); param.end_at = TimeManager.FromUnixTime(shops.end).ToString(); } else { continue; } } } else { continue; } } else if (param.type == BannerType.storyQuest) { flag = false; if (lastStoryQuest != null) { QuestParam questParam; if (string.IsNullOrEmpty(param.sval)) { questParam = lastStoryQuest; } else { questParam = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == param.sval)); if (questParam == null || questParam.iname != lastStoryQuest.iname && questParam.state == QuestStates.New) { questParam = lastStoryQuest; } } if (!questParam.IsDateUnlock(serverTime)) { continue; } } else { continue; } } else if (param.type == BannerType.eventQuest || param.type == BannerType.multiQuest) { if (!string.IsNullOrEmpty(param.sval)) { QuestParam questParam = Array.Find <QuestParam>(availableQuests, (Predicate <QuestParam>)(p => p.iname == param.sval)); if (questParam == null || !questParam.IsDateUnlock(serverTime)) { continue; } } } else if (param.type != BannerType.towerQuest && param.type != BannerType.gacha) { if (param.type == BannerType.url) { if (string.IsNullOrEmpty(param.sval)) { continue; } } else if (param.type == BannerType.arena || param.type == BannerType.pvp || param.type != BannerType.ordealQuest) { ; } } if (!flag || param.IsAvailablePeriod(now)) { bannerParamList.Add(param); } } } bannerParamList.Sort((Comparison <BannerParam>)((a, b) => a.priority - b.priority)); return(bannerParamList.ToArray()); }