Compare commits
No commits in common. "8736f54fe1e934da699f1f00d513befd5d6cace8" and "18e3e5cd7dabbf570a0dc051c780988604823ecf" have entirely different histories.
8736f54fe1
...
18e3e5cd7d
|
@ -370,7 +370,7 @@ func (m *CoinSceneMgr) OnPlatformDestroy(p *Platform) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.SendGameDestroy(ids, true)
|
SceneMgrSingleton.DoDelete(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.SendGameDestroy(ids, true)
|
SceneMgrSingleton.DoDelete(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.SendGameDestroy(ids, true)
|
SceneMgrSingleton.DoDelete(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.SendGameDestroy(false)
|
s.SendGameDelete(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.SendGameDestroy(false)
|
s.SendGameDelete(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.SendGameDestroy(ids, true)
|
SceneMgrSingleton.DoDelete(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.SendGameDestroy(false)
|
s.SendGameDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ func (this *HundredSceneMgr) OnPlatformDestroyByGameFreeId(p *Platform, gameFree
|
||||||
ids = append(ids, scene.sceneId)
|
ids = append(ids, scene.sceneId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SceneMgrSingleton.SendGameDestroy(ids, true)
|
SceneMgrSingleton.DoDelete(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.SendGameDestroy(false)
|
scene.SendGameDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2415,6 +2415,21 @@ 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)
|
||||||
|
@ -3817,9 +3832,9 @@ func (this *Player) SCVIPInfo() {
|
||||||
logger.Logger.Tracef("send vipinfo to client:%v", pack)
|
logger.Logger.Tracef("send vipinfo to client:%v", pack)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) GetVIPExpByPay(payTotal int64) int64 {
|
func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
|
||||||
vips := VipMgrSington.GetVIPcfg(this.Platform)
|
vips := VipMgrSington.GetVIPcfg(this.Platform)
|
||||||
return payTotal * int64(vips.MoneyRatio)
|
return int32(math.Floor(float64(payTotal) * vips.MoneyRatio / 100))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Player) VIPDraw(id, vip int32) {
|
func (this *Player) VIPDraw(id, vip int32) {
|
||||||
|
@ -3978,7 +3993,7 @@ func (this *Player) GetVIPLevel() int32 {
|
||||||
vips := VipMgrSington.GetVIPcfg(this.Platform)
|
vips := VipMgrSington.GetVIPcfg(this.Platform)
|
||||||
vip := int32(0)
|
vip := int32(0)
|
||||||
if vips != nil && this.MoneyPayTotal != 0 {
|
if vips != nil && this.MoneyPayTotal != 0 {
|
||||||
allExp := this.MoneyPayTotal * int64(vips.MoneyRatio)
|
allExp := int64(float64(this.MoneyPayTotal) * vips.MoneyRatio)
|
||||||
for _, v := range vips.List {
|
for _, v := range vips.List {
|
||||||
if allExp >= int64(v.VipEx) {
|
if allExp >= int64(v.VipEx) {
|
||||||
vip = v.VipId
|
vip = v.VipId
|
||||||
|
@ -4111,7 +4126,7 @@ func (this *Player) GetPayGoodsInfo() {
|
||||||
this.dirty = true
|
this.dirty = true
|
||||||
this.SendDiffData()
|
this.SendDiffData()
|
||||||
|
|
||||||
info.Amount[2] = int32(this.GetVIPExpByPay(int64(info.ConsumeNum)))
|
info.Amount[2] = this.GetVIPExpByPay(info.ConsumeNum)
|
||||||
|
|
||||||
BagMgrSingleton.AddItems(this, items, 0, info.GainWay, info.Operator, info.Remark, 0, 0, false)
|
BagMgrSingleton.AddItems(this, items, 0, info.GainWay, info.Operator, info.Remark, 0, 0, false)
|
||||||
|
|
||||||
|
|
|
@ -606,41 +606,6 @@ 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
|
||||||
|
@ -660,7 +625,7 @@ func (this *Scene) DelPlayer(p *Player) bool {
|
||||||
this.robotNum--
|
this.robotNum--
|
||||||
}
|
}
|
||||||
// 记录玩家最近玩游戏的房间
|
// 记录玩家最近玩游戏的房间
|
||||||
this.lastScene(p)
|
SceneMgrSingleton.OnPlayerLeaveScene(this, p)
|
||||||
// 玩家最后所在游戏
|
// 玩家最后所在游戏
|
||||||
p.LastGameId = int(this.dbGameFree.GetGameId())
|
p.LastGameId = int(this.dbGameFree.GetGameId())
|
||||||
}
|
}
|
||||||
|
@ -847,7 +812,7 @@ func (this *Scene) IsLongTimeInactive() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) SendGameDestroy(isGrace bool) {
|
func (this *Scene) SendGameDelete(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"
|
||||||
webapiproto "mongo.games.com/game/protocol/webapi"
|
webapi2 "mongo.games.com/game/protocol/webapi"
|
||||||
"mongo.games.com/game/webapi"
|
"mongo.games.com/game/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -28,13 +28,21 @@ var SceneMgrSingleton = &SceneMgr{
|
||||||
|
|
||||||
// SceneMgr 房间管理器
|
// SceneMgr 房间管理器
|
||||||
type SceneMgr struct {
|
type SceneMgr struct {
|
||||||
BaseClockSinker // 驱动时间事件
|
BaseClockSinker // 驱动时间事件
|
||||||
scenes map[int]*Scene // 房间id: Scene
|
|
||||||
|
|
||||||
privateAutoId int // 私人房房间号
|
scenes map[int]*Scene // 房间id: Scene
|
||||||
matchAutoId int // 比赛场房间号
|
privateAutoId int // 私人房房间号
|
||||||
coinSceneAutoId int // 金币场房间号
|
matchAutoId int // 比赛场房间号
|
||||||
hundredSceneAutoId int // 百人场房间号
|
coinSceneAutoId 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 获取回访码
|
||||||
|
@ -79,14 +87,6 @@ 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,8 +123,6 @@ 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 {
|
||||||
|
@ -139,10 +137,9 @@ 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) ([]*webapiproto.RoomInfo, int32, int32) {
|
gameFreeId, snId int32, start, end, pageSize int32) ([]*webapi2.RoomInfo, int32, int32) {
|
||||||
roomInfo := make([]*webapiproto.RoomInfo, 0, len(m.scenes))
|
roomInfo := make([]*webapi2.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 {
|
||||||
|
@ -162,7 +159,7 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode
|
||||||
platformName = s.limitPlatform.IdStr
|
platformName = s.limitPlatform.IdStr
|
||||||
}
|
}
|
||||||
|
|
||||||
si := &webapiproto.RoomInfo{
|
si := &webapi2.RoomInfo{
|
||||||
Platform: platformName,
|
Platform: platformName,
|
||||||
SceneId: int32(s.sceneId),
|
SceneId: int32(s.sceneId),
|
||||||
GameId: int32(s.gameId),
|
GameId: int32(s.gameId),
|
||||||
|
@ -269,21 +266,18 @@ 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 {
|
||||||
|
@ -304,9 +298,10 @@ 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
|
||||||
|
@ -341,7 +336,44 @@ 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) SendGameDestroy(sceneId []int, isGrace bool) {
|
func (m *SceneMgr) OnPlayerLeaveScene(s *Scene, p *Player) {
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
@ -361,6 +393,31 @@ func (m *SceneMgr) SendGameDestroy(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 接收所有时间事件
|
||||||
|
@ -378,18 +435,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 SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDestroy(false)
|
s.SendGameDelete(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 SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive CoinScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDestroy(false)
|
s.SendGameDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case s.IsPrivateScene():
|
case s.IsPrivateScene():
|
||||||
if s.IsLongTimeInactive() {
|
if s.IsLongTimeInactive() {
|
||||||
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene SendGameDestroy scene:%v IsLongTimeInactive", s.sceneId)
|
logger.Logger.Warnf("SceneMgr.DeleteLongTimeInactive PrivateScene SendGameDelete scene:%v IsLongTimeInactive", s.sceneId)
|
||||||
s.SendGameDestroy(false)
|
s.SendGameDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,10 @@ 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.SendGameDestroy(false)
|
s.SendGameDelete(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.SendGameDestroy(false)
|
s.SendGameDelete(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.SendGameDestroy(false)
|
s.SendGameDelete(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return common.ResponseTag_Ok, pack
|
return common.ResponseTag_Ok, pack
|
||||||
|
@ -3444,7 +3444,7 @@ func init() {
|
||||||
player.MoneyTotal += int64(info.ConsumeTypeNum)
|
player.MoneyTotal += int64(info.ConsumeTypeNum)
|
||||||
player.dirty = true
|
player.dirty = true
|
||||||
player.SendDiffData()
|
player.SendDiffData()
|
||||||
info.Amount[2] = int32(player.GetVIPExpByPay(int64(info.ConsumeNum)))
|
info.Amount[2] = player.GetVIPExpByPay(info.ConsumeNum)
|
||||||
|
|
||||||
var itemInfo []*playerproto.PayItem
|
var itemInfo []*playerproto.PayItem
|
||||||
var items []*Item
|
var items []*Item
|
||||||
|
|
Loading…
Reference in New Issue