Project_WL/Assets/Script/Table/Farm/table_harvestconfig.cs

97 lines
2.8 KiB
C#
Raw Permalink Normal View History

2024-12-18 04:17:10 +00:00
using CodeStage.AntiCheat.ObscuredTypes;
2024-12-15 01:39:39 +00:00
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
[Serializable]
public class HarvestConfigTableData : TableDataBase
{
2024-12-18 04:17:10 +00:00
ObscuredInt _Grade;
public int n_Grade
{
get { return _Grade; }
set { _Grade = value; _Grade.RandomizeCryptoKey(); }
} // 등급
ObscuredFloat _Rate;
public float f_Rate
{
get { return _Rate; }
set { _Rate = value; _Rate.RandomizeCryptoKey(); }
} // 비율
ObscuredInt _HarvestTime;
public int n_HarvestTime
{
get { return _HarvestTime; }
set { _HarvestTime = value; _HarvestTime.RandomizeCryptoKey(); }
} // 수확 시간
ObscuredInt _MinAmount;
public int n_MinAmount
{
get { return _MinAmount; }
set { _MinAmount = value; _MinAmount.RandomizeCryptoKey(); }
} // 최소 수량
ObscuredInt _MaxAmount;
public int n_MaxAmount
{
get { return _MaxAmount; }
set { _MaxAmount = value; _MaxAmount.RandomizeCryptoKey(); }
} // 최대 수량
ObscuredFloat _StatFruitRate;
public float f_StatFruitRate
{
get { return _StatFruitRate; }
set { _StatFruitRate = value; _StatFruitRate.RandomizeCryptoKey(); }
} // 스탯 과일 비율
ObscuredFloat _GoldFruitRate;
public float f_GoldFruitRate
{
get { return _GoldFruitRate; }
set { _GoldFruitRate = value; _GoldFruitRate.RandomizeCryptoKey(); }
} // 금 과일 비율
2024-12-15 01:39:39 +00:00
}
public class table_harvestconfig : table_missionbase
{
public static table_harvestconfig Ins;
List<HarvestConfigTableData> tableDatas;
Dictionary<int, HarvestConfigTableData> dic_Data = new Dictionary<int, HarvestConfigTableData>();
List<float> grade_rate = new List<float>();
protected override void Awake()
{
base.Awake();
Ins = this;
}
protected override void Start()
{
tableDatas = JsonConvert.DeserializeObject<List<HarvestConfigTableData>>(json_last);
for (int i = 0; i < Get_DataList().Count; i++)
{
var temp = Get_DataList()[i];
grade_rate.Add(temp.f_Rate);
dic_Data.Add(temp.n_Grade, temp);
}
#if UNITY_EDITOR
if (grade_rate.Sum() < 1f)
Debug.LogError($"table_harvestconfig 의 grade_rate 합계가 100%가 안됩니다.");
else if (grade_rate.Sum() > 1f)
Debug.LogError($"table_harvestconfig 의 grade_rate 합계가 100%가 넘습니다.");
#endif
base.Start();
}
public HarvestConfigTableData Get_Data_orNull(int grade) { return dic_Data[grade]; }
public HarvestConfigTableData Get_RandomData() { return Get_Data_orNull(DSUtil.Get_RandomIndex(grade_rate) + 1); }
public List<HarvestConfigTableData> Get_DataList() { return tableDatas; }
}