コード例 #1
0
 //显示GameView,创建地图,创建角色
 private void EnterGame(MapId mapId)
 {
     UIManager.Instance.ShowPanel <GameView>();
     mapManager = new MapManager();
     mapManager.ReadJsonAndInit("Datas/" + mapId.ToString() + ".json");
     playerCtrl = new PlayerController();
     playerCtrl.CreatePlayer("Player/cube_car");
     AudioManager.Instance.PlayBackground("Audio/" + mapId.ToString() + ".mp3");
     Camera.main.GetComponent <Animator>().SetTrigger(mapId.ToString());
     SetGamePause(true);
 }
コード例 #2
0
        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;
        }
コード例 #3
0
        public void WriteToNewMap(string path)
        {
            this.Path = path;

            string folder     = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path));
            var    folderPath = $"{Songs.SongPath}{folder}";

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            var list = new List <string>
            {
                "v1\n",
                $"AFileName: {AFileName}",
                $"BGFile: {BGFile}\n",
                $"MapId: {MapId.ToString()}",
                $"MapSetId: {MapSetId.ToString()}\n",
                $"BPM: {BPM.ToString()}\n",
                $"Mode: {Mode.ToString()}",
                $"Title: {Title}",
                $"Artist: {Artist}",
                $"Creator: {Creator}",
                $"DifficultyName: {DifficultyName}\n",
                $"Timings: {StartTime},{EndTime}\n",
                "HitObjects:",
            };

            WriteToFile(path, list);
            WriteToFile(path, HitObjects);
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: MapManager.cs プロジェクト: knoxaramav2/Hermes
        public void Save()
        {
            var path = GetMapPath(MapId.ToString());
            var json = JsonConvert.SerializeObject(this);

            File.WriteAllText(path, json);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
ファイル: Map.cs プロジェクト: WCell/WCell-Terrain
        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;
        }
コード例 #10
0
 private void updateMapBasedLinks()
 {
     Ini.Write("map_id", MapId.ToString(), "GW2");
     Ini.Write("map", Map, "GW2");
     Ini.Write("team_id", TeamColorId.ToString(), "GW2");
     Ini.Write("team", Team, "GW2");
     Links.updateMapBasedLinks();
 }
コード例 #11
0
ファイル: TileIdentifier.cs プロジェクト: NecroSharper/WCell
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteElementString("TileName", TileName);
     writer.WriteElementString("MapId", MapId.ToString());
     writer.WriteElementString("MapName", MapName);
     writer.WriteElementString("TileX", X.ToString());
     writer.WriteElementString("TileY", Y.ToString());
 }
コード例 #12
0
ファイル: MapRenderable3D.cs プロジェクト: vsafonkin/ualbion
        protected override void Subscribed()
        {
            Raise(new LoadPaletteEvent(_mapData.PaletteId));

            if (_tilemap != null)
            {
                return;
            }

            var assets = Resolve <IAssetManager>();

            _tilemap = new DungeonTileMap(_mapId,
                                          _mapId.ToString(),
                                          DrawLayer.Background,
                                          _tileSize,
                                          _mapData.Width, _mapData.Height,
                                          Resolve <ICoreFactory>(),
                                          Resolve <IPaletteManager>());

            for (int i = 0; i < _labyrinthData.FloorAndCeilings.Count; i++)
            {
                var      floorInfo = _labyrinthData.FloorAndCeilings[i];
                ITexture floor     = assets.LoadTexture(floorInfo?.SpriteId ?? AssetId.None);
                _tilemap.DefineFloor(i + 1, floor);
            }

            for (int i = 0; i < _labyrinthData.Walls.Count; i++)
            {
                var wallInfo = _labyrinthData.Walls[i];
                if (wallInfo == null)
                {
                    continue;
                }

                ITexture wall = assets.LoadTexture(wallInfo.SpriteId);
                if (wall == null)
                {
                    continue;
                }

                bool isAlphaTested = (wallInfo.Properties & Wall.WallFlags.AlphaTested) != 0;
                _tilemap.DefineWall(i + 1, wall, 0, 0, wallInfo.TransparentColour, isAlphaTested);

                foreach (var overlayInfo in wallInfo.Overlays)
                {
                    if (overlayInfo.SpriteId.IsNone)
                    {
                        continue;
                    }

                    var overlay = assets.LoadTexture(overlayInfo.SpriteId);
                    _tilemap.DefineWall(i + 1, overlay, overlayInfo.XOffset, overlayInfo.YOffset, wallInfo.TransparentColour, isAlphaTested);
                }
            }

            Resolve <IEngine>()?.RegisterRenderable(_tilemap);
            _fullUpdate = true;
        }
