本文整理汇总了C#中Corner.GetID方法的典型用法代码示例。如果您正苦于以下问题:C# Corner.GetID方法的具体用法?C# Corner.GetID怎么用?C# Corner.GetID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corner
的用法示例。
在下文中一共展示了Corner.GetID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FloatConstructor
public void FloatConstructor(float x, float y)
{
//Arrange
//Act
Corner corner = new Corner(1, x, y);
//Assert
Assert.IsNotNull(corner);
Assert.IsInstanceOf(typeof(Corner), corner);
Assert.AreEqual(1, corner.GetID());
Assert.AreEqual(x, corner.GetPoint().X);
Assert.AreEqual(y, corner.GetPoint().Y);
}
示例2: LoadFromDatabase
/**
* This method will load all corners from the database for local use.
* TODO: Only load things for a floor, because otherwise this bloody list will be HUGE.
*/
public void LoadFromDatabase()
{
_corners.Clear();
_cornerIdDict.Clear();
const string query = "SELECT * FROM `WallCorners`";
DataTable data = DatabaseHandler.GetInstance().SelectSQL(query);
if(data != null) {
foreach(DataRow row in data.Rows) {
uint id = DatabaseUtil.parseInt(row, "ID");
Corner corner = new Corner(id, row.Field<float>("X"), row.Field<float>("Y"));
corner.IsLoaded = true;
this._corners.Add(corner);
this._cornerIdDict.Add(corner.GetID(), corner);
}
DataTable data_conns = DatabaseHandler.GetInstance().SelectSQL("SELECT * FROM `Wall`");
if(data_conns != null) {
foreach(DataRow row_conns in data_conns.Rows) {
uint id = DatabaseUtil.parseInt(row_conns, "ID");
bool isDoor = row_conns.Field<bool>("IsDoor");
uint hinge = (uint)row_conns.Field<byte>("Hinge");
uint direction = (uint)row_conns.Field<byte>("Direction");
Corner left = this._cornerIdDict[DatabaseUtil.parseInt(row_conns,"LeftPointID")];
Corner right = this._cornerIdDict[DatabaseUtil.parseInt(row_conns,"RightPointID")];
if(left != null && right != null) {
Wall wall;
if(isDoor) wall = new Door(id, left, right, (hinge == 0 ? left : right), (direction == 0 ? Door.HingeDirection.Left : Door.HingeDirection.Right));
else wall = new Wall(id, left, right);
left.AddWall(wall);
right.AddWall(wall);
wall.IsLoaded = true;
this._walls.Add(wall);
}
}
}
}
}