diff --git a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua index 430e5a0355..613504aca6 100644 --- a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua +++ b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua @@ -43,4 +43,23 @@ function PackageManager.GetLoadingList() local list = string.split(this.config.LoadingImgList, "#") return list end +end + +function PackageManager.SetVideo(obj,Image) + local video = obj:GetComponent("VideoPlayer") + if this.config.VideoName then + Image:SetActive(true) + Log("加载视频:"..tostring(this.config.VideoName)) + video.clip = resMgr:LoadAsset(this.config.VideoName) + video:Play() + else + LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!") + Image:SetActive(false) + video:Pause() + end +end + +function PackageManager.UnloadVideo() + Log("卸载视频:"..tostring(this.config.VideoName)) + resMgr:LoadAsset(this.config.VideoName) end \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index 62a5f6b508..a65190643b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -3,7 +3,6 @@ LoginPanel = Inherit(BasePanel) local this = LoginPanel this.LoginWay = { Account = 0, WeChat = 1 } -local PackagerConfig = ConfigManager.GetConfig(ConfigName.PackageConfig) SERVER_VERSION = tonumber(ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.ServerVersion) or 0) local ServerVersion = SERVER_VERSION @@ -72,7 +71,8 @@ function this:InitComponent() this.healthTip = Util.GetGameObject(this.gameObject, "healthTip") this.healthTip:SetActive(IS_SHOW_HEALTH_TIP) - this.video = Util.GetGameObject(this.gameObject, "bg/GameObject"):GetComponent("VideoPlayer") + this.video = Util.GetGameObject(this.gameObject, "bg/GameObject") + this.rawImage = Util.GetGameObject(this.gameObject, "bg/RawImage") end --绑定事件(用于子类重写) @@ -195,19 +195,8 @@ end --界面打开时调用(用于子类重写) function this:OnOpen(...) - for _, config in ConfigPairs(PackagerConfig) do - if config.PackageName == PackageManager.PackageName then - if not config.VideoName or config.VideoName == "" then - LogError("包名:"..tostring(config.PackageName).."登录视频为空!") - else - Log("加载视频:"..tostring(config.VideoName)) - this.VideoName = config.VideoName - this.video.clip = resMgr:LoadAsset(config.VideoName) - this.video:Play() - end - break - end - end + --设置背景 + PackageManager.SetVideo(this.video,this.rawImage) if AppConst.Code ~= "" then MsgPanel.ShowOne(GetLanguageStrById(AppConst.Code)) AppConst.Code = "" @@ -282,7 +271,7 @@ end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.spLoader:Destroy() - resMgr:UnLoadAsset(this.VideoName) + PackageManager.UnloadVideo() end this.isWaiting = false