Esempio n. 1
0
    // 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();
        }
    }
Esempio n. 2
0
    // 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();
        }
    }