Beispiel #1
0
    private void ShowEndMenu(int[] pkt)
    {
        endMenuPanel = guiScr.CreatePanel(menuCanvas, "EndMenuPanel", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector3(1, 1, 1), new Vector3(0, 0, 0),
                                          new Vector2(400, 400), new Vector2(0, 0), spr, new Color32(255, 255, 255, 125));
        endMenuButt  = guiScr.FillWithButtons(endMenuPanel, 2, 1, 200, 100, spr, new Color32(255, 255, 255, 255));
        endMenuTex   = guiScr.SetMenuText(endMenuButt, endMenuNames);
        endMenuScore = guiScr.CreateTextField(endMenuPanel, "Score");

        string scor = "";

        if (PlayersNumber > 1)
        {
            scor += ("RED : " + pkt[0].ToString() + "\n");
            scor += ("GREEN : " + pkt[1].ToString() + "\n");
            if (playersNumber >= 3)
            {
                scor += ("BLUE : " + pkt[2].ToString() + "\n");
            }
            if (playersNumber >= 4)
            {
                scor += ("YELLOW : " + pkt[3].ToString() + "\n");
            }
        }
        else
        {
            scor += ("PLAYER : " + pkt[0].ToString() + "\n");
            scor += ("AI : " + pkt[1].ToString() + "\n");
        }
        endMenuScore.GetComponent <Text>().text = scor;

        endMenuButt[0, 0].GetComponent <Button>().onClick.AddListener(delegate
                                                                      { SceneManager.LoadScene(SceneManager.GetActiveScene().name); });
        endMenuButt[1, 0].GetComponent <Button>().onClick.AddListener(delegate
                                                                      { Application.Quit(); });
    }