-
Notifications
You must be signed in to change notification settings - Fork 96
/
SCAN_Popup.cs
58 lines (46 loc) · 918 Bytes
/
SCAN_Popup.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
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
namespace SCANsat.Unity.Unity
{
public class SCAN_Popup : CanvasFader
{
public class OnSelectEvent : UnityEvent { }
[SerializeField]
private TextHandler m_WarningText = null;
private OnSelectEvent _onSelectUpdate = new OnSelectEvent();
public OnSelectEvent OnSelectUpdate
{
get { return _onSelectUpdate; }
}
protected override void Awake()
{
base.Awake();
Alpha(0);
}
public void Setup(string text)
{
if (m_WarningText != null)
m_WarningText.OnTextUpdate.Invoke(text);
FadeIn();
}
private void FadeIn()
{
Fade(1, true);
}
public void FadeOut(bool fast = false)
{
Fade(0, fast, Close, false);
}
private void Close()
{
gameObject.SetActive(false);
DestroyImmediate(gameObject);
}
public void Confirm()
{
_onSelectUpdate.Invoke();
}
}
}