68 lines
1.8 KiB
Go
68 lines
1.8 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"`
|
|
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"`
|
|
EnterTimes int `json:"enter_times"`
|
|
RestTimes int `json:"rest_times"`
|
|
ExpMultiple int `json:"exp_multiple"`
|
|
CoinMultiple int `json:"coin_multiple"`
|
|
FirstDrop int `json:"first_drop"`
|
|
PassDrop int `json:"pass_drop"`
|
|
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"`
|
|
SweepUnlockType []int `json:"sweep_unlock_type"`
|
|
SweepUnlockArgs []int `json:"sweep_unlock_args"`
|
|
}
|
|
|
|
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]
|
|
}
|