UI 이벤트 추가
This commit is contained in:
@@ -39,19 +39,21 @@ public class UI_Button : UI_Base
|
||||
|
||||
// Get 호출 시에도 타입을 맞춰줍니다.
|
||||
// Get<TextMeshProUGUI>((int)Texts.ScoreText).text = "Bind Test";
|
||||
GetText((int)Texts.ScoreText).text = "Bind Test";
|
||||
|
||||
|
||||
GetButton((int)Buttons.PointButton).gameObject.AddUIEvent(OnButtonClicked);
|
||||
|
||||
GameObject go = GetImage((int)Images.ItemIcon).gameObject;
|
||||
UI_EventHandler evt = go.GetComponent<UI_EventHandler>();
|
||||
evt.OnDragHandler += ((PointerEventData data) => { evt.gameObject.transform.position = data.position; });
|
||||
AddUIEvent(go, (PointerEventData data) => { go.transform.position = data.position; }, Define.UIEvent.Drag);
|
||||
}
|
||||
|
||||
private int _score = 0;
|
||||
|
||||
public void OnButtonClicked()
|
||||
public void OnButtonClicked(PointerEventData data)
|
||||
{
|
||||
// GetComponentInChildren<TextMeshProUGUI>().text = "텍스트 변경 완료!";
|
||||
|
||||
_score += 1;
|
||||
|
||||
GetText((int)Texts.ScoreText).text = $"점수 : {_score}점";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user