当前位置: 首页>>代码示例>>C#>>正文


C# Region.Add方法代码示例

本文整理汇总了C#中Region.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Region.Add方法的具体用法?C# Region.Add怎么用?C# Region.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Region的用法示例。


在下文中一共展示了Region.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeFilling

 public void MakeFilling(Generation currentGeneration)
 {
     Random random = new Random();
     for (int row = 0; row < currentGeneration.DimensionX; row++)
     {
         Region listRow = new Region();
         for (int column = 0; column < currentGeneration.DimensionY; column++)
         {
             listRow.Add(random.Next(0, 2));
         }
         currentGeneration.WriteRow(listRow);
     }
 }
开发者ID:1Mystery,项目名称:GameLife,代码行数:13,代码来源:GenerationalFill.cs

示例2: RewriteGeneration

 public Generation RewriteGeneration(Generation currentGeneration, Generation nextGeneration, Dimention dimentions)
 {
     currentGeneration.DimensionX = dimentions.RowEnd - dimentions.RowStart + 1;
     currentGeneration.DimensionY = dimentions.ColumnEnd - dimentions.ColumnStart + 1;
     currentGeneration.ClearContent();
     for (int row = 0; row < currentGeneration.DimensionX; row++)
     {
         Region listRow = new Region();
         for (int column = 0; column < currentGeneration.DimensionY; column++)
         {
             listRow.Add(nextGeneration.ReadValueXY(row + dimentions.RowStart, column + dimentions.ColumnStart));
         }
         currentGeneration.WriteRow(listRow);
     }
     return currentGeneration;
 }
开发者ID:1Mystery,项目名称:GameLife,代码行数:16,代码来源:GenerationalChange.cs

示例3: RefillGeneration

        public Generation RefillGeneration(Generation currentGeneration)
        {
            Generation nextGeneration = new Generation();
            nextGeneration.DimensionX = currentGeneration.DimensionX + currentGeneration.Increase * 2;
            nextGeneration.DimensionY = currentGeneration.DimensionY + currentGeneration.Increase * 2;

            for (int row = 0; row < nextGeneration.DimensionX; row++)
            {
                Region listRow = new Region();
                for (int column = 0; column < nextGeneration.DimensionY; column++)
                {
                    CheckFieldModification check = new CheckFieldModification(currentGeneration, row - currentGeneration.Increase, column - currentGeneration.Increase);
                    listRow.Add(check.CheckStatusForNeighbours());
                    check.Dispose();
                }
                nextGeneration.WriteRow(listRow);
            }
            if (_checkDimension.CheckFieldRows(nextGeneration, 0, 1) == -1) { currentGeneration.ClearContent(); return currentGeneration; }
            _dimentions = new Dimention(currentGeneration.DimensionX, currentGeneration.DimensionY);
            if (currentGeneration.Increase > 0) CheckDimentions(nextGeneration);
            return _makeChange.RewriteGeneration(currentGeneration, nextGeneration, _dimentions);
        }
开发者ID:1Mystery,项目名称:GameLife,代码行数:22,代码来源:GenerationalFill.cs


注:本文中的Region.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。