mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
优化架构
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"hk4e/logger"
|
||||
"os"
|
||||
)
|
||||
|
||||
type GameDepot struct {
|
||||
PlayerAbilities map[string]*AvatarConfig
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) loadGameDepot() {
|
||||
g.GameDepot = new(GameDepot)
|
||||
playerElementsFilePath := g.binPrefix + "AbilityGroup/AbilityGroup_Other_PlayerElementAbility.json"
|
||||
playerElementsFile, err := os.ReadFile(playerElementsFilePath)
|
||||
if err != nil {
|
||||
logger.LOG.Error("open file error: %v", err)
|
||||
return
|
||||
}
|
||||
playerAbilities := make(map[string]*AvatarConfig)
|
||||
err = json.Unmarshal(playerElementsFile, &playerAbilities)
|
||||
if err != nil {
|
||||
logger.LOG.Error("parse file error: %v", err)
|
||||
return
|
||||
}
|
||||
g.GameDepot.PlayerAbilities = playerAbilities
|
||||
logger.LOG.Info("load %v PlayerAbilities", len(g.GameDepot.PlayerAbilities))
|
||||
}
|
||||
Reference in New Issue
Block a user