package data import ( "f1-game/internal/types" cmapStructure "github.com/cherry-game/cherry/extend/mapstructure" cdataConfig "github.com/cherry-game/components/data-config" ) // 策划配表 // 所有策划配表映射的golang文件都可以小写开头命名struct // 通过下面的var() 暴露struct给外部调用 // 禁止!!!外部引用任何配置的地址,以防热刷数据时没及时生效 type baseConfig struct { denyLoad bool } func (baseConfig) OnAfterLoad(_ bool) { } var ( _allList []cdataConfig.IConfig ) // 手工创建的表初始化放这里 var ( ProtoRoute = &protoRouteConfig{} SDK = &sdkConfig{} Lua = &luaConfig{} ) func init() { _allList = append(_allList, ProtoRoute, SDK, Lua, ) } func NewConfigs(configs ...cdataConfig.IConfig) *cdataConfig.Component { dataConfig := cdataConfig.New() dataConfig.Register(configs...) return dataConfig } func New() *cdataConfig.Component { return NewConfigs(_allList...) } func DecodeData(input any, output any) error { return cmapStructure.HookDecode( input, output, "json", types.GetDecodeHooks(), ) } func I32Min(v int32, minValue int32) int32 { if v < minValue { return minValue } return v }