public PilotFactory(Func <string, IAction> getAction, UpgradeSlotFactory upgradeSlotFactory, Func <string, IFaction> getFaction, Func <string, IUpgradeType> getUpgradeType) { GetAction = getAction; this.upgradeSlotFactory = upgradeSlotFactory; GetFaction = getFaction; GetUpgradeType = getUpgradeType; }
public UpgradeModifierParser(UpgradeSlotFactory upgradeSlotFactory, Func <string, IUpgradeType> getUpgradeType, Func <string, string, IUpgrade> getUpgrade, Func <string, IAction> getAction) { this.upgradeSlotFactory = upgradeSlotFactory; this.getUpgradeType = getUpgradeType; this.getUpgrade = getUpgrade; this.getAction = getAction; }
public IUpgrade CreateUpgrade(UpgradeJson upgrade) { System.Diagnostics.Debug.WriteLine(upgrade.Name); var upgradeSlotFactory = new UpgradeSlotFactory(this); UpgradeModifierParser parser = new UpgradeModifierParser(upgradeSlotFactory, GetUpgradeType, GetUpgrade, GetAction); return(new Upgrade(upgrade.Name, upgrade.Cost, upgrade.Description, upgrade.Unique, upgrade.Limited, GetFaction(upgrade.Faction), GetUpgradeType(upgrade.Type), new Structures.UpgradeModifierPackage( parser.ParseAddedActions(upgrade.AddedActions?.ToArray() ?? new string[0]), parser.ParseRemovedActions(upgrade.RemovedActions?.ToArray() ?? new string[0]), parser.ParseAddedUpgrades(upgrade.AddedUpgrades?.ToArray() ?? new AddedUpgradeJson[0]), parser.ParseRemovedUpgrades(upgrade.RemovedUpgrades?.ToArray() ?? new string[0]), parser.ParseChangedStats(upgrade.StatChanges?.ToArray() ?? new StatChangeJson[0]), parser.ParseSelectableUpgrades(upgrade.ChooseUpgrade?.ToArray() ?? new ChooseUpgradeJson[0])), UpgradeRestrictionParser.ParseRestrictionsForUpgrade(GetUpgradeType, GetAction, upgrade))); }