Exemplo n.º 1
0
 public static void RegisterPurchasableLandPlot(LandPlotShopEntry entry)
 {
     PurchasableUIRegistry.RegisterPurchasable <EmptyPlotUI>((x) =>
     {
         return(new PurchaseUI.Purchasable(entry.NameKey, entry.icon, entry.mainImg, entry.DescKey, entry.cost, entry.pediaId, () => x.BuyPlot(new LandPlotUI.PlotPurchaseItem()
         {
             icon = entry.icon, img = entry.mainImg, cost = entry.cost, plotPrefab = GameContext.Instance.LookupDirector.GetPlotPrefab(entry.plot)
         }), entry.isUnlocked ?? (() => true), () => true));
     });
 }
Exemplo n.º 2
0
 public static void RegisterPurchasableLandPlot(LandPlotShopEntry entry)
 {
     PurchasableUIRegistry.RegisterPurchasable <EmptyPlotUI>(x => new PurchaseUI.Purchasable(entry.NameKey, entry.icon, entry.mainImg, entry.DescKey, entry.cost, entry.pediaId, () =>
     {
         EmptyPlotUI emptyPlotUi = x;
         emptyPlotUi.BuyPlot(new LandPlotUI.PlotPurchaseItem()
         {
             icon       = entry.icon,
             img        = entry.mainImg,
             cost       = entry.cost,
             plotPrefab = SRSingleton <GameContext> .Instance.LookupDirector.GetPlotPrefab(entry.plot)
         });
     }, entry.isUnlocked ?? (() => true), (() => true), null, null, null, null));
 }
Exemplo n.º 3
0
 static LandPlotUpgradeRegistry()
 {
     ModdedIDRegistry.RegisterIDRegistry(moddedUpgrades);
     EnumPatcher.RegisterAlternate(typeof(LandPlot.Upgrade), (obj, name) => CreateLandPlotUpgrade(obj, name));
     PurchasableUIRegistry.RegisterManipulator((LandPlotUI ui, ref Purchasable[] purchasables) =>
     {
         List <Purchasable> purchasables1 = purchasables.ToList();
         Purchasable Demolish             = purchasables1.FirstOrDefault(match => match.nameKey == DemolishKey);
         if (Demolish == null)
         {
             return;
         }
         purchasables1.Remove(Demolish);
         Purchasable ClearCrop = purchasables1.FirstOrDefault(match => match.nameKey == ClearCropKey);
         if (ClearCrop != null)
         {
             purchasables1.Remove(ClearCrop);
             purchasables1.Add(ClearCrop);
         }
         purchasables1.Add(Demolish);
         purchasables = purchasables1.ToArray();
     });
 }
Exemplo n.º 4
0
 public static void RegisterPurchasableUpgrade <T>(UpgradeShopEntry entry) where T : LandPlotUI
 {
     PurchasableUIRegistry.RegisterPurchasable <T>((x) => new PurchaseUI.Purchasable(entry.NameKey, entry.icon, entry.mainImg, entry.DescKey, entry.cost, entry.landplotPediaId, () => {
         x.Upgrade(entry.upgrade, entry.cost);
     }, entry.isUnlocked ?? (() => true), () => !x.activator.HasUpgrade(entry.upgrade)));
 }
Exemplo n.º 5
0
 public static void RegisterPurchasableUpgrade <T>(UpgradeShopEntry entry) where T : LandPlotUI
 {
     PurchasableUIRegistry.RegisterPurchasable <T>((x) => new Purchasable(entry.NameKey, entry.icon, entry.mainImg, entry.DescKey, entry.cost, entry.landplotPediaId, () => {
         x.Upgrade(entry.upgrade, entry.cost);
     }, entry.isUnlocked != null ? (Func <bool>)(() => entry.isUnlocked(x.activator)) : (() => true), entry.isAvailable != null ? (Func <bool>)(() => entry.isAvailable(x.activator)) : (() => !x.activator.HasUpgrade(entry.upgrade)), null, entry.warning ?? null, null, null, entry.holdtopurchase));
 }