using System; using UnityEngine; using System.Collections.Generic; using System.IO; using Newtonsoft.Json; using HK; namespace Data { public enum AgreementTermsDataType{ Desc_1001 = 1001, SimplifiedChinese_1001 = 1001, English_1001 = 1001, Desc_1002 = 1002, SimplifiedChinese_1002 = 1002, English_1002 = 1002, Desc_1003 = 1003, SimplifiedChinese_1003 = 1003, English_1003 = 1003, Desc_1004 = 1004, SimplifiedChinese_1004 = 1004, English_1004 = 1004, } [System.Serializable] public class AgreementTermsData { /// /// ID /// public int ID; /// /// 描述 /// public string Desc; /// /// 中文 /// public string SimplifiedChinese; /// /// 英文 /// public string English; } [System.Serializable] public class AgreementTermsDatas { public List AgreementTermsList = new List(); } public class AgreementTermsDataExcel { private const string _fileName = "AgreementTerms"; private string _filePath; private AgreementTermsDatas _datas; public AgreementTermsDatas Datas => _datas; public AgreementTermsDataExcel() { _filePath = $"Assets/Res/ExcelData/{_fileName}.json"; var text = ResourcesManager.Instance.Load(_filePath); _datas = JsonConvert.DeserializeObject(text.text); } public AgreementTermsData GetData(int id) { foreach (var testData in _datas.AgreementTermsList) { if (id == testData.ID) { return testData; } } throw new NullReferenceException(); } }}