void OnGUI() { GUIStyle text_style; GUIStyle button_style; GUIStyle role_style = new GUIStyle(); role_style.normal.textColor = new Color(1, 0, 0); text_style = new GUIStyle() { fontSize = 30 }; button_style = new GUIStyle("button") { fontSize = 15 }; if (GUI.Button(new Rect(10, 10, 60, 30), "Rule", button_style)) { if (isShow) { isShow = false; } else { isShow = true; } } if (GUI.Button(new Rect(700, 10, 60, 30), "AI next", button_style)) { action.AI(); } if (isShow) { GUI.Label(new Rect(Screen.width / 2 - 85, 10, 200, 50), "让全部牧师和恶魔都渡河", role_style); GUI.Label(new Rect(Screen.width / 2 - 120, 30, 250, 50), "每一边恶魔数量都不能多于牧师数量", role_style); GUI.Label(new Rect(Screen.width / 2 - 85, 50, 250, 50), "点击牧师、恶魔、船移动", role_style); } if (sign == 1) { GUI.Label(new Rect(Screen.width / 2 - 90, Screen.height / 2 - 120, 100, 50), "Gameover!", text_style); if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 100, 50), "Restart", button_style)) { action.Restart(); sign = 0; } } else if (sign == 2) { GUI.Label(new Rect(Screen.width / 2 - 80, Screen.height / 2 - 120, 100, 50), "You Win!", text_style); if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2, 100, 50), "Restart", button_style)) { action.Restart(); sign = 0; } } }
void OnGUI() { GUIStyle text_style; GUIStyle button_style; text_style = new GUIStyle() { fontSize = 30 }; button_style = new GUIStyle("button") { fontSize = 15 }; if (sign == 0) { if (GUI.Button(new Rect(Screen.width / 2 - 100, 80, 60, 60), "Go!")) { action.MoveBoat(); } if (GUI.Button(new Rect(Screen.width / 2 + 40, 80, 60, 60), "Help!")) { action.AI(); } } else if (sign == -1) { GUI.Label(new Rect(Screen.width / 2 - 75, 100, 120, 50), "You Failed!", text_style); if (GUI.Button(new Rect(Screen.width / 2 - 50, 150, 100, 50), "Try Agian", button_style)) { action.Restart(); sign = 0; } } else if (sign == 1) { GUI.Label(new Rect(Screen.width / 2 - 60, 100, 120, 50), "You Win!", text_style); if (GUI.Button(new Rect(Screen.width / 2 - 50, 150, 100, 50), "Restart", button_style)) { action.Restart(); sign = 0; } } }