格式化代码

This commit is contained in:
huangxiaolei
2022-12-19 13:40:04 +08:00
parent f773ba8df7
commit 58b2df2bc6
92 changed files with 682 additions and 626 deletions

View File

@@ -39,7 +39,7 @@ func (g *GameDataConfig) loadScenePoints() {
dirPath := g.binPrefix + "Scene/Point"
fileList, err := os.ReadDir(dirPath)
if err != nil {
logger.LOG.Error("open dir error: %v", err)
logger.Error("open dir error: %v", err)
return
}
for _, file := range fileList {
@@ -50,19 +50,19 @@ func (g *GameDataConfig) loadScenePoints() {
startIndex := strings.Index(fileName, "scene")
endIndex := strings.Index(fileName, "_point.json")
if startIndex == -1 || endIndex == -1 || startIndex+5 > endIndex {
logger.LOG.Error("file name format error: %v", fileName)
logger.Error("file name format error: %v", fileName)
continue
}
sceneId := fileName[startIndex+5 : endIndex]
fileData, err := os.ReadFile(dirPath + "/" + fileName)
if err != nil {
logger.LOG.Error("open file error: %v", err)
logger.Error("open file error: %v", err)
continue
}
scenePointConfig := new(ScenePointConfig)
err = json.Unmarshal(fileData, scenePointConfig)
if err != nil {
logger.LOG.Error("parse file error: %v", err)
logger.Error("parse file error: %v", err)
continue
}
if len(scenePointConfig.Points) == 0 {
@@ -71,7 +71,7 @@ func (g *GameDataConfig) loadScenePoints() {
for k, v := range scenePointConfig.Points {
sceneIdInt32, err := strconv.ParseInt(k, 10, 32)
if err != nil {
logger.LOG.Error("parse file error: %v", err)
logger.Error("parse file error: %v", err)
continue
}
v.Id = int32(sceneIdInt32)
@@ -82,5 +82,5 @@ func (g *GameDataConfig) loadScenePoints() {
g.ScenePointEntries[scenePointEntry.Name] = scenePointEntry
}
}
logger.LOG.Info("load %v ScenePointEntries", len(g.ScenePointEntries))
logger.Info("load %v ScenePointEntries", len(g.ScenePointEntries))
}