From 65aa4efebbb1a27dbfeb69e10d05e75c1e932791 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 19 Apr 2024 17:55:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=B8=AA=E4=BA=BA=E6=B0=B4=E6=B1=A0?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AE=E8=AF=BB=E5=8F=96=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/base/platform.go | 45 ---------------------------- gamesrv/base/scene.go | 6 ++-- gamesrv/tienlen/scenedata_tienlen.go | 4 +-- 3 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 gamesrv/base/platform.go diff --git a/gamesrv/base/platform.go b/gamesrv/base/platform.go deleted file mode 100644 index b161108..0000000 --- a/gamesrv/base/platform.go +++ /dev/null @@ -1,45 +0,0 @@ -package base - -import ( - "mongo.games.com/game/protocol/webapi" - "mongo.games.com/goserver/core/logger" -) - -var PlatformConfigSingleton = &PlatformConfigMgr{ - Platforms: make(map[string]*PlatformConfig), -} - -type PlatformConfig struct { - PlayerPool *webapi.PlayerPool - GameConfig *webapi.GameConfig -} - -type PlatformConfigMgr struct { - Platforms map[string]*PlatformConfig //key 是平台标记 -} - -func (this *PlatformConfigMgr) Get(plt string) *PlatformConfig { - ret, ok := this.Platforms[plt] - if !ok { - ret = new(PlatformConfig) - this.Platforms[plt] = ret - } - return ret -} - -func (this *PlatformConfigMgr) Update(config any) { - if config == nil { - return - } - - switch v := config.(type) { - case *webapi.PlayerPool: - this.Get(v.GetPlatform()).PlayerPool = v - - case *webapi.GameConfig: - this.Get(v.GetPlatform()).GameConfig = v - - default: - logger.Logger.Error("Update config type error") - } -} diff --git a/gamesrv/base/scene.go b/gamesrv/base/scene.go index 2b74d40..957fc94 100644 --- a/gamesrv/base/scene.go +++ b/gamesrv/base/scene.go @@ -2436,7 +2436,7 @@ func (this *Scene) GetBaseScore() int32 { } func (this *Scene) PlayerPoolOdds(p *Player) int32 { - config := PlatformConfigSingleton.Get(p.Platform).PlayerPool + config := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool if config == nil { return 0 } @@ -2490,7 +2490,7 @@ func (this *Scene) GetPlayerOdds(p *Player, gameId int, hasRobot bool) int32 { // 场次水池概率 f = CoinPoolMgr.GetCoinPoolOdds(this.Platform, this.GetGameFreeId(), this.GroupId) - cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool + cfg := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool if cfg != nil && cfg.PlayerPoolSwitch { if g > 0 { t = f + (1000-f)*g/1000 @@ -2707,7 +2707,7 @@ func (this *Scene) Statistics(param *StaticParam) { // 个人输赢统计条件(个人水池) // 黑白名单和新手调控,溢出金币统计到个人水池 - cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool + cfg := ConfigMgrInst.GetAllConfig(p.Platform).PlayerPool isPlayerPool := cfg != nil && cfg.PlayerPoolSwitch && isControl && ((wbLevel == 0 && !isNovice) || addGain > 0) if isPlayerPool { keyGameType := common.GetKeyGameType(int(this.GetDBGameFree().GetGameType())) diff --git a/gamesrv/tienlen/scenedata_tienlen.go b/gamesrv/tienlen/scenedata_tienlen.go index 3838f09..03648e7 100644 --- a/gamesrv/tienlen/scenedata_tienlen.go +++ b/gamesrv/tienlen/scenedata_tienlen.go @@ -1184,7 +1184,7 @@ func (this *TienLenSceneData) SendHandCardOdds() { } } - gameConfig := base.PlatformConfigSingleton.Get(this.Platform).GameConfig + gameConfig := base.ConfigMgrInst.GetAllConfig(this.Platform).GameConfig // testPokers 用于测试 isTestPoker := false @@ -1228,7 +1228,7 @@ func (this *TienLenSceneData) SendHandCardOdds() { logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B) if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu { - gf := base.PlatformConfigSingleton.Get(this.Platform).GameConfig + gf := base.ConfigMgrInst.GetAllConfig(this.Platform).GameConfig items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()} score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha())) sum := int32(0)