示例#1
0
    /// <summary>
    /// 获取玩家之间的距离
    /// </summary>
    public void SendGetPlayerDistances()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, GoldFlowerProtoIdMap.CMD_SendGetPlayerDistances, (msg) =>
        {
            SendGoldFlowerDistanceAck ack = msg.Read <SendGoldFlowerDistanceAck>();
            if (ack.code == 1)
            {
                GameDistanceWidget widget = BaseView.GetWidget <GameDistanceWidget>(AssetsPathDic.GameDistanceWidget, mView.transform);
                if (ack.data.distances != null)
                {
                    for (int i = 0; i < ack.data.distances.Count; i++)
                    {
                        SendGoldFlowerDistanceInfo dis = ack.data.distances[i];
                        widget.AddDistancePaire(dis.leftHead, dis.leftName, dis.leftUid, dis.RightHead, dis.RightName, dis.RightUid, dis.distance + "Km");
                    }
                }
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#2
0
    /// <summary>
    /// 获取俱乐部玩家列表
    /// </summary>
    /// <param name="call"></param>
    public void SendGetClubPlayerInfo()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetClubUsers, (msg) =>
        {
            ClubPlayerInfoAck data = msg.Read <ClubPlayerInfoAck>();
            if (data.code == 1)
            {
                if (data.data != null)
                {
                    ClubModel.Inst.AllPlayerPeach = data.data.allPlayerPeach;
                }
                if (data.data != null && data.data.list != null)
                {
                    ClubModel.Inst.ClubPlayerInfoData = data.data.list;
                }
                ClubView view = Global.Inst.GetController <ClubController>().OpenWindow() as ClubView;
                view.SetData(ClubModel.Inst.mClubData);
            }
            else
            {
                GameUtils.ShowErrorTips(data.code);
            }
        });
    }
示例#3
0
    /// <summary>
    /// 发送准备
    /// </summary>
    public void SendReady(CallBack call = null)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, GoldFlowerProtoIdMap.CMD_SendRready, (msg) =>
        {
            CommonRecieveProto ack = msg.Read <CommonRecieveProto>();
            if (ack.code == 1)
            {
            }
            else if (ack.code == 104 || ack.code == 105 || ack.code == 24 || ack.code == 13 || ack.code == 7 || ack.code == 6)
            {
                bool gold = XXGoldFlowerGameModel.Inst.mGoldPattern;
                XXGoldFlowerGameModel.Inst.CleanMode();
                Global.Inst.GetController <MainController>().OpenWindow();
                CloseWindow();
            }
            else
            {
                //GameUtils.ShowErrorTips(ack.code);
                if (call != null)
                {
                    call();
                }
            }
        });
    }
示例#4
0
    /// <summary>
    /// 离开房间
    /// </summary>
    public void SendLeaveRoom()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, TenProtoIdMap.CMD_SendLeaveRoom, (msg) =>
        {
            CommonRecieveProto ack = msg.Read <CommonRecieveProto>();
            if (ack.code == 1)
            {
            }
            else if (ack.code == 104 || ack.code == 105 || ack.code == 24 || ack.code == 13 || ack.code == 7 || ack.code == 6)
            {
                bool gold = TenModel.Inst.mGoldPattern;
                TenModel.Inst.CleanModel();
                Global.Inst.GetController <GamePatternController>().SendGetRoomList((patternView) =>
                {
                    SQSceneLoader.It.LoadScene("HALL", () =>
                    {
                        Global.Inst.GetController <GamePatternController>().OpenWindow();
                        CloseWindow();
                    });
                    if (!gold)
                    {
                        patternView.BackToFriendWidget();
                    }
                });
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#5
0
    /// <summary>
    /// 获取俱乐部信息
    /// </summary>
    public void SendGetClubInfo()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetClubInfo, (msg) =>
        {
            ClubInfoAck ack = msg.Read <ClubInfoAck>();
            if (ack.code == 1 && ack.data.ClubInfo != null)
            {
                SendGetClubPlayerInfo();
                ClubModel.Inst.mClubId   = ack.data.ClubInfo.clubId;
                ClubModel.Inst.mClubData = ack.data.ClubInfo;
            }
            else
            {
                if (ack.code == 15)
                {//需要创建一个俱乐部
                    BaseView.GetWidget <CreateClubWidget>(AssetsPathDic.CreateClubWidget, Global.Inst.GetController <MainController>().mView.transform);
                }
                else
                {
                    GameUtils.ShowErrorTips(ack.code);
                }
            }
        });
    }
