From 9bb57b48a5bdf87936f5a08c0e05fe7fd39bfe24 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Fri, 4 Jun 2021 12:01:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=20=E5=8C=85=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E3=80=91=E6=B7=BB=E5=8A=A0=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Framework/Manager/PackageManager.lua | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua index 379685345e..143b49572f 100644 --- a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua +++ b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua @@ -60,29 +60,33 @@ end function PackageManager.SetVideo(obj, bg) obj:SetActive(false) - 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() - 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 - end) + 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() + 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 + end) + end + else + LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!") end - else - LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!") end end function PackageManager.UnloadVideo() - if this.config.VideoName then - -- Log("卸载视频:"..tostring(this.config.VideoName)) - -- resMgr:UnLoadAsset(this.config.VideoName) + if this.config then + if this.config.VideoName then + -- Log("卸载视频:"..tostring(this.config.VideoName)) + -- resMgr:UnLoadAsset(this.config.VideoName) + end end end \ No newline at end of file