Skip to content

Commit

Permalink
Upgrade to latest DesperateDevs
Browse files Browse the repository at this point in the history
  • Loading branch information
sschmid committed Jul 7, 2023
1 parent 3d59acf commit e3fe88e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/Entitas.CodeGeneration.Plugins/ComponentData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public ComponentData(CodeGeneratorData data) : base(data) { }
public static class ComponentDataExtension
{
public static string ToComponentName(this string fullTypeName, bool ignoreNamespaces) => ignoreNamespaces
? fullTypeName.ShortTypeName().RemoveComponentSuffix()
? fullTypeName.TypeName().RemoveComponentSuffix()
: fullTypeName.RemoveDots().RemoveComponentSuffix();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ string[] getComponentNames(Type type)
.SingleOrDefault();

if (attr == null)
return new[] {type.ToCompilableString().ShortTypeName().AddComponentSuffix()};
return new[] {type.ToCompilableString().TypeName().AddComponentSuffix()};

return attr.componentNames;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ EntityIndexData createCustomEntityIndexData(Type type)
data.IsCustom(true);
data.SetEntityIndexName(type.ToCompilableString().RemoveDots());
data.SetHasMultiple(false);
data.SetContextNames(new[] {attribute.contextType.ToCompilableString().ShortTypeName().RemoveContextSuffix()});
data.SetContextNames(new[] {attribute.contextType.ToCompilableString().TypeName().RemoveContextSuffix()});

var getMethods = type
.GetMethods(BindingFlags.Public | BindingFlags.Instance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ string[] getComponentNames(INamedTypeSymbol type)
{
var attr = type.GetAttribute<ComponentNameAttribute>();
if (attr == null)
return new[] {type.ToCompilableString().ShortTypeName().AddComponentSuffix()};
return new[] {type.ToCompilableString().TypeName().AddComponentSuffix()};

return attr.ConstructorArguments.First().Values.Select(arg => (string)arg.Value).ToArray();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ EntityIndexData createCustomEntityIndexData(INamedTypeSymbol type)
{
((INamedTypeSymbol)attribute.ConstructorArguments.First().Value)
.ToCompilableString()
.ShortTypeName()
.TypeName()
.RemoveContextSuffix()
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Array drawAddElement(Array array, string memberName, Type elementType)
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField(memberName, "empty");
if (EditorLayout.MiniButton($"add {elementType.ToCompilableString().ShortTypeName()}"))
if (EditorLayout.MiniButton($"add {elementType.ToCompilableString().TypeName()}"))
{
if (EntityDrawer.CreateDefault(elementType, out var defaultValue))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public object DrawAndGetNewValue(Type memberType, string memberName, object valu
EditorGUILayout.LabelField(memberName);
}

var keyTypeName = keyType.ToCompilableString().ShortTypeName();
var valueTypeName = valueType.ToCompilableString().ShortTypeName();
var keyTypeName = keyType.ToCompilableString().TypeName();
var valueTypeName = valueType.ToCompilableString().TypeName();
if (EditorLayout.MiniButton($"new <{keyTypeName}, {valueTypeName}>"))
if (EntityDrawer.CreateDefault(keyType, out var defaultKey))
if (EntityDrawer.CreateDefault(valueType, out var defaultValue))
Expand Down
12 changes: 6 additions & 6 deletions src/Entitas.VisualDebugging.Unity.Editor/EntityDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static bool DrawObjectMember(Type memberType, string memberName, object v
else
EditorGUILayout.LabelField(memberName, "null");

if (EditorLayout.MiniButton($"new {memberType.ToCompilableString().ShortTypeName()}"))
if (EditorLayout.MiniButton($"new {memberType.ToCompilableString().TypeName()}"))
{
if (CreateDefault(memberType, out var defaultValue))
setValue(target, defaultValue);
Expand Down Expand Up @@ -384,10 +384,10 @@ public static void GenerateIDefaultInstanceCreator(string typeName)
var preferences = new Preferences("Entitas.properties", $"{Environment.UserName}.userproperties");
var config = preferences.CreateAndConfigure<VisualDebuggingConfig>();
var folder = config.defaultInstanceCreatorFolderPath;
var filePath = folder + Path.DirectorySeparatorChar + "Default" + typeName.ShortTypeName() + "InstanceCreator.cs";
var filePath = folder + Path.DirectorySeparatorChar + "Default" + typeName.TypeName() + "InstanceCreator.cs";
var template = DEFAULT_INSTANCE_CREATOR_TEMPLATE_FORMAT
.Replace("${Type}", typeName)
.Replace("${ShortType}", typeName.ShortTypeName());
.Replace("${ShortType}", typeName.TypeName());
generateTemplate(folder, filePath, template);
}

Expand All @@ -396,16 +396,16 @@ public static void GenerateITypeDrawer(string typeName)
var preferences = new Preferences("Entitas.properties", $"{Environment.UserName}.userproperties");
var config = preferences.CreateAndConfigure<VisualDebuggingConfig>();
var folder = config.typeDrawerFolderPath;
var filePath = folder + Path.DirectorySeparatorChar + typeName.ShortTypeName() + "TypeDrawer.cs";
var filePath = folder + Path.DirectorySeparatorChar + typeName.TypeName() + "TypeDrawer.cs";
var template = TYPE_DRAWER_TEMPLATE_FORMAT
.Replace("${Type}", typeName)
.Replace("${ShortType}", typeName.ShortTypeName());
.Replace("${ShortType}", typeName.TypeName());
generateTemplate(folder, filePath, template);
}

static void generateTemplate(string folder, string filePath, string template)
{
if (!Directory.Exists(folder))
if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);

File.WriteAllText(filePath, template);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public object DrawAndGetNewValue(Type memberType, string memberName, object valu
else
EditorGUILayout.LabelField(memberName);

if (EditorLayout.MiniButton($"new {elementType.ToCompilableString().ShortTypeName()}"))
if (EditorLayout.MiniButton($"new {elementType.ToCompilableString().TypeName()}"))
if (EntityDrawer.CreateDefault(elementType, out var defaultValue))
itemsToAdd.Add(defaultValue);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Entitas.VisualDebugging.Unity.Editor/ListTypeDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ IList drawAddElement(IList list, string memberName, Type elementType)
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.LabelField(memberName, "empty");
if (EditorLayout.MiniButton($"add {elementType.ToCompilableString().ShortTypeName()}"))
if (EditorLayout.MiniButton($"add {elementType.ToCompilableString().TypeName()}"))
if (EntityDrawer.CreateDefault(elementType, out var defaultValue))
list.Add(defaultValue);
}
Expand Down

0 comments on commit e3fe88e

Please sign in to comment.