private StickerType GetStickerTypeFromStoreTab(StoreTab tab) { StickerType result = StickerType.Invalid; switch (tab) { case StoreTab.Crystals: result = StickerType.CrystalShop; break; case StoreTab.Fragments: result = StickerType.FragmentShop; break; case StoreTab.Structures: result = StickerType.StructureShop; break; default: if (tab == StoreTab.Treasure) { result = StickerType.TreasureShop; } break; } return(result); }
private void SetupSticker(StoreTab tab) { JewelControl jewelControl; if (this.tabStickers.ContainsKey(tab)) { jewelControl = this.tabStickers[tab]; } else { string name = tab.ToString(); string parentName = tab.ToString() + "Special"; jewelControl = JewelControl.CreateSticker(this.parentStoreScreen, name, parentName); if (jewelControl == null) { return; } this.tabStickers.Add(tab, jewelControl); } if (tab == StoreTab.Crystals) { this.SetupCrystalsSticker(jewelControl); } else { this.SetupTabSticker(jewelControl, tab); } }
private void HideStickerVisuals(StoreTab tab) { string text = string.Format("Texture{0}Icon", tab.ToString()); string name = string.Format("Widget{0}Special", tab.ToString()); string text2 = string.Format("SpriteBannerGradient{0}Special", tab.ToString()); string text3 = string.Format("SpriteBanner{0}Special", tab.ToString()); string text4 = string.Format("LabelSee{0}Deals", tab.ToString()); string text5 = string.Format("SpriteSee{0}DealsStroke", tab.ToString()); string text6 = string.Format("SpriteSee{0}DealsIcon", tab.ToString()); string text7 = string.Format("SpriteBkgStrokeTab{0}", tab.ToString()); string text8 = string.Format("SpriteBkgDetailRightTab{0}", tab.ToString()); string text9 = string.Format("SpriteBkgDetailLeftTab{0}", tab.ToString()); string text10 = string.Format("SpriteBkgInnerGlowTab{0}", tab.ToString()); UXTexture optionalElement = this.parentStoreScreen.GetOptionalElement <UXTexture>(text); if (optionalElement != null && this.orginalTextureNames.ContainsKey(text)) { optionalElement.LoadTexture(this.orginalTextureNames[text]); } UXElement optionalElement2 = this.parentStoreScreen.GetOptionalElement <UXElement>(name); if (optionalElement2 != null) { optionalElement2.Visible = false; } UXSprite optionalElement3 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text2); this.RestoreOriginalSpriteColor(text2, optionalElement3); UXSprite optionalElement4 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text3); this.RestoreOriginalSpriteColor(text3, optionalElement4); UXLabel optionalElement5 = this.parentStoreScreen.GetOptionalElement <UXLabel>(text4); this.RestoreOriginalLabelColor(text4, optionalElement5); UXSprite optionalElement6 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text5); this.RestoreOriginalSpriteColor(text5, optionalElement6); UXSprite optionalElement7 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text6); this.RestoreOriginalSpriteColor(text6, optionalElement7); UXSprite optionalElement8 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text7); this.RestoreOriginalSpriteColor(text7, optionalElement8); UXSprite optionalElement9 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text8); this.RestoreOriginalSpriteColor(text8, optionalElement9); UXSprite optionalElement10 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text9); this.RestoreOriginalSpriteColor(text9, optionalElement10); UXSprite optionalElement11 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text10); this.RestoreOriginalSpriteColor(text10, optionalElement11); }
public void CheckForStickerExpiration() { int num = ShopStickerViewModule.STICKER_TABS.Length; int serverTime = (int)Service.ServerAPI.ServerTime; for (int i = 0; i < num; i++) { StoreTab storeTab = ShopStickerViewModule.STICKER_TABS[i]; int endTime = this.tabStickers[storeTab].EndTime; if (endTime > 0 && serverTime >= endTime) { this.SetupSticker(storeTab); } } }
private void OpenStore(string action, string data) { StoreScreen storeScreen = new StoreScreen(); string[] array = data.Split(new char[] { '|' }); if (array.Length > 0) { StoreTab tab = StringUtils.ParseEnum <StoreTab>(array[0]); storeScreen.OpenStoreTab(tab); } Service.ScreenController.AddScreen(storeScreen); if (array.Length > 1) { storeScreen.ScrollToItem(array[1]); } }
private void SetupTabSticker(JewelControl jewel, StoreTab tab) { if (this.parentStoreScreen.IsTabLocked(tab)) { this.HideStickerVisuals(tab); return; } StickerType stickerTypeFromStoreTab = this.GetStickerTypeFromStoreTab(tab); StickerController stickerController = Service.StickerController; StickerVO storeStickerToDisplay = stickerController.GetStoreStickerToDisplay(stickerTypeFromStoreTab); jewel.EndTime = 0; if (storeStickerToDisplay == null) { jewel.Cleanup(); this.HideStickerVisuals(tab); return; } jewel.EndTime = storeStickerToDisplay.EndTime; this.SetupStickerVisuals(tab, storeStickerToDisplay); }
public override void Prepare() { base.VerifyArgumentCount(2); this.tab = StringUtils.ParseEnum <StoreTab>(this.prepareArgs[0]); this.parent.ChildPrepared(this); }
private void SetupStickerVisuals(StoreTab tab, StickerVO vo) { string text = string.Format("Texture{0}Icon", tab.ToString()); string name = string.Format("Widget{0}Special", tab.ToString()); string text2 = string.Format("SpriteBannerGradient{0}Special", tab.ToString()); string text3 = string.Format("SpriteBanner{0}Special", tab.ToString()); string text4 = string.Format("LabelSee{0}Deals", tab.ToString()); string text5 = string.Format("SpriteSee{0}DealsStroke", tab.ToString()); string text6 = string.Format("SpriteSee{0}DealsIcon", tab.ToString()); string text7 = string.Format("SpriteBkgStrokeTab{0}", tab.ToString()); string text8 = string.Format("SpriteBkgDetailRightTab{0}", tab.ToString()); string text9 = string.Format("SpriteBkgDetailLeftTab{0}", tab.ToString()); string text10 = string.Format("SpriteBkgInnerGlowTab{0}", tab.ToString()); UXTexture optionalElement = this.parentStoreScreen.GetOptionalElement <UXTexture>(text); FactionType faction = Service.CurrentPlayer.Faction; if (optionalElement != null) { string text11 = string.Empty; if (faction == FactionType.Rebel) { text11 = vo.TextureOverrideAssetNameRebel; } else { text11 = vo.TextureOverrideAssetNameEmpire; } if (!string.IsNullOrEmpty(text11)) { string assetName = optionalElement.AssetName; this.orginalTextureNames.Add(text, assetName); optionalElement.LoadTexture(text11); } } UXElement optionalElement2 = this.parentStoreScreen.GetOptionalElement <UXElement>(name); if (optionalElement2 != null) { optionalElement2.Visible = true; } UXSprite optionalElement3 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text2); if (optionalElement3 != null && !string.IsNullOrEmpty(vo.GradientColor)) { this.AddOriginalUIColor(text2, optionalElement3.Color); optionalElement3.Color = FXUtils.ConvertHexStringToColorObject(vo.GradientColor); } if (string.IsNullOrEmpty(vo.MainColor)) { return; } Color color = FXUtils.ConvertHexStringToColorObject(vo.MainColor); UXSprite optionalElement4 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text3); if (optionalElement4 != null) { this.AddOriginalUIColor(text3, optionalElement4.Color); optionalElement4.Color = color; } UXLabel optionalElement5 = this.parentStoreScreen.GetOptionalElement <UXLabel>(text4); if (optionalElement5 != null) { this.AddOriginalUIColor(text4, optionalElement5.TextColor); optionalElement5.TextColor = color; } UXSprite optionalElement6 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text5); if (optionalElement6 != null) { this.AddOriginalUIColor(text5, optionalElement6.Color); optionalElement6.Color = color; } UXSprite optionalElement7 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text6); if (optionalElement7 != null) { this.AddOriginalUIColor(text6, optionalElement7.Color); optionalElement7.Color = color; } UXSprite optionalElement8 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text7); if (optionalElement8 != null) { this.AddOriginalUIColor(text7, optionalElement8.Color); optionalElement8.Color = color; } Color color2 = new Color(color.r, color.g, color.b, 0.5f); UXSprite optionalElement9 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text8); if (optionalElement9 != null) { this.AddOriginalUIColor(text8, optionalElement9.Color); optionalElement9.Color = color2; } UXSprite optionalElement10 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text9); if (optionalElement10 != null) { this.AddOriginalUIColor(text9, optionalElement10.Color); optionalElement10.Color = color2; } UXSprite optionalElement11 = this.parentStoreScreen.GetOptionalElement <UXSprite>(text10); if (optionalElement11 != null) { this.AddOriginalUIColor(text10, optionalElement11.Color); optionalElement11.Color = new Color(color.r, color.g, color.b, 0.4f); } }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.InitializeGeneralSystemsEnd: this.CheckExpectedIAPCount(); this.GetValidProductsFromStore(); this.ScheduleValidateIAPItems(); this.eventManager.UnregisterObserver(this, EventId.InitializeGeneralSystemsEnd); return(EatResponse.NotEaten); case EventId.InitializeWorldStart: case EventId.InitializeWorldEnd: { IL_1C: if (id == EventId.StoreCategorySelected) { StoreTab storeTab = (StoreTab)cookie; if (storeTab == StoreTab.Treasure && this.products.Count == 0) { Service.BILoggingController.TrackGameAction("iap", "get_products_treasure_empty", "no_valid_products", string.Empty); } return(EatResponse.NotEaten); } if (id == EventId.StoreScreenReady) { if (this.numStoreRetryAttempts < 10) { if (this.products.Count == 0) { this.numStoreRetryAttempts++; Service.BILoggingController.TrackGameAction("iap", "get_products_store_retry", string.Empty, string.Empty); this.ValidateIAPItems(true); } } else if (this.products.Count == 0) { Service.BILoggingController.TrackGameAction("iap", "get_products_store_fail", this.numStoreRetryAttempts.ToString(), string.Empty); } return(EatResponse.NotEaten); } if (id == EventId.WorldLoadComplete) { this.eventManager.UnregisterObserver(this, EventId.WorldLoadComplete); if (!this.AreProductIdsReady) { this.eventManager.RegisterObserver(this, EventId.IAPProductIDsReady, EventPriority.Default); } else { this.RestorePurchases(); } return(EatResponse.NotEaten); } if (id == EventId.IAPProductIDsReady) { this.eventManager.UnregisterObserver(this, EventId.IAPProductIDsReady); this.RestorePurchases(); return(EatResponse.NotEaten); } if (id != EventId.TargetedBundleReserve) { return(EatResponse.NotEaten); } string productId = (string)cookie; this.ReserveTargetBundleOnServer(productId); return(EatResponse.NotEaten); } case EventId.SuccessfullyResumed: Service.InAppPurchaseController.OnApplicationResume(); return(EatResponse.NotEaten); } goto IL_1C; }