public void Init()
        {
            for (int row = 0; row < _configuration.LevelHeight; row++)
            {
                for (int column = 0; column < _configuration.LevelWidth; column++)
                {
                    EcsEntity  cellEntity = _world.NewEntity();
                    Vector2Int position   = new Vector2Int(column, row);
                    cellEntity.Set <Vector2Int>() = position;

                    bool hasChain = true;
                    int  tryCount = 0;

                    _gameField.Cells.Add(position, cellEntity);

                    while (hasChain && tryCount < 100)
                    {
                        tryCount++;

                        float             random        = Random.Range(0f, 100f);
                        CellConfiguration configuration = _configuration.CellConfigurations.Where(c => c.CheckInSpawnRabge(random)).First();

                        cellEntity.Set <Cell>().Configuration = configuration;

                        hasChain = GameFieldAnalyst.CheckCellInChain(_gameField.Cells, _configuration, position);
                    }
                }
            }
        }
        public CustomTableViewSource(
            CellConfiguration <TItem> configureCell,
            HeaderConfiguration <THeader> configureHeader,
            IEnumerable <TSection> sections = null)
            : base(sections)
        {
            Ensure.Argument.IsNotNull(configureCell, nameof(configureCell));

            this.configureCell   = configureCell;
            this.configureHeader = configureHeader;
        }
Esempio n. 3
0
        public CustomTableViewSource(
            CellConfiguration <TItem> configureCell,
            HeaderConfiguration <THeader> configureHeader,
            IImmutableList <TItem> items = null)
            : base(items)
        {
            Ensure.Argument.IsNotNull(configureCell, nameof(configureCell));

            this.configureCell   = configureCell;
            this.configureHeader = configureHeader;
        }
Esempio n. 4
0
        public void Run()
        {
            foreach (var index in _filter)
            {
                float             random        = Random.Range(0f, 100f);
                CellConfiguration configuration = _configuration.CellConfigurations.Where(c => c.CheckInSpawnRabge(random)).First();

                EcsEntity entity = _filter.GetEntity(index);
                entity.Unset <EmptySpace>();
                entity.Set <Cell>().Configuration = configuration;
                entity.Set <CreateCellViewRequest>();
            }
        }
Esempio n. 5
0
        private void SetCellsFromPullConfiguration(List <T> data, Worksheet worksheet)
        {
            PropertyInfo[] properties = typeof(T).GetProperties().OrderBy(p => p.MetadataToken).ToArray();
            PropertyInfo   property;
            object         value;

            int[]             position;
            CellConfiguration cellConfiguration = null;

            foreach (T t in data)
            {
                //we skip the uuid
                for (int i = 1; i < properties.Length; i++)
                {
                    property = properties[i];
                    value    = property.GetValue(t);
                    //FIXME: avoid hard coding this
                    if (worksheet.Name.Equals("Spec"))
                    {
                        cellConfiguration = property.GetCustomAttribute <SpecConfiguration>();
                    }
                    else if (worksheet.Name.Equals("Donnees"))
                    {
                        cellConfiguration = property.GetCustomAttribute <PowerRamDataConfiguration>();
                    }
                    else if (worksheet.Name.Equals("Actuator Key characteristics"))
                    {
                        cellConfiguration = property.GetCustomAttribute <ActuatorConfiguration>();
                    }
                    else if (worksheet.Name.Equals("Paramètre spec"))
                    {
                        cellConfiguration = property.GetCustomAttribute <StaticPerformanceConfiguration>();//TODO
                    }
                    else if (worksheet.Name.Equals(" section bloc hyd"))
                    {
                        cellConfiguration = property.GetCustomAttribute <HydraulicBlockConfiguration>();
                    }
                    if (cellConfiguration != null)
                    {
                        position = cellConfiguration.Position;
                        worksheet.Cells[position[0], position[1]].Value = value;
                        //TODO: process other cell properties
                    }
                }
            }
        }
 public CustomTableViewSource(
     CellConfiguration <TItem> configureCell,
     IEnumerable <TSection> sections)
     : this(configureCell, null, sections)
 {
 }
 public CustomTableViewSource(
     CellConfiguration <TItem> configureCell,
     IEnumerable <TItem> items = null)
     : this(configureCell, null, items)
 {
 }
 public ReloadCollectionViewSource(IImmutableList <TModel> items, CellConfiguration configureCell)
 {
     this.items         = items;
     this.configureCell = configureCell;
 }
Esempio n. 9
0
 public CustomTableViewSource(
     CellConfiguration <TItem> configureCell,
     IImmutableList <TSection> sections)
     : this(configureCell, null, sections)
 {
 }
Esempio n. 10
0
 public CustomTableViewSource(
     CellConfiguration <TItem> configureCell,
     IImmutableList <TItem> items = null)
     : this(configureCell, null, items)
 {
 }
Esempio n. 11
0
 public CustomTableViewSource(
     CellConfiguration <TItem> configureCell,
     IEnumerable <CollectionSection <THeader, TItem> > sections)
     : this(configureCell, null, sections)
 {
 }