public void AddSpecialOfferButtonOnLobbyEnter(NodeAddedEvent e, SingleNode <MainScreenComponent> mainScreen, [Combine] PersonalOfferNode personalOffer, [Context, JoinBy(typeof(SpecialOfferGroupComponent))] SpecialOfferNode specialOffer) { GameObject starterPackButton = mainScreen.component.StarterPackButton; StarterPackButtonComponent component = starterPackButton.GetComponent <StarterPackButtonComponent>(); component.PackEntity = specialOffer.Entity; component.SetImage(specialOffer.starterPackVisualConfig.ButtonSpriteUid); starterPackButton.SetActive(true); }
public void RemoveSpecialOfferNode(NodeRemoveEvent e, PersonalSpecialOfferPropertyNode node, [JoinBy(typeof(SpecialOfferGroupComponent))] SpecialOfferNode offer, [JoinAll] SingleNode <DealsUIComponent> deals) { deals.component.RemoveSpecialOffer(offer.Entity); }
public void AddSpecialOffer(NodeAddedEvent e, SingleNode <DealsUIComponent> deals, [Combine] SpecialOfferNode offer, [JoinBy(typeof(SpecialOfferGroupComponent))] PersonalSpecialOfferPropertyNode personalOfferProperty) { if (!offer.Entity.HasComponent <LeagueFirstEntranceSpecialOfferComponent>()) { deals.component.AddSpecialOffer(offer.Entity, null); } else { GameObject gameObject = deals.component.leagueSpecialOfferPrefab.gameObject; SpecialOfferContent content = deals.component.AddSpecialOffer(offer.Entity, gameObject); List <SpecialOfferItem> items = new List <SpecialOfferItem>(); foreach (KeyValuePair <long, int> pair in offer.Entity.GetComponent <CountableItemsPackComponent>().Pack) { long key = pair.Key; Entity entity = Flow.Current.EntityRegistry.GetEntity(key); int quantity = pair.Value; string spriteUid = entity.GetComponent <ImageItemComponent>().SpriteUid; string name = entity.GetComponent <DescriptionItemComponent>().Name; items.Add(new SpecialOfferItem(quantity, spriteUid, name)); } content.GetComponent <LeagueSpecialOfferComponent>().ShowOfferItems(items, offer.Entity.GetComponent <LeagueFirstEntranceSpecialOfferComponent>().WorthItPercent); } }
public void AddOffer(CollectOfferEvent e, PersonalSpecialOfferPropertyNode personalOfferProperty, [JoinBy(typeof(SpecialOfferGroupComponent))] SpecialOfferNode offer, [JoinAll] GoodsSelectionScreenNode screen) { StringBuilder builder = new StringBuilder(); if (offer.itemsPackFromConfig.Pack.Count > 0) { int num = 0; builder.Append("* —"); bool flag = true; foreach (long num2 in offer.itemsPackFromConfig.Pack) { ItemInMarketRequestEvent eventInstance = new ItemInMarketRequestEvent(); base.ScheduleEvent(eventInstance, offer); if (eventInstance.marketItems.ContainsKey(num2)) { if (!flag) { builder.Append(", "); } flag = false; builder.Append(eventInstance.marketItems[num2]); num++; } } if (num == 0) { builder.Append(screen.goodsSelectionScreen.SpecialOfferEmptyRewardMessage); } } if (offer.specialOfferDuration.OneShot && personalOfferProperty.Entity.HasComponent(typeof(PaymentIntentComponent))) { if (builder.Length > 0) { builder.Append("\n"); } builder.Append(screen.goodsSelectionScreen.SpecialOfferOneShotMessage); } screen.goodsSelectionScreen.SpecialOfferDataProvider.AddItem(offer.Entity, builder.ToString()); }