From 531652ae4b34b5b1b4748af12deb5678a39f77ad Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 22 Jul 2022 20:22:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=81=93=E5=85=B7=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_item.json | 20 ++++++++++---------- sys/configure/structs/game.item.go | 8 ++++---- sys/configure/structs/game.itemData.go | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bin/json/game_item.json b/bin/json/game_item.json index 6773baf2e..48729d79a 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -1,6 +1,6 @@ [ { - "id": "10001", + "id": 10001, "name": { "key": "itemname_10001", "text": "初级经验精灵" @@ -36,7 +36,7 @@ ] }, { - "id": "10002", + "id": 10002, "name": { "key": "itemname_10002", "text": "石头" @@ -72,7 +72,7 @@ ] }, { - "id": "10003", + "id": 10003, "name": { "key": "itemname_10003", "text": "5星阿宝碎片" @@ -108,7 +108,7 @@ ] }, { - "id": "10004", + "id": 10004, "name": { "key": "itemname_10004", "text": "金币自选箱子" @@ -144,7 +144,7 @@ ] }, { - "id": "10005", + "id": 10005, "name": { "key": "itemname_10005", "text": "随机金币箱子" @@ -180,7 +180,7 @@ ] }, { - "id": "10006", + "id": 10006, "name": { "key": "itemname_10006", "text": "金币箱子" @@ -216,7 +216,7 @@ ] }, { - "id": "10007", + "id": 10007, "name": { "key": "itemname_10007", "text": "2小时金币" @@ -252,7 +252,7 @@ ] }, { - "id": "10008", + "id": 10008, "name": { "key": "itemname_10008", "text": "特殊2小时金币" @@ -288,7 +288,7 @@ ] }, { - "id": "1", + "id": 1, "name": { "key": "itemname_1", "text": "宝箱自选" @@ -324,7 +324,7 @@ ] }, { - "id": "2", + "id": 2, "name": { "key": "itemname_2", "text": "金币" diff --git a/sys/configure/structs/game.item.go b/sys/configure/structs/game.item.go index 0c8c4c846..79a6cda49 100644 --- a/sys/configure/structs/game.item.go +++ b/sys/configure/structs/game.item.go @@ -9,13 +9,13 @@ package cfg type Game_item struct { - _dataMap map[string]*Game_itemData + _dataMap map[int32]*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[string]*Game_itemData) + dataMap := make(map[int32]*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[string]*Game_itemData { +func (table *Game_item) GetDataMap() map[int32]*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 string) *Game_itemData { +func (table *Game_item) Get(key int32) *Game_itemData { return table._dataMap[key] } diff --git a/sys/configure/structs/game.itemData.go b/sys/configure/structs/game.itemData.go index c02817a87..7c73ad249 100644 --- a/sys/configure/structs/game.itemData.go +++ b/sys/configure/structs/game.itemData.go @@ -11,7 +11,7 @@ package cfg import "errors" type Game_itemData struct { - Id string + Id int32 Name string Usetype int32 Color int32 @@ -41,7 +41,7 @@ func (Game_itemData) GetTypeId() int { func NewGame_itemData(_buf map[string]interface{}) (_v *Game_itemData, err error) { _v = &Game_itemData{} - { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } } + { 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; 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_) }