Beispiel #1
0
        public Tank(int row, int col, Direction direction, IMap map, IEnvironmentFactory environmentFactory, ICollision collision) : base(row, col, map)
        {
            this.Representative = '^';
            this.Direction      = direction;

            this.environmentFactory = environmentFactory ?? throw new ArgumentNullException();
            this.collision          = collision ?? throw new ArgumentNullException();

            this.Map[base.RowPosition, base.ColumnPosition] = this;
        }
Beispiel #2
0
        public Shell(int row, int col, IMap map, Direction direction, IEnvironmentFactory environmentFactory, ICollision collision) : base(row, col, map)
        {
            this.Representative = '+';
            this.Color          = ConsoleColor.DarkRed;
            this.direction      = direction;

            this.environmentFactory = environmentFactory ?? throw new ArgumentNullException();
            this.collision          = collision ?? throw new ArgumentNullException();

            this.Spawn();
        }
Beispiel #3
0
        public IEnvironmentSetup UseFactory(IEnvironmentFactory factory)
        {
            if (factory == null)
            {
                _environments = null;
                return(this);
            }

            EnsureEnvironmentsNotSet();
            _environments = new FactoryEnvironmentCollection(factory);
            return(this);
        }
Beispiel #4
0
        internal ZoneForm(IEditZone edit)
        {
            InitializeComponent();

            m_Edit = edit;
            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit = f.CreateZone();
            }

            m_Edit.BeginEdit();
        }
Beispiel #5
0
 public Engine(IDisplay display, /*IMainMenu menu, */ IMap map, IPlayerTank playerTank, IEnvironmentFactory environmentFactory, ICollision collision, IKeyboardWraper keyboard, IGameTimer timer, IGameSettings gameSettings, IData data)
 {
     //this.menu = menu;
     this.map                = map ?? throw new NoMapException();
     this.playerTank         = playerTank ?? throw new ArgumentNullException();
     this.environmentFactory = environmentFactory ?? throw new ArgumentNullException();
     this.collision          = collision ?? throw new ArgumentNullException();
     this.keyboard           = keyboard ?? throw new ArgumentNullException();
     this.timer              = timer ?? throw new ArgumentNullException();
     this.gameSettings       = gameSettings ?? throw new ArgumentNullException();
     this.data               = data;
     this.display            = display ?? throw new ArgumentNullException();
 }
Beispiel #6
0
        internal TableForm(IEditTable edit)
        {
            InitializeComponent();

            m_Edit = edit;
            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit = f.CreateTableAssociation();
            }

            m_Edit.BeginEdit();
        }
Beispiel #7
0
        internal IdGroupForm(IEditIdGroup edit)
        {
            InitializeComponent();

            m_Edit = edit;
            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit = f.CreateIdGroup();
            }

            m_Edit.BeginEdit();
        }
Beispiel #8
0
        internal EntityForm(IEditEntity edit)
        {
            InitializeComponent();

            m_Edit          = edit;
            m_DefaultTables = null;

            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit = f.CreateEntity();
            }

            m_Edit.BeginEdit();
        }
Beispiel #9
0
        public FactoryEnvironmentCollection(IEnvironmentFactory environmentFactory)
        {
            Assert.ArgumentNotNull(environmentFactory, nameof(environmentFactory));
            var environments = environmentFactory.ValidEnvironments;

            if (environments == null || environments.Count == 0)
            {
                environments = new[] { Constants.EnvironmentNameDefault }
            }
            ;
            _environmentFactory = environmentFactory;
            _namedCache         = new Dictionary <string, object>();
            _nameList           = environments.ToList();
            _validNames         = new HashSet <string>(environments);
        }
Beispiel #10
0
        internal TemplateForm(IEditTemplate edit)
        {
            InitializeComponent();

            m_Edit = edit;
            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit = f.CreateTemplate();
            }

            m_TableFactory = new TableFactory();
            m_Table        = null;
            m_Edit.BeginEdit();
        }
        /// <summary>
        /// Prompts the user for information for a new property item.
        /// </summary>
        public void NewItem()
        {
            using (PropertyForm dial = new PropertyForm(String.Empty, String.Empty))
            {
                if (dial.ShowDialog() == DialogResult.OK)
                {
                    IEnvironmentFactory f       = EnvironmentContainer.Factory;
                    IEditProperty       newProp = f.CreateProperty();
                    newProp.BeginEdit();
                    newProp.Name  = dial.PropertyName;
                    newProp.Value = dial.PropertyValue;
                    newProp.FinishEdit();

                    RefreshList();
                }
            }
        }
Beispiel #12
0
        internal ThemeForm(IEditTheme edit)
        {
            InitializeComponent();

            m_Edit = edit;
            if (m_Edit == null)
            {
                IEnvironmentFactory f = EnvironmentContainer.Factory;
                m_Edit   = f.CreateTheme();
                m_Layers = new ILayer[0];
            }
            else
            {
                m_Layers = m_Edit.Layers;
            }

            m_Edit.BeginEdit();
        }
