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)