private static Font LoadFontAtPlay(string fontId) { var font = AssetModule.Load <Font>(fontId); if (font == null) { Debug.LogError($"目标字体{fontId}不存在!"); return(null); } fontCaches.Add(fontId, font); return(font); }
private object LoadModelAtPlay(string logicId) { if (rxModels.ContainsKey(logicId)) { var targetModel = rxModels[logicId]; return(targetModel); } var app = ProjectInfoDati.GetActualInstance(); var type = GetRxModelType(app.DevelopProjectName, logicId); var finalId = logicId ?? type.Name; finalId += "_RxModel"; if (finalId.Contains("@")) { finalId = finalId.Replace("@", "_") .Replace("=", "_"); } var assetId = app.DevelopProjectName + "_" + finalId; TextAsset textAsset = null; try { textAsset = AssetModule.Load <TextAsset>(assetId); } catch (Exception e) { #if DEBUG Debug.LogError(e.Message + e.StackTrace); #endif } if (textAsset == null) { var newModel = Activator.CreateInstance(type); return(newModel); } var instance = UnityEngine.JsonUtility.FromJson(textAsset.text, type); return(instance); }