2025-04-26 21:05:13 +08:00
|
|
|
using System;
|
|
|
|
using UnityEngine;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using Newtonsoft.Json;
|
2025-07-13 15:53:13 +08:00
|
|
|
using HK;
|
2025-04-26 21:05:13 +08:00
|
|
|
|
|
|
|
namespace Data
|
|
|
|
{
|
|
|
|
public enum #CLASSNAME#Type{
|
|
|
|
#TYPEITEM#
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public class #CLASSNAME#
|
|
|
|
{
|
|
|
|
#CONSTCONTENT#
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public class #CLASSNAME#s
|
|
|
|
{
|
|
|
|
public List<#CLASSNAME#> #LISTNAME# = new List<#CLASSNAME#>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public class #CLASSNAME#Excel
|
|
|
|
{
|
|
|
|
private const string _fileName = "#FILENAME#";
|
|
|
|
private string _filePath;
|
|
|
|
private #CLASSNAME#s _datas;
|
|
|
|
public #CLASSNAME#s Datas => _datas;
|
|
|
|
|
|
|
|
public #CLASSNAME#Excel()
|
|
|
|
{
|
2025-07-13 15:53:13 +08:00
|
|
|
_filePath = $"Assets/Res/ExcelData/{_fileName}.json";
|
|
|
|
var text = ResourcesManager.Instance.Load<TextAsset>(_filePath);
|
|
|
|
_datas = JsonConvert.DeserializeObject<#CLASSNAME#s>(text.text);
|
2025-04-26 21:05:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public #CLASSNAME# GetData(int id)
|
|
|
|
{
|
|
|
|
foreach (var testData in _datas.#LISTNAME#)
|
|
|
|
{
|
|
|
|
if (id == testData.ID)
|
|
|
|
{
|
|
|
|
return testData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new NullReferenceException();
|
|
|
|
}
|
|
|
|
}}
|