Compare commits
No commits in common. "60255489d5a3768d974452d32c8b0f38944232b6" and "d3fb69d198e366e43a5a94be574ba5820c7f0bee" have entirely different histories.
60255489d5
...
d3fb69d198
|
@ -248,8 +248,8 @@ const (
|
||||||
GainWay_ActSignNew2 = 58 //签到看视频双倍领取
|
GainWay_ActSignNew2 = 58 //签到看视频双倍领取
|
||||||
GainWay_ItemUse = 59 //道具使用
|
GainWay_ItemUse = 59 //道具使用
|
||||||
GainWay_PhoneScore = 60 //手机积分活动
|
GainWay_PhoneScore = 60 //手机积分活动
|
||||||
GainWay_RankReward = 61 //排位奖励
|
GainWay_RankReward = 61 //
|
||||||
GainWay_TaskReward = 62 //任务奖励
|
GainWay_TaskReward = 62 //
|
||||||
GainWay_Interact = 63 //房间内互动效果
|
GainWay_Interact = 63 //房间内互动效果
|
||||||
GainWay_Collect = 64 //集卡活动
|
GainWay_Collect = 64 //集卡活动
|
||||||
GainWay_WeekCardAward = 65 //周卡奖励
|
GainWay_WeekCardAward = 65 //周卡奖励
|
||||||
|
|
|
@ -2158,7 +2158,6 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
||||||
pack := &player.SCGameExDropItems{}
|
pack := &player.SCGameExDropItems{}
|
||||||
pack.Items = make(map[int32]int32)
|
pack.Items = make(map[int32]int32)
|
||||||
for id, num := range realDrop {
|
for id, num := range realDrop {
|
||||||
remark := fmt.Sprintf("游戏掉落%v", id)
|
|
||||||
pack.Items[id] = proto.Int32(num)
|
pack.Items[id] = proto.Int32(num)
|
||||||
itemData := srvdata.PBDB_GameItemMgr.GetData(id)
|
itemData := srvdata.PBDB_GameItemMgr.GetData(id)
|
||||||
if itemData != nil {
|
if itemData != nil {
|
||||||
|
@ -2170,7 +2169,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
||||||
ItemId: itemData.Id,
|
ItemId: itemData.Id,
|
||||||
ItemName: itemData.Name,
|
ItemName: itemData.Name,
|
||||||
Count: int64(num),
|
Count: int64(num),
|
||||||
Remark: remark,
|
Remark: "tienlen游戏掉落",
|
||||||
TypeId: common.GainWay_Game,
|
TypeId: common.GainWay_Game,
|
||||||
GameId: int64(this.GameId),
|
GameId: int64(this.GameId),
|
||||||
GameFreeId: int64(this.GetGameFreeId()),
|
GameFreeId: int64(this.GetGameFreeId()),
|
||||||
|
|
|
@ -520,7 +520,7 @@ func (this *CSInviteFriendOpHandler) Process(s *netlib.Session, packetid int, da
|
||||||
send(p)
|
send(p)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !scene.PlayerEnter(p, pos, true) {
|
if !p.EnterScene(scene, true, pos) {
|
||||||
logger.Logger.Trace("CSInviteFriendHandler EnterScene fail")
|
logger.Logger.Trace("CSInviteFriendHandler EnterScene fail")
|
||||||
opRetCode = friend.OpResultCode_OPRC_Error //进入房间失败
|
opRetCode = friend.OpResultCode_OPRC_Error //进入房间失败
|
||||||
send(p)
|
send(p)
|
||||||
|
|
|
@ -165,7 +165,7 @@ func (this *CSEnterRoomHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !scene.PlayerEnter(p, -1, true) {
|
if !p.EnterScene(scene, true, -1) {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1339,6 +1339,58 @@ func (this *CSQueryRoomInfoHandler) ProcessLocalGame(s *netlib.Session, packetid
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CSQueryRoomInfoHandler) ProcessId(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Trace("CSQueryRoomInfoHandler Process recv ProcessId", data)
|
||||||
|
if msg, ok := data.(*gamehall.CSQueryRoomInfo); ok {
|
||||||
|
p := PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSQueryRoomInfoHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pack := &gamehall.SCQueryRoomInfo{}
|
||||||
|
mapGameCfg := PlatformMgrSingleton.GetGameFrees(p.Platform)
|
||||||
|
for _, v := range msg.GetId() {
|
||||||
|
gameid := v / 10000
|
||||||
|
pack.GameIds = append(pack.GameIds, gameid)
|
||||||
|
scenes := SceneMgrSingleton.GetScenesByGame(int(gameid))
|
||||||
|
for _, scene := range scenes {
|
||||||
|
var isShow bool
|
||||||
|
if mapGameCfg != nil {
|
||||||
|
if cfg, have := mapGameCfg[scene.dbGameFree.Id]; have && cfg.GroupId != 0 && cfg.GroupId == scene.groupId {
|
||||||
|
isShow = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if p.Platform == scene.limitPlatform.IdStr || isShow {
|
||||||
|
if scene != nil && scene.sceneMode == common.SceneMode_Public && len(scene.players) != 0 {
|
||||||
|
if scene.dbGameFree.Id == v {
|
||||||
|
roomInfo := &gamehall.QRoomInfo{
|
||||||
|
GameFreeId: proto.Int32(scene.dbGameFree.GetId()),
|
||||||
|
GameId: proto.Int32(scene.dbGameFree.GetGameId()),
|
||||||
|
RoomId: proto.Int(scene.sceneId),
|
||||||
|
BaseCoin: proto.Int64(int64(scene.BaseScore)),
|
||||||
|
LimitCoin: proto.Int64(scene.dbGameFree.GetLimitCoin()),
|
||||||
|
CurrNum: proto.Int(scene.GetPlayerCnt()),
|
||||||
|
MaxPlayer: proto.Int(scene.playerNum),
|
||||||
|
Creator: proto.Int32(scene.creator),
|
||||||
|
CreateTs: proto.Int32(int32(scene.createTime.Unix())),
|
||||||
|
Params: common.CopySliceInt64ToInt32(scene.params),
|
||||||
|
}
|
||||||
|
pack.RoomInfo = append(pack.RoomInfo, roomInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pack.OpRetCode = gamehall.OpResultCode_Game_OPRC_Sucess_Game
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SC_QUERYROOMINFO), pack)
|
||||||
|
logger.Logger.Trace("SCQueryRoomInfo: ", pack)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type CSLotteryLogPacketFactory struct {
|
type CSLotteryLogPacketFactory struct {
|
||||||
}
|
}
|
||||||
type CSLotteryLogHandler struct {
|
type CSLotteryLogHandler struct {
|
||||||
|
@ -1882,13 +1934,17 @@ func (this *CSCreateRoomHandler) ProcessLocalGame(s *netlib.Session, packetid in
|
||||||
}
|
}
|
||||||
scene, code = p.CreateLocalGameScene(roomId, int(gameId), int(gameSite), int(msg.GetSceneMode()), maxPlayerNum,
|
scene, code = p.CreateLocalGameScene(roomId, int(gameId), int(gameSite), int(msg.GetSceneMode()), maxPlayerNum,
|
||||||
params, dbGameFree, baseScore, csp.groupId)
|
params, dbGameFree, baseScore, csp.groupId)
|
||||||
if scene != nil && code == gamehall.OpResultCode_Game_OPRC_Sucess_Game {
|
if scene != nil {
|
||||||
|
if code == gamehall.OpResultCode_Game_OPRC_Sucess_Game {
|
||||||
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v Create Sucess GameId:%v", p.SnId, gameId)
|
logger.Logger.Tracef("CSCreateRoomHandler SnId:%v Create Sucess GameId:%v", p.SnId, gameId)
|
||||||
csp.AddScene(scene)
|
// try enter scene
|
||||||
if !scene.PlayerEnter(p, -1, true) {
|
csp.scenes[scene.sceneId] = scene
|
||||||
|
scene.csp = csp
|
||||||
|
if !p.EnterScene(scene, true, -1) {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
resp := &gamehall.SCCreateRoom{
|
resp := &gamehall.SCCreateRoom{
|
||||||
|
@ -1992,7 +2048,7 @@ func (this *CSCreateRoomHandler) ProcessThirteen(s *netlib.Session, packetid int
|
||||||
// try enter scene
|
// try enter scene
|
||||||
csp.scenes[scene.sceneId] = scene
|
csp.scenes[scene.sceneId] = scene
|
||||||
scene.csp = csp
|
scene.csp = csp
|
||||||
if !scene.PlayerEnter(p, -1, true) {
|
if !p.EnterScene(scene, true, -1) {
|
||||||
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
code = gamehall.OpResultCode_Game_OPRC_Error_Game
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/globalsign/mgo"
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/activity"
|
||||||
|
"mongo.games.com/game/protocol/server"
|
||||||
|
"mongo.games.com/game/srvdata"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ActSignMgrSington = &ActSignMgr{
|
||||||
|
SignConfigs: make(map[int]*server.DB_ActSign),
|
||||||
|
}
|
||||||
|
|
||||||
|
type ActSignMgr struct {
|
||||||
|
SignConfigs map[int]*server.DB_ActSign
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) Init() {
|
||||||
|
if this.SignConfigs == nil {
|
||||||
|
this.SignConfigs = make(map[int]*server.DB_ActSign)
|
||||||
|
}
|
||||||
|
for _, v := range srvdata.PBDB_ActSignMgr.Datas.GetArr() {
|
||||||
|
this.SignConfigs[int(v.Id)] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) GetConfig(id int) *server.DB_ActSign {
|
||||||
|
signConfig, ok := this.SignConfigs[id]
|
||||||
|
if ok {
|
||||||
|
return signConfig
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) OnPlayerLogin(player *Player) error {
|
||||||
|
return this.RefixedPlayerData(player)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) OnDayChanged(player *Player) error {
|
||||||
|
//跨天不需要
|
||||||
|
//this.RefixedPlayerData(player)
|
||||||
|
//this.SendSignDataToPlayer(player)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) RefixedPlayerData(player *Player) error {
|
||||||
|
if player.IsRob {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if player.SignData == nil {
|
||||||
|
player.SignData = &model.SignData{
|
||||||
|
SignIndex: 0,
|
||||||
|
LastSignTickets: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) SendSignDataToPlayer(player *Player) {
|
||||||
|
if player.IsRob {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pack := &activity.SCSignData{}
|
||||||
|
//已经领取第几个
|
||||||
|
pack.SignCount = proto.Int(player.SignData.SignIndex)
|
||||||
|
if player.SignData.LastSignTickets != 0 {
|
||||||
|
lastSignTime := time.Unix(player.SignData.LastSignTickets, 0)
|
||||||
|
dayDiff := int32(common.DiffDay(time.Now(), lastSignTime))
|
||||||
|
if dayDiff == 0 {
|
||||||
|
pack.TodaySign = proto.Int32(1)
|
||||||
|
} else {
|
||||||
|
pack.TodaySign = proto.Int32(0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pack.TodaySign = proto.Int32(0)
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
player.SendToClient(int(activity.ActSignPacketID_PACKET_SCSignData), pack)
|
||||||
|
logger.Logger.Trace("SCSignData: ", pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ActSignMgr) CanSign(player *Player, signIndex int) activity.OpResultCode_ActSign {
|
||||||
|
signConfig := this.GetConfig(signIndex)
|
||||||
|
if signConfig == nil {
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Error
|
||||||
|
}
|
||||||
|
|
||||||
|
if player.SignData.LastSignTickets != 0 {
|
||||||
|
lastSignTime := time.Unix(player.SignData.LastSignTickets, 0)
|
||||||
|
dayDiff := int32(common.DiffDay(time.Now(), lastSignTime))
|
||||||
|
if dayDiff == 0 {
|
||||||
|
if player.SignData.SignIndex == signIndex {
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Repeat
|
||||||
|
} else {
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Config_Day_Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if player.SignData.SignIndex != (signIndex - 1) {
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Config_Day_Error
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if signIndex != 1 {
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Config_Day_Error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess
|
||||||
|
}
|
||||||
|
|
||||||
|
//func (this *ActSignMgr) Sign(player *Player, signIndex int, signType int32) activity.OpResultCode_ActSign {
|
||||||
|
// errCode := this.CanSign(player, signIndex)
|
||||||
|
// if errCode != activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess {
|
||||||
|
// return errCode
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// signConfig := this.GetConfig(signIndex)
|
||||||
|
// if signConfig == nil {
|
||||||
|
// return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Error
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// player.SignData.LastSignTickets = time.Now().Unix()
|
||||||
|
// player.SignData.SignIndex = signIndex
|
||||||
|
//
|
||||||
|
// logger.Logger.Info("签到成功: ", signConfig)
|
||||||
|
// grade := signConfig.Grade
|
||||||
|
// switch signType {
|
||||||
|
// case 0: //普通签到
|
||||||
|
// case 1: //双倍签到
|
||||||
|
// grade *= 2
|
||||||
|
// }
|
||||||
|
// switch signConfig.Type {
|
||||||
|
// case 1: //金币
|
||||||
|
// player.AddCoin(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
|
||||||
|
// case 2: //钻石
|
||||||
|
// player.AddDiamond(int64(grade), 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"))
|
||||||
|
// case 3: //道具
|
||||||
|
// item := &Item{
|
||||||
|
// ItemId: signConfig.Item_Id,
|
||||||
|
// ItemNum: int64(grade),
|
||||||
|
// }
|
||||||
|
// BagMgrSingleton.AddItems(player, []*Item{item}, 0, common.GainWay_ActSign, strconv.Itoa(signIndex), time.Now().Format("2006-01-02 15:04:05"), 0, 0, false)
|
||||||
|
// }
|
||||||
|
// return activity.OpResultCode_ActSign_OPRC_Activity_Sign_Sucess
|
||||||
|
//}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
mgo.SetStats(true)
|
||||||
|
}
|
|
@ -23,10 +23,10 @@ var CoinSceneMgrSingleton = &CoinSceneMgr{
|
||||||
playerChanging: make(map[int32]int32),
|
playerChanging: make(map[int32]int32),
|
||||||
//按平台管理
|
//按平台管理
|
||||||
scenesOfPlatform: make(map[string]map[int32]*CoinScenePool),
|
scenesOfPlatform: make(map[string]map[int32]*CoinScenePool),
|
||||||
platformOfScene: make(map[int]string),
|
platformOfScene: make(map[int32]string),
|
||||||
//按组管理
|
//按组管理
|
||||||
scenesOfGroup: make(map[int32]map[int32]*CoinScenePool),
|
scenesOfGroup: make(map[int32]map[int32]*CoinScenePool),
|
||||||
groupOfScene: make(map[int]int32),
|
groupOfScene: make(map[int32]int32),
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateRoomCache struct {
|
type CreateRoomCache struct {
|
||||||
|
@ -39,14 +39,14 @@ type CoinSceneMgr struct {
|
||||||
|
|
||||||
//按平台管理
|
//按平台管理
|
||||||
scenesOfPlatform map[string]map[int32]*CoinScenePool // platform:gamefreeid
|
scenesOfPlatform map[string]map[int32]*CoinScenePool // platform:gamefreeid
|
||||||
platformOfScene map[int]string // sceneid:platform; 创建房间后记录房间所在平台
|
platformOfScene map[int32]string // sceneid:platform; 创建房间后记录房间所在平台
|
||||||
|
|
||||||
//按组管理
|
//按组管理
|
||||||
scenesOfGroup map[int32]map[int32]*CoinScenePool // groupid:gamefreeid
|
scenesOfGroup map[int32]map[int32]*CoinScenePool // groupid:gamefreeid
|
||||||
groupOfScene map[int]int32 // sceneid:groupid;
|
groupOfScene map[int32]int32 // sceneid:groupid;
|
||||||
|
|
||||||
//延迟创建房间列表
|
//延迟创建房间列表
|
||||||
delayCache []*CreateRoomCache // 待预创建房间
|
delayCache []CreateRoomCache // 待预创建房间
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCoinScenePool 获取一个场景池
|
// GetCoinScenePool 获取一个场景池
|
||||||
|
@ -72,33 +72,29 @@ func (csm *CoinSceneMgr) GetCoinScenePool(plt string, id int32) *CoinScenePool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if gf.GetDbGameFree() == nil {
|
var dbGameFree *server_proto.DB_GameFree
|
||||||
|
if groupId != 0 {
|
||||||
|
conf := PlatformGameGroupMgrSington.GetGameGroup(groupId)
|
||||||
|
if conf != nil {
|
||||||
|
dbGameFree = conf.GetDbGameFree()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if dbGameFree == nil {
|
||||||
|
dbGameFree = gf.GetDbGameFree()
|
||||||
|
}
|
||||||
|
if dbGameFree == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建了一个新的
|
// 创建了一个新的
|
||||||
// 应该是走不到这里,因为模块启动时所有场次都创建了房间池
|
// 应该是走不到这里,因为模块启动时所有场次都创建了房间池
|
||||||
pool := newCoinScenePool(plt, groupId, gf.GetDbGameFree())
|
return NewCoinScenePool(plt, groupId, dbGameFree)
|
||||||
if groupId != 0 {
|
|
||||||
v, ok := csm.scenesOfGroup[groupId]
|
|
||||||
if !ok || v == nil {
|
|
||||||
csm.scenesOfGroup[groupId] = make(map[int32]*CoinScenePool)
|
|
||||||
}
|
|
||||||
csm.scenesOfGroup[groupId][id] = pool
|
|
||||||
} else {
|
|
||||||
v, ok := csm.scenesOfPlatform[plt]
|
|
||||||
if !ok || v == nil {
|
|
||||||
csm.scenesOfPlatform[plt] = make(map[int32]*CoinScenePool)
|
|
||||||
}
|
|
||||||
csm.scenesOfPlatform[plt][id] = pool
|
|
||||||
}
|
|
||||||
return pool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (csm *CoinSceneMgr) findCoinScenePool(platform string, id int32) (pools map[int32]*CoinScenePool, groupID int32,
|
func (csm *CoinSceneMgr) findCoinScenePool(platform string, id int32) (pools map[int32]*CoinScenePool, groupID int32,
|
||||||
dbGameFree *server.DB_GameFree) {
|
dbGameFree *server.DB_GameFree) {
|
||||||
gf := PlatformMgrSingleton.GetGameFree(platform, id)
|
gf := PlatformMgrSingleton.GetGameFree(platform, id)
|
||||||
if gf == nil || gf.GetDbGameFree() == nil {
|
if gf == nil {
|
||||||
return nil, 0, nil
|
return nil, 0, nil
|
||||||
}
|
}
|
||||||
groupId := gf.GetGroupId()
|
groupId := gf.GetGroupId()
|
||||||
|
@ -106,14 +102,18 @@ func (csm *CoinSceneMgr) findCoinScenePool(platform string, id int32) (pools map
|
||||||
var ss map[int32]*CoinScenePool
|
var ss map[int32]*CoinScenePool
|
||||||
var ok bool
|
var ok bool
|
||||||
if groupId != 0 {
|
if groupId != 0 {
|
||||||
|
pgg := PlatformGameGroupMgrSington.GetGameGroup(groupId)
|
||||||
|
if pgg != nil {
|
||||||
ss, ok = csm.scenesOfGroup[groupId]
|
ss, ok = csm.scenesOfGroup[groupId]
|
||||||
if !ok {
|
if !ok {
|
||||||
ss = make(map[int32]*CoinScenePool)
|
ss = make(map[int32]*CoinScenePool)
|
||||||
csm.scenesOfGroup[groupId] = ss
|
csm.scenesOfGroup[groupId] = ss
|
||||||
}
|
}
|
||||||
return ss, groupId, gf.GetDbGameFree()
|
return ss, groupId, pgg.GetDbGameFree()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ss == nil {
|
||||||
ss, ok = csm.scenesOfPlatform[platform]
|
ss, ok = csm.scenesOfPlatform[platform]
|
||||||
if !ok {
|
if !ok {
|
||||||
ss = make(map[int32]*CoinScenePool)
|
ss = make(map[int32]*CoinScenePool)
|
||||||
|
@ -122,8 +122,11 @@ func (csm *CoinSceneMgr) findCoinScenePool(platform string, id int32) (pools map
|
||||||
return ss, 0, gf.GetDbGameFree()
|
return ss, 0, gf.GetDbGameFree()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil, 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
// PlayerEnter 玩家进入房间池
|
// PlayerEnter 玩家进入房间池
|
||||||
func (csm *CoinSceneMgr) PlayerEnter(p *Player, id int32, roomId int32, exclude []int32, isChangeRoom bool) hall_proto.OpResultCode {
|
func (csm *CoinSceneMgr) PlayerEnter(p *Player, id int32, roomId int32, exclude []int32, ischangeroom bool) hall_proto.OpResultCode {
|
||||||
logger.Logger.Tracef("(csm *CoinSceneMgr) PlayerEnter snid:%v id:%v roomid:%v exclude:%v", p.SnId, id, roomId, exclude)
|
logger.Logger.Tracef("(csm *CoinSceneMgr) PlayerEnter snid:%v id:%v roomid:%v exclude:%v", p.SnId, id, roomId, exclude)
|
||||||
if p.isDelete { //删档用户不让进游戏
|
if p.isDelete { //删档用户不让进游戏
|
||||||
return hall_proto.OpResultCode_OPRC_RoomHadClosed
|
return hall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
|
@ -141,9 +144,22 @@ func (csm *CoinSceneMgr) PlayerEnter(p *Player, id int32, roomId int32, exclude
|
||||||
return hall_proto.OpResultCode_OPRC_Error
|
return hall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
csp := csm.GetCoinScenePool(platform.IdStr, id)
|
pools, groupID, free := csm.findCoinScenePool(platform.IdStr, id)
|
||||||
|
if pools == nil {
|
||||||
|
return hall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
|
}
|
||||||
|
|
||||||
ret := csp.PlayerEnter(p, roomId, exclude, isChangeRoom)
|
csp, ok := pools[id]
|
||||||
|
if !ok || csp == nil {
|
||||||
|
csp = NewCoinScenePool(platform.IdStr, groupID, free)
|
||||||
|
if csp == nil {
|
||||||
|
logger.Logger.Warnf("(csm *CoinSceneMgr) PlayerEnter snid:%v find in id:%v exclude:%v NewCoinScenePool failed", p.SnId, id, exclude)
|
||||||
|
return hall_proto.OpResultCode_OPRC_Error
|
||||||
|
}
|
||||||
|
pools[id] = csp
|
||||||
|
}
|
||||||
|
|
||||||
|
ret := csp.PlayerEnter(p, roomId, exclude, ischangeroom)
|
||||||
|
|
||||||
logger.Logger.Warnf("(csm *CoinSceneMgr) PlayerEnter snid:%v find in id:%v exclude:%v return false", p.SnId, id, exclude)
|
logger.Logger.Warnf("(csm *CoinSceneMgr) PlayerEnter snid:%v find in id:%v exclude:%v return false", p.SnId, id, exclude)
|
||||||
return ret
|
return ret
|
||||||
|
@ -228,28 +244,28 @@ func (csm *CoinSceneMgr) PlayerLeave(p *Player, reason int) bool {
|
||||||
// OnDestroyScene 解散房间
|
// OnDestroyScene 解散房间
|
||||||
// sceneId 房间id
|
// sceneId 房间id
|
||||||
func (csm *CoinSceneMgr) OnDestroyScene(sceneId int) {
|
func (csm *CoinSceneMgr) OnDestroyScene(sceneId int) {
|
||||||
if platformName, ok := csm.platformOfScene[sceneId]; ok {
|
if platformName, ok := csm.platformOfScene[int32(sceneId)]; ok {
|
||||||
if ss, ok := csm.scenesOfPlatform[platformName]; ok {
|
if ss, ok := csm.scenesOfPlatform[platformName]; ok {
|
||||||
for _, csp := range ss {
|
for _, csp := range ss {
|
||||||
csp.OnDestroyScene(sceneId)
|
csp.OnDestroyScene(sceneId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(csm.platformOfScene, sceneId)
|
delete(csm.platformOfScene, int32(sceneId))
|
||||||
}
|
}
|
||||||
|
|
||||||
if groupId, ok := csm.groupOfScene[sceneId]; ok {
|
if groupId, ok := csm.groupOfScene[int32(sceneId)]; ok {
|
||||||
if ss, ok := csm.scenesOfGroup[groupId]; ok {
|
if ss, ok := csm.scenesOfGroup[groupId]; ok {
|
||||||
for _, csp := range ss {
|
for _, csp := range ss {
|
||||||
csp.OnDestroyScene(sceneId)
|
csp.OnDestroyScene(sceneId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(csm.groupOfScene, sceneId)
|
delete(csm.groupOfScene, int32(sceneId))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPlatformBySceneId 获取房间所在平台
|
// GetPlatformBySceneId 获取房间所在平台
|
||||||
func (csm *CoinSceneMgr) GetPlatformBySceneId(sceneId int) string {
|
func (csm *CoinSceneMgr) GetPlatformBySceneId(sceneId int) string {
|
||||||
if platformName, ok := csm.platformOfScene[sceneId]; ok {
|
if platformName, ok := csm.platformOfScene[int32(sceneId)]; ok {
|
||||||
return platformName
|
return platformName
|
||||||
}
|
}
|
||||||
s := SceneMgrSingleton.GetScene(sceneId)
|
s := SceneMgrSingleton.GetScene(sceneId)
|
||||||
|
@ -401,19 +417,76 @@ func (csm *CoinSceneMgr) StartChangeCoinSceneTransact(p *Player, id int32, exclu
|
||||||
return hall_proto.OpResultCode_OPRC_Error
|
return hall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// TouchCreateRoom 触发预创建房间
|
// ListRooms 给客户端发送场次房间列表
|
||||||
// 1.模块启动后触发
|
// id 场次id
|
||||||
// 2.游戏服建立连接后触发
|
func (csm *CoinSceneMgr) ListRooms(p *Player, id int32) bool {
|
||||||
// 3.房间解散后触发
|
//多平台支持
|
||||||
// 4.场次配置更新后
|
platform := p.GetPlatform()
|
||||||
func (csm *CoinSceneMgr) TouchCreateRoom(platform string, gameFreeId int32) {
|
if platform == nil {
|
||||||
gf := PlatformMgrSingleton.GetGameFree(platform, gameFreeId)
|
return false
|
||||||
if gf.Status && gf.DbGameFree.GetCreateRoomNum() > 0 {
|
}
|
||||||
logger.Logger.Tracef("TouchCreateRoom platform:%v gameFreeId:%v", platform, gameFreeId)
|
|
||||||
csm.delayCache = append(csm.delayCache, &CreateRoomCache{
|
pools, groupID, free := csm.findCoinScenePool(platform.IdStr, id)
|
||||||
platformName: platform,
|
if pools == nil {
|
||||||
gameFreeId: gameFreeId,
|
return false
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if csp, ok := pools[id]; ok && csp != nil {
|
||||||
|
return csp.ListRoom(p)
|
||||||
|
}
|
||||||
|
csp := NewCoinScenePool(platform.IdStr, groupID, free)
|
||||||
|
if csp == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
pools[id] = csp
|
||||||
|
return csp.ListRoom(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateRoomByCache 创建预创建房间
|
||||||
|
// 每2秒创建一次
|
||||||
|
func (csm *CoinSceneMgr) CreateRoomByCache() {
|
||||||
|
cnt := len(csm.delayCache)
|
||||||
|
if cnt > 0 {
|
||||||
|
data := csm.delayCache[cnt-1]
|
||||||
|
csm.delayCache = csm.delayCache[:cnt-1]
|
||||||
|
pdd := PlatformMgrSingleton.GetGameFree(data.platformName, data.gameFreeId)
|
||||||
|
//对战场和捕鱼场 预创建
|
||||||
|
if pdd != nil && pdd.DbGameFree != nil {
|
||||||
|
var ss map[int32]*CoinScenePool
|
||||||
|
var ok bool
|
||||||
|
//分组模式
|
||||||
|
if pdd.GroupId != 0 {
|
||||||
|
pgg := PlatformGameGroupMgrSington.GetGameGroup(pdd.GroupId)
|
||||||
|
if pgg != nil {
|
||||||
|
ss, ok = csm.scenesOfGroup[pdd.GroupId]
|
||||||
|
if !ok {
|
||||||
|
ss = make(map[int32]*CoinScenePool)
|
||||||
|
csm.scenesOfGroup[pdd.GroupId] = ss
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//独立模式
|
||||||
|
if ss == nil {
|
||||||
|
ss, ok = csm.scenesOfPlatform[data.platformName]
|
||||||
|
if !ok {
|
||||||
|
ss = make(map[int32]*CoinScenePool)
|
||||||
|
csm.scenesOfPlatform[data.platformName] = ss
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ss == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if csp, ok := ss[pdd.DbGameFree.Id]; ok && csp != nil {
|
||||||
|
csp.PreCreateRoom()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
csp := NewCoinScenePool(data.platformName, 0, pdd.DbGameFree)
|
||||||
|
if csp != nil {
|
||||||
|
ss[pdd.DbGameFree.Id] = csp
|
||||||
|
csp.PreCreateRoom()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,14 +495,42 @@ func (csm *CoinSceneMgr) ModuleName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (csm *CoinSceneMgr) Init() {
|
func (csm *CoinSceneMgr) Init() {
|
||||||
// 房间池初始化
|
// 场次池预创建
|
||||||
for _, platform := range PlatformMgrSingleton.GetPlatforms() {
|
for _, platform := range PlatformMgrSingleton.GetPlatforms() {
|
||||||
if platform.Isolated || platform.IdStr == "" {
|
if platform.Isolated || platform.IdStr == "" {
|
||||||
for _, v := range srvdata.PBDB_GameFreeMgr.Datas.GetArr() {
|
arr := srvdata.PBDB_GameFreeMgr.Datas.GetArr()
|
||||||
gps := PlatformMgrSingleton.GetGameFree(platform.IdStr, v.GetId())
|
for _, dbGame := range arr {
|
||||||
|
gps := PlatformMgrSingleton.GetGameFree(platform.IdStr, dbGame.GetId())
|
||||||
if gps != nil {
|
if gps != nil {
|
||||||
csm.GetCoinScenePool(platform.IdStr, v.GetId())
|
// dbGameFree
|
||||||
csm.TouchCreateRoom(platform.IdStr, v.GetId())
|
dbGameFree := gps.DbGameFree
|
||||||
|
if gps.GroupId != 0 {
|
||||||
|
pgg := PlatformGameGroupMgrSington.GetGameGroup(gps.GroupId)
|
||||||
|
if pgg != nil {
|
||||||
|
dbGameFree = pgg.DbGameFree
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CoinScenePool
|
||||||
|
csp := NewCoinScenePool(platform.IdStr, gps.GroupId, dbGameFree)
|
||||||
|
if csp != nil {
|
||||||
|
if gps.GroupId != 0 {
|
||||||
|
if ss, exist := csm.scenesOfGroup[gps.GroupId]; exist {
|
||||||
|
ss[dbGame.GetId()] = csp
|
||||||
|
} else {
|
||||||
|
ss = make(map[int32]*CoinScenePool)
|
||||||
|
ss[dbGame.GetId()] = csp
|
||||||
|
csm.scenesOfGroup[gps.GroupId] = ss
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ss, exist := csm.scenesOfPlatform[platform.IdStr]; exist {
|
||||||
|
ss[dbGame.GetId()] = csp
|
||||||
|
} else {
|
||||||
|
ss = make(map[int32]*CoinScenePool)
|
||||||
|
ss[dbGame.GetId()] = csp
|
||||||
|
csm.scenesOfPlatform[platform.IdStr] = ss
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,18 +538,8 @@ func (csm *CoinSceneMgr) Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (csm *CoinSceneMgr) Update() {
|
func (csm *CoinSceneMgr) Update() {
|
||||||
cnt := len(csm.delayCache)
|
// 预创建房间
|
||||||
if cnt > 0 {
|
csm.CreateRoomByCache()
|
||||||
data := csm.delayCache[cnt-1]
|
|
||||||
csm.delayCache = csm.delayCache[:cnt-1]
|
|
||||||
gf := PlatformMgrSingleton.GetGameFree(data.platformName, data.gameFreeId)
|
|
||||||
if gf != nil && gf.DbGameFree != nil {
|
|
||||||
csp := csm.GetCoinScenePool(data.platformName, data.gameFreeId)
|
|
||||||
if csp != nil {
|
|
||||||
csp.PreCreateRoom()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (csm *CoinSceneMgr) Shutdown() {
|
func (csm *CoinSceneMgr) Shutdown() {
|
||||||
|
@ -458,15 +549,24 @@ func (csm *CoinSceneMgr) Shutdown() {
|
||||||
//=====================PlatformObserver======================
|
//=====================PlatformObserver======================
|
||||||
|
|
||||||
func (this *CoinSceneMgr) OnPlatformCreate(p *Platform) {
|
func (this *CoinSceneMgr) OnPlatformCreate(p *Platform) {
|
||||||
|
if p.IdStr == DefaultPlatform {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//获取配置
|
||||||
|
gps := PlatformMgrSingleton.GetGameFrees(p.IdStr)
|
||||||
|
for _, v := range gps {
|
||||||
|
if v.Status && v.DbGameFree.GetCreateRoomNum() > 0 {
|
||||||
|
this.delayCache = append(this.delayCache, CreateRoomCache{gameFreeId: v.DbGameFree.Id, platformName: p.IdStr})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *CoinSceneMgr) OnPlatformDestroy(p *Platform) {
|
func (this *CoinSceneMgr) OnPlatformDestroy(p *Platform) {
|
||||||
if p == nil {
|
if p == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if v, ok := this.scenesOfPlatform[p.IdStr]; ok {
|
if csps, ok := this.scenesOfPlatform[p.IdStr]; ok {
|
||||||
for _, csp := range v {
|
for _, csp := range csps {
|
||||||
pack := &server_proto.WGGraceDestroyScene{}
|
pack := &server_proto.WGGraceDestroyScene{}
|
||||||
for _, scene := range csp.scenes {
|
for _, scene := range csp.scenes {
|
||||||
pack.Ids = append(pack.Ids, int32(scene.sceneId))
|
pack.Ids = append(pack.Ids, int32(scene.sceneId))
|
||||||
|
@ -477,6 +577,12 @@ func (this *CoinSceneMgr) OnPlatformDestroy(p *Platform) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *CoinSceneMgr) OnPlatformChangeIsolated(p *Platform, isolated bool) {
|
||||||
|
if !isolated {
|
||||||
|
this.OnPlatformDestroy(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (this *CoinSceneMgr) OnPlatformChangeDisabled(p *Platform, disabled bool) {
|
func (this *CoinSceneMgr) OnPlatformChangeDisabled(p *Platform, disabled bool) {
|
||||||
if disabled {
|
if disabled {
|
||||||
this.OnPlatformDestroy(p)
|
this.OnPlatformDestroy(p)
|
||||||
|
@ -507,7 +613,13 @@ func (this *CoinSceneMgr) OnPlatformGameFreeUpdate(p *Platform, oldCfg, newCfg *
|
||||||
}
|
}
|
||||||
srvlib.ServerSessionMgrSington.Broadcast(int(server_proto.SSPacketID_PACKET_WG_GRACE_DESTROYSCENE),
|
srvlib.ServerSessionMgrSington.Broadcast(int(server_proto.SSPacketID_PACKET_WG_GRACE_DESTROYSCENE),
|
||||||
pack, common.GetSelfAreaId(), srvlib.GameServerType)
|
pack, common.GetSelfAreaId(), srvlib.GameServerType)
|
||||||
this.TouchCreateRoom(p.IdStr, newCfg.DbGameFree.Id)
|
|
||||||
|
//预创建房间配置更新
|
||||||
|
if newCfg.DbGameFree.GetCreateRoomNum() != 0 && p.IdStr != DefaultPlatform && newCfg.Status {
|
||||||
|
logger.Logger.Tracef(">>>预创建房间 platform:%v %v_%v gamefreeid:%v CreateRoomNum:%v", p.Name,
|
||||||
|
newCfg.DbGameFree.GetName(), newCfg.DbGameFree.GetTitle(), newCfg.DbGameFree.GetId(), newCfg.DbGameFree.GetCreateRoomNum())
|
||||||
|
this.delayCache = append(this.delayCache, CreateRoomCache{gameFreeId: newCfg.DbGameFree.GetId(), platformName: p.IdStr})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,8 +683,8 @@ func (csm *CoinSceneMgr) OnGameSessionRegiste(gs *GameSession) {
|
||||||
//获取配置
|
//获取配置
|
||||||
gps := PlatformMgrSingleton.GetGameFrees(platform.IdStr)
|
gps := PlatformMgrSingleton.GetGameFrees(platform.IdStr)
|
||||||
for _, v := range gps {
|
for _, v := range gps {
|
||||||
if v != nil && (wildGs || common.InSliceInt32(gs.gameIds, v.DbGameFree.GetGameId())) {
|
if v.Status && v.DbGameFree.GetCreateRoomNum() > 0 && (wildGs || common.InSliceInt32(gs.gameIds, v.DbGameFree.GetGameId())) {
|
||||||
csm.TouchCreateRoom(platform.IdStr, v.DbGameFree.Id)
|
csm.delayCache = append(csm.delayCache, CreateRoomCache{gameFreeId: v.DbGameFree.Id, platformName: platform.IdStr})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mongo.games.com/game/common"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
gamehallproto "mongo.games.com/game/protocol/gamehall"
|
"mongo.games.com/game/proto"
|
||||||
serverproto "mongo.games.com/game/protocol/server"
|
gamehall_proto "mongo.games.com/game/protocol/gamehall"
|
||||||
|
server_proto "mongo.games.com/game/protocol/server"
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,24 +15,21 @@ type CoinScenePool struct {
|
||||||
platform string // 平台id
|
platform string // 平台id
|
||||||
groupId int32 // 组id
|
groupId int32 // 组id
|
||||||
id int32 // 场次id
|
id int32 // 场次id
|
||||||
dbGameFree *serverproto.DB_GameFree // 场次配置
|
dbGameFree *server_proto.DB_GameFree // 场次配置
|
||||||
dbGameRule *serverproto.DB_GameRule // 场次配置
|
dbGameRule *server_proto.DB_GameRule // 场次配置
|
||||||
scenes map[int]*Scene // 所有房间,房间id
|
scenes map[int]*Scene // 所有房间,房间id
|
||||||
players map[int32]struct{} // 玩家id
|
players map[int32]struct{} // 玩家id
|
||||||
|
|
||||||
// 扩展数据
|
// 扩展数据
|
||||||
extraData interface{}
|
extraData interface{}
|
||||||
// 房间池规则
|
// 匹配规则
|
||||||
policy ICoinScenePool
|
policy ICoinScenePool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCoinScenePool(platform string, groupId int32, dbGameFree *serverproto.DB_GameFree) *CoinScenePool {
|
func NewCoinScenePool(platform string, groupId int32, dbGameFree *server_proto.DB_GameFree) *CoinScenePool {
|
||||||
if dbGameFree == nil {
|
if dbGameFree == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if platform == "" {
|
|
||||||
platform = DefaultPlatform
|
|
||||||
}
|
|
||||||
|
|
||||||
dbGameRule := srvdata.PBDB_GameRuleMgr.GetData(dbGameFree.GetGameRule())
|
dbGameRule := srvdata.PBDB_GameRuleMgr.GetData(dbGameFree.GetGameRule())
|
||||||
if dbGameRule == nil {
|
if dbGameRule == nil {
|
||||||
|
@ -90,20 +87,20 @@ func (csp *CoinScenePool) CanInviteRob() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanEnter 检查入场条件
|
// CanEnter 检查入场条件
|
||||||
func (csp *CoinScenePool) CanEnter(p *Player) gamehallproto.OpResultCode {
|
func (csp *CoinScenePool) CanEnter(p *Player) gamehall_proto.OpResultCode {
|
||||||
if csp.dbGameFree == nil || p == nil {
|
if csp.dbGameFree == nil || p == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测房间状态是否开启
|
//检测房间状态是否开启
|
||||||
gps := PlatformMgrSingleton.GetGameFree(p.Platform, csp.id)
|
gps := PlatformMgrSingleton.GetGameFree(p.Platform, csp.id)
|
||||||
if gps == nil || !gps.Status {
|
if gps == nil || !gps.Status {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomHadClosed
|
return gamehall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
dbGameFree := csp.dbGameFree
|
dbGameFree := csp.dbGameFree
|
||||||
if dbGameFree == nil {
|
if dbGameFree == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomHadClosed
|
return gamehall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查游戏次数限制
|
//检查游戏次数限制
|
||||||
|
@ -112,7 +109,7 @@ func (csp *CoinScenePool) CanEnter(p *Player) gamehallproto.OpResultCode {
|
||||||
if dbGameFree.GetPlayNumLimit() != 0 &&
|
if dbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
todayData != nil &&
|
todayData != nil &&
|
||||||
todayData.GameTimes >= int64(dbGameFree.GetPlayNumLimit()) {
|
todayData.GameTimes >= int64(dbGameFree.GetPlayNumLimit()) {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomGameTimes
|
return gamehall_proto.OpResultCode_OPRC_RoomGameTimes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,44 +117,28 @@ func (csp *CoinScenePool) CanEnter(p *Player) gamehallproto.OpResultCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanAudienceEnter 检查观众入场条件
|
// CanAudienceEnter 检查观众入场条件
|
||||||
func (csp *CoinScenePool) CanAudienceEnter(p *Player) gamehallproto.OpResultCode {
|
func (csp *CoinScenePool) CanAudienceEnter(p *Player) gamehall_proto.OpResultCode {
|
||||||
if csp.dbGameFree == nil || p == nil {
|
if csp.dbGameFree == nil || p == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
//检测房间状态是否开启
|
//检测房间状态是否开启
|
||||||
gps := PlatformMgrSingleton.GetGameFree(p.Platform, csp.id)
|
gps := PlatformMgrSingleton.GetGameFree(p.Platform, csp.id)
|
||||||
if gps == nil {
|
if gps == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomHadClosed
|
return gamehall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
dbGameFree := csp.dbGameFree
|
dbGameFree := csp.dbGameFree
|
||||||
if dbGameFree == nil {
|
if dbGameFree == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomHadClosed
|
return gamehall_proto.OpResultCode_OPRC_RoomHadClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
return csp.policy.CanAudienceEnter(csp, p)
|
return csp.policy.CanAudienceEnter(csp, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddScene 添加房间
|
|
||||||
func (csp *CoinScenePool) AddScene(s *Scene) {
|
|
||||||
if s == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
csp.scenes[s.sceneId] = s
|
|
||||||
s.csp = csp
|
|
||||||
if csp.groupId != 0 {
|
|
||||||
CoinSceneMgrSingleton.groupOfScene[s.sceneId] = csp.groupId
|
|
||||||
} else {
|
|
||||||
CoinSceneMgrSingleton.platformOfScene[s.sceneId] = csp.platform
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlayerEnter 玩家进入房间池
|
// PlayerEnter 玩家进入房间池
|
||||||
// exclude 排除的房间id
|
func (csp *CoinScenePool) PlayerEnter(p *Player, roomId int32, exclude []int32, ischangeroom bool) gamehall_proto.OpResultCode {
|
||||||
// isChangeRoom 是否换房
|
if ret := csp.CanEnter(p); ret != gamehall_proto.OpResultCode_OPRC_Sucess {
|
||||||
func (csp *CoinScenePool) PlayerEnter(p *Player, roomId int32, exclude []int32, isChangeRoom bool) gamehallproto.OpResultCode {
|
|
||||||
if ret := csp.CanEnter(p); ret != gamehallproto.OpResultCode_OPRC_Sucess {
|
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter find snid:%v csp.CanEnter coin:%v ret:%v id:%v", p.SnId,
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter find snid:%v csp.CanEnter coin:%v ret:%v id:%v", p.SnId,
|
||||||
p.Coin, ret, csp.dbGameFree.GetId())
|
p.Coin, ret, csp.dbGameFree.GetId())
|
||||||
return ret
|
return ret
|
||||||
|
@ -165,77 +146,76 @@ func (csp *CoinScenePool) PlayerEnter(p *Player, roomId int32, exclude []int32,
|
||||||
|
|
||||||
if p.scene != nil {
|
if p.scene != nil {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
var scene *Scene
|
var scene *Scene
|
||||||
// 进入房间
|
// 进入房间
|
||||||
// 指定房间id进入,忽略排除exclude,只有机器人和进入预创建房间才允许
|
if roomId != 0 && (p.IsRob || p.GMLevel > 0 || csp.dbGameFree.GetCreateRoomNum() != 0) {
|
||||||
if roomId != 0 && (p.IsRob || csp.dbGameFree.GetCreateRoomNum() != 0) {
|
|
||||||
if s, ok := csp.scenes[int(roomId)]; ok {
|
if s, ok := csp.scenes[int(roomId)]; ok {
|
||||||
if s != nil && !s.deleting { //指定房间id进入,那么忽略掉排除id
|
if s != nil && !s.deleting { //指定房间id进入,那么忽略掉排除id
|
||||||
if s.IsFull() {
|
if s.IsFull() {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomIsFull
|
return gamehall_proto.OpResultCode_OPRC_RoomIsFull
|
||||||
}
|
}
|
||||||
if sp, ok := s.sp.(*ScenePolicyData); ok {
|
if sp, ok := s.sp.(*ScenePolicyData); ok {
|
||||||
if !s.starting || sp.EnterAfterStart {
|
if !s.starting || sp.EnterAfterStart {
|
||||||
scene = s
|
scene = s
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter[!s.starting || sp.EnterAfterStart] snid:%v sceneid:%v starting:%v EnterAfterStart:%v", p.SnId, s.sceneId, s.starting, sp.EnterAfterStart)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter[!s.starting || sp.EnterAfterStart] snid:%v sceneid:%v starting:%v EnterAfterStart:%v", p.SnId, s.sceneId, s.starting, sp.EnterAfterStart)
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter(robot:%v,roomid:%v, exclude:%v, isChangeRoom:%v) no found scene", p.SnId, roomId, exclude, isChangeRoom)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter(robot:%v,roomid:%v, exclude:%v, ischangeroom:%v) no found scene", p.SnId, roomId, exclude, ischangeroom)
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scene == nil {
|
if scene == nil {
|
||||||
var ret gamehallproto.OpResultCode
|
var ret gamehall_proto.OpResultCode
|
||||||
ret, scene = csp.policy.PlayerEnter(csp, p, exclude, isChangeRoom)
|
ret, scene = csp.policy.PlayerEnter(csp, p, exclude, ischangeroom)
|
||||||
if ret != gamehallproto.OpResultCode_OPRC_Sucess {
|
if ret != gamehall_proto.OpResultCode_OPRC_Sucess {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 没有找到房间,创建新房间
|
|
||||||
if scene == nil {
|
if scene == nil {
|
||||||
scene = csp.policy.NewScene(csp, p)
|
scene = csp.policy.NewScene(csp, p)
|
||||||
if scene != nil {
|
if scene != nil {
|
||||||
csp.AddScene(scene)
|
csp.scenes[scene.sceneId] = scene
|
||||||
|
scene.csp = csp
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Errorf("Create %v scene failed.", csp.id)
|
logger.Logger.Errorf("Create %v scene failed.", csp.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scene != nil {
|
if scene != nil {
|
||||||
if scene.PlayerEnter(p, -1, isChangeRoom) {
|
if p.EnterScene(scene, ischangeroom, -1) {
|
||||||
csp.OnPlayerEnter(p, scene)
|
csp.OnPlayerEnter(p, scene)
|
||||||
return gamehallproto.OpResultCode_OPRC_Sucess
|
return gamehall_proto.OpResultCode_OPRC_Sucess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter snid:%v not found scene", p.SnId)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter snid:%v not found scene", p.SnId)
|
||||||
return gamehallproto.OpResultCode_OPRC_SceneServerMaintain
|
return gamehall_proto.OpResultCode_OPRC_SceneServerMaintain
|
||||||
}
|
}
|
||||||
|
|
||||||
// AudienceEnter 观众入场
|
// AudienceEnter 观众入场
|
||||||
func (csp *CoinScenePool) AudienceEnter(p *Player, roomId int32, exclude []int32, isChangeRoom bool) gamehallproto.OpResultCode {
|
func (csp *CoinScenePool) AudienceEnter(p *Player, roomId int32, exclude []int32, ischangeroom bool) gamehall_proto.OpResultCode {
|
||||||
if ret := csp.CanAudienceEnter(p); ret != gamehallproto.OpResultCode_OPRC_Sucess {
|
if ret := csp.CanAudienceEnter(p); ret != gamehall_proto.OpResultCode_OPRC_Sucess {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter find snid:%v csp.CanEnter coin:%v ret:%v id:%v", p.SnId, p.Coin, ret, csp.dbGameFree.GetId())
|
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter find snid:%v csp.CanEnter coin:%v ret:%v id:%v", p.SnId, p.Coin, ret, csp.dbGameFree.GetId())
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.scene != nil {
|
if p.scene != nil {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
||||||
return gamehallproto.OpResultCode_OPRC_Error
|
return gamehall_proto.OpResultCode_OPRC_Error
|
||||||
}
|
}
|
||||||
|
|
||||||
var scene *Scene
|
var scene *Scene
|
||||||
if roomId != 0 {
|
if roomId != 0 {
|
||||||
if s, ok := csp.scenes[int(roomId)]; ok {
|
if s, ok := csp.scenes[int(roomId)]; ok {
|
||||||
if s != nil && !s.deleting {
|
if s != nil && !s.deleting /*&& s.sceneId != int(exclude)*/ {
|
||||||
scene = s
|
scene = s
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter[!s.starting || sp.EnterAfterStart] snid:%v sceneid:%v starting:%v EnterAfterStart:%v", p.SnId, s.sceneId, s.starting)
|
logger.Logger.Warnf("(csp *CoinScenePool) AudienceEnter[!s.starting || sp.EnterAfterStart] snid:%v sceneid:%v starting:%v EnterAfterStart:%v", p.SnId, s.sceneId, s.starting)
|
||||||
|
@ -244,29 +224,29 @@ func (csp *CoinScenePool) AudienceEnter(p *Player, roomId int32, exclude []int32
|
||||||
}
|
}
|
||||||
|
|
||||||
if scene == nil {
|
if scene == nil {
|
||||||
var ret gamehallproto.OpResultCode
|
var ret gamehall_proto.OpResultCode
|
||||||
ret, scene = csp.policy.AudienceEnter(csp, p, exclude, isChangeRoom)
|
ret, scene = csp.policy.AudienceEnter(csp, p, exclude, ischangeroom)
|
||||||
if ret != gamehallproto.OpResultCode_OPRC_Sucess {
|
if ret != gamehall_proto.OpResultCode_OPRC_Sucess {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if scene == nil {
|
if scene == nil {
|
||||||
return gamehallproto.OpResultCode_OPRC_NoFindDownTiceRoom
|
return gamehall_proto.OpResultCode_OPRC_NoFindDownTiceRoom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if scene != nil {
|
||||||
// 预创建房间检查观众数量
|
// 预创建房间检查观众数量
|
||||||
if scene.IsPreCreateScene() && scene.GetAudienceCnt() >= model.GameParamData.MaxAudienceNum {
|
if scene.IsPreCreateScene() && scene.GetAudienceCnt() >= model.GameParamData.MaxAudienceNum {
|
||||||
return gamehallproto.OpResultCode_OPRC_RoomIsFull
|
return gamehall_proto.OpResultCode_OPRC_RoomIsFull
|
||||||
}
|
}
|
||||||
|
if scene.AudienceEnter(p, ischangeroom) {
|
||||||
if scene.AudienceEnter(p, isChangeRoom) {
|
|
||||||
csp.OnPlayerEnter(p, scene)
|
csp.OnPlayerEnter(p, scene)
|
||||||
return gamehallproto.OpResultCode_OPRC_Sucess
|
return gamehall_proto.OpResultCode_OPRC_Sucess
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter snid:%v not found scene", p.SnId)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter snid:%v not found scene", p.SnId)
|
||||||
return gamehallproto.OpResultCode_OPRC_NoFindDownTiceRoom
|
return gamehall_proto.OpResultCode_OPRC_NoFindDownTiceRoom
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnPlayerEnter 玩家进入房间完成
|
// OnPlayerEnter 玩家进入房间完成
|
||||||
|
@ -371,16 +351,13 @@ func (csp *CoinScenePool) OnPlayerLeave(s *Scene, p *Player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnDestroyScene 解散房间
|
// OnDestroyScene 解散房间
|
||||||
// 房间解散一定是游戏服确认的,worldsrv收到游戏房间解散消息后解散房间
|
// todo 是否需要优化
|
||||||
func (csp *CoinScenePool) OnDestroyScene(sceneId int) {
|
func (csp *CoinScenePool) OnDestroyScene(sceneId int) {
|
||||||
scene, ok := csp.scenes[sceneId]
|
scene, ok := csp.scenes[sceneId]
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Tracef("(csp *CoinScenePool) OnDestroyScene scene:%v", sceneId)
|
|
||||||
|
|
||||||
// todo 是否需要优化
|
|
||||||
for id := range scene.players {
|
for id := range scene.players {
|
||||||
player := PlayerMgrSington.GetPlayerBySnId(id)
|
player := PlayerMgrSington.GetPlayerBySnId(id)
|
||||||
if player != nil {
|
if player != nil {
|
||||||
|
@ -409,7 +386,6 @@ func (csp *CoinScenePool) OnDestroyScene(sceneId int) {
|
||||||
csp.policy.OnDestroyScene(csp, sceneId)
|
csp.policy.OnDestroyScene(csp, sceneId)
|
||||||
scene.csp = nil // 解除关联
|
scene.csp = nil // 解除关联
|
||||||
delete(csp.scenes, sceneId)
|
delete(csp.scenes, sceneId)
|
||||||
CoinSceneMgrSingleton.TouchCreateRoom(csp.platform, csp.dbGameFree.Id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreCreateRoom 预创建房间
|
// PreCreateRoom 预创建房间
|
||||||
|
@ -417,78 +393,67 @@ func (csp *CoinScenePool) PreCreateRoom() {
|
||||||
if csp.platform == DefaultPlatform {
|
if csp.platform == DefaultPlatform {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
preCreateNum := int(csp.dbGameFree.GetCreateRoomNum())
|
||||||
|
if preCreateNum == 0 || model.GameParamData.ClosePreCreateRoom {
|
||||||
|
return
|
||||||
|
}
|
||||||
if p := PlatformMgrSingleton.GetPlatform(csp.platform); p == nil || p.Disable {
|
if p := PlatformMgrSingleton.GetPlatform(csp.platform); p == nil || p.Disable {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
preCreateNum := int(csp.dbGameFree.GetCreateRoomNum())
|
|
||||||
if preCreateNum <= 0 || model.GameParamData.ClosePreCreateRoom {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
num := preCreateNum - csp.GetRoomNum(common.SceneMode_Public)
|
|
||||||
if num > 0 {
|
|
||||||
logger.Logger.Tracef("预创建房间 [inc:%v] platform:%v gameFreeId:%v", num, csp.platform, csp.dbGameFree.Id)
|
|
||||||
for i := 0; i < num; i++ {
|
|
||||||
scene := csp.policy.NewPreCreateScene(csp)
|
|
||||||
if scene != nil {
|
|
||||||
csp.AddScene(scene)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (csp *CoinScenePool) GetRoomNum(mode ...int) int {
|
|
||||||
tp := 0
|
|
||||||
if len(mode) > 0 {
|
|
||||||
tp = mode[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
var num int
|
var num int
|
||||||
for _, scene := range csp.scenes {
|
for _, scene := range csp.scenes {
|
||||||
if tp > 0 {
|
if scene.limitPlatform.IdStr == csp.platform {
|
||||||
if scene.IsSceneMode(tp) {
|
|
||||||
num++
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
num++
|
num++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return num
|
if num < preCreateNum {
|
||||||
|
inc := preCreateNum - num
|
||||||
|
for i := 0; i < inc; i++ {
|
||||||
|
scene := csp.policy.NewPreCreateScene(csp)
|
||||||
|
if scene != nil {
|
||||||
|
csp.scenes[scene.sceneId] = scene
|
||||||
|
scene.csp = csp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListRoom 房间列表
|
// ListRoom 房间列表
|
||||||
//func (csp *CoinScenePool) ListRoom(p *Player) bool {
|
func (csp *CoinScenePool) ListRoom(p *Player) bool {
|
||||||
// if p.scene != nil {
|
if p.scene != nil {
|
||||||
// logger.Logger.Warnf("(csp *CoinScenePool) PlayerListRoom[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerListRoom[p.scene != nil] find snid:%v in scene:%v gameId:%v", p.SnId, p.scene.sceneId, p.scene.gameId)
|
||||||
// return false
|
return false
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if len(csp.scenes) == 0 {
|
csp.PreCreateRoom()
|
||||||
// return false
|
|
||||||
// }
|
if len(csp.scenes) == 0 {
|
||||||
//
|
return false
|
||||||
// pack := &gamehallproto.SCCoinSceneListRoom{
|
}
|
||||||
// Id: csp.dbGameFree.Id,
|
|
||||||
// LimitCoin: csp.dbGameFree.LimitCoin,
|
pack := &gamehall_proto.SCCoinSceneListRoom{
|
||||||
// MaxCoinLimit: csp.dbGameFree.MaxCoinLimit,
|
Id: csp.dbGameFree.Id,
|
||||||
// BaseScore: csp.dbGameFree.BaseScore,
|
LimitCoin: csp.dbGameFree.LimitCoin,
|
||||||
// MaxScore: csp.dbGameFree.MaxChip,
|
MaxCoinLimit: csp.dbGameFree.MaxCoinLimit,
|
||||||
// OtherIntParams: csp.dbGameFree.OtherIntParams,
|
BaseScore: csp.dbGameFree.BaseScore,
|
||||||
// }
|
MaxScore: csp.dbGameFree.MaxChip,
|
||||||
//
|
OtherIntParams: csp.dbGameFree.OtherIntParams,
|
||||||
// maxPlayerNum := 0
|
}
|
||||||
// for sceneId, s := range csp.scenes {
|
|
||||||
// data := &gamehallproto.CoinSceneInfo{
|
maxPlayerNum := 0
|
||||||
// SceneId: proto.Int(sceneId),
|
for sceneId, s := range csp.scenes {
|
||||||
// PlayerNum: proto.Int(len(s.players)),
|
data := &gamehall_proto.CoinSceneInfo{
|
||||||
// }
|
SceneId: proto.Int(sceneId),
|
||||||
// pack.Datas = append(pack.Datas, data)
|
PlayerNum: proto.Int(len(s.players)),
|
||||||
// maxPlayerNum = s.playerNum
|
}
|
||||||
// }
|
pack.Datas = append(pack.Datas, data)
|
||||||
// pack.MaxPlayerNum = proto.Int(maxPlayerNum)
|
maxPlayerNum = s.playerNum
|
||||||
// proto.SetDefaults(pack)
|
}
|
||||||
// p.SendToClient(int(gamehallproto.CoinSceneGamePacketID_PACKET_SC_COINSCENE_LISTROOM), pack)
|
pack.MaxPlayerNum = proto.Int(maxPlayerNum)
|
||||||
// return true
|
proto.SetDefaults(pack)
|
||||||
//}
|
p.SendToClient(int(gamehall_proto.CoinSceneGamePacketID_PACKET_SC_COINSCENE_LISTROOM), pack)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// GetHasTruePlayerSceneCnt 有真人的房间数量
|
// GetHasTruePlayerSceneCnt 有真人的房间数量
|
||||||
func (csp *CoinScenePool) GetHasTruePlayerSceneCnt() int {
|
func (csp *CoinScenePool) GetHasTruePlayerSceneCnt() int {
|
||||||
|
|
|
@ -34,7 +34,7 @@ func (this *BaseCoinScenePool) CanEnter(pool *CoinScenePool, p *Player) gamehall
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通用入场检测
|
// 通用入场检测
|
||||||
if pool.dbGameFree.GetLimitCoin() != 0 && pool.dbGameFree.GetLimitCoin() > p.Coin && !p.IsRob {
|
if pool.dbGameFree.GetLimitCoin() != 0 && int64(pool.dbGameFree.GetLimitCoin()) > p.Coin {
|
||||||
return gamehall.OpResultCode_OPRC_CoinNotEnough
|
return gamehall.OpResultCode_OPRC_CoinNotEnough
|
||||||
}
|
}
|
||||||
if pool.dbGameFree.GetMaxCoinLimit() != 0 && int64(pool.dbGameFree.GetMaxCoinLimit()) < p.Coin && !p.IsRob {
|
if pool.dbGameFree.GetMaxCoinLimit() != 0 && int64(pool.dbGameFree.GetMaxCoinLimit()) < p.Coin && !p.IsRob {
|
||||||
|
@ -67,10 +67,6 @@ func (this *BaseCoinScenePool) PlayerEnter(pool *CoinScenePool, p *Player, exclu
|
||||||
}
|
}
|
||||||
|
|
||||||
if !common.Config.IsDevMode {
|
if !common.Config.IsDevMode {
|
||||||
// 私人房
|
|
||||||
if s.IsPrivateScene() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// 禁止真人匹配
|
// 禁止真人匹配
|
||||||
if matchTrueManRule == MatchTrueManForbid && !p.IsRob && s.GetTruePlayerCnt() != 0 {
|
if matchTrueManRule == MatchTrueManForbid && !p.IsRob && s.GetTruePlayerCnt() != 0 {
|
||||||
continue
|
continue
|
||||||
|
@ -98,7 +94,7 @@ func (this *BaseCoinScenePool) PlayerEnter(pool *CoinScenePool, p *Player, exclu
|
||||||
}
|
}
|
||||||
|
|
||||||
//优先黑白名单
|
//优先黑白名单
|
||||||
if len(scenes) != 0 {
|
if scene == nil && len(scenes) != 0 {
|
||||||
gameId := pool.dbGameFree.GetGameId()
|
gameId := pool.dbGameFree.GetGameId()
|
||||||
if p.WBLevel < 0 { //黑名单玩家
|
if p.WBLevel < 0 { //黑名单玩家
|
||||||
var cntWhite int
|
var cntWhite int
|
||||||
|
@ -176,6 +172,7 @@ func (this *BaseCoinScenePool) PlayerEnter(pool *CoinScenePool, p *Player, exclu
|
||||||
|
|
||||||
if scene == nil && len(scenes) != 0 {
|
if scene == nil && len(scenes) != 0 {
|
||||||
//1.其次游戏的配桌规则
|
//1.其次游戏的配桌规则
|
||||||
|
if scene == nil {
|
||||||
matchFunc := GetCoinSceneMatchFunc(int(gameId))
|
matchFunc := GetCoinSceneMatchFunc(int(gameId))
|
||||||
if matchFunc != nil {
|
if matchFunc != nil {
|
||||||
scene = matchFunc(pool, p, scenes, sameIpLimit, exclude)
|
scene = matchFunc(pool, p, scenes, sameIpLimit, exclude)
|
||||||
|
@ -184,6 +181,14 @@ func (this *BaseCoinScenePool) PlayerEnter(pool *CoinScenePool, p *Player, exclu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 随机
|
||||||
|
if scene == nil {
|
||||||
|
for _, v := range scenes {
|
||||||
|
scene = v
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return gamehall.OpResultCode_OPRC_Sucess, scene
|
return gamehall.OpResultCode_OPRC_Sucess, scene
|
||||||
}
|
}
|
||||||
|
@ -214,23 +219,37 @@ func (this *BaseCoinScenePool) NewScene(pool *CoinScenePool, p *Player) *Scene {
|
||||||
gameId := int(pool.dbGameRule.GetGameId())
|
gameId := int(pool.dbGameRule.GetGameId())
|
||||||
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
||||||
if gs == nil {
|
if gs == nil {
|
||||||
logger.Logger.Warnf("Get %v game min session failed.", gameId)
|
logger.Logger.Errorf("Get %v game min session failed.", gameId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
gameMode := pool.dbGameRule.GetGameMode()
|
gameMode := pool.dbGameRule.GetGameMode()
|
||||||
params := common.CopySliceInt32ToInt64(pool.dbGameRule.GetParams())
|
params := common.CopySliceInt32ToInt64(pool.dbGameRule.GetParams())
|
||||||
|
var platformName string
|
||||||
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
||||||
if limitPlatform == nil || !limitPlatform.Isolated {
|
if limitPlatform == nil || !limitPlatform.Isolated {
|
||||||
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
||||||
|
platformName = DefaultPlatform
|
||||||
|
} else {
|
||||||
|
platformName = limitPlatform.IdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
||||||
|
|
||||||
scene := SceneMgrSingleton.CreateScene(0, 0, sceneId, gameId, int(gameMode), common.SceneMode_Public,
|
scene := SceneMgrSingleton.CreateScene(0, 0, sceneId, gameId, int(gameMode), int(common.SceneMode_Public),
|
||||||
1, -1, params, gs, limitPlatform, pool.groupId, pool.dbGameFree, pool.id)
|
1, -1, params, gs, limitPlatform, pool.groupId, pool.dbGameFree, int32(pool.id))
|
||||||
|
if scene != nil {
|
||||||
|
scene.hallId = pool.id
|
||||||
|
scene.csp = pool
|
||||||
|
if pool.groupId != 0 {
|
||||||
|
CoinSceneMgrSingleton.groupOfScene[int32(sceneId)] = pool.groupId
|
||||||
|
} else {
|
||||||
|
CoinSceneMgrSingleton.platformOfScene[int32(sceneId)] = platformName
|
||||||
|
}
|
||||||
return scene
|
return scene
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (this *BaseCoinScenePool) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
func (this *BaseCoinScenePool) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
||||||
return this.NewScene(pool, nil)
|
return this.NewScene(pool, nil)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
|
|
||||||
var coinScenePools = map[int32]ICoinScenePool{}
|
var coinScenePools = map[int32]ICoinScenePool{}
|
||||||
|
|
||||||
// RegisterCoinScenePool 注册房间池规则
|
// RegisterCoinScenePool 注册游戏匹配规则
|
||||||
func RegisterCoinScenePool(gameId int32, policy ICoinScenePool) {
|
func RegisterCoinScenePool(gameId int32, policy ICoinScenePool) {
|
||||||
coinScenePools[gameId] = policy
|
coinScenePools[gameId] = policy
|
||||||
}
|
}
|
||||||
|
@ -15,36 +15,21 @@ func GetCoinScenePool(gameId int32) ICoinScenePool {
|
||||||
return coinScenePools[gameId]
|
return coinScenePools[gameId]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ICoinScenePool 定义房间池规则的接口
|
|
||||||
// 公共处理逻辑可以写在 CoinScenePool,不能满足需求时再实现 ICoinScenePool
|
|
||||||
type ICoinScenePool interface {
|
type ICoinScenePool interface {
|
||||||
// New 创建房间池
|
|
||||||
New() interface{}
|
New() interface{}
|
||||||
// CanEnter 玩家是否可以进入
|
|
||||||
CanEnter(pool *CoinScenePool, p *Player) gamehall.OpResultCode
|
CanEnter(pool *CoinScenePool, p *Player) gamehall.OpResultCode
|
||||||
// CanAudienceEnter 观众是否可以进入
|
|
||||||
CanAudienceEnter(pool *CoinScenePool, p *Player) gamehall.OpResultCode
|
CanAudienceEnter(pool *CoinScenePool, p *Player) gamehall.OpResultCode
|
||||||
|
|
||||||
// PlayerEnter 玩家进入(匹配房间)
|
PlayerEnter(pool *CoinScenePool, p *Player, exclude []int32, ischangeroom bool) (ret gamehall.OpResultCode, scene *Scene)
|
||||||
// exclude 排除的房间列表
|
AudienceEnter(pool *CoinScenePool, p *Player, exclude []int32, ischangeroom bool) (ret gamehall.OpResultCode, scene *Scene)
|
||||||
// isChangeRoom 是否是换房间
|
|
||||||
PlayerEnter(pool *CoinScenePool, p *Player, exclude []int32, isChangeRoom bool) (ret gamehall.OpResultCode, scene *Scene)
|
|
||||||
// AudienceEnter 观众进入(匹配房间)
|
|
||||||
AudienceEnter(pool *CoinScenePool, p *Player, exclude []int32, isChangeRoom bool) (ret gamehall.OpResultCode, scene *Scene)
|
|
||||||
// OnPlayerEnter 玩家进入房间之后
|
|
||||||
OnPlayerEnter(pool *CoinScenePool, p *Player, scene *Scene)
|
OnPlayerEnter(pool *CoinScenePool, p *Player, scene *Scene)
|
||||||
|
|
||||||
// PlayerLeave 玩家离开
|
|
||||||
PlayerLeave(pool *CoinScenePool, p *Player, reason int) bool
|
PlayerLeave(pool *CoinScenePool, p *Player, reason int) bool
|
||||||
// AudienceLeave 观众离开
|
|
||||||
AudienceLeave(pool *CoinScenePool, p *Player, reason int) bool
|
AudienceLeave(pool *CoinScenePool, p *Player, reason int) bool
|
||||||
// OnPlayerLeave 玩家离开房间之后
|
|
||||||
OnPlayerLeave(pool *CoinScenePool, s *Scene, p *Player)
|
OnPlayerLeave(pool *CoinScenePool, s *Scene, p *Player)
|
||||||
|
|
||||||
// NewScene 创建房间
|
|
||||||
NewScene(pool *CoinScenePool, p *Player) *Scene
|
NewScene(pool *CoinScenePool, p *Player) *Scene
|
||||||
// NewPreCreateScene 创建预创建房间
|
|
||||||
NewPreCreateScene(pool *CoinScenePool) *Scene
|
NewPreCreateScene(pool *CoinScenePool) *Scene
|
||||||
// OnDestroyScene 房间解散之后
|
|
||||||
OnDestroyScene(pool *CoinScenePool, sceneId int)
|
OnDestroyScene(pool *CoinScenePool, sceneId int)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/protocol/gamehall"
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
serverproto "mongo.games.com/game/protocol/server"
|
server_proto "mongo.games.com/game/protocol/server"
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ type CoinScenePoolLocal struct {
|
||||||
BaseCoinScenePool
|
BaseCoinScenePool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude []int32, isChangeRoom bool) (ret gamehall.OpResultCode, scene *Scene) {
|
func (this *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude []int32, ischangeroom bool) (ret gamehall.OpResultCode, scene *Scene) {
|
||||||
// 配房规则
|
// 配房规则
|
||||||
// 如果全局为限制则看具体的游戏是否限制,如果全局为不限制则不考虑具体的游戏。
|
// 如果全局为限制则看具体的游戏是否限制,如果全局为不限制则不考虑具体的游戏。
|
||||||
sameIpLimit := !model.GameParamData.SameIpNoLimit
|
sameIpLimit := !model.GameParamData.SameIpNoLimit
|
||||||
|
@ -42,12 +42,12 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
matchTrueManRule := pool.dbGameFree.GetMatchTrueMan()
|
matchTrueManRule := pool.dbGameFree.GetMatchTrueMan()
|
||||||
|
|
||||||
//根据携带金额取进房间底注 DB_Createroom
|
//根据携带金额取进房间底注 DB_Createroom
|
||||||
var dbCreateRoom *serverproto.DB_Createroom
|
var dbCreateRoom *server_proto.DB_Createroom
|
||||||
gameId := pool.dbGameFree.GetGameId()
|
gameId := pool.dbGameFree.GetGameId()
|
||||||
dbCreateRoom = srvdata.CreateRoomMgrSington.GetDataByGameIdWithTakeCoin(gameId, p.Coin)
|
dbCreateRoom = srvdata.CreateRoomMgrSington.GetDataByGameIdWithTakeCoin(gameId, p.Coin)
|
||||||
if dbCreateRoom == nil {
|
if dbCreateRoom == nil {
|
||||||
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter(robot:%v, exclude:%v, isChangeRoom:%v) no found scene from DB_Createroom",
|
logger.Logger.Warnf("(csp *CoinScenePool) PlayerEnter(robot:%v, exclude:%v, ischangeroom:%v) no found scene from DB_Createroom",
|
||||||
p.SnId, exclude, isChangeRoom)
|
p.SnId, exclude, ischangeroom)
|
||||||
return gamehall.OpResultCode_OPRC_Error, nil
|
return gamehall.OpResultCode_OPRC_Error, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,10 +58,6 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
}
|
}
|
||||||
|
|
||||||
if !common.Config.IsDevMode {
|
if !common.Config.IsDevMode {
|
||||||
// 私人房
|
|
||||||
if s.IsPrivateScene() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// 禁止真人匹配
|
// 禁止真人匹配
|
||||||
if matchTrueManRule == MatchTrueManForbid && !p.IsRob && s.GetTruePlayerCnt() != 0 {
|
if matchTrueManRule == MatchTrueManForbid && !p.IsRob && s.GetTruePlayerCnt() != 0 {
|
||||||
continue
|
continue
|
||||||
|
@ -85,7 +81,7 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//根据携带金额取可进房间
|
//根据携带金额取可进房间
|
||||||
if len(dbCreateRoom.GetBetRange()) != 0 {
|
if dbCreateRoom != nil && len(dbCreateRoom.GetBetRange()) != 0 {
|
||||||
betRange := dbCreateRoom.GetBetRange()
|
betRange := dbCreateRoom.GetBetRange()
|
||||||
if common.InSliceInt32(betRange, s.BaseScore) {
|
if common.InSliceInt32(betRange, s.BaseScore) {
|
||||||
scenes[sceneId] = s
|
scenes[sceneId] = s
|
||||||
|
@ -96,7 +92,7 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
}
|
}
|
||||||
|
|
||||||
//优先黑白名单
|
//优先黑白名单
|
||||||
if len(scenes) != 0 {
|
if scene == nil && len(scenes) != 0 {
|
||||||
gameId := pool.dbGameFree.GetGameId()
|
gameId := pool.dbGameFree.GetGameId()
|
||||||
if p.WBLevel < 0 { //黑名单玩家
|
if p.WBLevel < 0 { //黑名单玩家
|
||||||
var cntWhite int
|
var cntWhite int
|
||||||
|
@ -155,7 +151,7 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
}
|
}
|
||||||
} else { //按类型匹配
|
} else { //按类型匹配
|
||||||
//优先真人
|
//优先真人
|
||||||
if len(scenes) != 0 && matchTrueManRule == MatchTrueManPriority {
|
if scene == nil && len(scenes) != 0 && matchTrueManRule == MatchTrueManPriority {
|
||||||
var selScene []*Scene
|
var selScene []*Scene
|
||||||
for _, value := range scenes {
|
for _, value := range scenes {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
|
@ -174,6 +170,7 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
|
|
||||||
if scene == nil && len(scenes) != 0 {
|
if scene == nil && len(scenes) != 0 {
|
||||||
//1.其次游戏的配桌规则
|
//1.其次游戏的配桌规则
|
||||||
|
if scene == nil {
|
||||||
matchFunc := GetCoinSceneMatchFunc(int(gameId))
|
matchFunc := GetCoinSceneMatchFunc(int(gameId))
|
||||||
if matchFunc != nil {
|
if matchFunc != nil {
|
||||||
scene = matchFunc(pool, p, scenes, sameIpLimit, exclude)
|
scene = matchFunc(pool, p, scenes, sameIpLimit, exclude)
|
||||||
|
@ -181,11 +178,12 @@ func (l *CoinScenePoolLocal) PlayerEnter(pool *CoinScenePool, p *Player, exclude
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return gamehall.OpResultCode_OPRC_Sucess, scene
|
return gamehall.OpResultCode_OPRC_Sucess, scene
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *CoinScenePoolLocal) NewScene(pool *CoinScenePool, p *Player) *Scene {
|
func (this *CoinScenePoolLocal) NewScene(pool *CoinScenePool, p *Player) *Scene {
|
||||||
gameId := int(pool.dbGameFree.GetGameId())
|
gameId := int(pool.dbGameFree.GetGameId())
|
||||||
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
||||||
if gs == nil {
|
if gs == nil {
|
||||||
|
@ -196,16 +194,20 @@ func (l *CoinScenePoolLocal) NewScene(pool *CoinScenePool, p *Player) *Scene {
|
||||||
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
||||||
|
|
||||||
params := pool.dbGameRule.GetParams()
|
params := pool.dbGameRule.GetParams()
|
||||||
|
var platformName string
|
||||||
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
||||||
if limitPlatform == nil || !limitPlatform.Isolated {
|
if limitPlatform == nil || !limitPlatform.Isolated {
|
||||||
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
||||||
|
platformName = DefaultPlatform
|
||||||
|
} else {
|
||||||
|
platformName = limitPlatform.IdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
//根据携带金额取可创房间 DB_Createroom
|
//根据携带金额取可创房间 DB_Createroom
|
||||||
baseScore := int32(0)
|
baseScore := int32(0)
|
||||||
gameSite := 0
|
gameSite := 0
|
||||||
playerTakeCoin := p.Coin
|
playerTakeCoin := p.Coin
|
||||||
var dbCreateRoom *serverproto.DB_Createroom
|
var dbCreateRoom *server_proto.DB_Createroom
|
||||||
arrs := srvdata.PBDB_CreateroomMgr.Datas.Arr
|
arrs := srvdata.PBDB_CreateroomMgr.Datas.Arr
|
||||||
for i := len(arrs) - 1; i >= 0; i-- {
|
for i := len(arrs) - 1; i >= 0; i-- {
|
||||||
if arrs[i].GetGameId() == int32(gameId) {
|
if arrs[i].GetGameId() == int32(gameId) {
|
||||||
|
@ -234,23 +236,33 @@ func (l *CoinScenePoolLocal) NewScene(pool *CoinScenePool, p *Player) *Scene {
|
||||||
|
|
||||||
scene := SceneMgrSingleton.CreateLocalGameScene(p.SnId, sceneId, gameId, gameSite, common.SceneMode_Public, 1, common.CopySliceInt32ToInt64(params),
|
scene := SceneMgrSingleton.CreateLocalGameScene(p.SnId, sceneId, gameId, gameSite, common.SceneMode_Public, 1, common.CopySliceInt32ToInt64(params),
|
||||||
gs, limitPlatform, 0, pool.dbGameFree, baseScore, pool.groupId, pool.id)
|
gs, limitPlatform, 0, pool.dbGameFree, baseScore, pool.groupId, pool.id)
|
||||||
|
if scene != nil {
|
||||||
|
scene.hallId = pool.id
|
||||||
|
scene.groupId = pool.groupId
|
||||||
|
CoinSceneMgrSingleton.platformOfScene[int32(sceneId)] = platformName
|
||||||
return scene
|
return scene
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (l *CoinScenePoolLocal) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
func (this *CoinScenePoolLocal) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
||||||
gameId := int(pool.dbGameRule.GetGameId())
|
gameId := int(pool.dbGameRule.GetGameId())
|
||||||
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
gs := GameSessMgrSington.GetMinLoadSess(gameId)
|
||||||
if gs == nil {
|
if gs == nil {
|
||||||
logger.Logger.Warnf("Get %v game min session failed.", gameId)
|
logger.Logger.Errorf("Get %v game min session failed.", gameId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
sceneId := SceneMgrSingleton.GenOneCoinSceneId()
|
||||||
|
|
||||||
params := pool.dbGameRule.GetParams()
|
params := pool.dbGameRule.GetParams()
|
||||||
|
var platformName string
|
||||||
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
limitPlatform := PlatformMgrSingleton.GetPlatform(pool.platform)
|
||||||
if limitPlatform == nil || !limitPlatform.Isolated {
|
if limitPlatform == nil || !limitPlatform.Isolated {
|
||||||
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
limitPlatform = PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
||||||
|
platformName = DefaultPlatform
|
||||||
|
} else {
|
||||||
|
platformName = limitPlatform.IdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
var scene *Scene
|
var scene *Scene
|
||||||
|
@ -262,7 +274,7 @@ func (l *CoinScenePoolLocal) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
||||||
//根据SceneType随机可创房间 DB_Createroom
|
//根据SceneType随机可创房间 DB_Createroom
|
||||||
baseScore := int32(0)
|
baseScore := int32(0)
|
||||||
gameSite := 0
|
gameSite := 0
|
||||||
var dbCreateRooms []*serverproto.DB_Createroom
|
var dbCreateRooms []*server_proto.DB_Createroom
|
||||||
arrs := srvdata.PBDB_CreateroomMgr.Datas.Arr
|
arrs := srvdata.PBDB_CreateroomMgr.Datas.Arr
|
||||||
for i := len(arrs) - 1; i >= 0; i-- {
|
for i := len(arrs) - 1; i >= 0; i-- {
|
||||||
if arrs[i].GetGameId() == int32(gameId) && arrs[i].GetGameSite() == pool.dbGameFree.GetSceneType() {
|
if arrs[i].GetGameId() == int32(gameId) && arrs[i].GetGameSite() == pool.dbGameFree.GetSceneType() {
|
||||||
|
@ -291,5 +303,16 @@ func (l *CoinScenePoolLocal) NewPreCreateScene(pool *CoinScenePool) *Scene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if scene != nil {
|
||||||
|
scene.hallId = pool.id
|
||||||
|
scene.csp = pool
|
||||||
|
if pool.groupId != 0 {
|
||||||
|
CoinSceneMgrSingleton.groupOfScene[int32(sceneId)] = pool.groupId
|
||||||
|
} else {
|
||||||
|
CoinSceneMgrSingleton.platformOfScene[int32(sceneId)] = platformName
|
||||||
|
}
|
||||||
return scene
|
return scene
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -222,6 +222,7 @@ func (this *GameSession) AddScene(s *Scene) {
|
||||||
|
|
||||||
func (this *GameSession) DelScene(s *Scene) {
|
func (this *GameSession) DelScene(s *Scene) {
|
||||||
delete(this.scenes, s.sceneId)
|
delete(this.scenes, s.sceneId)
|
||||||
|
//from gameserver, so don't need send msg
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *GameSession) AddPlayer(p *Player) {
|
func (this *GameSession) AddPlayer(p *Player) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ package main
|
||||||
// scenesOfPlatform: make(map[string]map[int32]*Scene),
|
// scenesOfPlatform: make(map[string]map[int32]*Scene),
|
||||||
// //玩家当前打开的小游戏列表
|
// //玩家当前打开的小游戏列表
|
||||||
// playerGaming: make(map[int32]map[int32]*Scene),
|
// playerGaming: make(map[int32]map[int32]*Scene),
|
||||||
// matchAutoId: common.MiniGameSceneStartId,
|
// autoId: common.MiniGameSceneStartId,
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//type MiniGameMgr struct {
|
//type MiniGameMgr struct {
|
||||||
|
@ -27,15 +27,15 @@ package main
|
||||||
// scenesOfPlatform map[string]map[int32]*Scene
|
// scenesOfPlatform map[string]map[int32]*Scene
|
||||||
// //玩家当前打开的小游戏列表
|
// //玩家当前打开的小游戏列表
|
||||||
// playerGaming map[int32]map[int32]*Scene
|
// playerGaming map[int32]map[int32]*Scene
|
||||||
// matchAutoId int
|
// autoId int
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func (this *MiniGameMgr) GenOneSceneId() int {
|
//func (this *MiniGameMgr) GenOneSceneId() int {
|
||||||
// this.matchAutoId++
|
// this.autoId++
|
||||||
// if this.matchAutoId > common.MiniGameSceneMaxId {
|
// if this.autoId > common.MiniGameSceneMaxId {
|
||||||
// this.matchAutoId = common.MiniGameSceneStartId
|
// this.autoId = common.MiniGameSceneStartId
|
||||||
// }
|
// }
|
||||||
// return this.matchAutoId
|
// return this.autoId
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//func (this *MiniGameMgr) PlayerEnter(p *Player, id int32) mngame.MNGameOpResultCode {
|
//func (this *MiniGameMgr) PlayerEnter(p *Player, id int32) mngame.MNGameOpResultCode {
|
||||||
|
|
|
@ -179,6 +179,7 @@ func NewPlayer(sid int64, pd *model.PlayerData, s *netlib.Session) *Player {
|
||||||
func (this *Player) init() bool {
|
func (this *Player) init() bool {
|
||||||
this.SetOnline()
|
this.SetOnline()
|
||||||
this.isNewbie = this.CreateTime == this.LastLoginTime
|
this.isNewbie = this.CreateTime == this.LastLoginTime
|
||||||
|
this.applyPos = -1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2350,6 +2351,23 @@ func (this *Player) CreateLocalGameScene(sceneId, gameId, gameSite, sceneMode, p
|
||||||
return s, hall_proto.OpResultCode_Game_OPRC_Sucess_Game
|
return s, hall_proto.OpResultCode_Game_OPRC_Sucess_Game
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Player) EnterScene(s *Scene, ischangeroom bool, pos int) bool {
|
||||||
|
if s == nil {
|
||||||
|
logger.Logger.Tracef("(this *Player) EnterScene, s == nil %v", this.SnId)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if s != nil {
|
||||||
|
this.applyPos = -1
|
||||||
|
if s.PlayerEnter(this, pos, ischangeroom) {
|
||||||
|
FirePlayerEnterScene(this, s)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Player) ReturnScene(isLoaded bool) *Scene {
|
func (this *Player) ReturnScene(isLoaded bool) *Scene {
|
||||||
logger.Logger.Tracef("(this *Player) ReturnScene %v", this.SnId)
|
logger.Logger.Tracef("(this *Player) ReturnScene %v", this.SnId)
|
||||||
if this.scene == nil {
|
if this.scene == nil {
|
||||||
|
|
|
@ -553,7 +553,6 @@ func (this *Scene) PlayerEnter(p *Player, pos int, ischangeroom bool) bool {
|
||||||
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_PLAYERENTER), msg)
|
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_PLAYERENTER), msg)
|
||||||
logger.Logger.Tracef("SSPacketID_PACKET_WG_PLAYERENTER Scene:%v ;PlayerEnter(%v, %v)", this.sceneId, p.SnId, pos)
|
logger.Logger.Tracef("SSPacketID_PACKET_WG_PLAYERENTER Scene:%v ;PlayerEnter(%v, %v)", this.sceneId, p.SnId, pos)
|
||||||
this.lastTime = time.Now()
|
this.lastTime = time.Now()
|
||||||
FirePlayerEnterScene(p, this)
|
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Warnf("(this *Scene:%v) PlayerEnter(%v, %v) Marshal player data error %v", this.sceneId, p.SnId, pos, err)
|
logger.Logger.Warnf("(this *Scene:%v) PlayerEnter(%v, %v) Marshal player data error %v", this.sceneId, p.SnId, pos, err)
|
||||||
|
@ -660,6 +659,7 @@ func (this *Scene) DelPlayer(p *Player) bool {
|
||||||
func (this *Scene) AudienceEnter(p *Player, ischangeroom bool) bool {
|
func (this *Scene) AudienceEnter(p *Player, ischangeroom bool) bool {
|
||||||
logger.Logger.Infof("(this *Scene:%v) AudienceEnter(%v) ", this.sceneId, p.SnId)
|
logger.Logger.Infof("(this *Scene:%v) AudienceEnter(%v) ", this.sceneId, p.SnId)
|
||||||
p.scene = this
|
p.scene = this
|
||||||
|
p.applyPos = -1
|
||||||
this.audiences[p.SnId] = p
|
this.audiences[p.SnId] = p
|
||||||
this.gameSess.AddPlayer(p)
|
this.gameSess.AddPlayer(p)
|
||||||
if this.IsHundredScene() {
|
if this.IsHundredScene() {
|
||||||
|
@ -744,6 +744,7 @@ func (this *Scene) DelAudience(p *Player) bool {
|
||||||
delete(this.gameCtx, p.SnId)
|
delete(this.gameCtx, p.SnId)
|
||||||
}
|
}
|
||||||
p.scene = nil
|
p.scene = nil
|
||||||
|
p.applyPos = -1
|
||||||
SceneMgrSingleton.OnPlayerLeaveScene(this, p)
|
SceneMgrSingleton.OnPlayerLeaveScene(this, p)
|
||||||
if this.IsHundredScene() {
|
if this.IsHundredScene() {
|
||||||
HundredSceneMgrSington.OnPlayerLeave(p)
|
HundredSceneMgrSington.OnPlayerLeave(p)
|
||||||
|
@ -952,6 +953,23 @@ func (this *Scene) ForceDelete(isManual bool) {
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_DESTROYSCENE), pack)
|
this.SendToGame(int(serverproto.SSPacketID_PACKET_WG_DESTROYSCENE), pack)
|
||||||
logger.Logger.Warnf("(this *Scene) ForceDelete() sceneid=%v", this.sceneId)
|
logger.Logger.Warnf("(this *Scene) ForceDelete() sceneid=%v", this.sceneId)
|
||||||
|
|
||||||
|
//if this.sceneId == SceneMgrSingleton.GetDgSceneId() {
|
||||||
|
// for _, value := range PlayerMgrSington.sidMap {
|
||||||
|
// if value.scene == nil {
|
||||||
|
// continue
|
||||||
|
// }
|
||||||
|
// if value.scene.sceneId == SceneMgrSingleton.GetDgSceneId() {
|
||||||
|
// value.DgGameLogout()
|
||||||
|
// pack := &hallproto.SCLeaveDgGame{}
|
||||||
|
// pack.OpRetCode = hallproto.OpResultCode_Game_OPRC_Sucess_Game
|
||||||
|
// value.SendToClient(int(hallproto.GameHallPacketID_PACKET_SC_LEAVEDGGAME), pack)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if this.IsPreCreateScene() {
|
||||||
|
CoinSceneMgrSingleton.delayCache = append(CoinSceneMgrSingleton.delayCache, CreateRoomCache{gameFreeId: this.dbGameFree.GetId(), platformName: this.limitPlatform.IdStr})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) Shutdown() {
|
func (this *Scene) Shutdown() {
|
||||||
|
@ -990,10 +1008,6 @@ func (this *Scene) IsPrivateScene() bool {
|
||||||
return this.sceneId >= common.PrivateSceneStartId && this.sceneId < common.PrivateSceneMaxId || this.sceneMode == common.SceneMode_Private
|
return this.sceneId >= common.PrivateSceneStartId && this.sceneId < common.PrivateSceneMaxId || this.sceneMode == common.SceneMode_Private
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) IsSceneMode(mode int) bool {
|
|
||||||
return this.sceneMode == mode
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *Scene) IsRankMatch() bool {
|
func (this *Scene) IsRankMatch() bool {
|
||||||
if this.dbGameFree == nil {
|
if this.dbGameFree == nil {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"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"
|
webapi2 "mongo.games.com/game/protocol/webapi"
|
||||||
|
"mongo.games.com/game/srvdata"
|
||||||
"mongo.games.com/game/webapi"
|
"mongo.games.com/game/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,8 +20,7 @@ func init() {
|
||||||
|
|
||||||
var SceneMgrSingleton = &SceneMgr{
|
var SceneMgrSingleton = &SceneMgr{
|
||||||
scenes: make(map[int]*Scene),
|
scenes: make(map[int]*Scene),
|
||||||
privateAutoId: common.PrivateSceneStartId,
|
autoId: common.MatchSceneStartId,
|
||||||
matchAutoId: common.MatchSceneStartId,
|
|
||||||
coinSceneAutoId: common.CoinSceneStartId,
|
coinSceneAutoId: common.CoinSceneStartId,
|
||||||
hundredSceneAutoId: common.HundredSceneStartId,
|
hundredSceneAutoId: common.HundredSceneStartId,
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,8 @@ var SceneMgrSingleton = &SceneMgr{
|
||||||
type SceneMgr struct {
|
type SceneMgr struct {
|
||||||
BaseClockSinker // 驱动时间事件
|
BaseClockSinker // 驱动时间事件
|
||||||
|
|
||||||
scenes map[int]*Scene // 房间id: Scene
|
scenes map[int]*Scene // sceneid:Scene
|
||||||
privateAutoId int // 私人房房间号
|
autoId int // 比赛场房间号
|
||||||
matchAutoId int // 比赛场房间号
|
|
||||||
coinSceneAutoId int // 金币场房间号
|
coinSceneAutoId int // 金币场房间号
|
||||||
hundredSceneAutoId int // 百人场房间号
|
hundredSceneAutoId int // 百人场房间号
|
||||||
}
|
}
|
||||||
|
@ -42,15 +41,6 @@ func (m *SceneMgr) AllocReplayCode() string {
|
||||||
return code
|
return code
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenOnePrivateSceneId 生产一个私人房间id
|
|
||||||
func (m *SceneMgr) GenOnePrivateSceneId() int {
|
|
||||||
m.privateAutoId++
|
|
||||||
if m.privateAutoId > common.PrivateSceneMaxId {
|
|
||||||
m.privateAutoId = common.PrivateSceneStartId
|
|
||||||
}
|
|
||||||
return m.privateAutoId
|
|
||||||
}
|
|
||||||
|
|
||||||
// GenOneCoinSceneId 生产一个金币场房间id
|
// GenOneCoinSceneId 生产一个金币场房间id
|
||||||
func (m *SceneMgr) GenOneCoinSceneId() int {
|
func (m *SceneMgr) GenOneCoinSceneId() int {
|
||||||
m.coinSceneAutoId++
|
m.coinSceneAutoId++
|
||||||
|
@ -71,11 +61,11 @@ func (m *SceneMgr) GenOneHundredSceneId() int {
|
||||||
|
|
||||||
// GenOneMatchSceneId 生产一个比赛场房间id
|
// GenOneMatchSceneId 生产一个比赛场房间id
|
||||||
func (m *SceneMgr) GenOneMatchSceneId() int {
|
func (m *SceneMgr) GenOneMatchSceneId() int {
|
||||||
m.matchAutoId++
|
m.autoId++
|
||||||
if m.matchAutoId > common.MatchSceneMaxId {
|
if m.autoId > common.MatchSceneMaxId {
|
||||||
m.matchAutoId = common.MatchSceneStartId
|
m.autoId = common.MatchSceneStartId
|
||||||
}
|
}
|
||||||
return m.matchAutoId
|
return m.autoId
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetScene 获取房间对象
|
// GetScene 获取房间对象
|
||||||
|
@ -91,12 +81,9 @@ func (m *SceneMgr) GetScenesByGame(gameId int) []*Scene {
|
||||||
var scenes []*Scene
|
var scenes []*Scene
|
||||||
for _, value := range m.scenes {
|
for _, value := range m.scenes {
|
||||||
if value.gameId == gameId {
|
if value.gameId == gameId {
|
||||||
s := m.GetScene(value.sceneId)
|
|
||||||
if s != nil {
|
|
||||||
scenes = append(scenes, value)
|
scenes = append(scenes, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return scenes
|
return scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,12 +92,9 @@ func (m *SceneMgr) GetScenesByGameFreeId(gameFreeId int32) []*Scene {
|
||||||
var scenes []*Scene
|
var scenes []*Scene
|
||||||
for _, value := range m.scenes {
|
for _, value := range m.scenes {
|
||||||
if value.dbGameFree.GetId() == gameFreeId {
|
if value.dbGameFree.GetId() == gameFreeId {
|
||||||
s := m.GetScene(value.sceneId)
|
|
||||||
if s != nil {
|
|
||||||
scenes = append(scenes, value)
|
scenes = append(scenes, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return scenes
|
return scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,29 +336,29 @@ func (m *SceneMgr) OnPlayerLeaveScene(s *Scene, p *Player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetThirdScene 获取三方游戏房间
|
// GetThirdScene 获取三方游戏房间
|
||||||
//func (m *SceneMgr) GetThirdScene(i webapi.IThirdPlatform) *Scene {
|
func (m *SceneMgr) GetThirdScene(i webapi.IThirdPlatform) *Scene {
|
||||||
// if i == nil {
|
if i == nil {
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
// sceneId := i.GetPlatformBase().SceneId
|
sceneId := i.GetPlatformBase().SceneId
|
||||||
// scene := m.scenes[sceneId]
|
scene := m.scenes[sceneId]
|
||||||
// if scene != nil {
|
if scene != nil {
|
||||||
// return scene
|
return scene
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// gs := GameSessMgrSington.GetMinLoadSess(i.GetPlatformBase().BaseGameID)
|
gs := GameSessMgrSington.GetMinLoadSess(i.GetPlatformBase().BaseGameID)
|
||||||
// if gs != nil {
|
if gs != nil {
|
||||||
// limitPlatform := PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
limitPlatform := PlatformMgrSingleton.GetPlatform(DefaultPlatform)
|
||||||
// var gameMode = common.SceneMode_Thr
|
var gameMode = common.SceneMode_Thr
|
||||||
// dbGameFree := srvdata.PBDB_GameFreeMgr.GetData(i.GetPlatformBase().VultGameID)
|
dbGameFree := srvdata.PBDB_GameFreeMgr.GetData(i.GetPlatformBase().VultGameID)
|
||||||
// scene := SceneMgrSingleton.CreateScene(0, 0, sceneId, i.GetPlatformBase().BaseGameID, gameMode, int(common.SceneMode_Thr), 1, -1,
|
scene := SceneMgrSingleton.CreateScene(0, 0, sceneId, i.GetPlatformBase().BaseGameID, gameMode, int(common.SceneMode_Thr), 1, -1,
|
||||||
// []int64{}, gs, limitPlatform, 0, dbGameFree, i.GetPlatformBase().VultGameID)
|
[]int64{}, gs, limitPlatform, 0, dbGameFree, i.GetPlatformBase().VultGameID)
|
||||||
// return scene
|
return scene
|
||||||
// } else {
|
} else {
|
||||||
// logger.Logger.Errorf("Get %v game min session failed.", i.GetPlatformBase().BaseGameID)
|
logger.Logger.Errorf("Get %v game min session failed.", i.GetPlatformBase().BaseGameID)
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
//=========================ClockSinker===============================
|
//=========================ClockSinker===============================
|
||||||
|
|
||||||
|
@ -389,19 +373,12 @@ func (m *SceneMgr) OnMiniTimer() {
|
||||||
if webapi.ThridPlatformMgrSington.FindPlatformByPlatformBaseGameId(s.gameId) != nil {
|
if webapi.ThridPlatformMgrSington.FindPlatformByPlatformBaseGameId(s.gameId) != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch {
|
if s.IsCoinScene() {
|
||||||
case s.IsCoinScene():
|
if s.IsLongTimeInactive() && s.dbGameFree.GetCreateRoomNum() == 0 { //预创建的房间,暂不过期销毁,判定依据:CreateRoomNum>0
|
||||||
if s.IsLongTimeInactive() {
|
|
||||||
if s.dbGameFree.GetCreateRoomNum() == 0 {
|
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene ForceDelete scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene ForceDelete scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.ForceDelete(false)
|
s.ForceDelete(false)
|
||||||
}
|
}
|
||||||
if s.dbGameFree.GetCreateRoomNum() > 0 && s.csp != nil && s.csp.GetRoomNum() > int(s.dbGameFree.GetCreateRoomNum()) {
|
} else if s.IsPrivateScene() {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene ForceDelete scene:%v IsLongTimeInactive", s.sceneId)
|
|
||||||
s.ForceDelete(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case s.IsPrivateScene():
|
|
||||||
if s.IsLongTimeInactive() {
|
if s.IsLongTimeInactive() {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene ForceDelete scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene ForceDelete scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.ForceDelete(false)
|
s.ForceDelete(false)
|
||||||
|
|
Loading…
Reference in New Issue