//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

package cfg

import "errors"

type GameTalentData struct {
    Id int32
    Type int32
    Node int32
    PreNode int32
    NodeLv int32
    PreNodeLv int32
    NodeDirection int32
    NodeLong int32
    NodePng string
    NodeType int32
    DiscPng string
    DiscPos int32
    Attribute []*Gameatr
    Range int32
    IconCos []*Gameatn
}

const TypeId_GameTalentData = -1561355726

func (*GameTalentData) GetTypeId() int32 {
    return -1561355726
}

func (_v *GameTalentData)Deserialize(_buf map[string]interface{}) (err error) {
    { 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 _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["node"].(float64); !_ok_ { err = errors.New("node error"); return }; _v.Node = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pre_node"].(float64); !_ok_ { err = errors.New("pre_node error"); return }; _v.PreNode = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["node_lv"].(float64); !_ok_ { err = errors.New("node_lv error"); return }; _v.NodeLv = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pre_node_lv"].(float64); !_ok_ { err = errors.New("pre_node_lv error"); return }; _v.PreNodeLv = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["node_direction"].(float64); !_ok_ { err = errors.New("node_direction error"); return }; _v.NodeDirection = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["node_long"].(float64); !_ok_ { err = errors.New("node_long error"); return }; _v.NodeLong = int32(_tempNum_) }
    { var _ok_ bool; if _v.NodePng, _ok_ = _buf["node_png"].(string); !_ok_ { err = errors.New("node_png error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["node_type"].(float64); !_ok_ { err = errors.New("node_type error"); return }; _v.NodeType = int32(_tempNum_) }
    { var _ok_ bool; if _v.DiscPng, _ok_ = _buf["disc_png"].(string); !_ok_ { err = errors.New("disc_png error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["disc_pos"].(float64); !_ok_ { err = errors.New("disc_pos error"); return }; _v.DiscPos = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["attribute"].([]interface{}); !_ok_ { err = errors.New("attribute error"); return }

                _v.Attribute = make([]*Gameatr, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *Gameatr
                    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatr(_x_); err != nil { return } }
                    _v.Attribute = append(_v.Attribute, _list_v_)
                }
            }

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["range"].(float64); !_ok_ { err = errors.New("range error"); return }; _v.Range = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["icon_cos"].([]interface{}); !_ok_ { err = errors.New("icon_cos error"); return }

                _v.IconCos = make([]*Gameatn, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *Gameatn
                    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
                    _v.IconCos = append(_v.IconCos, _list_v_)
                }
            }

    return
}

func DeserializeGameTalentData(_buf map[string]interface{}) (*GameTalentData, error) {
    v := &GameTalentData{}
    if err := v.Deserialize(_buf); err == nil {
        return v, nil
    } else {
        return nil, err
    }
}
