Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
92 lines
2.1 KiB
C#
92 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using Cute;
|
|
using UnityEngine;
|
|
|
|
public class FontChanger
|
|
{
|
|
public void Start()
|
|
{
|
|
}
|
|
|
|
public static IEnumerator FontChange(Action callback)
|
|
{
|
|
string font = getFont();
|
|
string text = "font_" + font + ".unity3d";
|
|
bool isDone = false;
|
|
string filename = text.ToLower();
|
|
Toolbox.AssetManager.CacheAsset(filename, delegate
|
|
{
|
|
AssetHandle assetHandle = Toolbox.AssetManager.GetAssetHandle(filename);
|
|
if (assetHandle != null)
|
|
{
|
|
assetHandle.isMultipleHandleIgnorAsset = true;
|
|
}
|
|
isDone = true;
|
|
});
|
|
while (!isDone)
|
|
{
|
|
yield return 0;
|
|
}
|
|
Global.GAME_FONT = Toolbox.ResourcesManager.LoadObject<Font>("Font/" + font);
|
|
if (Global.GAME_FONT != null)
|
|
{
|
|
Global.GAME_FONT_NAME = font;
|
|
}
|
|
callback?.Invoke();
|
|
}
|
|
|
|
public static IEnumerator FontTryChangePersistant(Action callback)
|
|
{
|
|
string font = getFont();
|
|
string text = "font_" + font + ".unity3d";
|
|
bool isDone = false;
|
|
bool isHandle = false;
|
|
string filename = text.ToLower();
|
|
Toolbox.AssetManager.CachePersistantAssetBeforeManifestLoad(filename, delegate
|
|
{
|
|
AssetHandle assetHandle = Toolbox.AssetManager.GetAssetHandle(filename);
|
|
if (assetHandle != null)
|
|
{
|
|
assetHandle.isMultipleHandleIgnorAsset = true;
|
|
Toolbox.ResourcesManager.RegistTemporaryAsset(filename);
|
|
isHandle = true;
|
|
}
|
|
isDone = true;
|
|
});
|
|
while (!isDone)
|
|
{
|
|
yield return 0;
|
|
}
|
|
if (isHandle)
|
|
{
|
|
Global.GAME_FONT = Toolbox.ResourcesManager.LoadObject<Font>("Font/" + font);
|
|
}
|
|
else
|
|
{
|
|
Global.GAME_FONT = null;
|
|
}
|
|
if (Global.GAME_FONT != null)
|
|
{
|
|
Global.GAME_FONT_NAME = font;
|
|
}
|
|
else
|
|
{
|
|
Toolbox.AssetManager.ClearAssetCacheAssetBundle();
|
|
Global.GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold";
|
|
}
|
|
callback?.Invoke();
|
|
}
|
|
|
|
public static void FontReset()
|
|
{
|
|
Global.GAME_FONT = null;
|
|
Global.GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold";
|
|
}
|
|
|
|
private static string getFont()
|
|
{
|
|
return Toolbox.SavedataManager.GetString("LANG_FONT", Global.GetFontLangType(Global.LANG_TYPE.Eng.ToString()));
|
|
}
|
|
}
|