Beispiel #13
0
        private void columnsPage_CloseFromNext(object sender, Gui.Wizard.PageEventArgs e)
        {
            // Ensure ID column has been defined
            string idColumnName = (idColumnComboBox.SelectedItem == null ? String.Empty : idColumnComboBox.SelectedItem.ToString());

            if (idColumnName.Length == 0)
            {
                MessageBox.Show("You must specify the name of the column that holds the feature ID");
                idColumnComboBox.Focus();
                e.Page = columnsPage;
                return;
            }

            m_Edit.IdColumnName = idColumnName;

            // Ensure column domains are up to date.
            // For the time being, we do NOT establish or remove foreign keys in the
            // database - if that is considered desirable, bear in mind that the changes
            // being saved here may ultimately be discarded by the user (on exit from the
            // application).

            List <IColumnDomain> cds     = new List <IColumnDomain>();
            IEnvironmentFactory  factory = EnvironmentContainer.Factory;

            foreach (DataGridViewRow row in columnsGrid.Rows)
            {
                IDomainTable dt = (row.Cells["dgcDomain"].Value as IDomainTable);

                if (dt != null)
                {
                    IEditColumnDomain cd = factory.CreateColumnDomain();
                    cd.ParentTable = m_Edit;
                    cd.ColumnName  = row.Cells["dgcColumnName"].FormattedValue.ToString();
                    cd.Domain      = dt;

                    cds.Add(cd);
                }
            }

            m_Edit.ColumnDomains = cds.ToArray();
            m_Edit.FinishEdit();
            this.DialogResult = DialogResult.OK;
            Close();
        }
Beispiel #14
0
        private void okButton_Click(object sender, EventArgs e)
        {
            // Ensure the table name is defined
            string tableName = tableNameComboBox.SelectedItem.ToString();

            if (tableName.Length == 0)
            {
                MessageBox.Show("The name of the domain table must be specified");
                tableNameComboBox.Focus();
                return;
            }

            IEnvironmentFactory f  = EnvironmentContainer.Factory;
            IEditDomainTable    dt = f.CreateDomainTable();

            dt.BeginEdit();
            dt.TableName = tableName;
            dt.FinishEdit();

            this.DialogResult = DialogResult.OK;
            Close();
        }
        /// <summary>
        /// Ensures all mandatory properties have been added
        /// </summary>
        /// <returns>True if any properties were added.</returns>
        bool AddMandatoryProperties(IProperty[] data)
        {
            bool result = false;

            string[] props = PropertyNaming.MandatoryProperties;

            foreach (string p in props)
            {
                if (!Array.Exists <IProperty>(data, delegate(IProperty t) { return(t.Name == p); }))
                {
                    IEnvironmentFactory f       = EnvironmentContainer.Factory;
                    IEditProperty       newProp = f.CreateProperty();
                    newProp.BeginEdit();
                    newProp.Name  = p;
                    newProp.Value = String.Empty;
                    newProp.FinishEdit();

                    result = true;
                }
            }

            return(result);
        }
Beispiel #16
0
 public Map(string directory, IEnvironmentFactory environmentFactory)
 {
     this.environmentFactory = environmentFactory;
     ParseMap(directory);
 }
 public EnvironmentSetup(IMapLoader mapLoader, IEnvironmentFactory environmentFactory, ITroopLoader troopLoader)
 {
     _mapLoader          = mapLoader;
     _environmentFactory = environmentFactory;
     _troopLoader        = troopLoader;
 }
Beispiel #18
0
 public HierarchyProvider(FileProviderOptions options, IEnvironmentFactory environmentFactory)
 {
     _basePath           = options.BasePath;
     _environmentFactory = environmentFactory;
 }
 public IShell CreateShell(int row, int col, IMap map, Direction direction, IEnvironmentFactory factory, ICollision collision)
 {
     return(new Shell(row, col, map, direction, factory, collision));
 }
Beispiel #20
0
 public EnvironmentFactoryTests()
 {
     _sut = new EnvironmentFactory();
 }
Beispiel #21
0
 public EnemyTank(int row, int col, Direction direction, IMap map, IPlayerTank playerTank, IEnvironmentFactory environmentFactory, ICollision collision, IGameTimer gameTimer) : base(row, col, direction, map, environmentFactory, collision)
 {
     this.Color      = ConsoleColor.Red;
     this.playerTank = playerTank;
     this.gameTimer  = gameTimer ?? throw new ArgumentNullException();
 }
Beispiel #22
0
 public PlayerTank(int row, int col, Direction direction, IMap map, IEnvironmentFactory environmentFactory, ICollision collision) : base(row, col, direction, map, environmentFactory, collision)
 {
     this.Color = ConsoleColor.Yellow;
 }