Skip to content

Commit

Permalink
Merge branch 'focus-creative-games:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
absences authored Dec 20, 2024
2 parents 89841a9 + f8a5fd6 commit e3aacb3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
14 changes: 14 additions & 0 deletions src/Luban.Core/Defs/DefAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ public bool TryGetVariantName(string variantKey, out string variantName)
return _variants.TryGetValue(variantKey, out variantName);
}

public bool TryGetVariantNameOrDefault(string variantKey, out string variantName)
{
if (_variants == null)
{
variantName = "";
return false;
}
if (_variants.TryGetValue(variantKey, out variantName))
{
return true;
}
return _variants.TryGetValue("default", out variantName);
}

public DefAssembly(RawAssembly assembly, string target, List<string> outputTables, List<RawGroup> groupDefs, Dictionary<string, string> variants)
{
_targets = assembly.Targets;
Expand Down
2 changes: 1 addition & 1 deletion src/Luban.Core/Defs/DefField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Compile()
if (Variants != null && Variants.Count > 0)
{
string variantKey = $"{HostType.FullName}.{Name}";
if (HostType.Assembly.TryGetVariantName(variantKey, out var variantName))
if (HostType.Assembly.TryGetVariantNameOrDefault(variantKey, out var variantName))
{
if (!Variants.Contains(variantName))
{
Expand Down
12 changes: 7 additions & 5 deletions src/Luban/Luban.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackAsTool>True</PackAsTool>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>3.10.0</Version>
<Version>3.11.0</Version>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Plugin\**" />
<EmbeddedResource Remove="Plugin\**" />
<None Remove="Plugin\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="YamlDotNet.NetCore" Version="1.0.0" />
Expand Down Expand Up @@ -64,10 +70,6 @@
<ProjectReference Include="..\Luban.Typescript\Luban.Typescript.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Plugin\" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
Expand Down

0 comments on commit e3aacb3

Please sign in to comment.