Exemplo n.º 1
0
        public void testLogin(string uin)
        {
            LoginVO lvo = new LoginVO();

            try {
                lvo.openId   = "" + uin;
                lvo.nickName = "" + uin;
                lvo.headIcon = "";
                lvo.unionid  = "" + uin;
                lvo.province = "广东省";
                lvo.city     = "深圳";
                lvo.sex      = 1;
                lvo.IP       = GameManager.getInstance().getIpAddress();
                String msg = JsonMapper.ToJson(lvo);

                GameManager.getInstance().Server.requset(APIS.LOGIN_REQUEST, msg);

                AvatarVO avo = new AvatarVO();
                avo.account          = new Account();
                avo.account.city     = lvo.city;
                avo.account.openid   = lvo.openId;
                avo.account.nickname = lvo.nickName;
                avo.account.headicon = lvo.headIcon;
                avo.account.unionid  = lvo.city;
                avo.account.sex      = lvo.sex;
                avo.IP = lvo.IP;
                GlobalData.getInstance().myAvatarVO = avo;
            } catch (Exception e) {
                Debug.Log(e.ToString());
                TipsManager.getInstance().setTips("请先打开你的微信客户端");
                return;
            }

            //GameManager.getInstance().Server.requset(new LoginRequest(null));
        }
Exemplo n.º 2
0
        public void onOtherJointRoom(ClientResponse response)
        {
            AvatarVO avatar = JsonMapper.ToObject <AvatarVO> (response.message);

            _uiHelper.getCardGOs(avatarList.Count).PlayerItem.setAvatarVo(avatar);
            avatarList.Add(avatar);
        }
Exemplo n.º 3
0
        public void updateRoomVO(RoomJoinResponseVo vo)
        {
            RoomVO   myRVO = GlobalData.getInstance().roomVO;
            AvatarVO myAVO = GlobalData.getInstance().myAvatarVO;

            myRVO.addWordCard   = vo.addWordCard;
            myRVO.hong          = vo.hong;
            myRVO.ma            = vo.ma;
            myRVO.name          = vo.name;
            myRVO.roomId        = vo.roomId;
            myRVO.roomType      = vo.roomType;
            myRVO.roundNumber   = vo.roundNumber;
            myRVO.sevenDouble   = vo.sevenDouble;
            myRVO.xiaYu         = vo.xiaYu;
            myRVO.ziMo          = vo.ziMo;
            myRVO.magnification = vo.magnification;

            GlobalData.getInstance().remainRoundCount = vo.roundNumber;


            GlobalData.getInstance().playerList = vo.playerList;

            for (int i = 0; i < vo.playerList.Count; i++)
            {
                AvatarVO avo = vo.playerList [i];
                if (avo.account.openid == myAVO.account.openid)
                {
                    myAVO.account.uuid     = avo.account.uuid;
                    myAVO.account.roomcard = avo.account.roomcard;
                    break;
                }
            }
        }
Exemplo n.º 4
0
        /**
         * 获取微信个人信息成功回调,登录
         *
         */
        public void getUserInforCallback(int reqID, ResponseState state, PlatformType type, Hashtable data)
        {
            //TipsManagerScript.getInstance ().setTips ("获取个人信息成功");

            if (data != null)
            {
                MyDebug.Log(data.toJson());
                LoginVO lvo = new LoginVO();
                try {
                    lvo.openId   = (string)data ["openid"];
                    lvo.nickName = (string)data ["nickname"];
                    lvo.headIcon = (string)data ["headimgurl"];
                    lvo.unionid  = (string)data ["unionid"];
                    lvo.province = (string)data ["province"];
                    lvo.city     = (string)data ["city"];
                    string sex = data ["sex"].ToString();
                    lvo.sex = int.Parse(sex);
                    lvo.IP  = GameManager.getInstance().getIpAddress();
                    String msg = JsonMapper.ToJson(lvo);

                    GameManager.getInstance().Server.requset(APIS.LOGIN_REQUEST, msg);

                    AvatarVO avo = new AvatarVO();
                    avo.account          = new Account();
                    avo.account.city     = lvo.city;
                    avo.account.openid   = lvo.openId;
                    avo.account.nickname = lvo.nickName;
                    avo.account.headicon = lvo.headIcon;
                    avo.account.unionid  = lvo.city;
                    avo.account.sex      = lvo.sex;
                    avo.IP = lvo.IP;
                    GlobalData.getInstance().myAvatarVO = avo;

                    MyDebug.Log(" loginvo.nickName:" + lvo.nickName);
                } catch (Exception e) {
                    MyDebug.Log("微信接口有变动!" + e.Message);
                    TipsManager.getInstance().setTips("请先打开你的微信客户端");
                    return;
                }
            }
            else
            {
                TipsManager.getInstance().setTips("微信登录失败");
            }
        }
