70 lines
2.0 KiB
C#
70 lines
2.0 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class EssenceTableData : TableDataBase
|
|
{
|
|
public int n_EssenceID;
|
|
public float f_Rate1;
|
|
public float f_Rate2;
|
|
public float f_Rate3;
|
|
public float f_Rate4;
|
|
public float f_Rate5;
|
|
public float f_Rate6;
|
|
|
|
public List<float> list_rate = new List<float>();
|
|
|
|
public override string Get_Name() { return table_itemlist.Ins.Get_Data(n_EssenceID).Get_Name(); }
|
|
public string Get_RateText()
|
|
{
|
|
string rtn = "";
|
|
for (int i = 0; i < list_rate.Count; i++)
|
|
{
|
|
if (list_rate[i] > 0f)
|
|
rtn += $"{DSUtil.Format(3331 + i, list_rate[i] * 100f)}\n";
|
|
}
|
|
return rtn;
|
|
}
|
|
}
|
|
|
|
public class table_essence : table_missionbase
|
|
{
|
|
public static table_essence Ins;
|
|
List<EssenceTableData> tableDatas;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
Ins = this;
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
tableDatas = JsonConvert.DeserializeObject<List<EssenceTableData>>(json_last);
|
|
for (int i = 0; i < Get_DataList().Count; i++)
|
|
{
|
|
var temp = Get_DataList()[i];
|
|
temp.list_rate.Add(temp.f_Rate1);
|
|
temp.list_rate.Add(temp.f_Rate2);
|
|
temp.list_rate.Add(temp.f_Rate3);
|
|
temp.list_rate.Add(temp.f_Rate4);
|
|
temp.list_rate.Add(temp.f_Rate5);
|
|
temp.list_rate.Add(temp.f_Rate6);
|
|
|
|
#if UNITY_EDITOR
|
|
if (temp.list_rate.Sum() < 1f)
|
|
Debug.LogError($"table_essence {temp.n_EssenceID} 의 list_rate 합계가 100%가 안됩니다.");
|
|
else if (temp.list_rate.Sum() > 1f)
|
|
Debug.LogError($"table_essence {temp.n_EssenceID} 의 list_rate 합계가 100%가 넘습니다.");
|
|
#endif
|
|
}
|
|
|
|
base.Start();
|
|
}
|
|
|
|
public EssenceTableData Get_Data(int essenceid) { return Get_DataList().Find(f => f.n_EssenceID == essenceid); }
|
|
public List<EssenceTableData> Get_DataList() { return tableDatas; }
|
|
} |