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


C# Corner.GetID方法代码示例

本文整理汇总了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);
        }
开发者ID:Railec,项目名称:SE1cKBS2,代码行数:14,代码来源:CornerTest.cs

示例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);
                        }
                    }
                }
            }
        }
开发者ID:Railec,项目名称:SE1cKBS2,代码行数:45,代码来源:WallHandler.cs


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