-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserGUI.cs
37 lines (33 loc) · 1.02 KB
/
UserGUI.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Com.Mygame;
public class UserGUI : MonoBehaviour {
private UserAction action;
public int status = 0;
GUIStyle style;
GUIStyle buttonStyle;
void Start() {
action = Director.getInstance ().currentSceneController as UserAction;
style = new GUIStyle();
style.fontSize = 40;
style.alignment = TextAnchor.MiddleCenter;
buttonStyle = new GUIStyle("button");
buttonStyle.fontSize = 20;
}
void OnGUI() {
if (status == 1) {
GUI.Label(new Rect(Screen.width/2-50, Screen.height/2-85, 100, 50), "You lose!", style);
if (GUI.Button(new Rect(Screen.width/2-70, Screen.height/2, 140, 70), "Play Again", buttonStyle)) {
status = 0;
action.restart ();
}
} else if(status == 2) {
GUI.Label(new Rect(Screen.width/2-50, Screen.height/2-85, 100, 50), "You win!", style);
if (GUI.Button(new Rect(Screen.width/2-70, Screen.height/2, 140, 70), "Play Again", buttonStyle)) {
status = 0;
action.restart ();
}
}
}
}