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


C# MapId.ToString方法代码示例

本文整理汇总了C#中MapId.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# MapId.ToString方法的具体用法?C# MapId.ToString怎么用?C# MapId.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MapId的用法示例。


在下文中一共展示了MapId.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryLoad

        internal static bool TryLoad(MapId mapId, out Map map)
        {
            map = null;
            var basePath = TerrainDisplayConfig.MapDir;
            var mapPath = Path.Combine(basePath, mapId.ToString());
            var fileName = string.Format("{0}{1}", mapId, Extension);
            var filePath = Path.Combine(mapPath, fileName);

            if (!Directory.Exists(mapPath))
            {
                log.Warn("Unable to find requested .map dir: {0}", mapPath);
                return false;
            }
            if (!File.Exists(filePath))
            {
                log.Warn("Unable to find requested .map file: {0}", filePath);
                return false;
            }

            using(var file = File.OpenRead(filePath))
            {
                map = ReadWDTInfo(file);
                file.Close();

                if (map == null)
                {
                    log.Warn("Unable to load the requested .map file: {0}", filePath);
                    return false;
                }
            }

            map.MapId = mapId;
            return true;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:34,代码来源:Map.cs

示例2: Process

        public static ExtractedM2 Process(string basePath, MapId mapId, string path)
        {
            basePath = Path.Combine(basePath, mapId.ToString());
            var filePath = Path.Combine(basePath, path);
            filePath = Path.ChangeExtension(filePath, ".m2x");

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
            }

            var m2 = new ExtractedM2();

            using(var file = File.OpenRead(filePath))
            using(var br = new BinaryReader(file))
            {
                var type = br.ReadString();
                if (type != fileType)
                {
                    br.Close();
                    throw new InvalidDataException(string.Format("M2x file in invalid format: {0}", filePath));
                }

                m2.Extents = br.ReadBoundingBox();
                m2.BoundingVertices = br.ReadVector3List();
                m2.BoundingTriangles = br.ReadIndex3List();

                br.Close();
            }

            return m2;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:32,代码来源:ExtractedM2Parser.cs

示例3: Process

        public static ExtractedWMO Process(string basePath, MapId mapId, string path)
        {
            basePath = Path.Combine(basePath, mapId.ToString());
            var filePath = Path.Combine(basePath, path);
            filePath = Path.ChangeExtension(filePath, ".wmo");

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
            }

            var wmo = new ExtractedWMO();

            using (var file = File.OpenRead(filePath))
            using (var br = new BinaryReader(file))
            {
                var type = br.ReadString();
                if (type != fileType)
                {
                    br.Close();
                    throw new InvalidDataException(string.Format("WMO file in invalid format: {0}", filePath));
                }

                wmo.Extents = br.ReadBoundingBox();
                wmo.WMOId = br.ReadUInt32();

                ReadWMODoodadDefs(br, wmo);

                ReadWMOGroups(br, wmo);
            }
            return wmo;
        }
开发者ID:WCell,项目名称:WCell-Terrain,代码行数:32,代码来源:ExtractedWMOParser.cs

示例4: MapTreeNode

 public MapTreeNode(MapId map, TreeNode[] arr)
     : base(map.ToString(), arr)
 {
     Map = map;
 }
开发者ID:KroneckerX,项目名称:WCell,代码行数:5,代码来源:MapTreeView.cs


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