//------------------------------------------------------------------------------ // // This code was generated by a tool. // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ package cfg import "errors" import "bright/serialization" type GameLatticeData struct { Key int32 Belongto int32 Regular int32 Place serialization.Vector2 Number []int32 Reserve int32 Icon string Type int32 Value int32 } const TypeId_GameLatticeData = -1468712828 func (*GameLatticeData) GetTypeId() int32 { return -1468712828 } func (_v *GameLatticeData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["belongto"].(float64); !_ok_ { err = errors.New("belongto error"); return }; _v.Belongto = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["regular"].(float64); !_ok_ { err = errors.New("regular error"); return }; _v.Regular = int32(_tempNum_) } { var _ok_ bool; var _v_ map[string]interface{}; if _v_, _ok_ = _buf["place"].(map[string]interface{}); !_ok_ { err = errors.New("place error"); return } var _x_, _y_ float32; { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["x"].(float64); !_ok_ { err = errors.New("x error"); return }; _x_ = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _v_["y"].(float64); !_ok_ { err = errors.New("y error"); return }; _y_ = float32(_tempNum_) } _v.Place = serialization.NewVector2(_x_, _y_) } { var _arr_ []interface{} var _ok_ bool if _arr_, _ok_ = _buf["number"].([]interface{}); !_ok_ { err = errors.New("number error"); return } _v.Number = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { var _list_v_ int32 { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.Number = append(_v.Number, _list_v_) } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["reserve"].(float64); !_ok_ { err = errors.New("reserve error"); return }; _v.Reserve = int32(_tempNum_) } { var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) } return } func DeserializeGameLatticeData(_buf map[string]interface{}) (*GameLatticeData, error) { v := &GameLatticeData{} if err := v.Deserialize(_buf); err == nil { return v, nil } else { return nil, err } }