//------------------------------------------------------------------------------
// <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 GameDispatch_TaskData struct {
    Id int32
    Type int32
    Taskname string
    Icon string
    Taskcd int32
    Tasktime int32
    Tasktxt string
    Taskneed int32
    Taskreq []*GameDispatchCond
    Reqtxt []string
    Taskreqex []*GameDispatchCond
    Reqextxt []string
    Reward []*Gameatn
    Rewardex []*Gameatn
}

const TypeId_GameDispatch_TaskData = -350189032

func (*GameDispatch_TaskData) GetTypeId() int32 {
    return -350189032
}

func (_v *GameDispatch_TaskData)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 __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["taskname"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Taskname error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Taskname, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { 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["taskcd"].(float64); !_ok_ { err = errors.New("taskcd error"); return }; _v.Taskcd = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tasktime"].(float64); !_ok_ { err = errors.New("tasktime error"); return }; _v.Tasktime = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tasktxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tasktxt error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tasktxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskneed"].(float64); !_ok_ { err = errors.New("taskneed error"); return }; _v.Taskneed = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["taskreq"].([]interface{}); !_ok_ { err = errors.New("taskreq error"); return }

                _v.Taskreq = make([]*GameDispatchCond, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *GameDispatchCond
                    { 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 = DeserializeGameDispatchCond(_x_); err != nil { return } }
                    _v.Taskreq = append(_v.Taskreq, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["reqtxt"].([]interface{}); !_ok_ { err = errors.New("reqtxt error"); return }

                _v.Reqtxt = make([]string, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ string
                    {  if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
                    _v.Reqtxt = append(_v.Reqtxt, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["taskreqex"].([]interface{}); !_ok_ { err = errors.New("taskreqex error"); return }

                _v.Taskreqex = make([]*GameDispatchCond, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *GameDispatchCond
                    { 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 = DeserializeGameDispatchCond(_x_); err != nil { return } }
                    _v.Taskreqex = append(_v.Taskreqex, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["reqextxt"].([]interface{}); !_ok_ { err = errors.New("reqextxt error"); return }

                _v.Reqextxt = make([]string, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ string
                    {  if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
                    _v.Reqextxt = append(_v.Reqextxt, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }

                _v.Reward = 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.Reward = append(_v.Reward, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["rewardex"].([]interface{}); !_ok_ { err = errors.New("rewardex error"); return }

                _v.Rewardex = 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.Rewardex = append(_v.Rewardex, _list_v_)
                }
            }

    return
}

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