コード例 #1
0
    void theMapMenu()
    {
        script = GetComponent<MainMenuScript_c>();
        script2 = GetComponent<MapMenuScript_c>();

        //layout start
        GUI.BeginGroup(new Rect(Screen.width / 2 - 200, 50, 400, 300));

        //boxes
        GUI.Box(new Rect(0, 0, 400, 300), "");
        GUI.Box(new Rect(96, 20, 200, 200), "");
        GUI.Box(new Rect(96, 222, 200, 20), "Level 1");

        //map preview/icon
        GUI.Label(new Rect(100, 20, 198, 198), mapTexture);

        //buttons
        startRect = new Rect(15, 250, 180, 40);
        if(GUI.Button(startRect, "Start") || selectStart)
        {
        startLevel();
        }
        backRect = new Rect(205, 250, 180, 40);
        if(GUI.Button(backRect, "Back to Main Menu") || selectBack)
        {
        back ();
        }

        //layout end
        GUI.EndGroup();
    }
コード例 #2
0
    void theFirstMenu()
    {
        GameObject handCursor = GameObject.Find("HandCursor");
        script = GetComponent<MainMenuScript_c>();
        script2 = GetComponent<MapMenuScript_c>();

        //layout start
        GUI.BeginGroup(new Rect(Screen.width / 2 - 150, 50, 300, 300));

        //the menu background box
        GUI.Box(new Rect(0, 0, 300, 300), "");

        //logo picture
        GUI.Label(new Rect(15, 10, 300, 68), logoTexture);

        ///////main menu buttons
        //game start button
        startRect = new Rect(55, 100, 180, 40);
        if(GUI.Button(startRect, "Start a New Game") //returns true if  button pressed
            || selectStart) //working
        {
        setUpNewGame();
        }
        //continue button
        contRect = new Rect(55, 150, 180, 40);
        if(GUI.Button(contRect, "Continue a Game")) //TODO: should only appear when there is a game to be continued
        {
         		goToNextMenu();
        }
        //quit button
        quitRect = new Rect(55, 200, 180, 40);
        if(GUI.Button(quitRect, "Quit") || selectQuit)
        {
           		quit ();
        }

        //layout end
        GUI.EndGroup();
    }