23 lines
536 B
Go
23 lines
536 B
Go
package base
|
|
|
|
import (
|
|
"go.etcd.io/etcd/client/v3"
|
|
|
|
"mongo.games.com/game/etcd"
|
|
"mongo.games.com/game/protocol/webapi"
|
|
)
|
|
|
|
func init() {
|
|
// 个人水池
|
|
etcd.Register(etcd.ETCDKEY_PLAYERPOOL, webapi.PlayerPool{}, PlatformConfigEtcd)
|
|
// 游戏配置
|
|
etcd.Register(etcd.ETCDKEY_GAME_CONFIG, webapi.GameConfig{}, PlatformConfigEtcd)
|
|
}
|
|
|
|
func PlatformConfigEtcd(completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
|
if event.Type == clientv3.EventTypeDelete {
|
|
return
|
|
}
|
|
PlatformConfigSingleton.Update(data)
|
|
}
|