1
0
forked from liza/Questionable

Update source generator

This commit is contained in:
Liza 2024-07-14 22:17:35 +02:00
parent 3800ce8b69
commit c521860851
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 20 additions and 1 deletions

View File

@ -346,6 +346,8 @@ public class QuestSourceGenerator : ISourceGenerator
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.KillEnemyDataIds), step.KillEnemyDataIds)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(QuestStep.ComplexCombatData), step.ComplexCombatData)
.AsSyntaxNodeOrToken(),
Assignment(nameof(QuestStep.JumpDestination), step.JumpDestination,
emptyStep.JumpDestination)
.AsSyntaxNodeOrToken(),

View File

@ -162,7 +162,24 @@ public static class RoslynShortcuts
else
throw new Exception($"Unsupported ExcelRef type {excelRef.Type}");
}
else if (value is null)
else if (value is ComplexCombatData complexCombatData)
{
return ObjectCreationExpression(
IdentifierName(nameof(ComplexCombatData)))
.WithInitializer(
InitializerExpression(
SyntaxKind.ObjectInitializerExpression,
SeparatedList<ExpressionSyntax>(
SyntaxNodeList(
Assignment(nameof(ComplexCombatData.DataId), complexCombatData.DataId, default(uint))
.AsSyntaxNodeOrToken(),
Assignment(nameof(ComplexCombatData.RewardItemId), complexCombatData.RewardItemId, null)
.AsSyntaxNodeOrToken(),
Assignment(nameof(ComplexCombatData.RewardItemCount), complexCombatData.RewardItemCount, null)
.AsSyntaxNodeOrToken(),
AssignmentList(nameof(ComplexCombatData.CompletionQuestVariablesFlags), complexCombatData.CompletionQuestVariablesFlags)
.AsSyntaxNodeOrToken()))));
}else if (value is null)
return LiteralExpression(SyntaxKind.NullLiteralExpression);
else
throw new Exception($"Unsupported data type {value.GetType()} = {value}");