public void onCreateRoomCallback(ClientResponse response)
    {
        if (response.handleCode == StatusCode.SESSION_expire ||
            response.handleCode == StatusCode.SESSION_invalid || response.bytes == null)
        {
            TipsManagerScript.getInstance().setTips("错误:" + response.handleCode);
            return;
        }

        staticc__room_opreation_response res = ClientRequest.DeSerialize <staticc__room_opreation_response>(response.bytes);

        Debug.Log("room number: " + res.data.room_num);

        //进入游戏中等待其他玩家加入
        GlobalDataScript.roomInfo = res.data;
        int roomid = Int32.Parse(response.message);

        sendVo.roomId = roomid;
        //			GlobalDataScript.roomVo = sendVo;
        GlobalDataScript.loginResponseData.roomId = roomid;
        //GlobalDataScript.loginResponseData.isReady = true;
        GlobalDataScript.loginResponseData.main     = true;
        GlobalDataScript.loginResponseData.isOnLine = true;

        GlobalDataScript.gamePlayPanel = PrefabManage.loadPerfab("Prefab/Panel_GamePlay");
        GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().createRoomAddAvatarVO(GlobalDataScript.loginResponseData);
        closeDialog();
    }
Пример #2
0
    public void LoginWeChatCallBack(ClientResponse response_msg)
    {
        if (watingPanel != null)
        {
            watingPanel.SetActive(false);
        }
        app_login__weixin_response response = ClientRequest.DeSerialize <app_login__weixin_response>(response_msg.bytes);

        Debug.Log("login we chat call back: " + response.data + "sessionId: " + response.data.session_id);
        string sessionId = response.data.session_id;

        GamePreferences.Instance.SessionId = sessionId;
        LoginWithSessionId();
    }
Пример #3
0
    public void LoginCallBack(ClientResponse response)
    {
        if (watingPanel != null)
        {
            watingPanel.SetActive(false);
        }

        if (response.handleCode == StatusCode.SESSION_expire ||
            response.handleCode == StatusCode.SESSION_invalid || response.bytes == null)
        {
            return;
        }

        profile_response reponseX = ClientRequest.DeSerialize <profile_response>(response.bytes);

        Debug.Log("logincallback: " + reponseX.data.nickname);
        GlobalDataScript.playerInfo = reponseX.data;

        SoundCtrl.getInstance().stopBGM();
        SoundCtrl.getInstance().playBGM();

        if (GlobalDataScript.homePanel != null)
        {
            GlobalDataScript.homePanel.GetComponent <HomePanelScript>().removeListener();
            Destroy(GlobalDataScript.homePanel);
        }

        if (GlobalDataScript.gamePlayPanel != null)
        {
            GlobalDataScript.gamePlayPanel.GetComponent <MyMahjongScript>().exitOrDissoliveRoom();
        }

//		GlobalDataScript.loginResponseData = JsonMapper.ToObject<AvatarVO>(response.message);
//		ChatSocket.getInstance().sendMsg(new LoginChatRequest(GlobalDataScript.loginResponseData.account.uuid));
        panelCreateDialog = Instantiate(Resources.Load("Prefab/Panel_Home")) as GameObject;
        panelCreateDialog.transform.parent     = GlobalDataScript.getInstance().canvsTransfrom;
        panelCreateDialog.transform.localScale = Vector3.one;
        panelCreateDialog.GetComponent <RectTransform>().offsetMax = new Vector2(0f, 0f);
        panelCreateDialog.GetComponent <RectTransform>().offsetMin = new Vector2(0f, 0f);
        GlobalDataScript.homePanel = panelCreateDialog;
        removeListener();
        Destroy(this);
        Destroy(gameObject);
    }
Пример #4
0
    private void chooseGameCallBack(ClientResponse response)
    {
        if (response.handleCode == StatusCode.SESSION_expire ||
            response.handleCode == StatusCode.SESSION_invalid || response.bytes == null)
        {
            Debug.Log("chooseGameCallBack error " + response.handleCode);
            return;
        }
        staticc__ChoiceR_response res = ClientRequest.DeSerialize <staticc__ChoiceR_response>(response.bytes);

        GlobalDataScript.roomParameters = res;
        for (int i = 0; i < res.choice_info.Count; i++)
        {
            choice_info item = res.choice_info [i];
            Debug.Log(i + ": " + item.name + "  " + item.choice.Count);            // + "  " + item.default);
            for (int j = 0; j < item.choice.Count; j++)
            {
                Debug.Log("item choice " + j + "  " + item.choice [j]);
            }
        }
    }
Пример #5
0
    public void WeChatLoginCallBack(string result)
    {
        try {
            Hashtable map         = (Hashtable)MiniJSON.jsonDecode(result);
            string    accessToken = (string)map ["access_token"];
            string    openId      = (string)map ["openid"];
            Debug.Log(" tag unity result: " + result + "  token:" + accessToken + " openid:" + openId);

            app_login__weixin_api login = new app_login__weixin_api();
            login.access_token = accessToken;
            login.openid       = openId;
            byte[] content = ClientRequest.Serialize <app_login__weixin_api>(login);

            app_login__weixin_api test = ClientRequest.DeSerialize <app_login__weixin_api>(content);
            Debug.Log(content.Length + "test: " + test.access_token + " openid:  " + test.openid);

            CustomSocket.getInstance().sendMsg(new ClientRequest(ApiCode.LoginWeChatRequest).SetContent <app_login__weixin_api>(login));
        } catch (System.Exception e) {
            Debug.Log(e.StackTrace);
        }
    }