コード例 #13
0
    public static ObjectId GetObjectId(MapId mapId)
    {
        for (int i = 0; i < Enum.GetValues(typeof(ObjectId)).Length; i++)
        {
            if (mapId.ToString() == Enum.GetName(typeof(ObjectId), i))
            {
                return((ObjectId)i);
            }
        }

        Debug.Log("指定されたオブジェクトが存在しません");
        return(0);
    }
コード例 #14
0
 private void btnProjectAreaPrice_Click(object sender, EventArgs e)
 {
     try
     {
         List <SqlParameter> param = new List <SqlParameter>();
         param.Add(new SqlParameter("MapId", MapId));
         param.Add(new SqlParameter("LayerId", LayerId));
         param.Add(new SqlParameter("ObjectId", ObjectId));
         DataTable table     = SqlHelper.Select(SqlHelper.GetSql("SelectMaxMinProjectYear"), param);
         int       startyear = DateTime.Now.Year;
         int       endyear   = DateTime.Now.Year;
         if (table != null && table.Rows.Count > 0)
         {
             int.TryParse(table.Rows[0]["MinYear"].ToString(), out startyear);
             int.TryParse(table.Rows[0]["MaxYear"].ToString(), out endyear);
         }
         ProjectAreaPriceReportConditionForm form = new ProjectAreaPriceReportConditionForm();
         form.StartYear = startyear;
         form.EndYear   = endyear;
         if (form.ShowDialog() == DialogResult.OK)
         {
             string sql = SqlHelper.GetSql("SelectProjectAreaPrice");
             sql = sql.Replace("@StartYear", form.StartYear.ToString());
             sql = sql.Replace("@EndYear", form.EndYear.ToString());
             sql = sql.Replace("@MapId", MapId.ToString());
             sql = sql.Replace("@LayerId", LayerId.ToString());
             sql = sql.Replace("@ObjectId", ObjectId.ToString());
             ReportForm report = new ReportForm();
             report.SQL             = sql;
             report.XAxisColumnName = "估价基准日";
             report.Title           = "宗地地价走势图";
             report.GraphType       = ReportForm.ReportGraphType.Line;
             report.Show();
         }
     }
     catch (Exception ex)
     {
         Common.ShowError(ex);
     }
 }
コード例 #15
0
        public bool LoadTile(TileIdentifier tileId)
        {
            var tileX = tileId.TileX;
            var tileY = tileId.TileY;

            if (!Directory.Exists(_basePath))
            {
                throw new DirectoryNotFoundException(string.Format("Invalid base directory for extracted map data: {0}", _basePath));
            }

            var mapPath  = Path.Combine(_basePath, _mapId.ToString());
            var fileName = string.Format("{0}_{1}{2}", tileY, tileX, ".map");
            var filePath = Path.Combine(mapPath, fileName);

            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Invalid path or file name: {0}", filePath);
            }

            var currentADT = ExtractedADTParser.Process(filePath, _mapId, tileX, tileY);

            foreach (var def in currentADT.M2Defs)
            {
                _terrainManager.M2Manager.Add(def);
            }

            foreach (var def in currentADT.WMODefs)
            {
                _terrainManager.WMOManager.AddWMO(def);
            }

            currentADT.GenerateHeightVertexAndIndices();
            currentADT.GenerateLiquidVertexAndIndices();

            MapTiles.Add(currentADT);

            return(true);
        }
コード例 #16
0
ファイル: MapTreeView.cs プロジェクト: KroneckerX/WCell
 public MapTreeNode(MapId map, TreeNode[] arr)
     : base(map.ToString(), arr)
 {
     Map = map;
 }
コード例 #17
0
 public MapTreeNode(MapId map, TreeNode[] arr)
     : base(map.ToString(), arr)
 {
     Map = map;
 }
コード例 #18
0
 private void Save()
 {
     CookieManager.Write(MapId.ToString(), ToString(), -1);
 }
コード例 #19
0
 public override string GetSummary()
 {
     return(MapId.ToString());
 }