TheInitialProject/Assets/Scripts/UI/UIMgr/UIMgrPath.cs
2024-10-23 16:59:02 +08:00

54 lines
1.3 KiB
C#

using UnityEngine;
using System;
using System.Collections.Generic;
using UnityEditor;
using Game;
using CaoCao.Resources;
using System.IO;
using Game.HotFix;
using CaoCao.XAsset;
public class UIMgrPath : ScriptableObject
{
/// <summary>
/// 所有UI预制体路径
/// </summary>
public List<UIPath> mAllUIPath = new List<UIPath>();
[System.Serializable]
public struct UIPath
{
/// <summary>
/// UI名
/// </summary>
public string mUIName;
/// <summary>
/// UI路径
/// </summary>
public string mUIPath;
}
/// <summary>
/// 同步获取
/// </summary>
/// <param name="_callBack"></param>
public static Dictionary<string, string> GetDic()
{
Dictionary<string, string> retDic = new Dictionary<string, string>();
//TextAsset ta = (TextAsset)HotfixEntry.Resources.LoadAsset(UIMgr.UIPathConfigFile);
TextAsset ta = HotfixEntry.Resources.Load<TextAsset>(UIMgr.UIPathConfigFile);
if (ta == null)
{
Debug.LogError("请先生成UI路径文件. 菜单/UI工具/生成UI预制体路径文件");
return retDic;
}
string xxxFile2Str = ta.text;
retDic = CaoCao.LitJson.JsonMapper.ToObject<Dictionary<string, string>>(xxxFile2Str);
return retDic;
}
}