//------------------------------------------------------------------------------
// <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"
import "bright/serialization"

type GameGuideData struct {
	Id          int32
	Group       int32
	Type        int32
	StartPar    string
	Parameter   string
	Interface   string
	Condition   string
	Followtj    string
	Followguide int32
	Finger      []string
	Offset      serialization.Vector2
	FingerTime  float32
	ObjSize     serialization.Vector2
	ObjOffset   serialization.Vector2
	Txt         string
	Speakerface int32
	Sound       string
	Mask        int32
	Lock        int32
	Uishow      int32
	Skiptime    int32
	Skip        int32
	Skipgroup   int32
	Reward      []*Gameatn
}

const TypeId_GameGuideData = -371227190

func (*GameGuideData) GetTypeId() int32 {
	return -371227190
}

func (_v *GameGuideData) 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["group"].(float64); !_ok_ {
			err = errors.New("group error")
			return
		}
		_v.Group = 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
		if _v.StartPar, _ok_ = _buf["startPar"].(string); !_ok_ {
			err = errors.New("startPar error")
			return
		}
	}
	{
		var _ok_ bool
		if _v.Parameter, _ok_ = _buf["parameter"].(string); !_ok_ {
			err = errors.New("parameter error")
			return
		}
	}
	{
		var _ok_ bool
		if _v.Interface, _ok_ = _buf["interface"].(string); !_ok_ {
			err = errors.New("interface error")
			return
		}
	}
	{
		var _ok_ bool
		if _v.Condition, _ok_ = _buf["condition"].(string); !_ok_ {
			err = errors.New("condition error")
			return
		}
	}
	{
		var _ok_ bool
		if _v.Followtj, _ok_ = _buf["followtj"].(string); !_ok_ {
			err = errors.New("followtj error")
			return
		}
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["followguide"].(float64); !_ok_ {
			err = errors.New("followguide error")
			return
		}
		_v.Followguide = int32(_tempNum_)
	}
	{
		var _arr_ []interface{}
		var _ok_ bool
		if _arr_, _ok_ = _buf["finger"].([]interface{}); !_ok_ {
			err = errors.New("finger error")
			return
		}

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

	{
		var _ok_ bool
		var _v_ map[string]interface{}
		if _v_, _ok_ = _buf["offset"].(map[string]interface{}); !_ok_ {
			err = errors.New("offset 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.Offset = serialization.NewVector2(_x_, _y_)
	}

	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["fingerTime"].(float64); !_ok_ {
			err = errors.New("fingerTime error")
			return
		}
		_v.FingerTime = float32(_tempNum_)
	}
	{
		var _ok_ bool
		var _v_ map[string]interface{}
		if _v_, _ok_ = _buf["objSize"].(map[string]interface{}); !_ok_ {
			err = errors.New("objSize 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.ObjSize = serialization.NewVector2(_x_, _y_)
	}

	{
		var _ok_ bool
		var _v_ map[string]interface{}
		if _v_, _ok_ = _buf["objOffset"].(map[string]interface{}); !_ok_ {
			err = errors.New("objOffset 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.ObjOffset = serialization.NewVector2(_x_, _y_)
	}

	{
		var _ok_ bool
		if _v.Txt, _ok_ = _buf["txt"].(string); !_ok_ {
			err = errors.New("txt error")
			return
		}
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["speakerface"].(float64); !_ok_ {
			err = errors.New("speakerface error")
			return
		}
		_v.Speakerface = int32(_tempNum_)
	}
	{
		var _ok_ bool
		if _v.Sound, _ok_ = _buf["sound"].(string); !_ok_ {
			err = errors.New("sound error")
			return
		}
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["mask"].(float64); !_ok_ {
			err = errors.New("mask error")
			return
		}
		_v.Mask = int32(_tempNum_)
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["lock"].(float64); !_ok_ {
			err = errors.New("lock error")
			return
		}
		_v.Lock = int32(_tempNum_)
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["uishow"].(float64); !_ok_ {
			err = errors.New("uishow error")
			return
		}
		_v.Uishow = int32(_tempNum_)
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["skiptime"].(float64); !_ok_ {
			err = errors.New("skiptime error")
			return
		}
		_v.Skiptime = int32(_tempNum_)
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["skip"].(float64); !_ok_ {
			err = errors.New("skip error")
			return
		}
		_v.Skip = int32(_tempNum_)
	}
	{
		var _ok_ bool
		var _tempNum_ float64
		if _tempNum_, _ok_ = _buf["skipgroup"].(float64); !_ok_ {
			err = errors.New("skipgroup error")
			return
		}
		_v.Skipgroup = int32(_tempNum_)
	}
	{
		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_)
		}
	}

	return
}

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