コード例 #1
0
    public void OnClick()
    {
        buttonSubmit.enabled = false;
        string inputNicknameValue = inputNickname.value;

        if (inputNicknameValue == null || "".Equals(inputNicknameValue))
        {
            ShowMessage(ErrorCode.EC_UC_NO_NICKNAME);
            buttonSubmit.enabled = true;
            return;
        }
        if (inputNicknameValue.Length > 16)
        {
            ShowMessage(ErrorCode.EC_UC_NICKNAME_TOO_LONG);
            buttonSubmit.enabled = true;
            return;
        }

        UpdateNickNameReq req = new UpdateNickNameReq
        {
            nickName = inputNicknameValue
        };

        HttpPost(Constants.API_UPDATE_NICKNAME, ProtoHelper.Proto2Bytes(req));
    }
コード例 #2
0
    public void StartPlay()
    {
        SocketRequest req = new SocketRequest();

        req.p1 = GUIDHelper.generate();
        req.p2 = "join";
        req.p3 = DataHelper.GetInstance().LoadToken(dbManager);
        req.p4 = SystemInfo.deviceUniqueIdentifier;
        req.p5 = "10";
        SendBytes(ProtoHelper.Proto2Bytes(req));
    }
コード例 #3
0
        private void OnWebSocketOpen(WebSocket webSocket)
        {
            Debug.Log("WebSocket open! now login.");
            SocketRequest req = new SocketRequest();

            req.p1 = GUIDHelper.generate();
            req.p2 = "login";
            req.p3 = DataHelper.GetInstance().LoadToken(dbManager);
            req.p4 = SystemInfo.deviceUniqueIdentifier;

            webSocket.Send(DESHelper.EncodeBytes(GZipHelper.compress(ProtoHelper.Proto2Bytes(req)), AppContext.GetInstance().getDesKey()));
        }
コード例 #4
0
    private void DoTake(bool take)
    {
        SocketRequest sr = new SocketRequest();

        sr.p1 = GUIDHelper.generate();
        sr.p2 = "takeLandlord";
        sr.p3 = LocalToken();
        sr.p4 = SystemInfo.deviceUniqueIdentifier;
        sr.p5 = AppContext.GetInstance().Watch.gameId.ToString();
        sr.p6 = AppContext.GetInstance().Watch.seatId.ToString();
        sr.p7 = take.ToString();
        SendBytes(ProtoHelper.Proto2Bytes(sr));
    }
コード例 #5
0
    public void OnbtlClick()
    {
        CleanMessage();
        buttonLogin.enabled = false;
        string mobile = inputMobile.value.Trim();
        string code   = inputCode.value.Trim();

        if (mobile == null || "".Equals(mobile))
        {
            ShowMessage(ErrorCode.EC_UC_NO_MOBILE);
            buttonLogin.enabled = true;
            return;
        }

        if (!RegexHelper.isMobile(mobile))
        {
            ShowMessage(ErrorCode.EC_UC_INVALID_MOBILE);
            buttonLogin.enabled = true;
            return;
        }

        if (code == null || "".Equals(code))
        {
            ShowMessage(ErrorCode.EC_UC_NO_CODE);
            buttonLogin.enabled = true;
            return;
        }

        if (!RegexHelper.isValidCode(code))
        {
            ShowMessage(ErrorCode.EC_UC_INVALID_CODE);
            buttonLogin.enabled = true;
            return;
        }

        LoginReq req = new LoginReq
        {
            clientId         = Constants.CLIENT_ID,
            deviceType       = DeviceHelper.getDeviceType(),
            fingerPrint      = SystemInfo.deviceUniqueIdentifier,
            mobile           = mobile,
            verificationCode = code,
            version          = Constants.VERSION
        };

        HttpPost(Constants.API_ID_LOGIN, ProtoHelper.Proto2Bytes(req));
    }
コード例 #6
0
    public void OnbtlClick()
    {
        CleanMessage();
        buttonSend.enabled = false;

        string mobile = inputMobile.value.Trim();

        if (mobile == null || "".Equals(mobile))
        {
            ShowMessage(ErrorCode.EC_UC_NO_MOBILE);
            buttonSend.enabled = true;
            return;
        }

        if (!RegexHelper.isMobile(mobile))
        {
            ShowMessage(ErrorCode.EC_UC_INVALID_MOBILE);
            buttonSend.enabled = true;
            return;
        }

        string s = resend ? "1" : "0";
//            SendLoginVerificationCodeReq req = new SendLoginVerificationCodeReq
//            {
//                DeviceType = DeviceHelper.getDeviceType(),
//                FingerPrint = SystemInfo.deviceUniqueIdentifier,
//                Mobile = mobile,
//                Resend = s,
//                LastChannel = lastChannel
//            };

        SendCode sc = new SendCode()
        {
            deviceType  = DeviceHelper.getDeviceType(),
            fingerPrint = SystemInfo.deviceUniqueIdentifier,
            mobile      = mobile,
            resend      = s,
            lastChannel = lastChannel
        };

        HttpPost(Constants.API_ID_SEND_CODE, ProtoHelper.Proto2Bytes(sc));
    }
コード例 #7
0
    public void SendPlayCards(PlayCardsReq req)
    {
        HideAll();
        SocketRequest sr = new SocketRequest();

        sr.p1  = GUIDHelper.generate();
        sr.p2  = "playCards";
        sr.p3  = LocalToken();
        sr.p4  = SystemInfo.deviceUniqueIdentifier;
        sr.p5  = AppContext.GetInstance().Watch.gameId.ToString();
        sr.p6  = AppContext.GetInstance().Watch.seatId.ToString();
        sr.p7  = AppContext.GetInstance().Watch.seqInGame.ToString();
        sr.p8  = req.typeWithPoints.cardsType.ToString();
        sr.p9  = req.Keys();
        sr.p10 = CardHelper.GetInstance().Join(req.points);
        sr.p11 = CardHelper.GetInstance().Join(req.handPoints);
        SendBytes(ProtoHelper.Proto2Bytes(sr));

        GetComponent <GameUIRender>().SendMessage("LetItGo");
    }
コード例 #8
0
    void LoginByToken()
    {
        string token = LocalToken();

        if ("-".Equals(token))
        {
            SceneManager.LoadScene("login");
            return;
        }

        LoginByTokenReq req = new LoginByTokenReq
        {
            clientId    = Constants.CLIENT_ID,
            version     = Constants.VERSION,
            deviceType  = DeviceHelper.getDeviceType(),
            fingerPrint = SystemInfo.deviceUniqueIdentifier,
            token       = token
        };

        dataType = 1;
        HttpPost(Constants.API_ID_LOGIN_BY_TOKEN, ProtoHelper.Proto2Bytes(req));
    }
コード例 #9
0
    void PullResource()
    {
        ConfigRow loadConfig = DataHelper.GetInstance().LoadConfig(dbManager);

        if (loadConfig.ResourceVersion == 0)
        {
            SimpleReq req = new SimpleReq
            {
                param0 = loadConfig.Lan
            };
            HttpPost(Constants.API_LOAD_ALL_RESOURCES, ProtoHelper.Proto2Bytes(req));
        }
        else
        {
            PullResourceReq req = new PullResourceReq
            {
                version = loadConfig.ResourceVersion,
                lan     = loadConfig.Lan
            };
            HttpPost(Constants.API_PULL_RESOURCES, ProtoHelper.Proto2Bytes(req));
        }
    }