32 lines
941 B
C#
32 lines
941 B
C#
using System.IO;
|
|
using Newtonsoft.Json;
|
|
using UnityEngine;
|
|
|
|
namespace ZC
|
|
{
|
|
internal class TaskListManager : ManagerBase<TaskListManager>
|
|
{
|
|
private TaskListDatas _datas;
|
|
public TaskListDatas Datas => _datas;
|
|
|
|
public override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
// string filePath = $"{Application.dataPath}/DemoGame/GameRes/Config/TaskListData.json";
|
|
var textAsset =
|
|
ResourcesLocalComponent.Instance.LoadAssetSync<TextAsset>(AssetConst
|
|
.Assets_DemoGame_GameRes_UIPanel_UIBattle_prefab);
|
|
|
|
// var json = File.ReadAllText(textAsset.text);
|
|
var datas = JsonConvert.DeserializeObject<TaskListDatas>(textAsset.text);
|
|
_datas = datas;
|
|
_datas.Init();
|
|
}
|
|
|
|
public void SetState(string title, TaskListType type)
|
|
{
|
|
_datas.SetState(title, type);
|
|
}
|
|
}
|
|
} |