using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class UI_Unit : UI_Popup
{
private Unit unit;
private void Start()
{
Init();
GetText((int)Texts.TXT_AttackPower).text = unit.AttackRange.ToString();
GetText((int)Texts.TXT_AttackSpeed).text = unit.MoveSpeed.ToString();
}
public override void Init()
{
base.Init();
Bind<Button>(typeof(Buttons));
Bind<TMP_Text>(typeof(Texts));
Bind<GameObject>(typeof(GameObjects));
Bind<Image>(typeof(Images));
GetButton((int)Buttons.Btn_Close).gameObject.AddUIEvent((PointerEventData data) => OnButtonClicked(Buttons.Btn_Close, data));
GetButton((int)Buttons.Blocker).gameObject.AddUIEvent((PointerEventData data) => OnButtonClicked(Buttons.Blocker, data));
}
private void OnButtonClicked(Buttons buttonType, PointerEventData data)
{
switch (buttonType)
{
//UIManager.Instance.ShowPopupUI<UI_Unit>();
case Buttons.Btn_Close:
ClosePopupUI();
break;
case Buttons.Blocker:
ClosePopupUI();
break;
}
}
public void UpdateUnitInfo(Unit unit)
{
this.unit = unit;
}
//enum
enum Buttons
{
Blocker,
Btn_Close
}
enum Texts
{
TXT_Character,
TXT_Characteristic,
TXT_AttackPower,
TXT_AttackPower_Increase,
TXT_AttackSpeed,
TXT_AttackSpeed_Increase,
TXT_Info
}
enum GameObjects
{
}
enum Images
{
Image_Unit,
Image_AttackPower,
Image_AttackSpeed,
Image_Info,
Image_Skill,
Image_Character,
Image_CharacterName,
Image_AttackPower_IconBox,
Image_AttackPower_Icon,
Image_AttackPowerUp_Icon,
Image_AttackSpeed_IconBox,
Image_AttackSpeed_Icon,
Image_AttackSpeedUp_Icon,
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class UI_Unit : UI_Popup
{
//enum
enum Buttons
{
Btn_Close
}
enum Texts
{
TXT_Character,
TXT_Characteristic,
TXT_AttackPower,
TXT_AttackPower_Increase,
TXT_AttackSpeed,
TXT_AttackSpeed_Increase,
TXT_Info
}
enum GameObjects
{
}
enum Images
{
Image_Unit,
Image_Skill,
Image_Character
}
private Unit unit;
private void Start()
{
Init();
GetText((int)Texts.TXT_AttackPower).text = unit.StatHandler.Stat.AttackRange.ToString();
GetText((int)Texts.TXT_AttackSpeed).text = unit.StatHandler.Stat.MoveSpeed.ToString();
}
public override void Init()
{
base.Init();
Bind<Button>(typeof(Buttons));
Bind<TMP_Text>(typeof(Texts));
Bind<GameObject>(typeof(GameObjects));
Bind<Image>(typeof(Images));
GetButton((int)Buttons.Btn_Close).gameObject.AddUIEvent((PointerEventData data) => OnButtonClicked(Buttons.Btn_Close, data));
}
private void OnButtonClicked(Buttons buttonType, PointerEventData data)
{
switch (buttonType)
{
//UIManager.Instance.ShowPopupUI<UI_Unit>();
case Buttons.Btn_Close:
ClosePopupUI();
break;
}
}
public void UpdateUnitInfo(Unit unit)
{
this.unit = unit;
}
}
댓글 영역