Skip to content

Commit

Permalink
Fixed multiword enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsDeltin committed Jun 21, 2019
1 parent 2f935aa commit 21306c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Deltinteger/Deltinteger/Elements/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ public class A_BigMessage : Element {}
[Parameter("Variable", typeof(Variable))]
[Parameter("Destination", ValueType.Any, typeof(V_Number))]
[Parameter("Rate", ValueType.Number, typeof(V_Number))]
[Parameter("Variable", typeof(ChaseReevaluation))]
[Parameter("Reevaluation", typeof(RateChaseReevaluation))]
public class A_ChaseGlobalVariableAtRate : Element {}

[ElementData("Chase Global Variable Over Time")]
[Parameter("Variable", typeof(Variable))]
[Parameter("Destination", ValueType.Any, typeof(V_Number))]
[Parameter("Duration", ValueType.Number, typeof(V_Number))]
[Parameter("Variable", typeof(ChaseReevaluation))]
[Parameter("Reevaluation", typeof(TimeChaseReevaluation))]
public class A_ChaseGlobalVariableOverTime : Element {}

[ElementData("Chase Player Variable At Rate")]
[Parameter("Variable", typeof(Variable))]
[Parameter("Destination", ValueType.Any, typeof(V_Number))]
[Parameter("Rate", ValueType.Number, typeof(V_Number))]
[Parameter("Variable", typeof(ChaseReevaluation))]
[Parameter("Reevaluation", typeof(RateChaseReevaluation))]
public class A_ChasePlayerVariableAtRate : Element {}

[ElementData("Chase Player Variable Over Time")]
[Parameter("Variable", typeof(Variable))]
[Parameter("Destination", ValueType.Any, typeof(V_Number))]
[Parameter("Duration", ValueType.Number, typeof(V_Number))]
[Parameter("Variable", typeof(ChaseReevaluation))]
[Parameter("Reevaluation", typeof(TimeChaseReevaluation))]
public class A_ChasePlayerVariableOverTime : Element {}

[ElementData("Clear Status")]
Expand Down
15 changes: 10 additions & 5 deletions Deltinteger/Deltinteger/Elements/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,14 @@ public static Element Special(EnumMember enumMember)
}

public string CodeName { get; private set; }
public string WorkshopName { get; private set; }
public EnumMember[] Members { get; private set; }
public Type Type { get; private set; }
public Type UnderlyingType { get; private set; }

public EnumData(Type type)
{
EnumOverride data = type.GetCustomAttribute<EnumOverride>();
CodeName = data?.CodeName ?? type.Name;
WorkshopName = data?.WorkshopName ?? type.Name;
CodeName = data?.CodeName ?? type.Name;

Type = type;
UnderlyingType = Enum.GetUnderlyingType(type);
Expand All @@ -122,7 +120,7 @@ public EnumData(Type type)
{
EnumOverride fieldData = fields[v].GetCustomAttribute<EnumOverride>();
string fieldCodeName = fieldData?.CodeName ?? fields[v].Name;
string fieldWorkshopName = fieldData?.WorkshopName ?? fields[v].Name;
string fieldWorkshopName = fieldData?.WorkshopName ?? Extras.AddSpacesToSentence(fields[v].Name, false);

Members[v] = new EnumMember(this, fieldCodeName, fieldWorkshopName, values.GetValue(v));
}
Expand Down Expand Up @@ -338,12 +336,19 @@ public enum ContraryMotion
}

[EnumParameter]
public enum ChaseReevaluation
public enum RateChaseReevaluation
{
DestinationAndRate,
None
}

[EnumParameter]
public enum TimeChaseReevaluation
{
DestinationAndDuration,
None
}

[EnumParameter]
public enum Status
{
Expand Down

0 comments on commit 21306c3

Please sign in to comment.