mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Enable Mono Build
Enable Mono Build
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if ENABLE_HYBRIDCLR
|
||||
using HybridCLR;
|
||||
#endif
|
||||
using UnityEngine;
|
||||
using TEngine;
|
||||
using System.Reflection;
|
||||
@@ -28,7 +30,9 @@ namespace GameMain
|
||||
private bool m_LoadAssemblyComplete;
|
||||
private bool m_LoadMetadataAssemblyComplete;
|
||||
private bool m_LoadAssemblyWait;
|
||||
#pragma warning disable CS0414
|
||||
private bool m_LoadMetadataAssemblyWait;
|
||||
#pragma warning restore CS0414
|
||||
private Assembly m_MainLogicAssembly;
|
||||
private List<Assembly> m_HotfixAssemblys;
|
||||
private IFsm<IProcedureManager> m_procedureOwner;
|
||||
@@ -251,7 +255,7 @@ namespace GameMain
|
||||
Log.Debug($"LoadMetadataAssetSuccess:Load text asset [ {assetName} ] failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
#if ENABLE_HYBRIDCLR
|
||||
try
|
||||
{
|
||||
byte[] dllBytes = textAsset.bytes;
|
||||
@@ -272,7 +276,11 @@ namespace GameMain
|
||||
finally
|
||||
{
|
||||
m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount;
|
||||
|
||||
}
|
||||
#else
|
||||
m_LoadMetadataAssemblyComplete = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,19 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
#if ENABLE_HYBRIDCLR
|
||||
using HybridCLR.Editor;
|
||||
using HybridCLR.Editor.Commands;
|
||||
#endif
|
||||
using TEngine.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using TEngine;
|
||||
|
||||
public static class BuildAssetsCommand
|
||||
{
|
||||
private const string EnableHybridClrScriptingDefineSymbol = "ENABLE_HYBRIDCLR";
|
||||
|
||||
/// <summary>
|
||||
/// 禁用HybridCLR宏定义。
|
||||
/// </summary>
|
||||
[MenuItem("HybridCLR/Define Symbols/Disable HybridCLR", false, 30)]
|
||||
public static void Disable()
|
||||
{
|
||||
ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableHybridClrScriptingDefineSymbol);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开启HybridCLR宏定义。
|
||||
/// </summary>
|
||||
[MenuItem("HybridCLR/Define Symbols/Enable HybridCLR", false, 31)]
|
||||
public static void Enable()
|
||||
{
|
||||
ScriptingDefineSymbols.RemoveScriptingDefineSymbol(EnableHybridClrScriptingDefineSymbol);
|
||||
ScriptingDefineSymbols.AddScriptingDefineSymbol(EnableHybridClrScriptingDefineSymbol);
|
||||
}
|
||||
|
||||
[MenuItem("HybridCLR/Build/BuildAssets And CopyTo AssemblyTextAssetPath")]
|
||||
public static void BuildAndCopyDlls()
|
||||
{
|
||||
#if ENABLE_HYBRIDCLR
|
||||
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
|
||||
CompileDllCommand.CompileDll(target);
|
||||
CopyAOTHotUpdateDlls(target);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void CopyAOTHotUpdateDlls(BuildTarget target)
|
||||
@@ -25,6 +48,7 @@ public static class BuildAssetsCommand
|
||||
|
||||
public static void CopyAOTAssembliesToAssetPath()
|
||||
{
|
||||
#if ENABLE_HYBRIDCLR
|
||||
var target = EditorUserBuildSettings.activeBuildTarget;
|
||||
string aotAssembliesSrcDir = SettingsUtil.GetAssembliesPostIl2CppStripDir(target);
|
||||
string aotAssembliesDstDir = Application.dataPath +"/"+ SettingsUtils.HybridCLRCustomGlobalSettings.AssemblyTextAssetPath;
|
||||
@@ -41,10 +65,12 @@ public static class BuildAssetsCommand
|
||||
System.IO.File.Copy(srcDllPath, dllBytesPath, true);
|
||||
Debug.Log($"[CopyAOTAssembliesToStreamingAssets] copy AOT dll {srcDllPath} -> {dllBytesPath}");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void CopyHotUpdateAssembliesToAssetPath()
|
||||
{
|
||||
#if ENABLE_HYBRIDCLR
|
||||
var target = EditorUserBuildSettings.activeBuildTarget;
|
||||
|
||||
string hotfixDllSrcDir = SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target);
|
||||
@@ -56,5 +82,6 @@ public static class BuildAssetsCommand
|
||||
System.IO.File.Copy(dllPath, dllBytesPath, true);
|
||||
Debug.Log($"[CopyHotUpdateAssembliesToStreamingAssets] copy hotfix dll {dllPath} -> {dllBytesPath}");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
@@ -20,6 +20,11 @@
|
||||
"name": "com.unity.textmeshpro",
|
||||
"expression": "",
|
||||
"define": "ENABLE_TEXTMESHPRO"
|
||||
},
|
||||
{
|
||||
"name": "com.focus-creative-games.hybridclr_unity",
|
||||
"expression": "",
|
||||
"define": "ENABLE_HYBRIDCLR"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
|
Reference in New Issue
Block a user