// Update is called once per frame void OnGUI() { firstScenceUserAction action = Director.getInstance().currentSceneController as firstScenceUserAction; string status = action.getStatus(); if (ifShowHelp == true) { GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 90, 200, 180), ""); GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 90, 200, 180), helpText); if (GUI.Button(new Rect(Screen.width / 2 - 20, Screen.height / 2 + 60, 40, 30), "Ok")) { ifShowHelp = false; } } if (GUI.Button(new Rect(10, 10, 100, 50), "帮助")) { ifShowHelp = true; } if (status == "playing") { if (GUI.Button(new Rect(130, 10, 100, 50), "重新开始")) { action.reset(); } } else { string showMsg; if (status == "lost") { showMsg = "你输了!"; } else { showMsg = "你赢了!"; } if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), showMsg)) { action.reset(); } } if (GUI.Button(new Rect(250, 10, 100, 50), "提示")) { action.nextStep(); } }
void OnGUI() { firstScenceUserAction action = Director.getInstance().currentSceneController as firstScenceUserAction; string status = action.getStatus(); if (show == true) { GUI.Box(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 250, 200, 160), ""); GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 250, 200, 180), ruletext); if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 + 40, 100, 50), "开始游戏")) { show = false; } } if (status == "playing") { if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 + 100, 100, 50), "重启游戏")) { action.reset(); } if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 + 160, 100, 50), "游戏规则")) { show = true; } } else //游戏结果信息 { string resultMsg; if (status == "lost") { resultMsg = "牧师被吃了!"; } else { resultMsg = "邪不胜正!!"; } if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), resultMsg)) { action.reset(); //show = true; //flag = false; //status = "playing"; } } }
// Update is called once per frame void OnGUI() { firstScenceUserAction action = Director.getInstance().currentSceneController as firstScenceUserAction; string status = action.getStatus(); if (status == "playing") { if (GUI.Button(new Rect(130, 10, 100, 50), "restart")) { action.reset(); } } else { string showMsg; if (status == "lost") { showMsg = "you lost!!"; } else { showMsg = "you win!!"; } if (GUI.Button(new Rect(Screen.width / 2 - 50, Screen.height / 2 - 25, 100, 50), showMsg)) { action.reset(); } } if (GUI.Button(new Rect(250, 10, 100, 50), "tips")) { action.nextStep(); } }