74 lines
2.0 KiB
Go
74 lines
2.0 KiB
Go
package data
|
|
|
|
import json "github.com/json-iterator/go"
|
|
|
|
type Scene struct {
|
|
Id int `json:"id"`
|
|
Type int `json:"type"`
|
|
CopyType int `json:"copy_type"`
|
|
CopyId int `json:"copy_id"`
|
|
IsElite bool `json:"is_elite"`
|
|
NameId int `json:"name_id"`
|
|
DescId int `json:"desc_id"`
|
|
Music int `json:"music"`
|
|
LevelPath string `json:"level_path"`
|
|
SceneBg []int `json:"scene_bg"`
|
|
BattleRound int `json:"battle_round"`
|
|
ConsumeItems []int `json:"consume_items"`
|
|
ConsumeNums []int `json:"consume_nums"`
|
|
SuConsumeItems []int `json:"su_consume_items"`
|
|
SuConsumeNums []int `json:"su_consume_nums"`
|
|
Monster1 int `json:"monster1"`
|
|
Monster2 int `json:"monster2"`
|
|
Monster3 int `json:"monster3"`
|
|
Monster4 int `json:"monster4"`
|
|
Monster5 int `json:"monster5"`
|
|
Monster6 int `json:"monster6"`
|
|
BuyNum int `json:"buy_num"`
|
|
MustDrop int `json:"must_drop"`
|
|
RandShows []int `json:"rand_shows"`
|
|
FirstDrop int `json:"first_drop"`
|
|
PassDrop int `json:"pass_drop"`
|
|
LoadingBg []int `json:"loading_bg"`
|
|
QuitLoadingBg []int `json:"quit_loading_bg"`
|
|
LoadingDes []int `json:"loading_des"`
|
|
QuitLoadingDes []int `json:"quit_loading_des"`
|
|
Star1Type int `json:"star1_type"`
|
|
Star1Value int `json:"star1_value"`
|
|
Star2Type int `json:"star2_type"`
|
|
Star2Value int `json:"star2_value"`
|
|
Star3Type int `json:"star3_type"`
|
|
Star3Value int `json:"star3_value"`
|
|
}
|
|
|
|
type SceneTable struct {
|
|
l []*Scene
|
|
m map[int]*Scene
|
|
}
|
|
|
|
func (this *SceneTable) load(buf []byte) error {
|
|
var err = json.Unmarshal(buf, &this.l)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
this.m = make(map[int]*Scene)
|
|
for i := range this.l {
|
|
this.m[this.l[i].Id] = this.l[i]
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (this *SceneTable) List() []*Scene {
|
|
return this.l
|
|
}
|
|
|
|
func (this *SceneTable) Get(i int) *Scene {
|
|
return this.l[i]
|
|
}
|
|
|
|
func (this *SceneTable) Find(id int) *Scene {
|
|
return this.m[id]
|
|
}
|