135 lines
4.4 KiB
Lua
135 lines
4.4 KiB
Lua
PackageManager = {}
|
|
local this = PackageManager
|
|
function PackageManager.Initialize()
|
|
this.PackageName = "test"
|
|
if AppConst.isSDK then
|
|
this.PackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
|
end
|
|
LogGreen("当前包名为:"..this.PackageName)
|
|
|
|
-- 获取当前包配置名,没有就按本地配置
|
|
this.ConfigName = ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.PACKAGE_CONFIG)
|
|
if not this.ConfigName then
|
|
this.ConfigName = "LOCAL"
|
|
end
|
|
if this.ConfigName == "XIPU" and AppConst.isSDK and AndroidDeviceInfo.Instance:GetVersionCode() == 2 then
|
|
this.ConfigName = "XIPU2"
|
|
end
|
|
|
|
local PackagerConfig = ConfigManager.GetConfig(ConfigName.PackageConfig)
|
|
for _, config in ConfigPairs(PackagerConfig) do
|
|
if config.ConfigName == this.ConfigName then
|
|
this.config = config
|
|
break
|
|
end
|
|
end
|
|
|
|
-- 获取stream设置
|
|
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_LOAD_STREAMING) then
|
|
resMgr:LoadStreamingText("PackConfig", function(config)
|
|
local json = require 'cjson'
|
|
local data = json.decode(config)
|
|
this.StreamConfig = data
|
|
LogError("Load text done!!!")
|
|
end)
|
|
end
|
|
end
|
|
|
|
-- 获取包名
|
|
function PackageManager.GetPackageID()
|
|
if this.StreamConfig then
|
|
return this.StreamConfig.PackID
|
|
end
|
|
end
|
|
-- 获取包名
|
|
function PackageManager.GetPackageName()
|
|
return this.PackageName
|
|
end
|
|
-- 获取充值计费点字段
|
|
function PackageManager.GetRechargeField()
|
|
if this.config then
|
|
return this.config.RechargeField
|
|
end
|
|
end
|
|
-- 获取登录背景图
|
|
function PackageManager.GetLoginPanelBg()
|
|
if this.StreamConfig then
|
|
return this.StreamConfig.LoginPanelBG
|
|
end
|
|
if this.config then
|
|
return this.config.LoginPanelBg
|
|
end
|
|
end
|
|
-- 获取登录Logo
|
|
function PackageManager.GetLoginPanelLogo()
|
|
if this.StreamConfig then
|
|
return this.StreamConfig.LoginPanelLogo
|
|
end
|
|
if this.config then
|
|
return this.config.LoginLogo
|
|
end
|
|
end
|
|
-- 获取充值计费点字段
|
|
function PackageManager.GetCustomEventField()
|
|
if this.config then
|
|
return this.config.CustomEventField
|
|
end
|
|
end
|
|
-- 获取loading图list
|
|
function PackageManager.GetLoadingList()
|
|
if this.StreamConfig then
|
|
local list = string.split(this.StreamConfig.LoadingPanelBG, "#")
|
|
return list
|
|
end
|
|
if this.config then
|
|
local list = string.split(this.config.LoadingImgList, "#")
|
|
return list
|
|
end
|
|
end
|
|
-- 获取登录背景图
|
|
function PackageManager.GetBHContent()
|
|
if this.config then
|
|
return this.config.BHContent
|
|
end
|
|
end
|
|
|
|
function PackageManager.SetVideo(obj, bg)
|
|
obj:SetActive(false)
|
|
if this.config then
|
|
if this.config.VideoName then
|
|
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_PLAY_LOGIN_VIDEO) then
|
|
Log("加载视频:"..tostring(this.config.VideoName))
|
|
resMgr:PreLoadAssetAsync(this.config.VideoName, function(isOk)
|
|
if isOk then
|
|
if UIManager.IsOpen(UIName.LoginPanel) then
|
|
local video = obj:GetComponent("VideoPlayer")
|
|
-- video.url = ServerConfigManager.GetVersionInfo("resUrl") .. AppConst.PlatformPath .."/"..tostring(this.config.VideoName) ..".mp4"
|
|
-- video.clip = resMgr:LoadAsset(this.config.VideoName)
|
|
video.url = AppConst.PersistentDataPath .."/"..tostring(this.config.VideoName)
|
|
video:Play()
|
|
bg:DOFade(0, 2)
|
|
obj:SetActive(true)
|
|
end
|
|
else
|
|
LogError("视频加载失败:"..this.config.VideoName)
|
|
end
|
|
end)
|
|
end
|
|
else
|
|
LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!")
|
|
end
|
|
end
|
|
end
|
|
|
|
function PackageManager.UnloadVideo()
|
|
if this.config then
|
|
if this.config.VideoName then
|
|
-- Log("卸载视频:"..tostring(this.config.VideoName))
|
|
-- resMgr:UnLoadAsset(this.config.VideoName)
|
|
end
|
|
end
|
|
end
|
|
|
|
function PackageManager.GetCCCode()
|
|
return ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.PACKAGE_CC_CODE) or ""
|
|
end |