public CreateCommand(IWeaponFactory weaponFactory,
                      IRepository <IWeapon> weaponRepository, string[] arguments)
     : base(arguments)
 {
     this.weaponFactory    = weaponFactory;
     this.weaponRepository = weaponRepository;
 }
Exemple #2
0
 protected Command(string[] commandArgs, IRepository weaponRepository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     CommandArgs      = commandArgs;
     WeaponRepository = weaponRepository;
     WeaponFactory    = weaponFactory;
     GemFactory       = gemFactory;
 }
 public CommandInterpreter(List <IWeapon> createdWeapons, IWeaponStorage weaponStorage, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.createdWeapons = createdWeapons;
     this.weaponStorage  = weaponStorage;
     this.weaponFactory  = weaponFactory;
     this.gemFactory     = gemFactory;
 }
Exemple #4
0
 public CommandInterpreter(string[] data, IRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.data          = data;
     this.repository    = repository;
     this.weaponFactory = weaponFactory;
     this.gemFactory    = gemFactory;
 }
 public DungeonController(GameWorld gameWorld, IDice dice, IWeaponFactory weaponFactory, IAsciiArtRepository asciiArtRepository)
 {
     _gameWorld = gameWorld;
     _dice = dice;
     _weaponFactory = weaponFactory;
     _asciiArtRepository = asciiArtRepository;
 }
Exemple #6
0
    public CelestialSystem CreateFromSerialized(IProjectileFactory projectileFactory, IPlanetFactory planetFactory,
                                                IWeaponFactory weaponFactory)
    {
        var celestialSystem = resolver.Resolve <CelestialSystem>();
        var planets         = new List <IPlanet>();

        var central           = scs.planets.First(planet => planet.isCentral);
        var centralStarPlanet = planetFactory.CreatePlanet(central.entity.pos);

        central.entity.FillIn(centralStarPlanet.SimulatedEntity);
        celestialSystem.AddCentralStar(centralStarPlanet);

        foreach (var serializedPlanet in scs.planets.Except(new [] { central }))
        {
            var appearance = new PlanetAppearance()
            {
                color = serializedPlanet.color
            };
            var planet = planetFactory.CreatePlanet(serializedPlanet.entity.pos, appearance);
            weaponFactory.AddWeapon(serializedPlanet.weaponType, planet);
            serializedPlanet.entity.FillIn(planet.SimulatedEntity);
            planets.Add(planet);
        }
        celestialSystem.AddRaw(planets);
        projectileFactory.celestialSystem = celestialSystem;

        foreach (var projectile in scs.projectiles)
        {
            var proj = projectileFactory.CreateBullet(projectile.entity.pos);
            projectile.entity.FillIn(proj);
        }

        return(celestialSystem);
    }
Exemple #7
0
 public Engine(IRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.repository         = repository;
     this.weaponFactory      = weaponFactory;
     this.gemFactory         = gemFactory;
     this.commandInterpreter = new CommandInterpreter(this.repository, this.weaponFactory, this.gemFactory);
 }
 public CreateCommand(string[] data, IInventory inventory,
                      IWeaponFactory weaponFactory, IRarityFactory rarityFactory) : base(data)
 {
     this.inventory     = inventory;
     this.weaponFactory = weaponFactory;
     this.rarityFactory = rarityFactory;
 }
Exemple #9
0
        public override void AddWeapon()
        {
            IWeaponFactory WeaponFactory = RTSFactory.GetWeaponFactory();
            IWeapon        Weapon        = WeaponFactory.CreateWeapon(m_BuildParam.emWeapon);

            m_BuildParam.NewCharacter.SetWeapon(Weapon);
        }
 public CreateCommand(string weaponType, string weaponName, IList <IWeapon> weapons)
 {
     this.weaponFactory = new WeaponFactory();
     this.weaponType    = weaponType;
     this.weaponName    = weaponName;
     this.weapons       = weapons;
 }
Exemple #11
0
 public Engine(IGemFactory gemFactory, IWeaponFactory weaponFactory, IWeaponRepository weaponRepository, ICommandInterpreter commandInterpreter)
 {
     this.gemFactory         = gemFactory;
     this.weaponFactory      = weaponFactory;
     this.weaponRepository   = weaponRepository;
     this.commandInterpreter = commandInterpreter;
 }
Exemple #12
0
 // 武器工廠
 public static IWeaponFactory GetWeaponFactory()
 {
     if (m_WeaponFactory == null)
     {
         m_WeaponFactory = new WeaponFactory();
     }
     return(m_WeaponFactory);
 }
Exemple #13
0
 public Engine()
 {
     this.createdWeapons     = new List <IWeapon>();
     this.weaponStorage      = new WeaponStorage();
     this.weaponFactory      = new WeaponFactory();
     this.gemFactory         = new GemFactory();
     this.commandInterpreter = new CommandInterpreter(createdWeapons, weaponStorage, weaponFactory, gemFactory);
 }
