Mono/C#: Add setting to include I18N assemblies in the exported game
This commit is contained in:
parent
ff7e7bd260
commit
59ec19d5a8
1 changed files with 49 additions and 0 deletions
|
@ -17,6 +17,43 @@ namespace GodotTools.Export
|
||||||
{
|
{
|
||||||
public class ExportPlugin : EditorExportPlugin
|
public class ExportPlugin : EditorExportPlugin
|
||||||
{
|
{
|
||||||
|
[Flags]
|
||||||
|
enum I18NCodesets
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
CJK = 1,
|
||||||
|
MidEast = 2,
|
||||||
|
Other = 4,
|
||||||
|
Rare = 8,
|
||||||
|
West = 16,
|
||||||
|
All = CJK | MidEast | Other | Rare | West
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string platform)
|
||||||
|
{
|
||||||
|
var codesets = (I18NCodesets) ProjectSettings.GetSetting("mono/export/i18n_codesets");
|
||||||
|
|
||||||
|
if (codesets == I18NCodesets.None)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir();
|
||||||
|
|
||||||
|
void AddI18NAssembly(string name) => assemblies.Add(name, Path.Combine(bclDir, $"{name}.dll"));
|
||||||
|
|
||||||
|
AddI18NAssembly("I18N");
|
||||||
|
|
||||||
|
if ((codesets & I18NCodesets.CJK) != 0)
|
||||||
|
AddI18NAssembly("I18N.CJK");
|
||||||
|
if ((codesets & I18NCodesets.MidEast) != 0)
|
||||||
|
AddI18NAssembly("I18N.MidEast");
|
||||||
|
if ((codesets & I18NCodesets.Other) != 0)
|
||||||
|
AddI18NAssembly("I18N.Other");
|
||||||
|
if ((codesets & I18NCodesets.Rare) != 0)
|
||||||
|
AddI18NAssembly("I18N.Rare");
|
||||||
|
if ((codesets & I18NCodesets.West) != 0)
|
||||||
|
AddI18NAssembly("I18N.West");
|
||||||
|
}
|
||||||
|
|
||||||
public void RegisterExportSettings()
|
public void RegisterExportSettings()
|
||||||
{
|
{
|
||||||
// TODO: These would be better as export preset options, but that doesn't seem to be supported yet
|
// TODO: These would be better as export preset options, but that doesn't seem to be supported yet
|
||||||
|
@ -24,6 +61,16 @@ namespace GodotTools.Export
|
||||||
GlobalDef("mono/export/include_scripts_content", false);
|
GlobalDef("mono/export/include_scripts_content", false);
|
||||||
GlobalDef("mono/export/export_assemblies_inside_pck", true);
|
GlobalDef("mono/export/export_assemblies_inside_pck", true);
|
||||||
|
|
||||||
|
GlobalDef("mono/export/i18n_codesets", I18NCodesets.All);
|
||||||
|
|
||||||
|
ProjectSettings.AddPropertyInfo(new Godot.Collections.Dictionary
|
||||||
|
{
|
||||||
|
["type"] = Variant.Type.Int,
|
||||||
|
["name"] = "mono/export/i18n_codesets",
|
||||||
|
["hint"] = PropertyHint.Flags,
|
||||||
|
["hint_string"] = "CJK,MidEast,Other,Rare,West"
|
||||||
|
});
|
||||||
|
|
||||||
GlobalDef("mono/export/aot/enabled", false);
|
GlobalDef("mono/export/aot/enabled", false);
|
||||||
GlobalDef("mono/export/aot/full_aot", false);
|
GlobalDef("mono/export/aot/full_aot", false);
|
||||||
|
|
||||||
|
@ -145,6 +192,8 @@ namespace GodotTools.Export
|
||||||
var initialDependencies = dependencies.Duplicate();
|
var initialDependencies = dependencies.Duplicate();
|
||||||
internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, DeterminePlatformBclDir(platform), dependencies);
|
internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, DeterminePlatformBclDir(platform), dependencies);
|
||||||
|
|
||||||
|
AddI18NAssemblies(dependencies, platform);
|
||||||
|
|
||||||
string outputDataDir = null;
|
string outputDataDir = null;
|
||||||
|
|
||||||
if (PlatformHasTemplateDir(platform))
|
if (PlatformHasTemplateDir(platform))
|
||||||
|
|
Loading…
Reference in a new issue