miduo_client/Assets/ManagedResources/~Lua/Framework/Manager/ServerConfigManager.lua

71 lines
2.3 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

ServerConfigManager = { }
local _ActiveCode = 0 -- 激活版本
ServerConfigManager.SettingConfig = {
ServerVersion = "ServerVersion", -- 用于切换正式服和提审服
ThinkAnalysis_GetDeviceID = "ThinkAnalysis_GetDeviceID", -- 数数获取DeviceID方法
LayoutBuilderWrap = "LayoutBuilderWrap", -- 强制刷新layout组件大小的方法修改到lua中调用
LanguagePackager = "LanguagePackager", -- 本地化处理
}
function ServerConfigManager.Initialize()
end
-- 判断设置是否激活
function ServerConfigManager.IsSettingActive(settingType)
local s_isActive = "Setting."..settingType..".isActive"
local s_versionCode = "Setting."..settingType..".versionCode"
local isActive = ServerConfigManager.GetConfigInfo(s_isActive) == "1"
if isActive then -- 激活
local vc = AndroidDeviceInfo.Instance:GetVersionCode()
if vc >= tonumber(ServerConfigManager.GetConfigInfo(s_versionCode)) then --符合包版本
return true
end
end
return false
end
function ServerConfigManager.GetSettingValue(settingType)
if ServerConfigManager.IsSettingActive(settingType) then
local s_value = "Setting."..settingType..".value"
local value = ServerConfigManager.GetConfigInfo(s_value)
LogError(s_value .. "| ".. value)
return value
end
end
-- 获取version信息老版本信息新版中用于获取版本号包版本号
function ServerConfigManager.GetVersionInfo(key)
-- 包版本大于启用的版本使用新的配置
if AndroidDeviceInfo.Instance:GetVersionCode() >= _ActiveCode then
local v = ServerConfigManager.GetConfigInfo(key)
if not v then
v = VersionManager:GetVersionInfo(key)
end
return v
else
return VersionManager:GetVersionInfo(key)
end
end
--
function ServerConfigManager.GetConfigInfo(key)
local s = ConfigMgr:GetConfigInfo(key)
return s
end
function ServerConfigManager.GetConfigNetInfo(key)
local s = ConfigMgr:GetConfigNetInfo(key)
return s
end
function ServerConfigManager.GetConfigPersistentInfo(key)
local s = ConfigMgr:GetConfigPersistentInfo(key)
return s
end
function ServerConfigManager.GetConfigStreamingInfo(key)
local s = ConfigMgr:GetConfigStreamingInfo(key)
return s
end