132 lines
4.2 KiB
C#
132 lines
4.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class MainToStatTest : MonoBehaviourSingletonTemplate<MainToStatTest>
|
|
{
|
|
public GameObject go_tables;
|
|
public Actor[] actors; // 0 pc, 1 몹
|
|
public TextMeshProUGUI[] labels; // 0 pc 스탯, 1 몹 스탯, 2 데미지, 3 클래스 정보
|
|
public TMP_InputField[] inputs; // 0 몹 방어력, 1 몹 마법저항력
|
|
public TMP_Dropdown m_TMP_Dropdown; // 공격 타입
|
|
|
|
List<eStat> list_showmobstat = new List<eStat> { eStat.BaseDmg, eStat.MaxHP, eStat.MaxMP, eStat.FinalAttackSpeed, eStat.FinalMoveSpeed, eStat.FinalDef, eStat.FinalMDef };
|
|
List<string> list_dmg = new List<string>();
|
|
int m_ClassID = 10501;
|
|
string m_AttackType = "P";
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
DSUtil.Get_Clone(go_tables);
|
|
for (int i = 0; i < labels.Length; i++)
|
|
labels[i].text = "";
|
|
}
|
|
|
|
IEnumerator Start()
|
|
{
|
|
while (!TableChecker.Ins.CheckAllLoad()) yield return null; // 테이블 로딩 기다리기
|
|
|
|
m_TMP_Dropdown.options.Clear();
|
|
var classlst = table_classopencondition.Ins.Get_DataList();
|
|
for (int i = 0; i < classlst.Count; i++)
|
|
{
|
|
m_TMP_Dropdown.options.Add(new TMP_Dropdown.OptionData { text = $"{classlst[i].n_ClassID},P,{classlst[i].Get_Name()}" });
|
|
m_TMP_Dropdown.options.Add(new TMP_Dropdown.OptionData { text = $"{classlst[i].n_ClassID},M,{classlst[i].Get_Name()}" });
|
|
}
|
|
|
|
// 캐릭터 세팅 및 수치 표시
|
|
Set_Class();
|
|
actors[0].Stop(false);
|
|
actors[0].Change_Target(false, actors[1]);
|
|
Set_Detail(true);
|
|
|
|
var spawnerid = 1;
|
|
actors[1].Set(true, null, null, spawnerid, false);
|
|
(actors[1] as MobActor).Set(eRole.Mob, table_monsterlist.Ins.Get_Data_orNull(1), Vector3.zero, null, 0);
|
|
|
|
yield return new WaitForSeconds(0.1f);
|
|
actors[1].transform.parent.eulerAngles = Vector3.up * 90f;
|
|
Set_Detail(false);
|
|
Set_AttackType();
|
|
}
|
|
|
|
public void Set_Detail(bool pc)
|
|
{
|
|
if (pc)
|
|
{
|
|
labels[0].text = "";
|
|
var pcactorinfo = actors[0].Get_StatInfo();
|
|
for (eStat i = 0; i < eStat.None; i++)
|
|
{
|
|
labels[0].text += MyText.Get_StatNameValueText(i, pcactorinfo.Get_Stat(i));
|
|
labels[0].text += "\n";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
labels[1].text = "";
|
|
var mobactorinfo = actors[1].Get_StatInfo();
|
|
foreach (var item in list_showmobstat)
|
|
{
|
|
labels[1].text += MyText.Get_StatNameValueText(item, mobactorinfo.Get_Stat(item));
|
|
labels[1].text += "\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Set_AttackType()
|
|
{
|
|
var split = m_TMP_Dropdown.captionText.text.Split(',');
|
|
m_ClassID = int.Parse(split[0]);
|
|
m_AttackType = split[1];
|
|
Set_Class();
|
|
}
|
|
void Set_Class()
|
|
{
|
|
actors[0].Set(false, null, new ServerData(), m_ClassID, true);
|
|
actors[0].m_AttackType = m_AttackType.Equals("P") ? eAttackType.Physics : eAttackType.Magic;
|
|
var classdata = table_classconfig.Ins.Get_Data_orNull(m_ClassID);
|
|
labels[3].text = $"{classdata.Get_JobName()}, {classdata.e_BattleType}, {actors[0].m_AttackType}";
|
|
}
|
|
|
|
public void Set_Dmglabel(string s)
|
|
{
|
|
list_dmg.Add(s);
|
|
if (list_dmg.Count > 11) list_dmg.RemoveAt(0);
|
|
|
|
labels[2].text = "";
|
|
for (int i = 0; i < list_dmg.Count; i++)
|
|
labels[2].text += list_dmg[i] + "\n";
|
|
}
|
|
|
|
public void OnChange_MobDef()
|
|
{
|
|
double.TryParse(inputs[0].text, out double v);
|
|
|
|
var stat = actors[1].Get_StatInfo();
|
|
stat.Set_Buff(eStat.FinalDef, v);
|
|
stat.Reset();
|
|
Set_Detail(false);
|
|
}
|
|
public void OnChange_MobMDef()
|
|
{
|
|
double.TryParse(inputs[1].text, out double v);
|
|
|
|
var stat = actors[1].Get_StatInfo();
|
|
stat.Set_Buff(eStat.FinalMDef, v);
|
|
stat.Reset();
|
|
Set_Detail(false);
|
|
}
|
|
|
|
public void OnClick_Stop()
|
|
{
|
|
actors[0].Play_Idle();
|
|
}
|
|
|
|
public void OnClick_Attack1()
|
|
{
|
|
actors[0].Play_Attack(0, 1f);
|
|
}
|
|
} |