本文整理汇总了C#中IBlock.GetUpperBound方法的典型用法代码示例。如果您正苦于以下问题:C# IBlock.GetUpperBound方法的具体用法?C# IBlock.GetUpperBound怎么用?C# IBlock.GetUpperBound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBlock
的用法示例。
在下文中一共展示了IBlock.GetUpperBound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LineData
public LineData(IBlock[,] layout, ISimulationEnvironment env, ResourceWrapper res)
{
_env = env;
_res = res;
_trains = new List<ITrainModel>();
_blocks = new List<IBlock>();
_layout = new LayoutCellDataContainer[layout.GetUpperBound(0) + 1,layout.GetUpperBound(1) + 1];
//for each item in the 1st dimension (row)
for (int i = 0; i <= layout.GetUpperBound(0); i++)
{
//for each item in the 2nd dimension (col)
for (int j = 0; j <= layout.GetUpperBound(1); j++)
{
//make a new container
var container = new LayoutCellDataContainer();
//determine tile
if (layout[i, j] == null)
{
//null container
container.BaseTile = _res.Unpopulated;
container.Tile = container.BaseTile;
container.Block = null;
container.Train = null;
}
else
{
container.Train = null;
_blocks.Add(layout[i, j]);
container.Block = layout[i, j];
//expand after prototype
if (layout[i, j].Line.CompareTo("Red") == 0 || layout[i, j].Line.CompareTo("red") == 0 ||
layout[i, j].Line.CompareTo("R") == 0 || layout[i, j].Line.CompareTo("r") == 0)
{
//red line
container.BaseTile = GetBlockType(container.Block);
container.Tile = container.BaseTile;
}
else if (layout[i, j].Line.CompareTo("Green") == 0 || layout[i, j].Line.CompareTo("green") == 0 ||
layout[i, j].Line.CompareTo("G") == 0 || layout[i, j].Line.CompareTo("g") == 0)
{
//green line
container.BaseTile = GetBlockType(container.Block);
container.Tile = container.BaseTile;
}
else
{
container.BaseTile = _res.TrackError;
container.Tile = container.BaseTile;
env.SendLogEntry("CTC Office: Line Data - IBlock.Line is invalid");
}
} //end determine tile
//add the container to the layout panel
_layout[i, j] = container;
} //end for 2nd dimension
} //end for 1st dimentsion
}