예제 #1
0
    public void OnHostButton()
    {
        SystemManager.Instance.ConnectionInfo.Host = true;
        TitleSceneMain sceneMain = SystemManager.Instance.GetCurrentSceneMain <TitleSceneMain>();

        sceneMain.GotoNextScene();
    }
예제 #2
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();
    }
    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();
    }