//------------------------------------------------------------------------------
// <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 GameBattleReadyData struct {
    Id int32
    PlayType int32
    HeroCount int32
    ReadyScene string
    BattleScenes []string
    DisableAiCamera int32
    DefaultHero int32
    DisableHero []string
    LockSlots []int32
    AssistTeam int32
    CanFriendHelp int32
    Numrounds int32
}

const TypeId_GameBattleReadyData = -266091495

func (*GameBattleReadyData) GetTypeId() int32 {
    return -266091495
}

func (_v *GameBattleReadyData)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["PlayType"].(float64); !_ok_ { err = errors.New("PlayType error"); return }; _v.PlayType = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["HeroCount"].(float64); !_ok_ { err = errors.New("HeroCount error"); return }; _v.HeroCount = int32(_tempNum_) }
    { var _ok_ bool; if _v.ReadyScene, _ok_ = _buf["readyScene"].(string); !_ok_ { err = errors.New("readyScene error"); return } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["battleScenes"].([]interface{}); !_ok_ { err = errors.New("battleScenes error"); return }

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

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

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

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

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["AssistTeam"].(float64); !_ok_ { err = errors.New("AssistTeam error"); return }; _v.AssistTeam = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["CanFriendHelp"].(float64); !_ok_ { err = errors.New("CanFriendHelp error"); return }; _v.CanFriendHelp = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Numrounds"].(float64); !_ok_ { err = errors.New("Numrounds error"); return }; _v.Numrounds = int32(_tempNum_) }
    return
}

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