- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using UnityEngine;
|
||
using XFramework;
|
||
using XFramework.Objects;
|
||
|
||
/// <summary>
|
||
/// 根据名称通过对象池生成一个Resources下的 Prefab
|
||
/// </summary>
|
||
public class ResourcesCreater
|
||
{
|
||
/// <summary>
|
||
/// 创建一个预制件 默认加入对象池
|
||
/// </summary>
|
||
/// <param name="prefabName">预制件名称</param>
|
||
/// <param name="usePool">是否加入对象池</param>
|
||
/// <returns></returns>
|
||
public static GameObject InstantiatePrefab(string prefabName, bool usePool = true)
|
||
{
|
||
string path = ResourcesManager.GetPath(prefabName);
|
||
if (!string.IsNullOrEmpty(path))
|
||
{
|
||
if (usePool)
|
||
return ObjectPool.Instance.Instantiate(Resources.Load<GameObject>(path));
|
||
else
|
||
return GameObject.Instantiate(Resources.Load<GameObject>(path));
|
||
}
|
||
else
|
||
{
|
||
Debug.LogError($"未查询到名称为{prefabName}资源的具体路径,需检查是否存在该资源并更新了ResMap!");
|
||
return null;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 创建一个预制件
|
||
/// </summary>
|
||
/// <param name="prefabName">预制件名称</param>
|
||
/// <param name="transform">parentTrans</param>
|
||
/// <param name="usePool">是否加入对象池</param>
|
||
/// <returns></returns>
|
||
public static GameObject InstantiatePrefab(string prefabName, Transform transform, bool usePool = true)
|
||
{
|
||
string path = ResourcesManager.GetPath(prefabName);
|
||
if (!string.IsNullOrEmpty(path))
|
||
{
|
||
if (usePool)
|
||
return ObjectPool.Instance.Instantiate((GameObject)Resources.Load(path), transform);
|
||
else
|
||
return GameObject.Instantiate(Resources.Load<GameObject>(path), transform);
|
||
}
|
||
else
|
||
{
|
||
Debug.LogError($"未查询到名称为{prefabName}资源的具体路径,需检查是否存在该资源并更新了ResMap!");
|
||
return null;
|
||
}
|
||
}
|
||
}
|