Пример #1
0
    public void StartServer()
    {
        string sName = hostServerName.GetComponentsInChildren <Text>()[1].text;
        string sPass = hostServerPass.GetComponentsInChildren <Text>()[1].text;
        string dName = hostDisplayName.GetComponentsInChildren <Text>()[1].text;

        if (sName.Trim() == "")
        {
            hostErrorText.SetActive(true);
            hostErrorText.GetComponentInChildren <Text>().text = "SERVER NAME REQUIRED";
        }
        else if (dName.Trim() == "")
        {
            hostErrorText.SetActive(true);
            hostErrorText.GetComponentInChildren <Text>().text = "DISPLAY NAME REQUIRED";
        }
        else
        {
            hostErrorText.SetActive(false);
            netManager.SetGameName(sName);
            netManager.SetGamePass(sPass);
            netManager.StartServer(dName);

            GotoLobby();
        }
    }
Пример #2
0
    // HOST GAME
    void hostGame()
    {
        int btnW = 160;
        int btnH = 30;

        int btnX = 200;
        int btnY = 200;

        TextAnchor labelAnchor = GUI.skin.label.alignment;

        GUI.skin.label.alignment = TextAnchor.MiddleRight;
        GUI.Label(new Rect(btnX, btnY + (btnH + btnPadding) * 1, btnW, btnH), "Server Name: ");
        GUI.Label(new Rect(btnX, btnY + (btnH + btnPadding) * 2, btnW, btnH), "Server Pass: "******"Start Server"))
        {
            if (networkManager.GetGameName() != "")
            {
                networkManager.StartServer("asdf");
                ShowMenu(MenuIndex.GameLobby);
            }
        }
    }