上传道具表

This commit is contained in:
liwei1dao 2022-07-22 20:16:02 +08:00
parent 663e11e228
commit 5e7876c886
2 changed files with 10 additions and 8 deletions

View File

@ -9,13 +9,13 @@
package cfg
type Game_item struct {
_dataMap map[int32]*Game_itemData
_dataMap map[string]*Game_itemData
_dataList []*Game_itemData
}
func NewGame_item(_buf []map[string]interface{}) (*Game_item, error) {
_dataList := make([]*Game_itemData, 0, len(_buf))
dataMap := make(map[int32]*Game_itemData)
dataMap := make(map[string]*Game_itemData)
for _, _ele_ := range _buf {
if _v, err2 := NewGame_itemData(_ele_); err2 != nil {
return nil, err2
@ -27,7 +27,7 @@ func NewGame_item(_buf []map[string]interface{}) (*Game_item, error) {
return &Game_item{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *Game_item) GetDataMap() map[int32]*Game_itemData {
func (table *Game_item) GetDataMap() map[string]*Game_itemData {
return table._dataMap
}
@ -35,7 +35,7 @@ func (table *Game_item) GetDataList() []*Game_itemData {
return table._dataList
}
func (table *Game_item) Get(key int32) *Game_itemData {
func (table *Game_item) Get(key string) *Game_itemData {
return table._dataMap[key]
}

View File

@ -11,13 +11,14 @@ package cfg
import "errors"
type Game_itemData struct {
Id int32
Id string
Name string
Usetype int32
Color int32
Bagtype int32
Index int32
SpecialType int32
Time int32
Effects string
BoxId int32
SynthetizeNum int32
@ -40,13 +41,14 @@ func (Game_itemData) GetTypeId() int {
func NewGame_itemData(_buf map[string]interface{}) (_v *Game_itemData, err error) {
_v = &Game_itemData{}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{ var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["usetype"].(float64); !_ok_ { err = errors.New("usetype error"); return }; _v.Usetype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["bagtype"].(float64); !_ok_ { err = errors.New("bagtype error"); return }; _v.Bagtype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["index"].(float64); !_ok_ { err = errors.New("index error"); return }; _v.Index = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["special_type"].(float64); !_ok_ { err = errors.New("special_type error"); return }; _v.SpecialType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = int32(_tempNum_) }
{ var _ok_ bool; if _v.Effects, _ok_ = _buf["effects"].(string); !_ok_ { err = errors.New("effects error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["box_id"].(float64); !_ok_ { err = errors.New("box_id error"); return }; _v.BoxId = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["synthetize_num"].(float64); !_ok_ { err = errors.New("synthetize_num error"); return }; _v.SynthetizeNum = int32(_tempNum_) }
@ -59,7 +61,7 @@ func NewGame_itemData(_buf map[string]interface{}) (_v *Game_itemData, err error
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["race"].(float64); !_ok_ { err = errors.New("race error"); return }; _v.Race = int32(_tempNum_) }
{ var _ok_ bool; if _v.Img, _ok_ = _buf["img"].(string); !_ok_ { err = errors.New("img error"); return } }
{ var _ok_ bool; if _v.Ico, _ok_ = _buf["ico"].(string); !_ok_ { err = errors.New("ico error"); return } }
{ var _ok_ bool; if _v.Intr, _ok_ = _buf["intr"].(string); !_ok_ { err = errors.New("intr error"); return } }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["intr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Intr error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Intr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{
var _arr_ []interface{}
var _ok_ bool