Add fallback settings to CSharp

This commit is contained in:
ExMatics HydrogenC
2023-11-30 23:12:56 +08:00
parent d3840bb1f3
commit cdbe59a3fb
54 changed files with 357 additions and 273 deletions

View File

@@ -171,8 +171,10 @@ namespace FlaxEditor.Options
get => _outputLogFont;
set
{
if (value == null || !value.Font)
_outputLogFont = new FontReference(ConsoleFont, 10);
if (value == null)
_outputLogFont = new FontReference(FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont), 10);
else if (!value.Font)
_outputLogFont.Font = FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.InconsolataRegularFont);
else
_outputLogFont = value;
}
@@ -234,30 +236,34 @@ namespace FlaxEditor.Options
[EditorDisplay("Cook & Run"), EditorOrder(500)]
public int NumberOfGameClientsToLaunch = 1;
private static FontAsset[] DefaultFonts =>
[FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont),
FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.CjkFont)];
private static FontAsset DefaultFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont);
private static FontAsset ConsoleFont => FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.PrimaryFont);
private MultiFontReference _titleFont = new MultiFontReference(DefaultFonts, 18);
private MultiFontReference _largeFont = new MultiFontReference(DefaultFonts, 14);
private MultiFontReference _mediumFont = new MultiFontReference(DefaultFonts, 9);
private MultiFontReference _smallFont = new MultiFontReference(DefaultFonts, 9);
private FontReference _titleFont = new FontReference(DefaultFont, 18);
private FontReference _largeFont = new FontReference(DefaultFont, 14);
private FontReference _mediumFont = new FontReference(DefaultFont, 9);
private FontReference _smallFont = new FontReference(DefaultFont, 9);
private FontReference _outputLogFont = new FontReference(ConsoleFont, 10);
/// <summary>
/// The fallback fonts.
/// </summary>
public FontAsset[] Fallbacks = [FlaxEngine.Content.LoadAsyncInternal<FontAsset>(EditorAssets.CjkFont)];
/// <summary>
/// Gets or sets the title font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(600), Tooltip("The title font for editor UI.")]
public MultiFontReference TitleFont
public FontReference TitleFont
{
get => _titleFont;
set
{
if (value == null || !value.Verify())
_titleFont = new MultiFontReference(DefaultFonts, 18);
if (value == null)
_titleFont = new FontReference(DefaultFont, 18);
else if (!value.Font)
_titleFont.Font = DefaultFont;
else
_titleFont = value;
}
@@ -267,13 +273,15 @@ namespace FlaxEditor.Options
/// Gets or sets the large font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(610), Tooltip("The large font for editor UI.")]
public MultiFontReference LargeFont
public FontReference LargeFont
{
get => _largeFont;
set
{
if (value == null || !value.Verify())
_largeFont = new MultiFontReference(DefaultFonts, 14);
if (value == null)
_largeFont = new FontReference(DefaultFont, 14);
else if (!value.Font)
_largeFont.Font = DefaultFont;
else
_largeFont = value;
}
@@ -283,13 +291,15 @@ namespace FlaxEditor.Options
/// Gets or sets the medium font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(620), Tooltip("The medium font for editor UI.")]
public MultiFontReference MediumFont
public FontReference MediumFont
{
get => _mediumFont;
set
{
if (value == null || !value.Verify())
_mediumFont = new MultiFontReference(DefaultFonts, 9);
if (value == null)
_mediumFont = new FontReference(DefaultFont, 9);
else if (!value.Font)
_mediumFont.Font = DefaultFont;
else
_mediumFont = value;
}
@@ -299,13 +309,15 @@ namespace FlaxEditor.Options
/// Gets or sets the small font for editor UI.
/// </summary>
[EditorDisplay("Fonts"), EditorOrder(630), Tooltip("The small font for editor UI.")]
public MultiFontReference SmallFont
public FontReference SmallFont
{
get => _smallFont;
set
{
if (value == null || !value.Verify())
_smallFont = new MultiFontReference(DefaultFonts, 9);
if (value == null)
_smallFont = new FontReference(DefaultFont, 9);
else if (!value.Font)
_smallFont.Font = DefaultFont;
else
_smallFont = value;
}