寻路服务器

This commit is contained in:
huangxiaolei
2022-12-21 17:42:56 +08:00
parent bfff798470
commit c4bc4b8ca1
22 changed files with 419 additions and 275 deletions

View File

@@ -95,42 +95,3 @@ func (g *GameDataConfig) loadAll() {
g.excelBinPrefix += "/"
g.load()
}
func (g *GameDataConfig) ReadWorldTerrain() []byte {
resourcePath := g.getResourcePathPrefix()
dirInfo, err := os.Stat(resourcePath)
if err != nil || !dirInfo.IsDir() {
logger.Error("open game data config dir error: %v", err)
return nil
}
dirInfo, err = os.Stat(resourcePath + "/WorldStatic")
if err != nil || !dirInfo.IsDir() {
logger.Error("open game data world static dir error: %v", err)
return nil
}
data, err := os.ReadFile(resourcePath + "/WorldStatic/world_terrain.bin")
if err != nil {
logger.Error("read world terrain file error: %v", err)
return nil
}
return data
}
func (g *GameDataConfig) WriteWorldTerrain(data []byte) {
resourcePath := g.getResourcePathPrefix()
dirInfo, err := os.Stat(resourcePath)
if err != nil || !dirInfo.IsDir() {
logger.Error("open game data config dir error: %v", err)
return
}
dirInfo, err = os.Stat(resourcePath + "/WorldStatic")
if err != nil || !dirInfo.IsDir() {
logger.Error("open game data world static dir error: %v", err)
return
}
err = os.WriteFile(resourcePath+"/WorldStatic/world_terrain.bin", data, 0644)
if err != nil {
logger.Error("write world terrain file error: %v", err)
return
}
}