-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathButtonCollider_Example.cs
96 lines (67 loc) · 2.28 KB
/
ButtonCollider_Example.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#region Header
/* ============================================
* Author : Require PlayerPref Key : "Author"
* Initial Creation Date : 2020-07-14
* Summary :
* Template : New Behaviour For Unity Editor V2
============================================ */
#endregion Header
using UnityEngine;
using System.Collections;
using UIFramework;
using UnityEngine.UI;
/// <summary>
///
/// </summary>
public class ButtonCollider_Example : MonoBehaviour, IHas_UIButton<ButtonCollider_Example.EButtonName>
{
/* const & readonly declaration */
/* enum & struct declaration */
public enum EButtonName
{
ButtonColliderExample,
}
/* public - Field declaration */
/* protected & private - Field declaration */
Button pButton;
// ========================================================================== //
/* public - [Do~Something] Function */
// ========================================================================== //
/* protected - [Override & Unity API] */
private void Awake()
{
HasUIElementHelper.DoInit_HasUIElement(this);
pButton = GetComponentInChildren<ButtonCollider>().pButton;
}
public void ButtonTest_Inspector()
{
Debug.Log(nameof(ButtonTest_Inspector), this);
StartCoroutine(ButtonCoroutine(pButton));
}
void ButtonTest_Interface(Button pButton)
{
Debug.Log(nameof(ButtonTest_Interface), this);
StartCoroutine(ButtonCoroutine(pButton));
}
public void IHas_UIButton_OnClickButton(UIButtonMessage<EButtonName> sButtonMsg)
{
switch (sButtonMsg.eButtonName)
{
case EButtonName.ButtonColliderExample:
ButtonTest_Interface(sButtonMsg.pButtonInstance_OrNull);
break;
}
}
/* protected - [abstract & virtual] */
// ========================================================================== //
#region Private
IEnumerator ButtonCoroutine(Button pButton)
{
Text pText = pButton.GetComponentInChildren<Text>();
pText.text = "Clicked!";
yield return new WaitForSeconds(1f);
pText.text = "Normal";
yield break;
}
#endregion Private
}