本文整理汇总了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);
}
}
示例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;
}
示例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);
}