review
This commit is contained in:
parent
71655d8126
commit
7ebe12c3de
|
@ -370,7 +370,7 @@ func (m *CoinSceneMgr) OnPlatformDestroy(p *Platform) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.DoDelete(ids, true)
|
SceneMgrSingleton.SendGameDestroy(ids, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CoinSceneMgr) OnPlatformChangeDisabled(p *Platform, disabled bool) {
|
func (m *CoinSceneMgr) OnPlatformChangeDisabled(p *Platform, disabled bool) {
|
||||||
|
@ -395,7 +395,7 @@ func (m *CoinSceneMgr) OnPlatformGameFreeUpdate(p *Platform, oldCfg, newCfg *web
|
||||||
for _, scene := range cps.scenes {
|
for _, scene := range cps.scenes {
|
||||||
ids = append(ids, scene.sceneId)
|
ids = append(ids, scene.sceneId)
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.DoDelete(ids, true)
|
SceneMgrSingleton.SendGameDestroy(ids, true)
|
||||||
m.TouchCreateRoom(p.IdStr, newCfg.DbGameFree.Id)
|
m.TouchCreateRoom(p.IdStr, newCfg.DbGameFree.Id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ func (m *CoinSceneMgr) OnPlatformDestroyByGameFreeId(p *Platform, gameFreeId int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.DoDelete(ids, true)
|
SceneMgrSingleton.SendGameDestroy(ids, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
//=========================PlatformGameGroupObserver==============================
|
//=========================PlatformGameGroupObserver==============================
|
||||||
|
|
|
@ -330,7 +330,7 @@ func (csp *CoinScenePool) onPlayerLeave(s *Scene, p *Player) {
|
||||||
// 玩家离开结算空房间的私人房
|
// 玩家离开结算空房间的私人房
|
||||||
if s.IsPrivateScene() {
|
if s.IsPrivateScene() {
|
||||||
if s.IsEmpty() {
|
if s.IsEmpty() {
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -345,7 +345,7 @@ func (csp *CoinScenePool) onPlayerLeave(s *Scene, p *Player) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hasCnt > int(csp.dbGameFree.GetCreateRoomNum()) {
|
if hasCnt > int(csp.dbGameFree.GetCreateRoomNum()) {
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,7 @@ func (this *HundredSceneMgr) OnPlatformDestroy(p *Platform) {
|
||||||
for _, scene := range ss {
|
for _, scene := range ss {
|
||||||
ids = append(ids, scene.sceneId)
|
ids = append(ids, scene.sceneId)
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.DoDelete(ids, true)
|
SceneMgrSingleton.SendGameDestroy(ids, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ func (this *HundredSceneMgr) OnPlatformGameFreeUpdate(p *Platform, oldCfg, newCf
|
||||||
}
|
}
|
||||||
if scenes, exist := this.scenesOfPlatform[p.IdStr]; exist {
|
if scenes, exist := this.scenesOfPlatform[p.IdStr]; exist {
|
||||||
if s, ok := scenes[newCfg.DbGameFree.Id]; ok {
|
if s, ok := scenes[newCfg.DbGameFree.Id]; ok {
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ func (this *HundredSceneMgr) OnPlatformDestroyByGameFreeId(p *Platform, gameFree
|
||||||
ids = append(ids, scene.sceneId)
|
ids = append(ids, scene.sceneId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.DoDelete(ids, true)
|
SceneMgrSingleton.SendGameDestroy(ids, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ func (ms *MatchSceneMgr) MatchStop(tm *TmMatch) {
|
||||||
if SceneMgrSingleton.scenes != nil && tm != nil {
|
if SceneMgrSingleton.scenes != nil && tm != nil {
|
||||||
for _, scene := range SceneMgrSingleton.scenes {
|
for _, scene := range SceneMgrSingleton.scenes {
|
||||||
if scene.IsMatchScene() && scene.matchId == tm.SortId {
|
if scene.IsMatchScene() && scene.matchId == tm.SortId {
|
||||||
scene.SendGameDelete(false)
|
scene.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2415,21 +2415,6 @@ func (this *Player) GetIP() string {
|
||||||
return this.Ip
|
return this.Ip
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) CreateScene(sceneId, gameId, gameMode, sceneMode int, numOfGames int32, params []int64, dbGameFree *serverproto.DB_GameFree) (*Scene, hallproto.OpResultCode_Game) {
|
|
||||||
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
|
||||||
if gs == nil {
|
|
||||||
logger.Logger.Warnf("(this *Player) EnterScene %v, %v GameSessMgrSington.GetMinLoadSess() = nil ", this.SnId, gameId)
|
|
||||||
return nil, hallproto.OpResultCode_Game_OPRC_SceneServerMaintain_Game
|
|
||||||
}
|
|
||||||
|
|
||||||
s := SceneMgrSingleton.CreateScene(0, this.SnId, sceneId, gameId, gameMode, sceneMode, 1, numOfGames, params, gs, this.GetPlatform(), 0, dbGameFree, dbGameFree.GetId())
|
|
||||||
if s == nil {
|
|
||||||
logger.Logger.Tracef("(this *Player) EnterScene %v, SceneMgrSingleton.CreateScene() = nil ", this.SnId)
|
|
||||||
return nil, hallproto.OpResultCode_Game_OPRC_Error_Game
|
|
||||||
}
|
|
||||||
return s, hallproto.OpResultCode_Game_OPRC_Sucess_Game
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *Player) CreateLocalGameScene(sceneId, gameId, gameSite, sceneMode, playerNum int, params []int64,
|
func (this *Player) CreateLocalGameScene(sceneId, gameId, gameSite, sceneMode, playerNum int, params []int64,
|
||||||
dbGameFree *serverproto.DB_GameFree, baseScore, groupId int32) (*Scene, hallproto.OpResultCode_Game) {
|
dbGameFree *serverproto.DB_GameFree, baseScore, groupId int32) (*Scene, hallproto.OpResultCode_Game) {
|
||||||
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
||||||
|
|
|
@ -606,6 +606,41 @@ func (this *Scene) AudienceEnter(p *Player, ischangeroom bool) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Scene) lastScene(p *Player) {
|
||||||
|
// 记录玩家在每个游戏场次最后进入的房间号
|
||||||
|
// 只记录金币场
|
||||||
|
if this.IsCoinScene() {
|
||||||
|
const MINHOLD = 10
|
||||||
|
const MAXHOLD = 20
|
||||||
|
holdCnt := MINHOLD
|
||||||
|
if this.csp != nil {
|
||||||
|
holdCnt = this.csp.GetHasTruePlayerSceneCnt() + 2
|
||||||
|
if holdCnt < MINHOLD {
|
||||||
|
holdCnt = MINHOLD
|
||||||
|
}
|
||||||
|
if holdCnt > MAXHOLD {
|
||||||
|
holdCnt = MAXHOLD
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if p.lastSceneId == nil {
|
||||||
|
p.lastSceneId = make(map[int32][]int32)
|
||||||
|
}
|
||||||
|
id := this.dbGameFree.GetId()
|
||||||
|
if sceneIds, exist := p.lastSceneId[id]; exist {
|
||||||
|
if !common.InSliceInt32(sceneIds, int32(this.sceneId)) {
|
||||||
|
sceneIds = append(sceneIds, int32(this.sceneId))
|
||||||
|
cnt := len(sceneIds)
|
||||||
|
if cnt > holdCnt {
|
||||||
|
sceneIds = sceneIds[cnt-holdCnt:]
|
||||||
|
}
|
||||||
|
p.lastSceneId[id] = sceneIds
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.lastSceneId[id] = []int32{int32(this.sceneId)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Scene) DelPlayer(p *Player) bool {
|
func (this *Scene) DelPlayer(p *Player) bool {
|
||||||
if p.scene != this {
|
if p.scene != this {
|
||||||
roomId := 0
|
roomId := 0
|
||||||
|
@ -625,7 +660,7 @@ func (this *Scene) DelPlayer(p *Player) bool {
|
||||||
this.robotNum--
|
this.robotNum--
|
||||||
}
|
}
|
||||||
// 记录玩家最近玩游戏的房间
|
// 记录玩家最近玩游戏的房间
|
||||||
SceneMgrSingleton.OnPlayerLeaveScene(this, p)
|
this.lastScene(p)
|
||||||
// 玩家最后所在游戏
|
// 玩家最后所在游戏
|
||||||
p.LastGameId = int(this.dbGameFree.GetGameId())
|
p.LastGameId = int(this.dbGameFree.GetGameId())
|
||||||
}
|
}
|
||||||
|
@ -812,7 +847,7 @@ func (this *Scene) IsLongTimeInactive() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) SendGameDelete(isGrace bool) {
|
func (this *Scene) SendGameDestroy(isGrace bool) {
|
||||||
if !isGrace {
|
if !isGrace {
|
||||||
this.deleting = true
|
this.deleting = true
|
||||||
this.force = true
|
this.force = true
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
serverproto "mongo.games.com/game/protocol/server"
|
serverproto "mongo.games.com/game/protocol/server"
|
||||||
webapi2 "mongo.games.com/game/protocol/webapi"
|
webapiproto "mongo.games.com/game/protocol/webapi"
|
||||||
"mongo.games.com/game/webapi"
|
"mongo.games.com/game/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,22 +29,14 @@ var SceneMgrSingleton = &SceneMgr{
|
||||||
// SceneMgr 房间管理器
|
// SceneMgr 房间管理器
|
||||||
type SceneMgr struct {
|
type SceneMgr struct {
|
||||||
BaseClockSinker // 驱动时间事件
|
BaseClockSinker // 驱动时间事件
|
||||||
|
|
||||||
scenes map[int]*Scene // 房间id: Scene
|
scenes map[int]*Scene // 房间id: Scene
|
||||||
|
|
||||||
privateAutoId int // 私人房房间号
|
privateAutoId int // 私人房房间号
|
||||||
matchAutoId int // 比赛场房间号
|
matchAutoId int // 比赛场房间号
|
||||||
coinSceneAutoId int // 金币场房间号
|
coinSceneAutoId int // 金币场房间号
|
||||||
hundredSceneAutoId int // 百人场房间号
|
hundredSceneAutoId int // 百人场房间号
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SceneMgr) GetPlatformBySceneId(sceneId int) string {
|
|
||||||
s := m.GetScene(sceneId)
|
|
||||||
if s != nil && s.limitPlatform != nil {
|
|
||||||
return s.limitPlatform.IdStr
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllocReplayCode 获取回访码
|
// AllocReplayCode 获取回访码
|
||||||
func (m *SceneMgr) AllocReplayCode() string {
|
func (m *SceneMgr) AllocReplayCode() string {
|
||||||
code, _ := model.GetOneReplayId()
|
code, _ := model.GetOneReplayId()
|
||||||
|
@ -87,6 +79,14 @@ func (m *SceneMgr) GenOneMatchSceneId() int {
|
||||||
return m.matchAutoId
|
return m.matchAutoId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *SceneMgr) GetPlatformBySceneId(sceneId int) string {
|
||||||
|
s := m.GetScene(sceneId)
|
||||||
|
if s != nil && s.limitPlatform != nil {
|
||||||
|
return s.limitPlatform.IdStr
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// GetScene 获取房间对象
|
// GetScene 获取房间对象
|
||||||
func (m *SceneMgr) GetScene(sceneId int) *Scene {
|
func (m *SceneMgr) GetScene(sceneId int) *Scene {
|
||||||
if s, exist := m.scenes[sceneId]; exist && !s.deleting {
|
if s, exist := m.scenes[sceneId]; exist && !s.deleting {
|
||||||
|
@ -123,6 +123,8 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene {
|
||||||
return scenes
|
return scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetMatchRoom 获取比赛房间
|
||||||
|
// sortId 比赛id
|
||||||
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
||||||
var scenes []*Scene
|
var scenes []*Scene
|
||||||
for _, value := range m.scenes {
|
for _, value := range m.scenes {
|
||||||
|
@ -137,9 +139,10 @@ func (m *SceneMgr) GetMatchRoom(sortId int64) []*Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalAllRoom 获取房间列表
|
// MarshalAllRoom 获取房间列表
|
||||||
|
// 返回 房间列表,总页数,总条数
|
||||||
func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode, clubId, sceneMode, sceneId int,
|
func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode, clubId, sceneMode, sceneId int,
|
||||||
gameFreeId, snId int32, start, end, pageSize int32) ([]*webapi2.RoomInfo, int32, int32) {
|
gameFreeId, snId int32, start, end, pageSize int32) ([]*webapiproto.RoomInfo, int32, int32) {
|
||||||
roomInfo := make([]*webapi2.RoomInfo, 0, len(m.scenes))
|
roomInfo := make([]*webapiproto.RoomInfo, 0, len(m.scenes))
|
||||||
var isNeedFindAll = false
|
var isNeedFindAll = false
|
||||||
if model.GameParamData.IsFindRoomByGroup && platform != "" && snId != 0 && gameId == 0 &&
|
if model.GameParamData.IsFindRoomByGroup && platform != "" && snId != 0 && gameId == 0 &&
|
||||||
gameMode == 0 && sceneId == -1 && groupId == 0 && clubId == 0 && sceneMode == 0 {
|
gameMode == 0 && sceneId == -1 && groupId == 0 && clubId == 0 && sceneMode == 0 {
|
||||||
|
@ -159,7 +162,7 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode
|
||||||
platformName = s.limitPlatform.IdStr
|
platformName = s.limitPlatform.IdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
si := &webapi2.RoomInfo{
|
si := &webapiproto.RoomInfo{
|
||||||
Platform: platformName,
|
Platform: platformName,
|
||||||
SceneId: int32(s.sceneId),
|
SceneId: int32(s.sceneId),
|
||||||
GameId: int32(s.gameId),
|
GameId: int32(s.gameId),
|
||||||
|
@ -266,18 +269,21 @@ func (m *SceneMgr) CreateScene(agentor, creator int32, sceneId, gameId, gameMode
|
||||||
numOfGames int32, params []int64, gs *GameSession, limitPlatform *Platform, groupId int32, dbGameFree *serverproto.DB_GameFree,
|
numOfGames int32, params []int64, gs *GameSession, limitPlatform *Platform, groupId int32, dbGameFree *serverproto.DB_GameFree,
|
||||||
paramsEx ...int32) *Scene {
|
paramsEx ...int32) *Scene {
|
||||||
logger.Logger.Trace("(this *SceneMgr) CreateScene ")
|
logger.Logger.Trace("(this *SceneMgr) CreateScene ")
|
||||||
|
// 创建房间
|
||||||
s := NewScene(agentor, creator, sceneId, gameId, gameMode, sceneMode, clycleTimes, numOfGames, params, gs, limitPlatform, groupId,
|
s := NewScene(agentor, creator, sceneId, gameId, gameMode, sceneMode, clycleTimes, numOfGames, params, gs, limitPlatform, groupId,
|
||||||
dbGameFree, paramsEx...)
|
dbGameFree, paramsEx...)
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m.scenes[sceneId] = s
|
m.scenes[sceneId] = s
|
||||||
|
|
||||||
|
// 创建水池
|
||||||
if !s.IsMatchScene() && dbGameFree != nil && limitPlatform != nil {
|
if !s.IsMatchScene() && dbGameFree != nil && limitPlatform != nil {
|
||||||
//平台水池设置
|
//平台水池设置
|
||||||
gs.DetectCoinPoolSetting(limitPlatform.IdStr, dbGameFree.GetId(), s.groupId)
|
gs.DetectCoinPoolSetting(limitPlatform.IdStr, dbGameFree.GetId(), s.groupId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加到游戏服记录中
|
||||||
gs.AddScene(s)
|
gs.AddScene(s)
|
||||||
var platformName string
|
var platformName string
|
||||||
if limitPlatform != nil {
|
if limitPlatform != nil {
|
||||||
|
@ -298,10 +304,9 @@ func (m *SceneMgr) CreateLocalGameScene(creator int32, sceneId, gameId, gameSite
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m.scenes[sceneId] = s
|
m.scenes[sceneId] = s
|
||||||
gs.AddScene(s)
|
|
||||||
|
|
||||||
|
gs.AddScene(s)
|
||||||
var platformName string
|
var platformName string
|
||||||
if limitPlatform != nil {
|
if limitPlatform != nil {
|
||||||
platformName = limitPlatform.IdStr
|
platformName = limitPlatform.IdStr
|
||||||
|
@ -336,44 +341,7 @@ func (m *SceneMgr) DestroyScene(sceneId int, isCompleted bool) {
|
||||||
logger.Logger.Infof("(this *SceneMgr) DestroyScene, SceneId=%v", sceneId)
|
logger.Logger.Infof("(this *SceneMgr) DestroyScene, SceneId=%v", sceneId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SceneMgr) OnPlayerLeaveScene(s *Scene, p *Player) {
|
func (m *SceneMgr) SendGameDestroy(sceneId []int, isGrace bool) {
|
||||||
logger.Logger.Trace("(this *SceneMgr) OnPlayerLeaveScene", p.SnId)
|
|
||||||
|
|
||||||
// 记录玩家在每个游戏场次最后进入的房间号
|
|
||||||
// 只记录金币场
|
|
||||||
if s.IsCoinScene() {
|
|
||||||
const MINHOLD = 10
|
|
||||||
const MAXHOLD = 20
|
|
||||||
holdCnt := MINHOLD
|
|
||||||
if s.csp != nil {
|
|
||||||
holdCnt = s.csp.GetHasTruePlayerSceneCnt() + 2
|
|
||||||
if holdCnt < MINHOLD {
|
|
||||||
holdCnt = MINHOLD
|
|
||||||
}
|
|
||||||
if holdCnt > MAXHOLD {
|
|
||||||
holdCnt = MAXHOLD
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if p.lastSceneId == nil {
|
|
||||||
p.lastSceneId = make(map[int32][]int32)
|
|
||||||
}
|
|
||||||
id := s.dbGameFree.GetId()
|
|
||||||
if sceneIds, exist := p.lastSceneId[id]; exist {
|
|
||||||
if !common.InSliceInt32(sceneIds, int32(s.sceneId)) {
|
|
||||||
sceneIds = append(sceneIds, int32(s.sceneId))
|
|
||||||
cnt := len(sceneIds)
|
|
||||||
if cnt > holdCnt {
|
|
||||||
sceneIds = sceneIds[cnt-holdCnt:]
|
|
||||||
}
|
|
||||||
p.lastSceneId[id] = sceneIds
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p.lastSceneId[id] = []int32{int32(s.sceneId)}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *SceneMgr) DoDelete(sceneId []int, isGrace bool) {
|
|
||||||
if len(sceneId) == 0 {
|
if len(sceneId) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -393,31 +361,6 @@ func (m *SceneMgr) DoDelete(sceneId []int, isGrace bool) {
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(serverproto.SSPacketID_PACKET_WG_DESTROYSCENE), pack, common.GetSelfAreaId(), srvlib.GameServerType)
|
srvlib.ServerSessionMgrSington.Broadcast(int(serverproto.SSPacketID_PACKET_WG_DESTROYSCENE), pack, common.GetSelfAreaId(), srvlib.GameServerType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetThirdScene 获取三方游戏房间
|
|
||||||
//func (m *SceneMgr) GetThirdScene(i webapi.IThirdPlatform) *Scene {
|
|
||||||
// if i == nil {
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
// sceneId := i.GetPlatformBase().SceneId
|
|
||||||
// scene := m.scenes[sceneId]
|
|
||||||
// if scene != nil {
|
|
||||||
// return scene
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// gs := GameSessMgrSington.GetMinLoadSess(i.GetPlatformBase().BaseGameID)
|
|
||||||
// if gs != nil {
|
|
||||||
// limitPlatform := PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
|
||||||
// var gameMode = common.SceneMode_Thr
|
|
||||||
// dbGameFree := srvdata.PBDB_GameFreeMgr.GetData(i.GetPlatformBase().VultGameID)
|
|
||||||
// scene := SceneMgrSingleton.CreateScene(0, 0, sceneId, i.GetPlatformBase().BaseGameID, gameMode, int(common.SceneMode_Thr), 1, -1,
|
|
||||||
// []int64{}, gs, limitPlatform, 0, dbGameFree, i.GetPlatformBase().VultGameID)
|
|
||||||
// return scene
|
|
||||||
// } else {
|
|
||||||
// logger.Logger.Errorf("Get %v game min session failed.", i.GetPlatformBase().BaseGameID)
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//=========================ClockSinker===============================
|
//=========================ClockSinker===============================
|
||||||
|
|
||||||
// InterestClockEvent 接收所有时间事件
|
// InterestClockEvent 接收所有时间事件
|
||||||
|
@ -435,18 +378,18 @@ func (m *SceneMgr) OnMiniTimer() {
|
||||||
case s.IsCoinScene():
|
case s.IsCoinScene():
|
||||||
if s.IsLongTimeInactive() {
|
if s.IsLongTimeInactive() {
|
||||||
if s.dbGameFree.GetCreateRoomNum() == 0 {
|
if s.dbGameFree.GetCreateRoomNum() == 0 {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
if s.dbGameFree.GetCreateRoomNum() > 0 && s.csp != nil && s.csp.GetRoomNum() > int(s.dbGameFree.GetCreateRoomNum()) {
|
if s.dbGameFree.GetCreateRoomNum() > 0 && s.csp != nil && s.csp.GetRoomNum() > int(s.dbGameFree.GetCreateRoomNum()) {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case s.IsPrivateScene():
|
case s.IsPrivateScene():
|
||||||
if s.IsLongTimeInactive() {
|
if s.IsLongTimeInactive() {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,6 @@ type ScenePolicyData struct {
|
||||||
customIndexParams []*ScenePolicyDataParam
|
customIndexParams []*ScenePolicyDataParam
|
||||||
}
|
}
|
||||||
|
|
||||||
func alignto(val, align int32) int32 {
|
|
||||||
return (val + align - 1) / align
|
|
||||||
}
|
|
||||||
|
|
||||||
func (spd *ScenePolicyData) Init() bool {
|
func (spd *ScenePolicyData) Init() bool {
|
||||||
spd.nameMap = make(map[string]*ScenePolicyDataParam)
|
spd.nameMap = make(map[string]*ScenePolicyDataParam)
|
||||||
spd.aliasNameMap = make(map[string]*ScenePolicyDataParam)
|
spd.aliasNameMap = make(map[string]*ScenePolicyDataParam)
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ func init() {
|
||||||
if s != nil && !s.deleting && len(s.players) == 0 {
|
if s != nil && !s.deleting && len(s.players) == 0 {
|
||||||
logger.Logger.Warnf("WebService SpecailEmptySceneId destroyroom scene:%v", s.sceneId)
|
logger.Logger.Warnf("WebService SpecailEmptySceneId destroyroom scene:%v", s.sceneId)
|
||||||
s.TryForceDeleteMatchInfo()
|
s.TryForceDeleteMatchInfo()
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 2: //删除所有未开始的房间
|
case 2: //删除所有未开始的房间
|
||||||
|
@ -1764,7 +1764,7 @@ func init() {
|
||||||
if s != nil && !s.deleting && !s.starting && !s.IsHundredScene() {
|
if s != nil && !s.deleting && !s.starting && !s.IsHundredScene() {
|
||||||
logger.Logger.Warnf("WebService SpecailUnstartSceneId destroyroom scene:%v", s.sceneId)
|
logger.Logger.Warnf("WebService SpecailUnstartSceneId destroyroom scene:%v", s.sceneId)
|
||||||
s.TryForceDeleteMatchInfo()
|
s.TryForceDeleteMatchInfo()
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: //删除指定房间
|
default: //删除指定房间
|
||||||
|
@ -1787,7 +1787,7 @@ func init() {
|
||||||
}
|
}
|
||||||
logger.Logger.Warnf("WebService destroyroom scene:%v", s.sceneId)
|
logger.Logger.Warnf("WebService destroyroom scene:%v", s.sceneId)
|
||||||
s.TryForceDeleteMatchInfo()
|
s.TryForceDeleteMatchInfo()
|
||||||
s.SendGameDelete(false)
|
s.SendGameDestroy(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return common.ResponseTag_Ok, pack
|
return common.ResponseTag_Ok, pack
|
||||||
|
|
Loading…
Reference in New Issue