导表工具案例
This commit is contained in:
parent
335c93f92b
commit
72fd4f127e
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"Id": 1,
|
||||||
|
"Count": "a",
|
||||||
|
"Award": {
|
||||||
|
"0": "asd",
|
||||||
|
"1": "12"
|
||||||
|
},
|
||||||
|
"Other": {
|
||||||
|
"0": {
|
||||||
|
"id": 1,
|
||||||
|
"name": "张飞"
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"name": "刘备",
|
||||||
|
"id": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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": "刘备"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -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": "刘备"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue