Пример #1
0
    public void OnClientButton()
    {
        SystemManager.Instance.ConnectionInfo.Host = false;
        TitleSceneMain sceneMain = SystemManager.Instance.GetCurrentSceneMain <TitleSceneMain>();

        // IP 입력 값
        if (!string.IsNullOrEmpty(IPAddressInputField.text) || IPAddressInputField.text != DefaultIPAddress)
        {
            SystemManager.Instance.ConnectionInfo.IPAddress = IPAddressInputField.text;
        }

        if (!string.IsNullOrEmpty(PortInputField.text) || PortInputField.text != DefaultPort)
        {
            int port = 0;
            if (int.TryParse(PortInputField.text, out port))
            {
                SystemManager.Instance.ConnectionInfo.Port = port;
            }
            else
            {
                Debug.LogError("OnClientButton error! port = " + PortInputField.text);
                return;
            }
        }

        sceneMain.GotoNextScene();
    }
Пример #2
0
    public void OnClientButton()
    {
        SystemManager.Instance.ConnectionInfo.host = false;

        if (!(string.IsNullOrWhiteSpace(ipAddressInputField.text) && ipAddressInputField.text.Equals(defaultIpAddress)))
        {
            SystemManager.Instance.ConnectionInfo.ipAddress = ipAddressInputField.text.Trim();
        }

        if (!(string.IsNullOrWhiteSpace(portInputField.text) && portInputField.text.Equals(defaultPort)))
        {
            if (int.TryParse(portInputField.text.Trim(), out int port))
            {
                SystemManager.Instance.ConnectionInfo.port = port;
            }
            else
            {
                Debug.LogError("OnClientButton error port = " + portInputField.text);
                return;
            }
        }

        TitleSceneMain sceneMain = SystemManager.Instance.GetCurrentSceneMain <TitleSceneMain>();

        sceneMain.GoToNextScene();
    }
Пример #3
0
    public void OnHostButton()
    {
        SystemManager.Instance.ConnectionInfo.Host = true;
        TitleSceneMain sceneMain = SystemManager.Instance.GetCurrentSceneMain <TitleSceneMain>();

        sceneMain.GotoNextScene();
    }
    public void OnClientButton()
    {
        //클라이언트라면 입력된 ip, host를 사용한다.
        SystemManager.Instance.ConnectionInfo.Host = false;
        TitleSceneMain sceneMain = SystemManager.Instance.GetCurrentSceneMain <TitleSceneMain>();

        //IPAddressInputField의 입력값이 널이거나 비어있지 않거나(||) 디폴트 값이 아니라면
        if (!string.IsNullOrEmpty(IPAddressInputField.text) || IPAddressInputField.text != DefaultIPAddress)
        {
            SystemManager.Instance.ConnectionInfo.IPAddress = IPAddressInputField.text;
        }

        //PortInputField 입력값이 널이거나 비어있지 않거나(||) 디폴트 값이 아니라면
        if (!string.IsNullOrEmpty(PortInputField.text) || PortInputField.text != DefaultPort)
        {
            //입력받은 포트를 TryParse해서 성공한다면(true 리턴) 그대로 세팅
            //아니라면(false 리턴) 에러로그
            int port = 0;
            if (int.TryParse(PortInputField.text, out port))
            {
                SystemManager.Instance.ConnectionInfo.Port = port;
            }
            else
            {
                Debug.LogError("OnClientButton Error! port = " + PortInputField.text);
                return;
            }
        }


        sceneMain.GotoNextScene();
    }