Exemple #14
0
        public IExecutable CreateCommand(string[] data, IRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
        {
            Assembly    assembly   = Assembly.GetExecutingAssembly();
            Type        type       = assembly.GetTypes().FirstOrDefault(t => t.Name == data[0] + "Command");
            IExecutable executable = (IExecutable)Activator.CreateInstance(type, new object[] { data, repository, weaponFactory, gemFactory });

            return(executable);
        }
Exemple #15
0
 public void Execute(
     string[] commandParameters,
     IDictionary <string, IWeapon> weapons,
     IWeaponFactory weaponFactory,
     IInputOutputManager inputOutputManager,
     IGemFactory gemFactory)
 {
     Environment.Exit(0);
 }
 public PlayerCreator(IPlayerFactory playerFactory, IEngineFactory engineFactory, IArmourFactory armourFactory, IWeaponFactory weaponFactory, ISpaceshipFactory spaceshipFactory, IBulletFactory bulletFactory)
 {
     this.playerFactory    = playerFactory;
     this.engineFactory    = engineFactory;
     this.armourFactory    = armourFactory;
     this.weaponFactory    = weaponFactory;
     this.spaceshipFactory = spaceshipFactory;
     this.bulletFactory    = bulletFactory;
 }
Exemple #17
0
        private void AddCreatedWeaponToRepo(IWeaponFactory weaponFactory, IRepository repo)
        {
            string  rarity      = this.Data[1].Split().First();
            string  weaponType  = this.Data[1].Split().Last();
            string  name        = this.Data[2];
            IWeapon weaponToAdd = weaponFactory.Create(weaponType, rarity, name);

            repo.AddWeapon(weaponToAdd);
        }
Exemple #18
0
 public Create(
     string[] data,
     IRepository repository,
     IWeaponFactory weaponFactory)
     : base(data)
 {
     this.Repository    = repository;
     this.WeaponFactory = weaponFactory;
 }
Exemple #19
0
        private static void TestWeaponFactory(IWeaponFactory factory)
        {
            IWeapon meeleWeapon  = factory.Create(WeaponType.Melee);
            IWeapon rangedWeapon = factory.Create(WeaponType.Ranged);
            IWeapon magicWeapon  = factory.Create(WeaponType.Magic);

            Console.WriteLine($"Meele Weapon: {meeleWeapon}");
            Console.WriteLine($"Ranged Weapon: {rangedWeapon}");
            Console.WriteLine($"Magic Weapon: {magicWeapon}");
        }
Exemple #20
0
 public Engine(IGemFactory gemFactory, IWeaponFactory weaponFactory,
               ICommandInterpreter commandInterpreter, IRepository repository, IReader reader, IWriter writer)
 {
     this.gemFactory         = gemFactory;
     this.weaponFactory      = weaponFactory;
     this.commandInterpreter = commandInterpreter;
     this.repository         = repository;
     this.reader             = reader;
     this.writer             = writer;
 }
    public override void SetWeapon()
    {
        IWeaponFactory WeaponFactory = GameFactory.GetWeaponFactory();
        //从工厂加载武器
        IWeapon Weapon = WeaponFactory.CreateWeapon(m_BuildParam.emWeapon);

        //设置武器的挂载点
        Weapon.SetGameObject((m_BuildParam.NewCharacter as ISoldier).GetWeaponObj());
        //显示武器
        Weapon.ShowWeapon();
        m_BuildParam.NewCharacter.SetWeapon(Weapon);
    }
 public Engine(
     IInputOutputManager inputOutputManager,
     ICommandDispatcher commandDispatcher,
     IWeaponFactory weaponFactory,
     IGemFactory gemFactory)
 {
     this.inputOutputManager = inputOutputManager;
     this.commandDispatcher  = commandDispatcher;
     this.weapons            = new Dictionary <string, IWeapon>();
     this.weaponFactory      = weaponFactory;
     this.gemFactory         = gemFactory;
 }
        public MonsterFactory(IWeaponFactory weaponFactory, ISpellFactory spellFactory, IItemFactory itemFactory, IMonsterDataRepository monsterDataRepository, IActionSelector actionSelector, IStatsGenerator statsGenerator, IDice dice)
        {
            this.weaponFactory = weaponFactory;
            this.spellFactory = spellFactory;
            this.itemFactory = itemFactory;
            _actionSelector = actionSelector;
            _statsGenerator = statsGenerator;
            _dice = dice;

            monsterArchetypes = monsterDataRepository.GetAllMonsterArchetypes().ToList();
            monsterModifiers = monsterDataRepository.GetAllMonsterModifiers().ToList();
        }
Exemple #24
0
    public void Execute(
        string[] commandParameters,
        IDictionary <string, IWeapon> weapons,
        IWeaponFactory weaponFactory,
        IInputOutputManager inputOutputManager,
        IGemFactory gemFactory)
    {
        string  targetWeaponName = commandParameters[0];
        IWeapon targetWeapon     = weapons[targetWeaponName];

        inputOutputManager.WriteLine($"{targetWeaponName}: {targetWeapon.ToString()}");
    }
Exemple #25
0
 public CommandInterpreter(
     IWeaponRepository weaponRepository,
     ICommandFactory commandFactory,
     IWeaponFactory weaponFactory,
     IGemFactory gemFactory,
     IOutputWriter outputWriter)
 {
     this.weaponRepository = weaponRepository;
     this.commandFactory   = commandFactory;
     this.weaponFactory    = weaponFactory;
     this.gemFactory       = gemFactory;
     this.outputWriter     = outputWriter;
 }
 public Engine(
     IInputManager inputManager,
     IOutputManager outputManager,
     IWeaponRepository weaponDataBase,
     IWeaponFactory weaponFactory,
     IGemFactory gemFactory)
 {
     this.inputManager   = inputManager;
     this.outputManager  = outputManager;
     this.weaponDataBase = weaponDataBase;
     this.weaponFactory  = weaponFactory;
     this.gemFactory     = gemFactory;
 }
Exemple #27
0
    public void Execute(
        string[] commandParameters,
        IDictionary <string, IWeapon> weapons,
        IWeaponFactory weaponFactory,
        IInputOutputManager inputOutputManager,
        IGemFactory gemFactory)
    {
        string targetAxeName = commandParameters[0];
        int    socketIndex   = int.Parse(commandParameters[1]);

        IWeapon targetAxe = weapons[targetAxeName];

        targetAxe.RemoveGem(socketIndex);
    }
Exemple #28
0
 public CommandInterpreter(
     IRepository <IWeapon> weaponRepository,
     IWeaponFactory weaponFactory,
     IRarityFactory rarityFactory,
     IGemFactory gemFactory,
     IClarityFactory clarityFactory,
     IWriter writer)
 {
     this.weaponRepository = weaponRepository;
     this.weaponFactory    = weaponFactory;
     this.rarityFactory    = rarityFactory;
     this.gemFactory       = gemFactory;
     this.clarityFactory   = clarityFactory;
     this.writer           = writer;
 }
Exemple #29
0
    public void Execute(
        string[] commandParameters,
        IDictionary <string, IWeapon> weapons,
        IWeaponFactory weaponFactory,
        IInputOutputManager inputOutputManager,
        IGemFactory gemFactory)
    {
        string[] tokens       = commandParameters[0].Split(' ');
        string   weaponRarity = tokens[0];
        string   weaponType   = tokens[1];
        string   weaponName   = commandParameters[1];

        IWeapon weapon = weaponFactory.CreateWeapon(weaponType, weaponRarity);

        weapons.Add(weaponName, weapon);
    }
 public Engine
 (
     IConsoleRender renderer,
     IConsoleInputController controller,
     ICommandFactory commandFactory,
     IWeaponFactory weaponFactory,
     IGemFactory gemFactory,
     IInventory inventory
 )
 {
     this.renderer       = renderer;
     this.controller     = controller;
     this.CommandFactory = commandFactory;
     this.WeaponFactory  = weaponFactory;
     this.GemFactory     = gemFactory;
     this.Inventory      = inventory;
 }
Exemple #31
0
    public void DispatchCommand(
        string[] commandParameters,
        IDictionary <string, IWeapon> weapons,
        IWeaponFactory weaponFactory,
        IInputOutputManager inputOutputManager,
        IGemFactory gemFactory)
    {
        string commandName = commandParameters[0];

        string[] parameters = commandParameters.Skip(1).ToArray();

        if (!this.commands.ContainsKey(commandName))
        {
            throw new InvalidOperationException($"Command {commandName} not valid!");
        }

        this.commands[commandName].Execute(parameters, weapons, weaponFactory, inputOutputManager, gemFactory);
    }
Exemple #32
0
    public void Construct(IWeaponFactory weaponFactory,
                          GameUIViewFactory gameUiViewFactory,
                          BlockContainer blockContainer,
                          ILevelLoaderService levelLoaderService)
    {
        this.levelLoaderService = levelLoaderService;
        this.blockContainer     = blockContainer;

        ui = gameUiViewFactory.Create();

        weaponFactory.Load();

        weapon = weaponFactory.Create();

        Subscribe();

        ConfigureAttacksCount();

        SetupUI();
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="Samurai" /> class.
 /// </summary>
 /// <param name="weaponFactory">The weapon factory.</param>
 public Samurai(IWeaponFactory weaponFactory)
 {
     this.weaponFactory = weaponFactory;
 }
	// 武器工廠
	public static IWeaponFactory GetWeaponFactory()
	{
		if( m_WeaponFactory == null)		
			m_WeaponFactory = new WeaponFactory();
		return m_WeaponFactory;
	}
 /// <summary>
 /// Initializes a new instance of the <see cref="Town"/> class.
 /// </summary>
 /// <param name="weaponFactory">The weapon factory.</param>
 public Town(IWeaponFactory weaponFactory)
 {
     this.WeaponFactory = weaponFactory;
 }