using CodeStage.AntiCheat.ObscuredTypes; using Newtonsoft.Json; using System; using System.Collections.Generic; using UnityEngine; using Random = UnityEngine.Random; [Serializable] public class EnchantGradeConfigTableData : TableDataBase { ObscuredInt _EnchantGrade; public int n_EnchantGrade { get { return _EnchantGrade; } set { _EnchantGrade = value; _EnchantGrade.RandomizeCryptoKey(); } } // 인첸트 등급 ObscuredInt _OptionLevelMin; public int n_OptionLevelMin { get { return _OptionLevelMin; } set { _OptionLevelMin = value; _OptionLevelMin.RandomizeCryptoKey(); } } // 최소 옵션 레벨 ObscuredInt _OptionLevelMax; public int n_OptionLevelMax { get { return _OptionLevelMax; } set { _OptionLevelMax = value; _OptionLevelMax.RandomizeCryptoKey(); } } // 최대 옵션 레벨 ObscuredString _Color; public string s_Color { get { return _Color; } set { _Color = value; _Color.RandomizeCryptoKey(); } } // 색상 public Color GradeColor; } public class table_enchantgradeconfig : table_missionbase { public static table_enchantgradeconfig Ins; List tableDatas; Dictionary dic_Data = new Dictionary(); 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]; ColorUtility.TryParseHtmlString(temp.s_Color, out temp.GradeColor); dic_Data.Add(temp.n_EnchantGrade, temp); } base.Start(); } public int Get_Lv(int grade) { var Tdata = Get_Data(grade); return Random.Range(Tdata.n_OptionLevelMin, Tdata.n_OptionLevelMax + 1); } public EnchantGradeConfigTableData Get_Data(int grade) { return dic_Data[grade]; } public EnchantGradeConfigTableData Get_Data_bylv(int lv) { var lst = Get_DataList(); for (int i = 0; i < lst.Count; i++) { if (lst[i].n_OptionLevelMax > lv) return lst[i]; } return lst[0]; } public List Get_DataList() { return tableDatas; } public Color Get_Color(int lv) { for (int i = 0; i < Get_DataList().Count; i++) { if (Get_DataList()[i].n_OptionLevelMax > lv) return Get_DataList()[i].GradeColor; } return Color.black; } }