-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTitleEvent.cs
57 lines (44 loc) · 1.12 KB
/
TitleEvent.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class TitleEvent : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler {
public string sceneName;
public Image image { get { return GetComponent<Image>(); } }
public Color setColor;
private Color originColor;
public enum Imagetype{
Start,
Continue,
Config,
Quit
}
public Imagetype imageType;
void Start(){
originColor = image.color;
}
// click event
public void OnPointerClick (PointerEventData eventData){
switch (imageType) {
case Imagetype.Start:
SceneManager.LoadScene (sceneName); // sceneName Main
break;
case Imagetype.Continue:
SceneManager.LoadScene (sceneName); // sceneName Menu
break;
case Imagetype.Config:
break;
case Imagetype.Quit:
Application.Quit (); // game 終了
break;
}
}
public void OnPointerEnter(PointerEventData eventData){
image.color = Color.red;
}
public void OnPointerExit(PointerEventData eventData){
image.color = originColor;
}
}