2025-07-02 10:24:01 +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-07-02 10:24:01 +08:00
|
|
|
|
|
|
|
namespace Data
|
|
|
|
{
|
|
|
|
public enum InventoryDataType{
|
|
|
|
Description_1001 = 1001,
|
|
|
|
Color_1001 = 1001,
|
|
|
|
Lint_1001 = 1001,
|
|
|
|
Count_1001 = 1001,
|
|
|
|
Description_1002 = 1002,
|
|
|
|
Color_1002 = 1002,
|
|
|
|
Lint_1002 = 1002,
|
|
|
|
Count_1002 = 1002,
|
|
|
|
Description_1003 = 1003,
|
|
|
|
Color_1003 = 1003,
|
|
|
|
Lint_1003 = 1003,
|
|
|
|
Count_1003 = 1003,
|
|
|
|
Description_1004 = 1004,
|
|
|
|
Color_1004 = 1004,
|
|
|
|
Lint_1004 = 1004,
|
|
|
|
Count_1004 = 1004,
|
|
|
|
Description_1005 = 1005,
|
|
|
|
Color_1005 = 1005,
|
|
|
|
Lint_1005 = 1005,
|
|
|
|
Count_1005 = 1005,
|
|
|
|
Description_1006 = 1006,
|
|
|
|
Color_1006 = 1006,
|
|
|
|
Lint_1006 = 1006,
|
|
|
|
Count_1006 = 1006,
|
|
|
|
Description_1007 = 1007,
|
|
|
|
Color_1007 = 1007,
|
|
|
|
Lint_1007 = 1007,
|
|
|
|
Count_1007 = 1007,
|
|
|
|
Description_1008 = 1008,
|
|
|
|
Color_1008 = 1008,
|
|
|
|
Lint_1008 = 1008,
|
|
|
|
Count_1008 = 1008,
|
|
|
|
Description_1009 = 1009,
|
|
|
|
Color_1009 = 1009,
|
|
|
|
Lint_1009 = 1009,
|
|
|
|
Count_1009 = 1009,
|
|
|
|
Description_1010 = 1010,
|
|
|
|
Color_1010 = 1010,
|
|
|
|
Lint_1010 = 1010,
|
|
|
|
Count_1010 = 1010,
|
|
|
|
Description_1011 = 1011,
|
|
|
|
Color_1011 = 1011,
|
|
|
|
Lint_1011 = 1011,
|
|
|
|
Count_1011 = 1011,
|
|
|
|
Description_1012 = 1012,
|
|
|
|
Color_1012 = 1012,
|
|
|
|
Lint_1012 = 1012,
|
|
|
|
Count_1012 = 1012,
|
|
|
|
Description_1013 = 1013,
|
|
|
|
Color_1013 = 1013,
|
|
|
|
Lint_1013 = 1013,
|
|
|
|
Count_1013 = 1013,
|
|
|
|
Description_1014 = 1014,
|
|
|
|
Color_1014 = 1014,
|
|
|
|
Lint_1014 = 1014,
|
|
|
|
Count_1014 = 1014,
|
|
|
|
Description_1015 = 1015,
|
|
|
|
Color_1015 = 1015,
|
|
|
|
Lint_1015 = 1015,
|
|
|
|
Count_1015 = 1015,
|
|
|
|
Description_1016 = 1016,
|
|
|
|
Color_1016 = 1016,
|
|
|
|
Lint_1016 = 1016,
|
|
|
|
Count_1016 = 1016,
|
|
|
|
Description_1017 = 1017,
|
|
|
|
Color_1017 = 1017,
|
|
|
|
Lint_1017 = 1017,
|
|
|
|
Count_1017 = 1017,
|
|
|
|
Description_1018 = 1018,
|
|
|
|
Color_1018 = 1018,
|
|
|
|
Lint_1018 = 1018,
|
|
|
|
Count_1018 = 1018,
|
|
|
|
Description_1019 = 1019,
|
|
|
|
Color_1019 = 1019,
|
|
|
|
Lint_1019 = 1019,
|
|
|
|
Count_1019 = 1019,
|
|
|
|
Description_1020 = 1020,
|
|
|
|
Color_1020 = 1020,
|
|
|
|
Lint_1020 = 1020,
|
|
|
|
Count_1020 = 1020,
|
|
|
|
Description_1021 = 1021,
|
|
|
|
Color_1021 = 1021,
|
|
|
|
Lint_1021 = 1021,
|
|
|
|
Count_1021 = 1021,
|
|
|
|
Description_1022 = 1022,
|
|
|
|
Color_1022 = 1022,
|
|
|
|
Lint_1022 = 1022,
|
|
|
|
Count_1022 = 1022,
|
|
|
|
Description_1023 = 1023,
|
|
|
|
Color_1023 = 1023,
|
|
|
|
Lint_1023 = 1023,
|
|
|
|
Count_1023 = 1023,
|
|
|
|
Description_1024 = 1024,
|
|
|
|
Color_1024 = 1024,
|
|
|
|
Lint_1024 = 1024,
|
|
|
|
Count_1024 = 1024,
|
|
|
|
Description_1025 = 1025,
|
|
|
|
Color_1025 = 1025,
|
|
|
|
Lint_1025 = 1025,
|
|
|
|
Count_1025 = 1025,
|
|
|
|
Description_1026 = 1026,
|
|
|
|
Color_1026 = 1026,
|
|
|
|
Lint_1026 = 1026,
|
|
|
|
Count_1026 = 1026,
|
|
|
|
Description_1027 = 1027,
|
|
|
|
Color_1027 = 1027,
|
|
|
|
Lint_1027 = 1027,
|
|
|
|
Count_1027 = 1027,
|
|
|
|
Description_1028 = 1028,
|
|
|
|
Color_1028 = 1028,
|
|
|
|
Lint_1028 = 1028,
|
|
|
|
Count_1028 = 1028,
|
|
|
|
Description_1029 = 1029,
|
|
|
|
Color_1029 = 1029,
|
|
|
|
Lint_1029 = 1029,
|
|
|
|
Count_1029 = 1029,
|
|
|
|
Description_1030 = 1030,
|
|
|
|
Color_1030 = 1030,
|
|
|
|
Lint_1030 = 1030,
|
|
|
|
Count_1030 = 1030,
|
|
|
|
Description_1031 = 1031,
|
|
|
|
Color_1031 = 1031,
|
|
|
|
Lint_1031 = 1031,
|
|
|
|
Count_1031 = 1031,
|
|
|
|
Description_1032 = 1032,
|
|
|
|
Color_1032 = 1032,
|
|
|
|
Lint_1032 = 1032,
|
|
|
|
Count_1032 = 1032,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public class InventoryData
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// ID
|
|
|
|
/// </summary>
|
|
|
|
public int ID;
|
|
|
|
/// <summary>
|
|
|
|
/// 描述
|
|
|
|
/// </summary>
|
|
|
|
public string Description;
|
|
|
|
/// <summary>
|
|
|
|
/// 颜色
|
|
|
|
/// </summary>
|
|
|
|
public string Color;
|
|
|
|
/// <summary>
|
|
|
|
/// 样式
|
|
|
|
/// </summary>
|
|
|
|
public string Lint;
|
|
|
|
/// <summary>
|
|
|
|
/// 数量
|
|
|
|
/// </summary>
|
|
|
|
public int Count;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
[System.Serializable]
|
|
|
|
public class InventoryDatas
|
|
|
|
{
|
|
|
|
public List<InventoryData> InventoryList = new List<InventoryData>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public class InventoryDataExcel
|
|
|
|
{
|
|
|
|
private const string _fileName = "Inventory";
|
|
|
|
private string _filePath;
|
|
|
|
private InventoryDatas _datas;
|
|
|
|
public InventoryDatas Datas => _datas;
|
|
|
|
|
|
|
|
public InventoryDataExcel()
|
|
|
|
{
|
2025-07-13 15:53:13 +08:00
|
|
|
_filePath = $"Assets/Res/ExcelData/{_fileName}.json";
|
|
|
|
var text = ResourcesManager.Instance.Load<TextAsset>(_filePath);
|
|
|
|
_datas = JsonConvert.DeserializeObject<InventoryDatas>(text.text);
|
2025-07-02 10:24:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public InventoryData GetData(int id)
|
|
|
|
{
|
|
|
|
foreach (var testData in _datas.InventoryList)
|
|
|
|
{
|
|
|
|
if (id == testData.ID)
|
|
|
|
{
|
|
|
|
return testData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new NullReferenceException();
|
|
|
|
}
|
|
|
|
}}
|