Auto-publish WXSDK.

This commit is contained in:
nebulaliu 2024-03-06 11:02:34 +08:00
parent 940d8b69ba
commit 87d21fc46b
8 changed files with 12 additions and 12 deletions

View File

@ -28,7 +28,7 @@ namespace WeChatWASM
SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js"); SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js");
// string templateHeader = (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package && UnityUtil.GetEngineVersion() >= UnityUtil.EngineVersion.Tuanjie) ? "PACKAGE:com.qq.wx.minigame:" : "PROJECT:"; // string templateHeader = (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package && UnityUtil.GetEngineVersion() >= UnityUtil.EngineVersion.Tuanjie) ? "PACKAGE:com.qq.wx.minigame:" : "PROJECT:";
string templateHeader = "PROJECT:"; string templateHeader = "PROJECT:";
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
PlayerSettings.WeixinMiniGame.threadsSupport = false; PlayerSettings.WeixinMiniGame.threadsSupport = false;
PlayerSettings.runInBackground = false; PlayerSettings.runInBackground = false;
PlayerSettings.WeixinMiniGame.compressionFormat = WeixinMiniGameCompressionFormat.Disabled; PlayerSettings.WeixinMiniGame.compressionFormat = WeixinMiniGameCompressionFormat.Disabled;
@ -177,7 +177,7 @@ namespace WeChatWASM
public static void UpdateGraphicAPI() public static void UpdateGraphicAPI()
{ {
GraphicsDeviceType[] targets = new GraphicsDeviceType[] { }; GraphicsDeviceType[] targets = new GraphicsDeviceType[] { };
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WeixinMiniGame, false); PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WeixinMiniGame, false);
if (config.CompileOptions.Webgl2) if (config.CompileOptions.Webgl2)
{ {
@ -281,7 +281,7 @@ namespace WeChatWASM
{ {
text = RemoveFunctionsWithPrefix(text, prefix); text = RemoveFunctionsWithPrefix(text, prefix);
} }
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
if (PlayerSettings.WeixinMiniGame.exceptionSupport == WeixinMiniGameExceptionSupport.None) if (PlayerSettings.WeixinMiniGame.exceptionSupport == WeixinMiniGameExceptionSupport.None)
#else #else
if (PlayerSettings.WebGL.exceptionSupport == WebGLExceptionSupport.None) if (PlayerSettings.WebGL.exceptionSupport == WebGLExceptionSupport.None)
@ -354,7 +354,7 @@ namespace WeChatWASM
private static int Build() private static int Build()
{ {
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
PlayerSettings.WeixinMiniGame.emscriptenArgs = string.Empty; PlayerSettings.WeixinMiniGame.emscriptenArgs = string.Empty;
if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER")) if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER"))
{ {
@ -383,14 +383,14 @@ namespace WeChatWASM
{ {
UnityEngine.Debug.LogWarningFormat($"UnityHeap大于500M时32位Android与iOS普通模式较大概率启动失败中轻度游戏建议小于该值。请查看GIT文档<a href=\"https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/OptimizationMemory.md\">优化Unity WebGL的内存</a>"); UnityEngine.Debug.LogWarningFormat($"UnityHeap大于500M时32位Android与iOS普通模式较大概率启动失败中轻度游戏建议小于该值。请查看GIT文档<a href=\"https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/OptimizationMemory.md\">优化Unity WebGL的内存</a>");
} }
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
PlayerSettings.WeixinMiniGame.emscriptenArgs += $" -s TOTAL_MEMORY={config.ProjectConf.MemorySize}MB"; PlayerSettings.WeixinMiniGame.emscriptenArgs += $" -s TOTAL_MEMORY={config.ProjectConf.MemorySize}MB";
#else #else
PlayerSettings.WebGL.emscriptenArgs += $" -s TOTAL_MEMORY={config.ProjectConf.MemorySize}MB"; PlayerSettings.WebGL.emscriptenArgs += $" -s TOTAL_MEMORY={config.ProjectConf.MemorySize}MB";
#endif #endif
} }
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
if (config.CompileOptions.ProfilingMemory) if (config.CompileOptions.ProfilingMemory)
{ {
PlayerSettings.WeixinMiniGame.emscriptenArgs += " --memoryprofiler "; PlayerSettings.WeixinMiniGame.emscriptenArgs += " --memoryprofiler ";
@ -1201,7 +1201,7 @@ namespace WeChatWASM
{ {
var importer = AssetImporter.GetAtPath(jsLibs[i]) as PluginImporter; var importer = AssetImporter.GetAtPath(jsLibs[i]) as PluginImporter;
bool value = i == index; bool value = i == index;
#if WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, value); importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, value);
#else #else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, value); importer.SetCompatibleWithPlatform(BuildTarget.WebGL, value);

View File

@ -255,7 +255,7 @@ namespace WeChatWASM
ShowNotification(new GUIContent("转换完成")); ShowNotification(new GUIContent("转换完成"));
else else
{ {
#if (UNITY_WEBGL || WEIXINMINIGAME) && UNITY_INSTANTGAME #if (UNITY_WEBGL || PLATFORM_WEIXINMINIGAME) && UNITY_INSTANTGAME
// 上传首包资源 // 上传首包资源
if (!string.IsNullOrEmpty(WXConvertCore.FirstBundlePath) && File.Exists(WXConvertCore.FirstBundlePath)) if (!string.IsNullOrEmpty(WXConvertCore.FirstBundlePath) && File.Exists(WXConvertCore.FirstBundlePath))
{ {

View File

@ -2,7 +2,7 @@
{ {
public class WXPluginVersion public class WXPluginVersion
{ {
public static string pluginVersion = "202403051510"; // 这一行不要改他,导出的时候会自动替换 public static string pluginVersion = "202403061052"; // 这一行不要改他,导出的时候会自动替换
} }
public class WXPluginConf public class WXPluginConf

Binary file not shown.

View File

@ -1,4 +1,4 @@
#if UNITY_WEBGL|| WEIXINMINIGAME || UNITY_EDITOR #if UNITY_WEBGL || WEIXINMINIGAME || UNITY_EDITOR
using System; using System;
using UnityEngine; using UnityEngine;
using WeChatWASM; using WeChatWASM;
@ -12,7 +12,7 @@ internal class CheckFrame : MonoBehaviour
frameCnt++; frameCnt++;
if (frameCnt == 2) if (frameCnt == 2)
{ {
#if (UNITY_WEBGL|| WEIXINMINIGAME) && !UNITY_EDITOR #if (UNITY_WEBGL || WEIXINMINIGAME) && !UNITY_EDITOR
WXSDKManagerHandler.Instance.HideLoadingPage(); WXSDKManagerHandler.Instance.HideLoadingPage();
#endif #endif
Destroy(this); Destroy(this);

Binary file not shown.

View File

@ -1 +1 @@
{"name":"com.qq.weixin.minigame","displayName":"WXSDK","description":"WeChat Mini Game Tuanjie Engine Adapter SDK Package.","version":"0.1.1","unity":"2019.4","unityRelease":"29f1","keywords":["Tuanjie","WX"],"dependencies":{}} {"name":"com.qq.weixin.minigame","displayName":"WXSDK","description":"WeChat Mini Game Tuanjie Engine Adapter SDK Package.","version":"0.1.2","unity":"2019.4","unityRelease":"29f1","keywords":["Tuanjie","WX"],"dependencies":{}}