Exemplo n.º 5
0
        public void setAvatarVo(AvatarVO value)
        {
            if (value != null)
            {
                avatarVO          = value;
                readyImg.enabled  = avatarVO.isReady;
                bankerImg.enabled = avatarVO.main;
                nameText.text     = avatarVO.account.nickname;
                scoreText.text    = avatarVO.scores + "";
                offlineImage.transform.gameObject.SetActive(!avatarVO.isOnLine);
                StartCoroutine(LoadImg());
            }
            else
            {
                nameText.text     = "";
                readyImg.enabled  = false;
                bankerImg.enabled = false;
                scoreText.text    = "";
                readyImg.enabled  = false;

                headerIcon.sprite = Resources.Load("Image/morentouxiang", typeof(Sprite)) as Sprite;
            }
        }
Exemplo n.º 6
0
        /*************************断线重连*********************************/
        private void reEnterRoom()
        {
            _tableView.updateRule();
            //设置座位

            avatarList       = GlobalData.getInstance().playerList;
            _data.AvatarList = GlobalData.getInstance().playerList;
            for (int i = 0; i < avatarList.Count; i++)
            {
                _uiHelper.getCardGOs(i).PlayerItem.setAvatarVo(avatarList [i]);
            }


            if (_data.paiArray.Length == 0)              //游戏还没有开始
            {
                GlobalData.getInstance().gameStatus = GameStatus.READYING;
            }
            else                //牌局已开始
            {
                GlobalData.getInstance().gameStatus = GameStatus.GAMING;
                _uiHelper.hideReadyIcon();
                cleanGameplayUI();


                for (int i = 0; i < _data.AvatarList.Count; i++)
                {
                    AvatarVO avo  = avatarList [i];
                    var      hand = avo.paiArray [0];
                    //HandCard
                    _uiHelper.addOtherHandCards(i, avo.commonCards);
                    //TableCard
                    int[] chupai = avo.chupais;
                    if (chupai != null && chupai.Length > 0)
                    {
                        for (int j = 0; j < chupai.Length; j++)
                        {
                            _uiHelper.addCardToTable(i, chupai [j]);
                        }
                    }
                    //GangCard
                    if (checkPaiArrayContainType(avo.paiArray [1], PaiArrayType.GANG))
                    {
                        var gangs = avo.huReturnObjectVO.totalInfo.getGangInfos();
                        for (int j = 0; j < gangs.Length; j++)
                        {
                            var info = gangs [j];
                            hand [info.cardPoint] -= 4;
                            if (info.type == "an")
                            {
                                _uiHelper.addPGCCards(i, info.cardPoint, 3);
                            }
                            else
                            {
                                _uiHelper.addPGCCards(i, info.cardPoint, 2);
                            }
                        }
                    }
                    //PengCard
                    if (checkPaiArrayContainType(avo.paiArray [1], PaiArrayType.PENG))
                    {
                        for (int j = 0; j < avo.paiArray[1].Length; j++)
                        {
                            var t = avo.paiArray [1] [j] & (int)PaiArrayType.PENG;
                            if (t > 0 && hand [j] > 2)
                            {
                                hand [j] -= 3;
                                _uiHelper.addPGCCards(i, j, 1);
                            }
                        }
                    }
                    //ChiCard
                    if (checkPaiArrayContainType(avo.paiArray [1], PaiArrayType.CHI))
                    {
                        var chis = avo.huReturnObjectVO.totalInfo.getChiInfos();
                        for (int j = 0; j < chis.Length; j++)
                        {
                            var info = chis [j];
                            int a    = info.cardPionts [0];
                            int b    = info.cardPionts [1];
                            int c    = info.cardPionts [2];
                            hand [a] -= 1;
                            hand [b] -= 1;
                            hand [c] -= 1;
                            a         = Math.Min(Math.Min(b, c), a);
                            _uiHelper.addPGCCards(i, a, 4);
                        }
                    }
                }
                _data.AvatarList = GlobalData.getInstance().playerList;
                _uiHelper.addMyHandCards(_data.paiArray [0]);
                GameManager.getInstance().Server.requset(APIS.RETURN_ONLINE_REQUEST, "dd");
            }
        }
Exemplo n.º 7
0
        /**显示用户信息面板**/
        public void showUserInfoPanel(AvatarVO avo)
        {
            GameObject g = loadPerfab("Prefab/W_UserInfoUI");

            g.GetComponent <UserInfoView> ().setUIData(avo);
        }