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