上传星座图代码

This commit is contained in:
liwei1dao 2022-10-31 18:56:13 +08:00
parent c94df125a8
commit 1f53c183c0
5 changed files with 13491 additions and 5 deletions

13299
bin/json/game_horoscope.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
package horoscope
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
)
const (
game_arenabuychallenge = "game_arenabuychallenge.json" //购买挑战记录
game_horoscope = "game_horoscope.json" //购买挑战记录
)
@ -16,14 +16,29 @@ const (
type configureComp struct {
modules.MCompConfigure
module *Horoscope
lock sync.RWMutex
ais map[int32][]*cfg.GameArenaRobotData
}
//组件初始化接口
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Horoscope)
this.LoadConfigure(game_arenabuychallenge, cfg.NewGameArenaBuyChallenge)
this.LoadConfigure(game_horoscope, cfg.NewGameHoroscope)
return
}
//查询阵容表
func (this *configureComp) getHoroscope(id int32) (result *cfg.GameHoroscopeData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_horoscope); err != nil {
this.module.Errorln(err)
} else {
if result, ok = v.(*cfg.GameHoroscope).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found getHoroscope:%d", id)
this.module.Errorln(err)
}
}
return
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <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
type GameHoroscope struct {
_dataMap map[int32]*GameHoroscopeData
_dataList []*GameHoroscopeData
}
func NewGameHoroscope(_buf []map[string]interface{}) (*GameHoroscope, error) {
_dataList := make([]*GameHoroscopeData, 0, len(_buf))
dataMap := make(map[int32]*GameHoroscopeData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameHoroscopeData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameHoroscope{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameHoroscope) GetDataMap() map[int32]*GameHoroscopeData {
return table._dataMap
}
func (table *GameHoroscope) GetDataList() []*GameHoroscopeData {
return table._dataList
}
func (table *GameHoroscope) Get(key int32) *GameHoroscopeData {
return table._dataMap[key]
}

View File

@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
// <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 GameHoroscopeData struct {
Id int32
Type int32
TypeName string
GrowType int32
NodeId int32
Name string
Icon string
Comicon string
Lv int32
CostItem []*Gameatn
AddGroup int32
AddClassify int32
Text string
Upgrade []*Gameatr
Position string
Front string
Behind string
}
const TypeId_GameHoroscopeData = 1230895646
func (*GameHoroscopeData) GetTypeId() int32 {
return 1230895646
}
func (_v *GameHoroscopeData)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["type_name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.TypeName error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.TypeName, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["grow_type"].(float64); !_ok_ { err = errors.New("grow_type error"); return }; _v.GrowType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["node_id"].(float64); !_ok_ { err = errors.New("node_id error"); return }; _v.NodeId = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _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; if _v.Comicon, _ok_ = _buf["comicon"].(string); !_ok_ { err = errors.New("comicon error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["cost_item"].([]interface{}); !_ok_ { err = errors.New("cost_item error"); return }
_v.CostItem = 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.CostItem = append(_v.CostItem, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["AddGroup"].(float64); !_ok_ { err = errors.New("AddGroup error"); return }; _v.AddGroup = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["AddClassify"].(float64); !_ok_ { err = errors.New("AddClassify error"); return }; _v.AddClassify = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Text error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Text, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["upgrade"].([]interface{}); !_ok_ { err = errors.New("upgrade error"); return }
_v.Upgrade = 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.Upgrade = append(_v.Upgrade, _list_v_)
}
}
{ var _ok_ bool; if _v.Position, _ok_ = _buf["position"].(string); !_ok_ { err = errors.New("position error"); return } }
{ var _ok_ bool; if _v.Front, _ok_ = _buf["front"].(string); !_ok_ { err = errors.New("front error"); return } }
{ var _ok_ bool; if _v.Behind, _ok_ = _buf["behind"].(string); !_ok_ { err = errors.New("behind error"); return } }
return
}
func DeserializeGameHoroscopeData(_buf map[string]interface{}) (*GameHoroscopeData, error) {
v := &GameHoroscopeData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// <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 Gameatr struct {
A string
N int32
}
const TypeId_Gameatr = -1705653565
func (*Gameatr) GetTypeId() int32 {
return -1705653565
}
func (_v *Gameatr)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.A, _ok_ = _buf["a"].(string); !_ok_ { err = errors.New("a error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ { err = errors.New("n error"); return }; _v.N = int32(_tempNum_) }
return
}
func DeserializeGameatr(_buf map[string]interface{}) (*Gameatr, error) {
v := &Gameatr{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}