Initial commit: Client Doc docs Server Tools
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XGame.MiniGame
|
||||
{
|
||||
// 小游戏 CDN 的平台段(与 LoadDll.sPlatform / CDN 目录命名一致),及平台相关的本地 AB 打开方式
|
||||
public static class MiniGamePlatform
|
||||
{
|
||||
#if UNITY_ANDROID
|
||||
public const string Name = "android";
|
||||
#elif UNITY_IOS
|
||||
public const string Name = "ios";
|
||||
#elif UNITY_WEBGL
|
||||
public const string Name = "webgl";
|
||||
#else
|
||||
public const string Name = "pc";
|
||||
#endif
|
||||
|
||||
// WebGL 无同步文件系统 mmap,LoadFromFile 不可用 → 读字节走 LoadFromMemory;其余平台 LoadFromFile 更省内存
|
||||
public static AssetBundle LoadAssetBundle(string localPath)
|
||||
{
|
||||
#if UNITY_WEBGL
|
||||
return AssetBundle.LoadFromMemory(File.ReadAllBytes(localPath));
|
||||
#else
|
||||
return AssetBundle.LoadFromFile(localPath);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user