1
This commit is contained in:
parent
4f9b7ed56d
commit
0020a4af8c
60
src/server/game/activity_mgr.go
Normal file
60
src/server/game/activity_mgr.go
Normal file
@ -0,0 +1,60 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"server/game/mod/msg"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type ActivityMgr struct {
|
||||
*ServerMod
|
||||
}
|
||||
|
||||
type ActivityData struct {
|
||||
List map[int]*ActivityCfg // 玩家排行榜
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
type ActivityCfg struct {
|
||||
Id int
|
||||
Type int
|
||||
Strartime int64
|
||||
Endtime int64
|
||||
Level int
|
||||
Title string
|
||||
MailTitle string
|
||||
MailContent string
|
||||
RewardItem map[string]interface{}
|
||||
Extra map[string]interface{}
|
||||
}
|
||||
|
||||
const ()
|
||||
|
||||
func (r *ActivityMgr) Init() {
|
||||
r.key = RANK_MGR_KEY
|
||||
r.data = &ActivityData{
|
||||
List: make(map[int]*ActivityCfg, 0),
|
||||
}
|
||||
// 注册处理函数
|
||||
r.init()
|
||||
}
|
||||
|
||||
func (r *ActivityMgr) getData() *ActivityData {
|
||||
return r.data.(*ActivityData)
|
||||
}
|
||||
|
||||
// 零点更新 重置榜单
|
||||
func (r *ActivityMgr) ZeroUpdate(m *msg.Msg) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (r ActivityMgr) GetActivityCfg(Id int) ActivityCfg {
|
||||
// 获取活动配置
|
||||
data := r.getData()
|
||||
data.mu.Lock()
|
||||
defer data.mu.Unlock()
|
||||
cfg, ok := data.List[Id]
|
||||
if !ok {
|
||||
return ActivityCfg{}
|
||||
}
|
||||
return *cfg
|
||||
}
|
||||
@ -22,6 +22,7 @@ const (
|
||||
BAN_MGR_KEY = "BAN_MGR"
|
||||
PER_SAVE_TIME = 60
|
||||
MESSAGE_MGR_KEY = "MESSAGE_MGR"
|
||||
ACTIVITY_MGR_KEY = "ACTIVITY_MGR"
|
||||
)
|
||||
|
||||
type ServerMod struct {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user