private bool onPurchaseClickedEvent(CatalogUIEvents.BuyPanelPurchaseButtonClickedEvent evt)
        {
            CatalogThemeDefinition themeByScheduelId  = Service.Get <CatalogServiceProxy>().GetThemeByScheduelId(currentTheme.scheduledThemeChallengeId);
            TemplateDefinition     templateDefinition = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >().Values.ToList().First((TemplateDefinition x) => x.Id == evt.ItemData.equipment.definitionId);
            string tokenTranslation  = Service.Get <Localizer>().GetTokenTranslation(templateDefinition.Name);
            string tokenTranslation2 = Service.Get <Localizer>().GetTokenTranslation(themeByScheduelId.Title);
            int    level             = Service.Get <ProgressionService>().Level;
            long   cost = evt.ItemData.cost;

            Service.Get <ICPSwrveService>().PurchaseClothing(tokenTranslation, (int)cost, 1, level);
            bool flag = navCategory == CatalogShopNavEnum.POPULAR;

            Service.Get <ICPSwrveService>().Action("clothing_catalog_item", "purchase", tokenTranslation2, tokenTranslation, flag.ToString());
            return(false);
        }
        private bool onBuyPanelPurchaseButtonClickedEvent(CatalogUIEvents.BuyPanelPurchaseButtonClickedEvent evt)
        {
            int  coins = Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).Coins;
            long cost  = evt.ItemData.cost;

            if (coins < cost)
            {
                Service.Get <PromptManager>().ShowPrompt("InsufficientFundsErrorPrompt", null);
            }
            else
            {
                purchaseItem    = evt.ItemData;
                itemForPurchase = evt.ItemData.equipment;
                Service.Get <INetworkServicesManager>().CatalogService.PurchaseCatalogItem(evt.ItemData.clothingCatalogItemId);
            }
            return(false);
        }
Ejemplo n.º 3
0
 private bool onPurchaseClicked(CatalogUIEvents.BuyPanelPurchaseButtonClickedEvent evt)
 {
     Service.Get <EventDispatcher>().AddListener <CatalogServiceEvents.ItemPurchaseCompleteEvent>(onPurchaseComplete);
     return(false);
 }