78 lines
1.4 KiB
Go
78 lines
1.4 KiB
Go
|
|
// Code generated by xlsx2proto.
|
|
// DO NOT EDIT!
|
|
|
|
package srvdata
|
|
|
|
import (
|
|
"google.golang.org/protobuf/proto"
|
|
|
|
"mongo.games.com/game/protocol/server"
|
|
)
|
|
|
|
var PBDB_Game_DropMgr = &DB_Game_DropMgr{
|
|
Datas: &server.DB_Game_DropArray{},
|
|
pool: make(map[int32]*server.DB_Game_Drop),
|
|
|
|
}
|
|
|
|
type DB_Game_DropMgr struct {
|
|
Datas *server.DB_Game_DropArray
|
|
pool map[int32]*server.DB_Game_Drop
|
|
|
|
}
|
|
|
|
func (this *DB_Game_DropMgr) unmarshal(data []byte) error {
|
|
err := proto.Unmarshal(data, this.Datas)
|
|
if err == nil {
|
|
this.arrangeData()
|
|
}
|
|
return err
|
|
}
|
|
|
|
func (this *DB_Game_DropMgr) reunmarshal(data []byte) error {
|
|
newDatas := &server.DB_Game_DropArray{}
|
|
err := proto.Unmarshal(data, newDatas)
|
|
if err == nil {
|
|
for _, item := range newDatas.Arr {
|
|
existItem := this.GetData(item.GetId())
|
|
if existItem == nil {
|
|
this.pool[item.GetId()] = item
|
|
this.Datas.Arr = append(this.Datas.Arr, item)
|
|
|
|
} else {
|
|
*existItem = *item
|
|
}
|
|
}
|
|
}
|
|
return err
|
|
}
|
|
|
|
func (this *DB_Game_DropMgr) arrangeData() {
|
|
if this.Datas == nil {
|
|
return
|
|
}
|
|
|
|
dataArr := this.Datas.GetArr()
|
|
if dataArr == nil {
|
|
return
|
|
}
|
|
|
|
for _, data := range dataArr {
|
|
this.pool[data.GetId()] = data
|
|
|
|
}
|
|
}
|
|
|
|
func (this *DB_Game_DropMgr) GetData(id int32) *server.DB_Game_Drop {
|
|
if data, ok := this.pool[id]; ok {
|
|
return data
|
|
}
|
|
return nil
|
|
}
|
|
|
|
|
|
func init() {
|
|
DataMgr.register("DB_Game_Drop.dat", &ProtobufDataLoader{dh: PBDB_Game_DropMgr})
|
|
}
|