game_sync/ranksrv/com/platform.go

38 lines
657 B
Go

package com
import (
"mongo.games.com/game/protocol/webapi"
)
var PlatformConfigSingleton = &PlatformConfigMgr{
Platforms: make(map[string]*PlatformConfig),
}
type PlatformConfig struct {
}
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.Platform:
this.Get(v.GetPlatformName())
default:
}
}