public CommandInterpreter(List <IWeapon> createdWeapons, IWeaponStorage weaponStorage, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.createdWeapons = createdWeapons;
     this.weaponStorage  = weaponStorage;
     this.weaponFactory  = weaponFactory;
     this.gemFactory     = gemFactory;
 }
예제 #2
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);
 }
예제 #3
0
 protected Command(string[] commandArgs, IRepository weaponRepository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     CommandArgs      = commandArgs;
     WeaponRepository = weaponRepository;
     WeaponFactory    = weaponFactory;
     GemFactory       = gemFactory;
 }
 public AddCommand(IGemFactory gemFactory,
                   IRepository <IWeapon> weaponRepository, string[] arguments)
     : base(arguments)
 {
     this.gemFactory       = gemFactory;
     this.weaponRepository = weaponRepository;
 }
예제 #5
0
 public Engine(IGemFactory gemFactory, IWeaponFactory weaponFactory, IWeaponRepository weaponRepository, ICommandInterpreter commandInterpreter)
 {
     this.gemFactory         = gemFactory;
     this.weaponFactory      = weaponFactory;
     this.weaponRepository   = weaponRepository;
     this.commandInterpreter = commandInterpreter;
 }
예제 #6
0
 public CommandInterpreter(string[] data, IRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.data          = data;
     this.repository    = repository;
     this.weaponFactory = weaponFactory;
     this.gemFactory    = gemFactory;
 }
예제 #7
0
 public AddCommand(string weaponName, int socketIndex, string gemType, IList <IWeapon> weapons)
 {
     this.weaponName  = weaponName;
     this.weapons     = weapons;
     this.socketIndex = socketIndex;
     this.gemType     = gemType;
     this.gemFactory  = new GemFactory();
 }
예제 #8
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);
 }
예제 #9
0
파일: Add.cs 프로젝트: vesy53/SoftUni
 public Add(
     string[] data,
     IRepository repository,
     IGemFactory gemFactory)
     : base(data)
 {
     this.Repository = repository;
     this.GemFactory = gemFactory;
 }
예제 #10
0
 public void Execute(
     string[] commandParameters,
     IDictionary <string, IWeapon> weapons,
     IWeaponFactory weaponFactory,
     IInputOutputManager inputOutputManager,
     IGemFactory gemFactory)
 {
     Environment.Exit(0);
 }
예제 #11
0
파일: Engine.cs 프로젝트: sahwar/SoftUni-1
 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;
 }
예제 #12
0
    private static Gem CreateGem(string gemInfo, IGemFactory gemFactory)
    {
        var gemTokens = gemInfo.Split();

        var clarity = Enum.Parse <Clarity>(gemTokens[0]);
        var gemType = gemTokens[1];

        var gem = (Gem)gemFactory.CreateGem(gemType, clarity);

        return(gem);
    }
예제 #13
0
        private void AddNewGem(IGemFactory gemFactory, IRepository repo)
        {
            string nameOfWeapon = this.Data[1];
            int    index        = int.Parse(this.Data[2]);
            string claryty      = this.Data[3].Split().First();
            string gemType      = this.Data[3].Split().Last();
            IGem   gemToAdd     = gemFactory.Create(gemType, claryty);
            var    weapon       = repo.GetWeapon(nameOfWeapon);

            weapon.AddGem(index, gemToAdd);
        }
예제 #14
0
 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;
 }
예제 #15
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()}");
    }
 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;
 }
예제 #17
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;
 }
예제 #18
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);
    }
예제 #19
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;
 }
예제 #20
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);
    }
예제 #21
0
 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;
 }
예제 #22
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);
    }
예제 #23
0
        public Board(Texture2D cellTexture2D, Rectangle boardContainer, int lines, int columns, IGemFactory gemFactory,
                     VectorInput vectorInput)
        {
            if (lines == 0 || columns == 0)
            {
                throw new ArgumentException("Lines and Columns can't be 0");
            }

            CellTexture2D = cellTexture2D;
            Gems          = new Gem[columns, lines];
            Cells         = new Rectangle[columns, lines];
            var widthCell  = boardContainer.Width / columns;
            var heightCell = boardContainer.Height / lines;
            var cellSize   = Math.Min(widthCell, heightCell);

            GemOffset = (int)(cellSize * 0.1);
            GemSize   = cellSize - GemOffset * 2;
            var startX = boardContainer.X + (boardContainer.Width - columns * cellSize) / 2;
            var startY = boardContainer.Y + (boardContainer.Height - lines * cellSize) / 2;

            CellColor  = new Color(Color.White, 50);
            GemFactory = gemFactory;
            for (var x = 0; x < columns; x++)
            {
                for (var y = 0; y < lines; y++)
                {
                    Cells[x, y] = new Rectangle(startX + x * cellSize, startY + y * cellSize, cellSize, cellSize);
                    CreateGem(x, y);
                }
            }

            Lines              = lines;
            Columns            = columns;
            Recalculate        = new List <Gem>(Gems.Length);
            BoardState         = BoardState.Move;
            VectorInput        = vectorInput;
            VectorInput.Press += VectorInputOnPress;
        }
예제 #24
0
 public Engine()
 {
     this.repository    = new WeaponRepository();
     this.weaponFactory = new WeaponFactory();
     this.gemFactory    = new GemFactory();
 }
예제 #25
0
 public AddCommand(string[] data, IRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory) : base(data, repository, weaponFactory, gemFactory)
 {
 }
 public CommandInterpreter(IWeaponRepository repository, IWeaponFactory weaponFactory, IGemFactory gemFactory)
 {
     this.repository    = repository;
     this.weaponFactory = weaponFactory;
     this.gemFactory    = gemFactory;
 }
예제 #27
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);
        }
예제 #28
0
 public Engine(IWeaponFactory weaponFactory, IGemFactory gemFactory, IRepository repository)
 {
     this.commandInterpreter = new CommandInterpreter(weaponFactory, gemFactory, repository);
 }
 public AddCommand(string[] data, IArmory armory, IGemFactory gemFactory)
     : base(data)
 {
     this.Armory     = armory;
     this.GemFactory = gemFactory;
 }
예제 #30
0
 public AddCommand(string[] data, IWeaponRepository repository, IGemFactory gemFactory)
     : base(data)
 {
     this.repository = repository;
     this.gemFactory = gemFactory;
 }