mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 00:08:53 -05:00
Change: DisplayName of field with ShowAlchemySerializationData
This commit is contained in:
parent
d9c9f4f809
commit
af4832ea10
@ -153,9 +153,8 @@ namespace Alchemy.SourceGenerator
|
|||||||
var typeGenerics = typeSymbol.IsGenericType
|
var typeGenerics = typeSymbol.IsGenericType
|
||||||
? "<" + string.Join(", ", typeSymbol.TypeParameters.Select(x => x.Name)) + ">"
|
? "<" + string.Join(", ", typeSymbol.TypeParameters.Select(x => x.Name)) + ">"
|
||||||
: "";
|
: "";
|
||||||
|
var displayName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).Replace("global::", "");
|
||||||
var alchemySerializationDataName = typeSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
|
var alchemySerializationDataName = displayName.Replace(".", "_");
|
||||||
.Replace("global::", "").Replace(".", "_");
|
|
||||||
alchemySerializationDataName ="__alchemySerializationData_"+ ReplaceGenericsToCount(alchemySerializationDataName,genericsCount) ;
|
alchemySerializationDataName ="__alchemySerializationData_"+ ReplaceGenericsToCount(alchemySerializationDataName,genericsCount) ;
|
||||||
|
|
||||||
var inheritedOnBeforeSerialize = hasInheritedImplementation
|
var inheritedOnBeforeSerialize = hasInheritedImplementation
|
||||||
@ -171,9 +170,9 @@ namespace Alchemy.SourceGenerator
|
|||||||
or "Alchemy.Serialization.ShowAlchemySerializationDataAttribute");
|
or "Alchemy.Serialization.ShowAlchemySerializationDataAttribute");
|
||||||
|
|
||||||
var serializationDataAttributesCode = hasShowSerializationData
|
var serializationDataAttributesCode = hasShowSerializationData
|
||||||
? "[global::Alchemy.Inspector.ReadOnly, global::UnityEngine.TextArea(3, 999), global::UnityEngine.SerializeField]"
|
? $"[global::Alchemy.Inspector.LabelText(\"Alchemy Serialization Data ({displayName})\"),global::Alchemy.Inspector.ReadOnly, global::UnityEngine.TextArea(3, 999), global::UnityEngine.SerializeField]"
|
||||||
: "[global::UnityEngine.HideInInspector, global::UnityEngine.SerializeField]";
|
: "[global::UnityEngine.HideInInspector, global::UnityEngine.SerializeField]";
|
||||||
|
|
||||||
// target class namespace
|
// target class namespace
|
||||||
var ns = typeSymbol.ContainingNamespace.IsGlobalNamespace
|
var ns = typeSymbol.ContainingNamespace.IsGlobalNamespace
|
||||||
? string.Empty
|
? string.Empty
|
||||||
|
Binary file not shown.
@ -1,11 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using Alchemy.Serialization;
|
using Alchemy.Serialization;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Test
|
||||||
[AlchemySerialize]
|
|
||||||
public partial class InheritedSerializeTest : InheritedSerializeTestBase<string>
|
|
||||||
{
|
{
|
||||||
[AlchemySerializeField, NonSerialized] int? nullableInt;
|
[ShowAlchemySerializationData]
|
||||||
|
[AlchemySerialize]
|
||||||
|
public partial class InheritedSerializeTest : InheritedSerializeTestBase<string>
|
||||||
|
{
|
||||||
|
[AlchemySerializeField, NonSerialized] int? nullableInt;
|
||||||
|
}
|
||||||
}
|
}
|
@ -3,11 +3,10 @@ using System.Collections.Generic;
|
|||||||
using Alchemy.Serialization;
|
using Alchemy.Serialization;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
[ShowAlchemySerializationData]
|
||||||
[AlchemySerialize]
|
[AlchemySerialize]
|
||||||
public partial class InheritedSerializeTestBase<T> : MonoBehaviour
|
public partial class InheritedSerializeTestBase<T> : MonoBehaviour
|
||||||
{
|
{
|
||||||
[AlchemySerializeField, NonSerialized] HashSet<T> set;
|
[AlchemySerializeField, NonSerialized] HashSet<T> set;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user