mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
Merge pull request #91 from mi1890/main
* [fix] installed as a package ,class not found issue
This commit is contained in:
@@ -69,7 +69,23 @@ public static class EventInterfaceGenerate
|
||||
EventInterfaceGenerateTag.HadGenerate = true;
|
||||
|
||||
// 加载程序集
|
||||
Assembly assembly = typeof(GameApp).Assembly;
|
||||
Assembly assembly = null;
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
foreach(var type in asm.GetTypes())
|
||||
{
|
||||
if (type.Name == "GameApp")
|
||||
{
|
||||
assembly = asm;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(assembly == null)
|
||||
{
|
||||
Debug.LogError("Game App Class Not Found");
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取程序集中的所有类型
|
||||
Type[] types = assembly.GetTypes();
|
||||
|
@@ -10,6 +10,7 @@ public class TEngineSettingsProvider : SettingsProvider
|
||||
private const string headerName = "TEngine/TEngineSettings";
|
||||
private SerializedObject m_CustomSettings;
|
||||
|
||||
private static string m_SettingsPath = k_SettingsPath;
|
||||
internal static SerializedObject GetSerializedSettings()
|
||||
{
|
||||
return new SerializedObject(SettingsUtils.GlobalSettings);
|
||||
@@ -17,7 +18,12 @@ public class TEngineSettingsProvider : SettingsProvider
|
||||
|
||||
public static bool IsSettingsAvailable()
|
||||
{
|
||||
return File.Exists(k_SettingsPath);
|
||||
var pathes = AssetDatabase.FindAssets("TEngineGlobalSettings", new string[2] { k_SettingsPath,"Packages/com.tengine/" });
|
||||
if (pathes.Length > 0)
|
||||
{
|
||||
m_SettingsPath = AssetDatabase.GUIDToAssetPath(pathes[0]);
|
||||
}
|
||||
return pathes.Length > 0;
|
||||
}
|
||||
|
||||
public override void OnActivate(string searchContext, VisualElement rootElement)
|
||||
@@ -29,16 +35,16 @@ public class TEngineSettingsProvider : SettingsProvider
|
||||
public override void OnDeactivate()
|
||||
{
|
||||
base.OnDeactivate();
|
||||
SaveAssetData(k_SettingsPath);
|
||||
SaveAssetData(m_SettingsPath);
|
||||
}
|
||||
|
||||
|
||||
void SaveAssetData(string path)
|
||||
{
|
||||
TEngineSettings old = AssetDatabase.LoadAssetAtPath<TEngineSettings>(k_SettingsPath);
|
||||
TEngineSettings old = AssetDatabase.LoadAssetAtPath<TEngineSettings>(m_SettingsPath);
|
||||
TEngineSettings data = ScriptableObject.CreateInstance<TEngineSettings>();
|
||||
data.Set(old.FrameworkGlobalSettings, old.BybridCLRCustomGlobalSettings);
|
||||
AssetDatabase.DeleteAsset(path);
|
||||
AssetDatabase.CreateAsset(data, path);
|
||||
AssetDatabase.CreateAsset(data, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
Reference in New Issue
Block a user