diff --git a/planner/configexport/example/client.UNConfig.json b/planner/configexport/example/client.UNConfig.json new file mode 100644 index 0000000..2174b4c --- /dev/null +++ b/planner/configexport/example/client.UNConfig.json @@ -0,0 +1,18 @@ +{ + "Id": 1, + "Count": "a", + "Award": { + "0": "asd", + "1": "12" + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "name": "刘备", + "id": 2 + } + } +} \ No newline at end of file diff --git a/planner/configexport/example/client.XXConfig.json b/planner/configexport/example/client.XXConfig.json new file mode 100644 index 0000000..8c7c6c3 --- /dev/null +++ b/planner/configexport/example/client.XXConfig.json @@ -0,0 +1,78 @@ +{ + "1": { + "a": { + "Id": 1, + "Count": "a", + "Award": { + "0": "asd", + "1": "12" + }, + "Other": { + "0": { + "name": "张飞", + "id": 1 + }, + "1": { + "id": 2, + "name": "刘备" + } + } + }, + "b": { + "Id": 1, + "Count": "b", + "Award": { + "0": "asd", + "1": "12" + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + } + } + }, + "2": { + "c": { + "Award": { + "0": "asd", + "1": "12" + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + }, + "Id": 2, + "Count": "c" + }, + "d": { + "Id": 2, + "Count": "d", + "Award": { + "0": "asd", + "1": "12" + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + } + } + } +} \ No newline at end of file diff --git a/planner/configexport/example/config.define.go b/planner/configexport/example/config.define.go new file mode 100644 index 0000000..bad882b --- /dev/null +++ b/planner/configexport/example/config.define.go @@ -0,0 +1,60 @@ +// Code generated by minotaur-config-export. DO NOT EDIT. +package example + // XXConfig 有索引 +type XXConfig struct { + Id int // 任务ID + Count string // 次数 + Info *XXConfigInfo // 信息 + Other map[int]*XXConfigOther // 信息2 +} + +type XXConfigInfo struct { + Id int + Name string + Info *XXConfigInfoInfo +} + +type XXConfigInfoInfo struct { + Lv int + Exp *XXConfigInfoInfoExp +} + +type XXConfigInfoInfoExp struct { + Mux int + Count int +} + +type XXConfigOther struct { + Id int + Name string +} + + // UNConfig 无索引 +type UNConfig struct { + Id int // 任务ID + Count string // 次数 + Info *UNConfigInfo // 信息 + Other map[int]*UNConfigOther // 信息2 +} + +type UNConfigInfo struct { + Id int + Name string + Info *UNConfigInfoInfo +} + +type UNConfigInfoInfo struct { + Lv int + Exp *UNConfigInfoInfoExp +} + +type UNConfigInfoInfoExp struct { + Mux int + Count int +} + +type UNConfigOther struct { + Id int + Name string +} + diff --git a/planner/configexport/example/config.go b/planner/configexport/example/config.go new file mode 100644 index 0000000..2e581e2 --- /dev/null +++ b/planner/configexport/example/config.go @@ -0,0 +1,36 @@ +// Code generated by minotaur-config-export. DO NOT EDIT. +package example +import ( + jsonIter "github.com/json-iterator/go" + "os" +) + +var json = jsonIter.ConfigCompatibleWithStandardLibrary +var ( + GameXXConfig map[int]map[string]*XXConfig + gameXXConfig map[int]map[string]*XXConfig + GameUNConfig *UNConfig + gameUNConfig *UNConfig +) + +func LoadConfig(handle func(filename string, config any) error) { + handle("XXConfig.json", &gameXXConfig) + handle("UNConfig.json", &gameUNConfig) +} + +func Refresh() { + GameXXConfig = gameXXConfig + GameUNConfig = gameUNConfig +} + +func DefaultLoad(filepath string) { + LoadConfig(func(filename string, config any) error { + bytes, err := os.ReadFile(filepath) + if err != nil { + return err + } + + return json.Unmarshal(bytes, &config) + }) +} + diff --git a/planner/configexport/example/server.UNConfig.json b/planner/configexport/example/server.UNConfig.json new file mode 100644 index 0000000..fd0e5c7 --- /dev/null +++ b/planner/configexport/example/server.UNConfig.json @@ -0,0 +1,25 @@ +{ + "Count": "a", + "Info": { + "id": 1, + "name": "小明", + "info": { + "lv": 1, + "exp": { + "mux": 10, + "count": 100 + } + } + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + }, + "Id": 1 +} \ No newline at end of file diff --git a/planner/configexport/example/server.XXConfig.json b/planner/configexport/example/server.XXConfig.json new file mode 100644 index 0000000..2416d88 --- /dev/null +++ b/planner/configexport/example/server.XXConfig.json @@ -0,0 +1,106 @@ +{ + "1": { + "a": { + "Id": 1, + "Count": "a", + "Info": { + "id": 1, + "name": "小明", + "info": { + "exp": { + "mux": 10, + "count": 100 + }, + "lv": 1 + } + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + } + }, + "b": { + "Id": 1, + "Count": "b", + "Info": { + "name": "小明", + "info": { + "lv": 1, + "exp": { + "mux": 10, + "count": 100 + } + }, + "id": 1 + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + } + } + }, + "2": { + "c": { + "Count": "c", + "Info": { + "id": 1, + "name": "小明", + "info": { + "lv": 1, + "exp": { + "mux": 10, + "count": 100 + } + } + }, + "Other": { + "1": { + "id": 2, + "name": "刘备" + }, + "0": { + "id": 1, + "name": "张飞" + } + }, + "Id": 2 + }, + "d": { + "Id": 2, + "Count": "d", + "Info": { + "id": 1, + "name": "小明", + "info": { + "lv": 1, + "exp": { + "count": 100, + "mux": 10 + } + } + }, + "Other": { + "0": { + "id": 1, + "name": "张飞" + }, + "1": { + "id": 2, + "name": "刘备" + } + } + } + } +} \ No newline at end of file