1
This commit is contained in:
parent
9d3f817dc3
commit
6d5fb42a9b
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"gameapi_url": "https://game2006api-test.kingsome.cn",
|
"gameapi_url": "https://game2006api-test.kingsome.cn",
|
||||||
"auto_start_time": 3600,
|
"auto_start_time": 3600,
|
||||||
"game_start_notify_time": 20
|
"game_start_notify_time": 20,
|
||||||
|
"delay_delete_time": 60
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ type MsgHandler interface {
|
|||||||
CMKickoutTeam(*f5.MsgHdr, *CMKickoutTeam)
|
CMKickoutTeam(*f5.MsgHdr, *CMKickoutTeam)
|
||||||
CMKickoutMember(*f5.MsgHdr, *CMKickoutMember)
|
CMKickoutMember(*f5.MsgHdr, *CMKickoutMember)
|
||||||
CMCloseNotify(*f5.MsgHdr, *CMCloseNotify)
|
CMCloseNotify(*f5.MsgHdr, *CMCloseNotify)
|
||||||
|
CMReportPingValue(*f5.MsgHdr, *CMReportPingValue)
|
||||||
|
CMGetCurrentRoom(*f5.MsgHdr, *CMGetCurrentRoom)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MsgHandlerImpl) CMPing(hdr *f5.MsgHdr, msg *CMPing) {
|
func (this *MsgHandlerImpl) CMPing(hdr *f5.MsgHdr, msg *CMPing) {
|
||||||
@ -93,6 +95,12 @@ func (this *MsgHandlerImpl) CMKickoutMember(hdr *f5.MsgHdr, msg *CMKickoutMember
|
|||||||
func (this *MsgHandlerImpl) CMCloseNotify(hdr *f5.MsgHdr, msg *CMCloseNotify) {
|
func (this *MsgHandlerImpl) CMCloseNotify(hdr *f5.MsgHdr, msg *CMCloseNotify) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MsgHandlerImpl) CMReportPingValue(hdr *f5.MsgHdr, msg *CMReportPingValue) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MsgHandlerImpl) CMGetCurrentRoom(hdr *f5.MsgHdr, msg *CMGetCurrentRoom) {
|
||||||
|
}
|
||||||
|
|
||||||
func (this *CMPing) GetNetMsgId() uint16 {
|
func (this *CMPing) GetNetMsgId() uint16 {
|
||||||
return uint16(CMMessageIdE__CMPing)
|
return uint16(CMMessageIdE__CMPing)
|
||||||
}
|
}
|
||||||
@ -193,6 +201,18 @@ func (this *CMCloseNotify) GetNetMsgId() uint16 {
|
|||||||
return uint16(CMMessageIdE__CMCloseNotify)
|
return uint16(CMMessageIdE__CMCloseNotify)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CMReportPingValue) GetNetMsgId() uint16 {
|
||||||
|
return uint16(CMMessageIdE__CMReportPingValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CMGetCurrentRoom) GetNetMsgId() uint16 {
|
||||||
|
return uint16(CMMessageIdE__CMGetCurrentRoom)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SMGetCurrentRoom) GetNetMsgId() uint16 {
|
||||||
|
return uint16(SMMessageIdE__SMGetCurrentRoom)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *SMRoomMemberChangeNotify) GetNetMsgId() uint16 {
|
func (this *SMRoomMemberChangeNotify) GetNetMsgId() uint16 {
|
||||||
return uint16(SMMessageIdE__SMRoomMemberChangeNotify)
|
return uint16(SMMessageIdE__SMRoomMemberChangeNotify)
|
||||||
}
|
}
|
||||||
@ -387,4 +407,28 @@ func init() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handlers[int(CMMessageIdE__CMReportPingValue)] = &CsNetMsgHandler{
|
||||||
|
MsgId: int(CMMessageIdE__CMReportPingValue),
|
||||||
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
msg := &CMReportPingValue{}
|
||||||
|
proto.Unmarshal(data, msg)
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||||
|
handler.CMReportPingValue(hdr, hdr.Msg.(*CMReportPingValue))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
handlers[int(CMMessageIdE__CMGetCurrentRoom)] = &CsNetMsgHandler{
|
||||||
|
MsgId: int(CMMessageIdE__CMGetCurrentRoom),
|
||||||
|
ParseCb: func (data []byte) interface{} {
|
||||||
|
msg := &CMGetCurrentRoom{}
|
||||||
|
proto.Unmarshal(data, msg)
|
||||||
|
return msg
|
||||||
|
},
|
||||||
|
Cb: func (hdr *f5.MsgHdr, handler MsgHandler) {
|
||||||
|
handler.CMGetCurrentRoom(hdr, hdr.Msg.(*CMGetCurrentRoom))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -48,6 +48,7 @@ type Config struct {
|
|||||||
gameapi_url string
|
gameapi_url string
|
||||||
auto_start_time int32
|
auto_start_time int32
|
||||||
game_start_notify_time int32
|
game_start_notify_time int32
|
||||||
|
delay_delete_time int32
|
||||||
|
|
||||||
_flags1_ uint64
|
_flags1_ uint64
|
||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
@ -205,6 +206,14 @@ func (this *Config) HasGameStartNotifyTime() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Config) GetDelayDeleteTime() int32 {
|
||||||
|
return this.delay_delete_time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Config) HasDelayDeleteTime() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func (this *HallCluster) LoadFromKv(kv map[string]interface{}) {
|
func (this *HallCluster) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||||
@ -238,4 +247,5 @@ func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||||
f5.ReadMetaTableField(&this.auto_start_time, "auto_start_time", &this._flags1_, 2, kv)
|
f5.ReadMetaTableField(&this.auto_start_time, "auto_start_time", &this._flags1_, 2, kv)
|
||||||
f5.ReadMetaTableField(&this.game_start_notify_time, "game_start_notify_time", &this._flags1_, 3, kv)
|
f5.ReadMetaTableField(&this.game_start_notify_time, "game_start_notify_time", &this._flags1_, 3, kv)
|
||||||
|
f5.ReadMetaTableField(&this.delay_delete_time, "delay_delete_time", &this._flags1_, 4, kv)
|
||||||
}
|
}
|
||||||
|
@ -39,4 +39,5 @@ message Config
|
|||||||
optional string gameapi_url = 1;
|
optional string gameapi_url = 1;
|
||||||
optional int32 auto_start_time = 2;
|
optional int32 auto_start_time = 2;
|
||||||
optional int32 game_start_notify_time = 3;
|
optional int32 game_start_notify_time = 3;
|
||||||
|
optional int32 delay_delete_time = 4;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ type room struct {
|
|||||||
teamIdHash map[int32]*team
|
teamIdHash map[int32]*team
|
||||||
members map[string]*member
|
members map[string]*member
|
||||||
startTimer *f5.TimerWp
|
startTimer *f5.TimerWp
|
||||||
|
delayDeleteTimer *f5.TimerWp
|
||||||
attacher *f5.TimerAttacher
|
attacher *f5.TimerAttacher
|
||||||
gameStartNotifyMsg *cs.SMRoomGameStartNotify
|
gameStartNotifyMsg *cs.SMRoomGameStartNotify
|
||||||
}
|
}
|
||||||
@ -51,6 +52,12 @@ func (this *room) init(roomId string, roomIdx int64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) unInit() {
|
func (this *room) unInit() {
|
||||||
|
for ; len(this.teamUuidHash) > 0; {
|
||||||
|
for _, t := range(this.teamUuidHash) {
|
||||||
|
t.unInit()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
this.attacher.ClearTimers()
|
this.attacher.ClearTimers()
|
||||||
this.entry.DelInit()
|
this.entry.DelInit()
|
||||||
delete(_roomMgr.idHash, this.roomId)
|
delete(_roomMgr.idHash, this.roomId)
|
||||||
@ -317,6 +324,7 @@ func (this *room) doDisband(reason int32) {
|
|||||||
m.hum.SendMsg(notifyMsg)
|
m.hum.SendMsg(notifyMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.delayDeleteRoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) doStart(reason int32) {
|
func (this *room) doStart(reason int32) {
|
||||||
@ -334,6 +342,7 @@ func (this *room) doStart(reason int32) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
this.attacher)
|
this.attacher)
|
||||||
|
this.delayDeleteRoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *room) viewable() bool {
|
func (this *room) viewable() bool {
|
||||||
@ -472,6 +481,19 @@ func (this *room) notifyRoomInfo() {
|
|||||||
this.broadcastMsg(notifyMsg)
|
this.broadcastMsg(notifyMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *room) delayDeleteRoom() {
|
||||||
|
if this.delayDeleteTimer != nil {
|
||||||
|
panic("errror dealyDeleteRoom")
|
||||||
|
}
|
||||||
|
this.delayDeleteTimer = f5.GetTimer().SetTimeoutExWp(
|
||||||
|
1000 * mt.Table.Config.Get().GetDelayDeleteTime(),
|
||||||
|
func (e int32, args *q5.Args) {
|
||||||
|
if e == q5.TIMER_EXEC_EVENT {
|
||||||
|
this.unInit()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
this.attacher)
|
||||||
|
}
|
||||||
|
|
||||||
func newRoom() *room {
|
func newRoom() *room {
|
||||||
r := new(room)
|
r := new(room)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user