示例#6
0
    /// <summary>
    /// 获取仓库信息
    /// </summary>
    /// <param name="call"></param>
    public void SendGetWareInfo(CallBack call)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetWareInfo, (msg) =>
        {
            SendGetWareInfoAck ack = msg.Read <SendGetWareInfoAck>();
            if (ack.code == 1)
            {
                PlayerModel.Inst.UserInfo.gold      = ack.data.info.gold;
                PlayerModel.Inst.UserInfo.wareHouse = ack.data.info.ware;
                PlayerModel.Inst.UserInfo.roomCard  = ack.data.info.roomCard;
                GlobalEvent.dispatch(eEvent.UPDATE_PROP);

                if (call != null)
                {
                    call();
                }
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#7
0
    /// <summary>
    /// 发送亮牌
    /// </summary>
    public void SendShowCard()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, GoldFlowerProtoIdMap.CMD_SendShowCard, (msg) =>
        {
            CommonRecieveProto ack = msg.Read <CommonRecieveProto>();
            if (ack.code == 1)
            {
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#8
0
    /// <summary>
    /// 获取平台场的人数
    /// </summary>
    /// <param name="call"></param>
    public void SendGetGoldPeopleNum(CallBack <List <int> > call)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetGoldPeopleNum, (msg) =>
        {
            GamePatternSendGetGoldPeopleNumAck ack = msg.Read <GamePatternSendGetGoldPeopleNumAck>();
            if (ack.code == 1)
            {
                if (call != null && ack.data != null)
                {
                    call(ack.data.nums);
                }
            }
        }, false);
    }
示例#9
0
    /// <summary>
    /// 检测是否还在游戏中
    /// </summary>
    /// <param name="call"></param>
    public void SendCheckInGame()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendCheckInGame, (msg) =>
        {
            GamePatternSendGetGoldPeopleNumAck ack = msg.Read <GamePatternSendGetGoldPeopleNumAck>();
            if (ack.code == 1)
            {
                Global.Inst.GetController <MainController>().BackToMain();
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        }, false);
    }
示例#10
0
    /// <summary>
    /// 发送心跳连接
    /// </summary>
    public void SendHeartBreath()
    {
        mNoHeartTime++;
        if (mNoHeartTime >= 3)
        {//超过两次没有收到心跳恢复
            SQDebug.Log("通过心跳判定的断网处理");
            ShowNetTips();
            return;
        }
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_Breath, (msg) =>
        {
            mNoHeartTime      = 0;
            mAutoReConnectNum = 0;
        }, false);
    }
示例#11
0
    /// <summary>
    /// 获取总代信息
    /// </summary>
    /// <param name="callback"></param>
    public void GetGeneralData(CallBack <GeneralAgrentData> callback)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetGeneralInfo, (msg) =>
        {
            GeneralAgrentRecieve data = msg.Read <GeneralAgrentRecieve>();
            if (data.code == 1)
            {
                if (callback != null)
                {
                    callback(data.data);
                }
            }
            else
            {
                GameUtils.ShowErrorTips(data.code);
            }
        });
    }
示例#12
0
    //获取俱乐部和代理收益数量
    public void SetGetGainNumReq(Action <float, float> call)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetGain, (msg) =>
        {
            SendGetGainNumAck ack = msg.Read <SendGetGainNumAck>();
            if (ack.code == 1)
            {
                if (call != null)
                {
                    call(ack.data.info.club, ack.data.info.agent);
                }
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#13
0
    /// <summary>
    /// 获取滚动公告
    /// </summary>
    public void SendGetNotice(CallBack call = null)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetNotice, (msg) =>
        {
            SendGetNoticeAck ack = msg.Read <SendGetNoticeAck>();
            if (ack.code == 1 && ack.data.messages != null)
            {
                MainViewModel.Inst.BroadMessage = ack.data.messages;
                //if (mView != null)
                //{
                //    mView.AddBroadMessage(ack.data.messages);
                //}
                if (call != null)
                {
                    call();
                }
            }
        });
    }
