84 lines
4.0 KiB
C#
84 lines
4.0 KiB
C#
|
|
using Newtonsoft.Json;
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
[Serializable]
|
||
|
|
public class AbilityConfigTableData : TableDataBase
|
||
|
|
{
|
||
|
|
public int n_AbilityID; // 특성을 각각 구분하기 위한 고유 ID
|
||
|
|
public eBattleType e_BattleType; // 특성 UI 카테고리 분류를 위한 Enum 값
|
||
|
|
public int n_AbilityStep; // 특성 강화 단계를 의미하며, 단계가 증가할수록 우측으로 점진적으로 배열된다.
|
||
|
|
public int n_AbilityOrder; // 특성이 배치 될 상/중/하 분류 위치
|
||
|
|
public int n_RequireAbility1; // 특성 강화에 요구되는 선행 스킬의 ID1
|
||
|
|
public int n_RequireAbility2; // 특성 강화에 요구되는 선행 스킬의 ID2
|
||
|
|
public int n_NextAbility;
|
||
|
|
public eBattleType e_AbilityTarget; // 특성 효과가 적용 될 직업군을 분류하기 위한 값 (※예를 들어 같은 공격력 증가라도, 활 캐릭터에게만 적용 되는 공격력 증가 효과를 만들기 위한 목적)
|
||
|
|
public eStat e_OptionType; // 특성 효과를 구성하기 위한 옵션 타입 값
|
||
|
|
public float f_DefaultValue; // 1레벨 기준 특성 효과의 기본 값
|
||
|
|
public float f_LevelPerValue; // 레벨 당 특성 효과 증가량을 산출하기 위한 증가량
|
||
|
|
public float f_BalanceConstant; // 레벨 당 특성 효과 증가량을 산출하기 위한 밸런스 상수 K 값
|
||
|
|
public int n_MaxUpgradeLevel; // 특성을 강화할 수 있는 최대 제한 레벨
|
||
|
|
|
||
|
|
public float Get_Value(int lv) { return Get_Value(lv, f_BalanceConstant, f_DefaultValue, f_LevelPerValue); }
|
||
|
|
public override string Get_Name() { return table_itemlist.Ins.Get_Data(n_AbilityID).Get_Name(); }
|
||
|
|
public string Get_Desc() { return table_itemlist.Ins.Get_Data(n_AbilityID).Get_Desc(); }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public class table_abilityconfig : table_missionbase
|
||
|
|
{
|
||
|
|
public static table_abilityconfig Ins;
|
||
|
|
List<AbilityConfigTableData> tableDatas;
|
||
|
|
Dictionary<int, AbilityConfigTableData> dic_Data = new Dictionary<int, AbilityConfigTableData>();
|
||
|
|
|
||
|
|
// UI 표시용
|
||
|
|
Dictionary<eBattleType, List<AbilityConfigTableData>> dic_typeList = new Dictionary<eBattleType, List<AbilityConfigTableData>>();
|
||
|
|
// 스탯 적용용
|
||
|
|
Dictionary<eBattleType, List<AbilityConfigTableData>> dic_StatList = new Dictionary<eBattleType, List<AbilityConfigTableData>>();
|
||
|
|
|
||
|
|
protected override void Awake()
|
||
|
|
{
|
||
|
|
base.Awake();
|
||
|
|
Ins = this;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void Start()
|
||
|
|
{
|
||
|
|
tableDatas = JsonConvert.DeserializeObject<List<AbilityConfigTableData>>(json_last);
|
||
|
|
for (int i = 0; i < Get_DataList().Count; i++)
|
||
|
|
{
|
||
|
|
var temp = Get_DataList()[i];
|
||
|
|
if (!dic_typeList.ContainsKey(temp.e_BattleType))
|
||
|
|
dic_typeList.Add(temp.e_BattleType, new List<AbilityConfigTableData>());
|
||
|
|
dic_typeList[temp.e_BattleType].Add(temp);
|
||
|
|
|
||
|
|
if (!dic_StatList.ContainsKey(temp.e_BattleType))
|
||
|
|
dic_StatList.Add(temp.e_BattleType, new List<AbilityConfigTableData>());
|
||
|
|
dic_StatList[temp.e_BattleType].Add(temp);
|
||
|
|
}
|
||
|
|
|
||
|
|
for (int i = 0; i < Get_DataList().Count; i++)
|
||
|
|
{
|
||
|
|
var temp = Get_DataList()[i];
|
||
|
|
dic_Data.Add(temp.n_AbilityID, temp);
|
||
|
|
if (temp.e_AbilityTarget == eBattleType.All)
|
||
|
|
{
|
||
|
|
foreach (var item in dic_StatList)
|
||
|
|
item.Value.Add(temp);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
base.Start();
|
||
|
|
}
|
||
|
|
|
||
|
|
public AbilityConfigTableData Get_Data_orNull(int id) { return dic_Data.ContainsKey(id) ? dic_Data[id] : null; }
|
||
|
|
public List<AbilityConfigTableData> Get_DataList() { return tableDatas; }
|
||
|
|
public List<AbilityConfigTableData> Get_DataList(eBattleType type) { return dic_typeList[type]; }
|
||
|
|
public List<AbilityConfigTableData> Get_DataList_Stat(eBattleType type)
|
||
|
|
{
|
||
|
|
if (dic_StatList.ContainsKey(type))
|
||
|
|
return dic_StatList[type];
|
||
|
|
return new List<AbilityConfigTableData>();
|
||
|
|
}
|
||
|
|
}
|