Esempio n. 1
0
    void Start()
    {
        if (HostButton != null)
        {
            HostButton.onClick.AddListener(() => GameManager.singleton.HostGame());
        }

        if (JoinButton != null)
        {
            JoinButton.onClick.AddListener(() => GameManager.singleton.JoinGame());
        }

        if (PlayerNameInputField != null)
        {
            PlayerNameInputField.BindToPlayerPrefs("PLAYER_NAME", "Unknown");
        }

        if (IpAdressInputField != null)
        {
            IpAdressInputField.BindToPlayerPrefs("IP_ADRESS", "127.0.0.1");
            IpAdressInputField.Bind(s => GameManager.singleton.networkAddress = s);
        }

        if (PortInputField != null)
        {
            PortInputField.BindToPlayerPrefs("PORT", "7777");
            PortInputField.Bind(s => GameManager.singleton.networkPort = int.Parse(s));
        }
    }