Code cleanup.

This commit is contained in:
2023-06-22 13:18:34 +08:00
parent 22cb8f0cb4
commit a7aff4d625
8 changed files with 321 additions and 302 deletions

View File

@@ -22,14 +22,6 @@ namespace Cryville.Crtr {
get;
private set;
}
public static readonly string FileProtocolPrefix
#if UNITY_STANDALONE_WIN
= "file:///";
#elif UNITY_ANDROID
= "file://";
#else
#error No file protocol prefix is defined.
#endif
public static IAudioDeviceManager AudioManager;
public static AudioClient AudioClient;
public static SimpleSequencerSource AudioSequencer;
@@ -129,19 +121,10 @@ namespace Cryville.Crtr {
Settings.Default.Save();
Logger.Log("main", 1, "UI", "Initializing font manager");
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
var fontMatcher = new FallbackListFontMatcher(new FontManagerWindows());
fontMatcher.LoadDefaultWindowsFallbackList();
TMPAutoFont.FontMatcher = fontMatcher;
TMPAutoFont.DefaultShader = Resources.Load<Shader>("TextMesh Pro/Shaders/TMP_SDF SSD");
#elif UNITY_ANDROID
var fontMatcher = new FallbackListFontMatcher(new FontManagerAndroid());
fontMatcher.LoadDefaultAndroidFallbackList();
TMPAutoFont.FontMatcher = fontMatcher;
TMPAutoFont.DefaultShader = Resources.Load<Shader>("TextMesh Pro/Shaders/TMP_SDF-Mobile SSD");
#else
#error No font manager initialization logic.
#endif
TMPAutoFont.FontMatcher = new FallbackListFontMatcher(PlatformConfig.FontManager) {
MapScriptToTypefaces = PlatformConfig.ScriptFontMap
};
TMPAutoFont.DefaultShader = Resources.Load<Shader>(PlatformConfig.TextShader);
Logger.Log("main", 1, "Game", "Initialized");
}
@@ -181,5 +164,14 @@ namespace Cryville.Crtr {
}
Logger.Log("main", l, "Internal", "{0}\n{1}", condition, stackTrace);
}
public static void SuspendBackgroundTasks() {
NetworkTaskWorker.SuspendBackgroundTasks();
Dialog.Suppress();
}
public static void ResumeBackgroundTasks() {
Dialog.Release();
NetworkTaskWorker.ResumeBackgroundTasks();
}
}
}