mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-17 17:34:34 +08:00
stash
This commit is contained in:
parent
3fd97cce1f
commit
b86bfeff1a
@ -100,7 +100,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
IEnumerable<(IComponentTemplate template, ITypeMeta meta)> itemMetaPairs = ComponentTemplateTypeCache.Dummies.ToArray().Select(dummy =>
|
||||
{
|
||||
ITypeMeta meta;
|
||||
if (dummy is IComponentTemplateWithMetaOverride withMetaOverride)
|
||||
if (dummy is ITypeMeta withMetaOverride)
|
||||
{
|
||||
meta = withMetaOverride;
|
||||
}
|
||||
|
@ -141,12 +141,12 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
}
|
||||
_serializableTypes = serializableTypes.ToArray();
|
||||
_entityEditorBlockDrawers = entityEditorBlockDrawers.ToArray();
|
||||
_serializableTypeWithMetaIDMetas = serializableTypes
|
||||
_serializableTypeWithMetaIDs = serializableTypes
|
||||
.Where(TypeMeta.IsHasMetaID)
|
||||
.Select(type => type.ToMeta())
|
||||
.ToArray();
|
||||
|
||||
foreach (var item in _serializableTypeWithMetaIDMetas)
|
||||
foreach (var item in _serializableTypeWithMetaIDs)
|
||||
{
|
||||
_metaIDTypePairs[item.MetaID] = item.Type;
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
||||
internal static readonly Assembly _integrationAssembly;
|
||||
internal static readonly Type[] _serializableTypes;
|
||||
internal static readonly EntityEditorBlockDrawer[] _entityEditorBlockDrawers;
|
||||
internal static readonly TypeMeta[] _serializableTypeWithMetaIDMetas;
|
||||
internal static readonly TypeMeta[] _serializableTypeWithMetaIDs;
|
||||
private static readonly Dictionary<string, Type> _metaIDTypePairs = new Dictionary<string, Type>();
|
||||
|
||||
public static bool TryGetTypeForMetaID(string metaID, out Type type)
|
||||
|
@ -32,10 +32,9 @@ namespace DCFApixels.DragonECS
|
||||
Selected
|
||||
}
|
||||
}
|
||||
public interface IComponentTemplateWithMetaOverride : IComponentTemplate, ITypeMeta { }
|
||||
|
||||
[Serializable]
|
||||
public abstract class ComponentTemplateBase : IComponentTemplateWithMetaOverride
|
||||
public abstract class ComponentTemplateBase : IComponentTemplate, ITypeMeta
|
||||
{
|
||||
#region Properties
|
||||
public abstract Type Type { get; }
|
||||
|
8
src/Tools/ComponentTamplateGenerator.meta
Normal file
8
src/Tools/ComponentTamplateGenerator.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8935338c08d47e745ad09f788caea516
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
src/Tools/ComponentTamplateGenerator/CodeTemplates.meta
Normal file
8
src/Tools/ComponentTamplateGenerator/CodeTemplates.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cadcdafa2e78b9c4c90de49ae46c973e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,7 @@
|
||||
namespace DCFApixels.DragonECS.Unity.Generated
|
||||
{
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaGroup("<GENERATED>")]
|
||||
[MetaName(#NAME#)]
|
||||
internal class Template_#GUID# : ComponentTemplate<#TYPE_NAMESPACE#.#TYPE#> { }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9abfee9812ed09d4b91226c59c299a29
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,7 @@
|
||||
namespace DCFApixels.DragonECS.Unity.Generated
|
||||
{
|
||||
[MetaTags(MetaTags.HIDDEN)]
|
||||
[MetaGroup("<GENERATED>")]
|
||||
[MetaName(#NAME#)]
|
||||
internal class Template_#GUID# : TagComponentTemplate<#TYPE_NAMESPACE#.#TYPE#> { }
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d6b6bbb28b605a4bacbef5a07af3f16
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
73
src/Tools/ComponentTamplateGenerator/Generator.cs
Normal file
73
src/Tools/ComponentTamplateGenerator/Generator.cs
Normal file
@ -0,0 +1,73 @@
|
||||
#if UNITY_EDITOR
|
||||
using DCFApixels.DragonECS;
|
||||
using DCFApixels.DragonECS.Unity;
|
||||
using DCFApixels.DragonECS.Unity.Editors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Compilation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DCFApixels.DragonECS.Unity.Editors
|
||||
{
|
||||
internal static class Generator
|
||||
{
|
||||
private const string PATH = "Assets/Generated/" + EcsUnityConsts.UNITY_PACKAGE_NAME;
|
||||
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
public static void OnLoad()
|
||||
{
|
||||
CompilationPipeline.compilationStarted -= CompilationPipeline_compilationStarted;
|
||||
CompilationPipeline.compilationStarted += CompilationPipeline_compilationStarted;
|
||||
CompilationPipeline.compilationFinished -= CompilationPipeline_compilationFinished;
|
||||
CompilationPipeline.compilationFinished += CompilationPipeline_compilationFinished;
|
||||
}
|
||||
|
||||
private static void CompilationPipeline_compilationStarted(object obj)
|
||||
{
|
||||
Debug.Log("compilationStarted");
|
||||
}
|
||||
private static void CompilationPipeline_compilationFinished(object obj)
|
||||
{
|
||||
Debug.Log("compilationFinished");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void OnCompilationFinished(object obj)
|
||||
{
|
||||
if (EditorUtility.scriptCompilationFailed)
|
||||
{
|
||||
CleanupFail();
|
||||
}
|
||||
|
||||
|
||||
var componentMetas = UnityEditorUtility._serializableTypeWithMetaIDs.Where(o => o.IsComponent);
|
||||
}
|
||||
|
||||
private static void CleanupFail()
|
||||
{
|
||||
var guids = FindGeneratedAssets();
|
||||
}
|
||||
private static string[] FindGeneratedAssets()
|
||||
{
|
||||
string[] guids = AssetDatabase.FindAssets($" t:MonoScript", new[] { PATH });
|
||||
return guids;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static void Generate(IEnumerable<TypeMeta> types)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
11
src/Tools/ComponentTamplateGenerator/Generator.cs.meta
Normal file
11
src/Tools/ComponentTamplateGenerator/Generator.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b862679ef65a6f24ab1ac3cba1fc9b46
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -55,7 +55,7 @@ namespace DCFApixels.DragonECS.Unity.RefRepairer.Editors
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
var typeMetas = UnityEditorUtility._serializableTypeWithMetaIDMetas;
|
||||
var typeMetas = UnityEditorUtility._serializableTypeWithMetaIDs;
|
||||
foreach (var meta in typeMetas)
|
||||
{
|
||||
var key = new TypeData(meta.Type);
|
||||
|
Loading…
Reference in New Issue
Block a user