微信小程序编译
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
All checks were successful
Plugin Library CI / publish (00.BuildOriginality) (push) Successful in 13s
Plugin Library CI / publish (00.StaryEvo) (push) Successful in 17s
Plugin Library CI / publish (00.StaryEvoTools) (push) Successful in 35s
Plugin Library CI / publish (01.HybridCLR) (push) Successful in 15s
Plugin Library CI / publish (02.InformationSave) (push) Successful in 3s
Plugin Library CI / publish (03.YooAsset) (push) Successful in 33s
Plugin Library CI / publish (04.AudioCore) (push) Successful in 3s
Plugin Library CI / publish (05.TableTextConversion) (push) Successful in 5s
Plugin Library CI / publish (06.UIFarme) (push) Successful in 15s
Plugin Library CI / publish (07.RKTools) (push) Successful in 2s
Plugin Library CI / publish (08.UniTask) (push) Successful in 3s
Plugin Library CI / publish (09.CodeChecker) (push) Successful in 16s
Plugin Library CI / publish (10.StoryEditor) (push) Successful in 3s
Plugin Library CI / publish (10.XNode) (push) Successful in 3s
Plugin Library CI / publish (11.PointCloudTools) (push) Successful in 2s
Plugin Library CI / publish (12.WeixinMinigame) (push) Successful in 2m32s
This commit is contained in:
146
Assets/12.WeixinMinigame/Runtime/WXRuntimeExtDef.cs
Normal file
146
Assets/12.WeixinMinigame/Runtime/WXRuntimeExtDef.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
#if PLATFORM_WEIXINMINIGAME || PLATFORM_WEBGL || UNITY_EDITOR
|
||||
namespace WeChatWASM
|
||||
{
|
||||
public class WXRuntimeExtDef
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
static void OnWXRuntimeExtDefLoadRuntimeMethod()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
private static void Init()
|
||||
{
|
||||
|
||||
#if UNITY_2018_1_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", false);
|
||||
#endif
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", false);
|
||||
#endif
|
||||
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_EDITOR_OSX
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", false);
|
||||
#endif
|
||||
#if UNITY_EDITOR_LINUX
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", false);
|
||||
#endif
|
||||
#if UNITY_2020
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2020", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2020", false);
|
||||
#endif
|
||||
#if UNITY_2021
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2021", false);
|
||||
#endif
|
||||
#if UNITY_2022
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2022", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2022", false);
|
||||
#endif
|
||||
#if UNITY_6000
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000", false);
|
||||
#endif
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_INSTANTGAME
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", false);
|
||||
#endif
|
||||
#if WEIXINMINIGAME
|
||||
WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", false);
|
||||
#endif
|
||||
#if TUANJIE_2022_3_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", false);
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", false);
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WEBGL
|
||||
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", false);
|
||||
#endif
|
||||
RegisterController();
|
||||
}
|
||||
|
||||
private static void RegisterController()
|
||||
{
|
||||
// Example:
|
||||
/*
|
||||
WXRuntimeExtDef.RegisterAction("xxx", (args) =>
|
||||
{
|
||||
#if UNITY_2018
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
});
|
||||
*/
|
||||
WXRuntimeExtEnvDef.RegisterAction("Unity.GetObjectInstanceID", (args) =>
|
||||
{
|
||||
#if UNITY_2021_3_OR_NEWER
|
||||
if (args is UnityEngine.Object unityObject)
|
||||
{
|
||||
return unityObject.GetInstanceID();
|
||||
}
|
||||
#endif
|
||||
// unityObject.GetInstanceID() would never return 0.
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user