Esempio n. 1
0
        private GeometryObj EditArea(GeometryObj obj, DataRow areaRow)
        {
            if (areaRow[DB.COL_AREA_X] == DBNull.Value || areaRow[DB.COL_AREA_Y] == DBNull.Value)
                return null;

            float x = (float)Convert.ToDouble(areaRow[DB.COL_AREA_X]);
            float y = (float)Convert.ToDouble(areaRow[DB.COL_AREA_Y]);

            float width = areaRow[DB.COL_AREA_Z] == DBNull.Value ? 0 : (float)Convert.ToDouble(areaRow[DB.COL_AREA_Z]);
            float height = areaRow[DB.COL_AREA_R] == DBNull.Value ? 0 : (float)Convert.ToDouble(areaRow[DB.COL_AREA_R]);

            if (x > 0 || y > 0)
            {
                Model m_PointModel;
                if ((string)areaRow[DB.COL_AREA_AREATYPE] == Const.AREA_SQUARE)
                {
                    DOL.Tools.Mapping.DX.Meshes.Plane plane = new DOL.Tools.Mapping.DX.Meshes.Plane(Common.Device, width, height, false);
                    m_PointModel = new Model(plane, Textures.AreaSquare);
                }
                else
                {
                    DOL.Tools.Mapping.DX.Meshes.Plane plane = new DOL.Tools.Mapping.DX.Meshes.Plane(Common.Device, height, height, true);
                    m_PointModel = new Model(plane, Textures.AreaCircle);
                }

                obj.Model = m_PointModel;
                obj.X = x;
                obj.Y = y;
            }
            return obj;
        }
        private GeometryObj AddLocation(DataRow locationRow)
        {
            if (locationRow[DB.COL_LOCATION_X] == DBNull.Value || locationRow[DB.COL_LOCATION_Y] == DBNull.Value)
                return null;

            float x = (float)Convert.ToDouble(locationRow[DB.COL_LOCATION_X]);
            float y = (float)Convert.ToDouble(locationRow[DB.COL_LOCATION_Y]);

            GeometryObj obj = null;
            if (x > 0 || y > 0)
            {

                Model m_PointModel;

                m_PointModel = new Model(Plane, Textures.LoadMapObjectTexture("Location"));

                obj = new GeometryObj(this,m_PointModel, DrawLevel.Forer, DetailLevel.Detailed, x, y, 0, 0, 0, 0,
                    new Vector3(2, 2, 2),true,true);
                if (!IsFiltered)
                    DXControl.GeoObjects.Add(obj);
                SetObjectForRow(locationRow, obj);
            }
            return obj;
        }
Esempio n. 3
0
        private GeometryObj AddArea(DataRow areaRow)
        {
            if (areaRow[DB.COL_AREA_X] == DBNull.Value || areaRow[DB.COL_AREA_Y] == DBNull.Value)
                return null;

            float x = (float)Convert.ToDouble(areaRow[DB.COL_AREA_X]);
            float y = (float)Convert.ToDouble(areaRow[DB.COL_AREA_Y]);

            float width = areaRow[DB.COL_AREA_Z] == DBNull.Value ? 0 : (float)Convert.ToDouble(areaRow[DB.COL_AREA_Z]);
            float height = areaRow[DB.COL_AREA_R] == DBNull.Value ? 0 : (float)Convert.ToDouble(areaRow[DB.COL_AREA_R]);

            GeometryObj obj = null;
            if (x > 0 || y > 0)
            {
                Model m_PointModel;
                if ((string)areaRow[DB.COL_AREA_AREATYPE] == Const.AREA_SQUARE)
                {
                    DOL.Tools.Mapping.DX.Meshes.Plane plane = new DOL.Tools.Mapping.DX.Meshes.Plane(Common.Device, width, height, false);
                    m_PointModel = new Model(plane, Textures.AreaSquare);
                }
                else
                {
                    DOL.Tools.Mapping.DX.Meshes.Plane plane = new DOL.Tools.Mapping.DX.Meshes.Plane(Common.Device, height, height, true);
                    m_PointModel = new Model(plane, Textures.AreaCircle);
                }

                obj = new GeometryObj(this, m_PointModel, DrawLevel.Backer, DetailLevel.Nondetailed, x, y, 0, 0, 0, 0,
                    new Vector3(1, 1, 1), true,false);

                if (!IsFiltered)
                    DXControl.GeoObjects.Add(obj);

                SetObjectForRow(areaRow, obj);
            }
            return obj;
        }
        private GeometryObj AddMob(DataRow mobRow)
        {
            if (mobRow[DB.COL_NPC_X] == DBNull.Value || mobRow[DB.COL_NPC_Y] == DBNull.Value)
                return null;

            float x = (float)Convert.ToDouble(mobRow[DB.COL_NPC_X]);
            float y = (float)Convert.ToDouble(mobRow[DB.COL_NPC_Y]);
            float heading = Utils.HeadingToRadians(Convert.ToInt32(mobRow[DB.COL_NPC_HEADING]));

            GeometryObj obj = null;
            if (x > 0 || y > 0)
            {

                Model m_PointModel;
                if ((byte)mobRow[DB.COL_NPC_REALM] == (byte)eRealm.None)
                {
                    m_PointModel = new Model(Plane, Textures.Mob);
                }
                else
                {
                    m_PointModel = new Model(Plane, Textures.NPC);
                }

                obj = new GeometryObj(this,m_PointModel, DrawLevel.Forer, DetailLevel.Detailed, x, y, 0, 0, 0, heading,
                    new Vector3(1, 1, 1),true,true);

                if (!IsFiltered)
                    DXControl.GeoObjects.Add(obj);
                SetObjectForRow(mobRow, obj);
            }
            return obj;
        }