Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
        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)));
        }