示例#14
0
    /// <summary>
    /// 离开房间
    /// </summary>
    public void SendLeaveRoom()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, GoldFlowerProtoIdMap.CMD_SendLeaveRoom, (msg) =>
        {
            CommonRecieveProto ack = msg.Read <CommonRecieveProto>();
            if (ack.code == 1)
            {
            }
            else if (ack.code == 104 || ack.code == 105 || ack.code == 24 || ack.code == 13 || ack.code == 7 || ack.code == 6)
            {
                Global.Inst.GetController <MainController>().SendGetWareInfo(() =>
                {
                    if (XXGoldFlowerGameModel.Inst.mGoldPattern)
                    {//平台房
                        XXGoldFlowerGameModel.Inst.CleanMode();
                        Global.Inst.GetController <SelectRoomController>().SendGetGoldPeopleNum((data) =>
                        {
                            SelectRoomView v = Global.Inst.GetController <SelectRoomController>().OpenWindow() as SelectRoomView;
                            v.SetData(data);
                            Global.Inst.GetController <MainController>().OpenWindow();
                            CloseWindow();
                        });
                    }
                    else
                    {
                        Global.Inst.GetController <MainController>().OpenWindow();
                        CloseWindow();
                    }
                });
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#15
0
    /// <summary>
    /// 请求获取代理收益
    /// </summary>
    public void SendGetAgentGain()
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetAgentGain, (msg) =>
        {
            SendGetAgentWinAck ack = msg.Read <SendGetAgentWinAck>();
            if (ack.code == 1)
            {
                AgentGainWidget widget = Global.Inst.GetController <AgentGainController>().OpenWindow() as AgentGainWidget;
                if (ack.data != null)
                {
                    mView.gameObject.SetActive(false);
                    float allpeach = PlayerModel.Inst.UserInfo.gold + PlayerModel.Inst.UserInfo.wareHouse;
                    widget.InitUI(ack.data.agentList, mView.gameObject, ack.data.agentNum, ClubModel.Inst.AllPlayerPeach, PlayerModel.Inst.UserInfo.wareHouse, ack.data.higherAgent);
                }
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
        });
    }
示例#16
0
    /// <summary>
    /// 获取房间列表
    /// </summary>
    public void SendGetRoomList(CallBack <GamePatternView> call = null)
    {
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, ProtoIdMap.CMD_SendGetRoomList, (msg) => {
            SendGetRoomListAck ack = msg.Read <SendGetRoomListAck>();
            if (ack.code == 1)
            {
                //打开界面
                OpenWindow();
                List <string> names = new List <string>();
                names.Add(typeof(GamePatternView).Name);
                BaseView.CloseAllViewBut(names);

                GamePatternModel.Inst.mChouCheng = ack.data.chouCheng;
                GamePatternModel.Inst.mClubId    = ack.data.clubId;

                PlayerModel.Inst.UserInfo.gold     = ack.data.gold;
                PlayerModel.Inst.UserInfo.roomCard = ack.data.roomCard;

                //刷新界面
                if (ack.data.roomInfoList == null || ack.data.roomInfoList.Count == 0)
                {
                    GamePatternModel.Inst.mRoomList.Clear();
                }
                else
                {
                    GamePatternModel.Inst.mRoomList = ack.data.roomInfoList;
                }
                mView.SetData(ack.data.clubId, ack.data.totalNum, ack.data.onLineNum, ack.data.chouCheng, ack.data.clubName);
                if (call != null)
                {
                    call(mView);
                }
            }
        });
    }
示例#17
0
    /// <summary>
    /// 切换房间
    /// </summary>
    public void SendChangGoldPattern()
    {
        XXGoldFlowerGameModel.Inst.mChangDesk = true;
        CommonSendProto req = new CommonSendProto();

        NetProcess.SendRequest <CommonSendProto>(req, GoldFlowerProtoIdMap.CMD_SendChangGoldRoom, (msg) =>
        {
            GoldFlowerCreateRoomAck ack = msg.Read <GoldFlowerCreateRoomAck>();
            if (ack.code == 1)
            {
                XXGoldFlowerGameModel.Inst.CleanMode(true);
                ServerCreateJoinGame(ack.data);
            }
            else
            {
                GameUtils.ShowErrorTips(ack.code);
            }
            if (mView != null)
            {
                mView.mSelfPlayer.SetChanagDeskBtnState(true);
                mView.mSelfPlayer.SetReadyBtnState(true);
            }
        });
    }