【登录视频】优化加载过程
parent
2024f8173e
commit
9bd23a74cf
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -4,6 +4,9 @@ using UnityEngine;
|
|||
using UnityEngine.Events;
|
||||
using LuaInterface;
|
||||
using GameCore;
|
||||
using System.IO;
|
||||
using ResUpdate;
|
||||
|
||||
namespace GameLogic {
|
||||
/// <summary>
|
||||
/// 资源管理器
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 卸载资源
|
||||
/// </summary>
|
||||
|
|
|
@ -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<Image>();
|
||||
|
||||
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(() => {
|
||||
|
|
|
@ -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<bool>), factory.System_Action_bool);
|
||||
dict.Add(typeof(System.Func<bool>), 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<UnityEngine.Application.AdvertisingIdentifierCallback>.Init(factory.UnityEngine_Application_AdvertisingIdentifierCallback);
|
||||
DelegateTraits<UnityEngine.Application.LowMemoryCallback>.Init(factory.UnityEngine_Application_LowMemoryCallback);
|
||||
DelegateTraits<UnityEngine.Application.LogCallback>.Init(factory.UnityEngine_Application_LogCallback);
|
||||
DelegateTraits<System.Action<bool>>.Init(factory.System_Action_bool);
|
||||
DelegateTraits<System.Func<bool>>.Init(factory.System_Func_bool);
|
||||
DelegateTraits<UnityEngine.AudioClip.PCMReaderCallback>.Init(factory.UnityEngine_AudioClip_PCMReaderCallback);
|
||||
DelegateTraits<UnityEngine.AudioClip.PCMSetPositionCallback>.Init(factory.UnityEngine_AudioClip_PCMSetPositionCallback);
|
||||
|
@ -245,7 +243,6 @@ public class DelegateFactory
|
|||
TypeTraits<UnityEngine.Application.AdvertisingIdentifierCallback>.Init(factory.Check_UnityEngine_Application_AdvertisingIdentifierCallback);
|
||||
TypeTraits<UnityEngine.Application.LowMemoryCallback>.Init(factory.Check_UnityEngine_Application_LowMemoryCallback);
|
||||
TypeTraits<UnityEngine.Application.LogCallback>.Init(factory.Check_UnityEngine_Application_LogCallback);
|
||||
TypeTraits<System.Action<bool>>.Init(factory.Check_System_Action_bool);
|
||||
TypeTraits<System.Func<bool>>.Init(factory.Check_System_Func_bool);
|
||||
TypeTraits<UnityEngine.AudioClip.PCMReaderCallback>.Init(factory.Check_UnityEngine_AudioClip_PCMReaderCallback);
|
||||
TypeTraits<UnityEngine.AudioClip.PCMSetPositionCallback>.Init(factory.Check_UnityEngine_AudioClip_PCMSetPositionCallback);
|
||||
|
@ -332,7 +329,6 @@ public class DelegateFactory
|
|||
StackTraits<UnityEngine.Application.AdvertisingIdentifierCallback>.Push = factory.Push_UnityEngine_Application_AdvertisingIdentifierCallback;
|
||||
StackTraits<UnityEngine.Application.LowMemoryCallback>.Push = factory.Push_UnityEngine_Application_LowMemoryCallback;
|
||||
StackTraits<UnityEngine.Application.LogCallback>.Push = factory.Push_UnityEngine_Application_LogCallback;
|
||||
StackTraits<System.Action<bool>>.Push = factory.Push_System_Action_bool;
|
||||
StackTraits<System.Func<bool>>.Push = factory.Push_System_Func_bool;
|
||||
StackTraits<UnityEngine.AudioClip.PCMReaderCallback>.Push = factory.Push_UnityEngine_AudioClip_PCMReaderCallback;
|
||||
StackTraits<UnityEngine.AudioClip.PCMSetPositionCallback>.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<bool> System_Action_bool(LuaFunction func, LuaTable self, bool flag)
|
||||
{
|
||||
if (func == null)
|
||||
{
|
||||
System.Action<bool> fn = delegate(bool param0) { };
|
||||
return fn;
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
System_Action_bool_Event target = new System_Action_bool_Event(func);
|
||||
System.Action<bool> d = target.Call;
|
||||
target.method = d.Method;
|
||||
return d;
|
||||
}
|
||||
else
|
||||
{
|
||||
System_Action_bool_Event target = new System_Action_bool_Event(func, self);
|
||||
System.Action<bool> d = target.CallWithSelf;
|
||||
target.method = d.Method;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
bool Check_System_Action_bool(IntPtr L, int pos)
|
||||
{
|
||||
return TypeChecker.CheckDelegateType(typeof(System.Action<bool>), L, pos);
|
||||
}
|
||||
|
||||
void Push_System_Action_bool(IntPtr L, System.Action<bool> o)
|
||||
{
|
||||
ToLua.Push(L, o);
|
||||
}
|
||||
|
||||
class System_Func_bool_Event : LuaDelegate
|
||||
{
|
||||
public System_Func_bool_Event(LuaFunction func) : base(func) { }
|
||||
|
|
|
@ -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<GameLogic.ResourcesManager>(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)
|
||||
{
|
||||
|
|
|
@ -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<System.Action<bool>>.Create(func);
|
||||
ToLua.Push(L, arg1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaTable self = ToLua.CheckLuaTable(L, 2);
|
||||
Delegate arg1 = DelegateTraits<System.Action<bool>>.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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue