//------------------------------------------------------------------------------
// <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 GameFightGlobalEventData struct {
    Id int32
    Count int32
    LoopTime int32
    Desc string
    When int32
    FromCheck string
    TargetCheck string
    MainSkillCheck string
    AfterSkillCheck string
    BuffCheck string
    FightEndCheck string
    AddCon []string
    Execution int32
    Args []string
}

const TypeId_GameFightGlobalEventData = 1534270285

func (*GameFightGlobalEventData) GetTypeId() int32 {
    return 1534270285
}

func (_v *GameFightGlobalEventData)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["Count"].(float64); !_ok_ { err = errors.New("Count error"); return }; _v.Count = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["LoopTime"].(float64); !_ok_ { err = errors.New("LoopTime error"); return }; _v.LoopTime = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["desc"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Desc error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Desc, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["When"].(float64); !_ok_ { err = errors.New("When error"); return }; _v.When = int32(_tempNum_) }
    { var _ok_ bool; if _v.FromCheck, _ok_ = _buf["FromCheck"].(string); !_ok_ { err = errors.New("FromCheck error"); return } }
    { var _ok_ bool; if _v.TargetCheck, _ok_ = _buf["TargetCheck"].(string); !_ok_ { err = errors.New("TargetCheck error"); return } }
    { var _ok_ bool; if _v.MainSkillCheck, _ok_ = _buf["MainSkillCheck"].(string); !_ok_ { err = errors.New("MainSkillCheck error"); return } }
    { var _ok_ bool; if _v.AfterSkillCheck, _ok_ = _buf["AfterSkillCheck"].(string); !_ok_ { err = errors.New("AfterSkillCheck error"); return } }
    { var _ok_ bool; if _v.BuffCheck, _ok_ = _buf["BuffCheck"].(string); !_ok_ { err = errors.New("BuffCheck error"); return } }
    { var _ok_ bool; if _v.FightEndCheck, _ok_ = _buf["FightEndCheck"].(string); !_ok_ { err = errors.New("FightEndCheck error"); return } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["AddCon"].([]interface{}); !_ok_ { err = errors.New("AddCon error"); return }

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

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

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

    return
}

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