using CodeStage.AntiCheat.ObscuredTypes; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; [Serializable] public class HarvestConfigTableData : TableDataBase { 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(); } } // 금 과일 비율 } public class table_harvestconfig : table_missionbase { public static table_harvestconfig Ins; List tableDatas; Dictionary dic_Data = new Dictionary(); List grade_rate = new List(); protected override void Awake() { base.Awake(); Ins = this; } protected override void Start() { tableDatas = JsonConvert.DeserializeObject>(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 Get_DataList() { return tableDatas; } }