Esempio n. 1
0
    //아래는 Login버튼을 클릭하였을떄 호출되는 함수
    public void SendLoginRequest()
    {
        var InputID = (GameObject.Find("input_id_field")).GetComponent <InputField>().text;
        // var InputPW = (GameObject.Find("input_pw_field")).GetComponent<InputField>().text;
        var InputIPAddr = (GameObject.Find("input_ip_addr_field")).GetComponent <InputField>().text;

        GameNetworkServer.Instance.ipAddr = InputIPAddr;
        var request = new LoginReqPacket();

        request.SetValue(InputID, InputID);
        var bodyData = request.ToBytes();

        if (gameServer.ClientStatus == GameNetworkServer.CLIENT_STATUS.NONE)
        {
            if (gameServer.GetIsConnected() == false)
            {
                GameNetworkServer.Instance.ConnectToServer();
            }

            GameNetworkServer.Instance.RequestLogin(InputID, InputID);
        }

        isLoginReqPktSended = true;
        Debug.Log("LoginReqPacket sended");
    }
    public void SendRoomEnterReqPacket()
    {
        Debug.Log("RoomEnterReqPacket called");
        if (isWatingEnterRoomRes == true)
        {
            return;
        }

        var request  = new RoomEnterReqPacket();
        var bodyData = request.ToBytes();

        if (gameServer.ClientStatus == GameNetworkServer.CLIENT_STATUS.LOGIN)
        {
            if (gameServer.GetIsConnected() == false)
            {
                errorMsgBox.PopUpErrorMessage("네트워크와의 접속이 끊어졌습니다");
            }

            GameNetworkServer.Instance.RequestRoomEnter();
        }

        isWatingEnterRoomRes = true;
        Debug.Log("RoomEnterReqPacket sended");
    }