diff --git a/Assets/ManagedResources/Prefabs/UI/Login/LoginPanel.prefab b/Assets/ManagedResources/Prefabs/UI/Login/LoginPanel.prefab index cd960d0c58..e92aed64fd 100644 --- a/Assets/ManagedResources/Prefabs/UI/Login/LoginPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Login/LoginPanel.prefab @@ -1872,7 +1872,7 @@ VideoPlayer: m_AspectRatio: 2 m_DataSource: 0 m_PlaybackSpeed: 1 - m_AudioOutputMode: 2 + m_AudioOutputMode: 0 m_TargetAudioSources: - {fileID: 0} m_DirectAudioVolumes: @@ -6490,7 +6490,7 @@ ParticleSystem: --- !u!199 &8490762427165167817 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -11323,7 +11323,7 @@ ParticleSystem: --- !u!199 &8490762427297531630 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -16820,7 +16820,7 @@ ParticleSystem: --- !u!199 &8490762427821104763 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -21804,7 +21804,7 @@ ParticleSystem: --- !u!199 &8490762428035569255 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -26595,7 +26595,7 @@ ParticleSystem: --- !u!199 &8490762428074860618 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -31534,7 +31534,7 @@ ParticleSystem: --- !u!199 &8490762428351855326 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -36361,7 +36361,7 @@ ParticleSystem: --- !u!199 &8490762428588085446 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -41223,7 +41223,7 @@ ParticleSystem: --- !u!199 &8490762428872251531 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -46336,7 +46336,7 @@ ParticleSystem: --- !u!199 &8490762429003853987 ParticleSystemRenderer: serializedVersion: 6 - m_ObjectHideFlags: 0 + m_ObjectHideFlags: 2 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} diff --git a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua index c9b534b88e..d02d288bcb 100644 --- a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua +++ b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua @@ -31,6 +31,12 @@ function PackageManager.GetLoginPanelBg() return this.config.LoginPanelBg end end +-- 获取登录Logo +function PackageManager.GetLoginPanelLogo() + if this.config then + return this.config.LoginLogo + end +end -- 获取充值计费点字段 function PackageManager.GetCustomEventField() if this.config then @@ -46,18 +52,23 @@ function PackageManager.GetLoadingList() end function PackageManager.SetVideo(obj,Image) + Image:SetActive(false) if this.config.VideoName then - local video = obj:GetComponent("VideoPlayer") - Log("加载视频:"..tostring(this.config.VideoName)) if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.IS_PLAY_LOGIN_VIDEO) then - video.url = ServerConfigManager.GetVersionInfo("resUrl") .. AppConst.PlatformPath .."/"..tostring(this.config.VideoName) ..".mp4" - -- video.clip = resMgr:LoadAsset(this.config.VideoName) - video:Play() + 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() + Image:SetActive(true) + end + end) end - Image:SetActive(true) else LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!") - Image:SetActive(false) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index a65190643b..76de989f5c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -64,8 +64,16 @@ function this:InitComponent() this.versionText.text = Language[11136]..LoginRoot_Version - this.logo = Util.GetGameObject(this.gameObject, "logo") - this.logo:GetComponent("Image"):SetNativeSize() + this.logo = Util.GetGameObject(this.gameObject, "logo"):GetComponent("Image") + local logoStr = PackageManager.GetLoginPanelLogo() + if logoStr then + this.logo.gameObject:SetActive(true) + this.logo.sprite = this.spLoader:LoadSprite(logoStr) + this.logo:SetNativeSize() + else + this.logo.gameObject:SetActive(false) + end + -- BindLightFlash(Util.GetGameObject(this.logo, "saoguang"), this.logo) this.healthTip = Util.GetGameObject(this.gameObject, "healthTip") diff --git a/Assets/Scripts/Bridge/ResourcesManager.cs b/Assets/Scripts/Bridge/ResourcesManager.cs index c3033a9511..3e753b02d7 100644 --- a/Assets/Scripts/Bridge/ResourcesManager.cs +++ b/Assets/Scripts/Bridge/ResourcesManager.cs @@ -4,6 +4,9 @@ using UnityEngine; using UnityEngine.Events; using LuaInterface; using GameCore; +using System.IO; +using ResUpdate; + namespace GameLogic { /// /// 资源管理器 @@ -100,6 +103,34 @@ namespace GameLogic { }); } + public void PreLoadAssetAsync(string assetName, LuaFunction luaFunc) + { + Debug.Log("预加载资源:" + assetName); + if (File.Exists(AppConst.PersistentDataPath + assetName) && PlayerPrefs.GetInt(assetName + "_IsPreLoad", 0) == 1) + { + Debug.Log("预加载资源已存在"); + if (luaFunc != null) + { + luaFunc.Call(true); + } + }else + { + string downLoadURL = VersionManager.Instance.GetVersionInfo("resUrl") + AppConst.PlatformPath + "/"; + Debug.Log("预加载资源路径:"+downLoadURL); + ResourceDownloadManager.Instance.StartDownload(assetName, downLoadURL, "", (string name, DownLoadProgress dp) => { + Debug.LogFormat("预加载资源进度:{0}/{1}", dp.Size, dp.TotalSize); + }, (string name, bool isOk) => + { + Debug.Log("预加载资源完成:" + isOk); + PlayerPrefs.SetInt(assetName + "_IsPreLoad", 1); + if (luaFunc != null) + { + luaFunc.Call(isOk); + } + }); + } + } + /// /// 卸载资源 /// diff --git a/Assets/Scripts/GameInit/GameStart.cs b/Assets/Scripts/GameInit/GameStart.cs index 0757c37c88..a75dce283d 100644 --- a/Assets/Scripts/GameInit/GameStart.cs +++ b/Assets/Scripts/GameInit/GameStart.cs @@ -26,6 +26,7 @@ public class GameStart : MonoBehaviour if (Application.isEditor) { StartCoroutine(StartGame()); + //playSplash(); } else { @@ -48,7 +49,7 @@ public class GameStart : MonoBehaviour void playSplash() { - bool isShowSplash = false; + bool isShowSplash = true; if (isShowSplash) { string path = AppConst.PersistentDataPath + "lz4/splashpanel.unity3d"; @@ -63,7 +64,7 @@ public class GameStart : MonoBehaviour Image image2 = gameObj2.transform.Find("Canvas/image2").GetComponent(); image2.DOFade(1, 0).OnComplete(() => { - image2.DOFade(0, 0).SetDelay(2).OnComplete(() => { + image2.DOFade(0, 0).SetDelay(0).OnComplete(() => { image.color = new Color(image.color.r, image.color.g, image.color.b, 0); image.DOFade(1, 1).OnComplete(() => { image.DOFade(0, 1).SetDelay(2).OnComplete(() => { diff --git a/Assets/Source/Generate/DelegateFactory.cs b/Assets/Source/Generate/DelegateFactory.cs index dd6e7d039e..670240d0f4 100644 --- a/Assets/Source/Generate/DelegateFactory.cs +++ b/Assets/Source/Generate/DelegateFactory.cs @@ -71,7 +71,6 @@ public class DelegateFactory dict.Add(typeof(UnityEngine.Application.AdvertisingIdentifierCallback), factory.UnityEngine_Application_AdvertisingIdentifierCallback); dict.Add(typeof(UnityEngine.Application.LowMemoryCallback), factory.UnityEngine_Application_LowMemoryCallback); dict.Add(typeof(UnityEngine.Application.LogCallback), factory.UnityEngine_Application_LogCallback); - dict.Add(typeof(System.Action), factory.System_Action_bool); dict.Add(typeof(System.Func), factory.System_Func_bool); dict.Add(typeof(UnityEngine.AudioClip.PCMReaderCallback), factory.UnityEngine_AudioClip_PCMReaderCallback); dict.Add(typeof(UnityEngine.AudioClip.PCMSetPositionCallback), factory.UnityEngine_AudioClip_PCMSetPositionCallback); @@ -158,7 +157,6 @@ public class DelegateFactory DelegateTraits.Init(factory.UnityEngine_Application_AdvertisingIdentifierCallback); DelegateTraits.Init(factory.UnityEngine_Application_LowMemoryCallback); DelegateTraits.Init(factory.UnityEngine_Application_LogCallback); - DelegateTraits>.Init(factory.System_Action_bool); DelegateTraits>.Init(factory.System_Func_bool); DelegateTraits.Init(factory.UnityEngine_AudioClip_PCMReaderCallback); DelegateTraits.Init(factory.UnityEngine_AudioClip_PCMSetPositionCallback); @@ -245,7 +243,6 @@ public class DelegateFactory TypeTraits.Init(factory.Check_UnityEngine_Application_AdvertisingIdentifierCallback); TypeTraits.Init(factory.Check_UnityEngine_Application_LowMemoryCallback); TypeTraits.Init(factory.Check_UnityEngine_Application_LogCallback); - TypeTraits>.Init(factory.Check_System_Action_bool); TypeTraits>.Init(factory.Check_System_Func_bool); TypeTraits.Init(factory.Check_UnityEngine_AudioClip_PCMReaderCallback); TypeTraits.Init(factory.Check_UnityEngine_AudioClip_PCMSetPositionCallback); @@ -332,7 +329,6 @@ public class DelegateFactory StackTraits.Push = factory.Push_UnityEngine_Application_AdvertisingIdentifierCallback; StackTraits.Push = factory.Push_UnityEngine_Application_LowMemoryCallback; StackTraits.Push = factory.Push_UnityEngine_Application_LogCallback; - StackTraits>.Push = factory.Push_System_Action_bool; StackTraits>.Push = factory.Push_System_Func_bool; StackTraits.Push = factory.Push_UnityEngine_AudioClip_PCMReaderCallback; StackTraits.Push = factory.Push_UnityEngine_AudioClip_PCMSetPositionCallback; @@ -3603,63 +3599,6 @@ public class DelegateFactory ToLua.Push(L, o); } - class System_Action_bool_Event : LuaDelegate - { - public System_Action_bool_Event(LuaFunction func) : base(func) { } - public System_Action_bool_Event(LuaFunction func, LuaTable self) : base(func, self) { } - - public void Call(bool param0) - { - func.BeginPCall(); - func.Push(param0); - func.PCall(); - func.EndPCall(); - } - - public void CallWithSelf(bool param0) - { - func.BeginPCall(); - func.Push(self); - func.Push(param0); - func.PCall(); - func.EndPCall(); - } - } - - public System.Action System_Action_bool(LuaFunction func, LuaTable self, bool flag) - { - if (func == null) - { - System.Action fn = delegate(bool param0) { }; - return fn; - } - - if(!flag) - { - System_Action_bool_Event target = new System_Action_bool_Event(func); - System.Action d = target.Call; - target.method = d.Method; - return d; - } - else - { - System_Action_bool_Event target = new System_Action_bool_Event(func, self); - System.Action d = target.CallWithSelf; - target.method = d.Method; - return d; - } - } - - bool Check_System_Action_bool(IntPtr L, int pos) - { - return TypeChecker.CheckDelegateType(typeof(System.Action), L, pos); - } - - void Push_System_Action_bool(IntPtr L, System.Action o) - { - ToLua.Push(L, o); - } - class System_Func_bool_Event : LuaDelegate { public System_Func_bool_Event(LuaFunction func) : base(func) { } diff --git a/Assets/Source/Generate/GameLogic_ResourcesManagerWrap.cs b/Assets/Source/Generate/GameLogic_ResourcesManagerWrap.cs index d8fb6ed2d8..2367a7777e 100644 --- a/Assets/Source/Generate/GameLogic_ResourcesManagerWrap.cs +++ b/Assets/Source/Generate/GameLogic_ResourcesManagerWrap.cs @@ -11,6 +11,7 @@ public class GameLogic_ResourcesManagerWrap L.RegFunction("LoadAsset", LoadAsset); L.RegFunction("LoadSpriteAsset", LoadSpriteAsset); L.RegFunction("LoadAssetAsync", LoadAssetAsync); + L.RegFunction("PreLoadAssetAsync", PreLoadAssetAsync); L.RegFunction("UnLoadAsset", UnLoadAsset); L.RegFunction("UnLoadGame", UnLoadGame); L.RegFunction("UnLoadUnUseAssetAndAssetBundle", UnLoadUnUseAssetAndAssetBundle); @@ -118,6 +119,24 @@ public class GameLogic_ResourcesManagerWrap } } + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int PreLoadAssetAsync(IntPtr L) + { + try + { + ToLua.CheckArgsCount(L, 3); + GameLogic.ResourcesManager obj = (GameLogic.ResourcesManager)ToLua.CheckObject(L, 1); + string arg0 = ToLua.CheckString(L, 2); + LuaFunction arg1 = ToLua.CheckLuaFunction(L, 3); + obj.PreLoadAssetAsync(arg0, arg1); + return 0; + } + catch (Exception e) + { + return LuaDLL.toluaL_exception(L, e); + } + } + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int UnLoadAsset(IntPtr L) { diff --git a/Assets/Source/Generate/LuaBinder.cs b/Assets/Source/Generate/LuaBinder.cs index 1b1df626bb..a056b25e2b 100644 --- a/Assets/Source/Generate/LuaBinder.cs +++ b/Assets/Source/Generate/LuaBinder.cs @@ -399,7 +399,6 @@ public static class LuaBinder L.RegFunction("Action_int", System_Action_int); L.RegFunction("Comparison_int", System_Comparison_int); L.RegFunction("Func_int_int", System_Func_int_int); - L.RegFunction("Action_bool", System_Action_bool); L.RegFunction("Func_bool", System_Func_bool); L.RegFunction("Action_UnityEngine_AsyncOperation", System_Action_UnityEngine_AsyncOperation); L.RegFunction("Action_string", System_Action_string); @@ -2532,33 +2531,6 @@ public static class LuaBinder } } - [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] - static int System_Action_bool(IntPtr L) - { - try - { - int count = LuaDLL.lua_gettop(L); - LuaFunction func = ToLua.CheckLuaFunction(L, 1); - - if (count == 1) - { - Delegate arg1 = DelegateTraits>.Create(func); - ToLua.Push(L, arg1); - } - else - { - LuaTable self = ToLua.CheckLuaTable(L, 2); - Delegate arg1 = DelegateTraits>.Create(func, self); - ToLua.Push(L, arg1); - } - return 1; - } - catch(Exception e) - { - return LuaDLL.toluaL_exception(L, e); - } - } - [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int System_Func_bool(IntPtr L) {