siyao
4 年前
当前提交
bf3c9fb9
共有 16 个文件被更改,包括 83 次插入 和 98 次删除
-
23com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
-
3com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanelWrapper.cs
-
20engine/Build.bee.cs
-
4engine/README.md
-
6engine/src/assets/directory_asset_bundle.cc
-
9engine/src/flow/raster_cache.cc
-
3engine/src/lib/ui/painting/skottie.cc
-
4engine/src/runtime/mono_api.cc
-
2engine/src/shell/platform/unity/android/uiwidgets_panel.h
-
2engine/src/shell/platform/unity/android/android_task_runner.cc
-
49com.unity.uiwidgets/Runtime/engine2/AndroidPlatformUtil.cs
-
14com.unity.uiwidgets/Runtime/engine2/AndroidGLInit.cs
-
42com.unity.uiwidgets/Runtime/engine2/AndroidUnpackStreamingAsset.cs
-
0/com.unity.uiwidgets/Runtime/engine2/AndroidPlatformUtil.cs.meta
-
0/engine/src/shell/platform/unity/android/android_task_runner.h
-
0/engine/src/shell/platform/unity/android/android_task_runner.cc
|
|||
#if !UNITY_EDITOR && UNITY_ANDROID
|
|||
using UnityEngine; |
|||
using AOT; |
|||
using System; |
|||
using System.IO; |
|||
using System.Runtime.InteropServices; |
|||
using NativeBindings = Unity.UIWidgets.ui.NativeBindings; |
|||
namespace Unity.UIWidgets.engine2 { |
|||
public static class AndroidPlatformUtil { |
|||
[DllImport(NativeBindings.dllName)] |
|||
internal static extern void InitUnpackFile(UnpackFileCallback unpack); |
|||
|
|||
internal delegate string UnpackFileCallback(string file); |
|||
|
|||
[MonoPInvokeCallback(typeof(UnpackFileCallback))] |
|||
internal static string unpackFile(string file) { |
|||
var dir = Application.temporaryCachePath + "/"; |
|||
if (!File.Exists(dir + file)) { |
|||
WWW unpackerWWW = new WWW("jar:file://" + Application.dataPath + "!/assets/" + file); |
|||
while (!unpackerWWW.isDone) { |
|||
} // This will block in the webplayer.
|
|||
|
|||
if (!string.IsNullOrEmpty(unpackerWWW.error)) { |
|||
Debug.Log("Error unpacking 'jar:file://" + Application.dataPath + "!/assets/" + file + |
|||
"'"); |
|||
dir = ""; |
|||
return dir + file; |
|||
} |
|||
|
|||
File.WriteAllBytes(dir + file, unpackerWWW.bytes); // 64MB limit on File.WriteAllBytes.
|
|||
} |
|||
|
|||
return dir + file; |
|||
|
|||
return ""; |
|||
} |
|||
|
|||
[DllImport(NativeBindings.dllName)] |
|||
static extern System.IntPtr GetUnityContextEventFunc(); |
|||
|
|||
public static void Init() { |
|||
if (Application.platform == RuntimePlatform.Android) { |
|||
InitUnpackFile(unpackFile); |
|||
GL.IssuePluginEvent(GetUnityContextEventFunc(), 1); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
#endif
|
|
|||
using System.Runtime.InteropServices; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
|
|||
namespace engine2 { |
|||
public class AndroidGLInit { |
|||
[DllImport(NativeBindings.dllName)] |
|||
static extern System.IntPtr GetUnityContextEventFunc(); |
|||
|
|||
public static void Init() { |
|||
GL.IssuePluginEvent(GetUnityContextEventFunc(), 1); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using AOT; |
|||
using System; |
|||
using System.IO; |
|||
using System.Runtime.InteropServices; |
|||
using NativeBindings = Unity.UIWidgets.ui.NativeBindings; |
|||
|
|||
public static class AndroidUnpackStreamingAssets { |
|||
|
|||
[DllImport(NativeBindings.dllName)] |
|||
internal static extern void InitUnpackFile(UnpackFileCallback unpack); |
|||
|
|||
internal delegate string UnpackFileCallback(string file); |
|||
|
|||
[MonoPInvokeCallback(typeof(UnpackFileCallback))] |
|||
internal static string unpackFile(string file) { |
|||
if (Application.platform == RuntimePlatform.Android) { |
|||
var dir = Application.temporaryCachePath + "/"; |
|||
if (!File.Exists(dir + file)) { |
|||
WWW unpackerWWW = new WWW("jar:file://" + Application.dataPath + "!/assets/" + file); |
|||
while (!unpackerWWW.isDone) { |
|||
} // This will block in the webplayer.
|
|||
|
|||
if (!string.IsNullOrEmpty(unpackerWWW.error)) { |
|||
Debug.Log("Error unpacking 'jar:file://" + Application.dataPath + "!/assets/" + file + |
|||
"'"); |
|||
dir = ""; |
|||
return dir + file; |
|||
} |
|||
File.WriteAllBytes(dir + file, unpackerWWW.bytes); // 64MB limit on File.WriteAllBytes.
|
|||
} |
|||
return dir + file; |
|||
} |
|||
|
|||
return ""; |
|||
} |
|||
|
|||
public static void OnEnable() |
|||
{ |
|||
InitUnpackFile(unpackFile); |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue