/* * public void OnEnterRoomLoaded() * { * roomID = int.Parse(roomidStr); * SendAddRoom addRoom = SendAddRoom.CreateBuilder() * .SetRoomID(roomID) * .SetOpenid(GameInfo.OpenID) * .Build(); * byte[] body = addRoom.ToByteArray(); * byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 2003, body.Length, 0, body); * Debug.Log("jiaru" + roomID + ",id:" + GameInfo.OpenID); * GameInfo.cs.Send(data); * * GameInfo.MJplayers.Clear();//加入房间时,清空字典,以免加入别的房间,数据不对 * roomidStr = null; * }*/ //message SendAddRoomOne{ //required string openid = 1;//用户OPENID //required int32 RoomID=2;//房间号} /// <summary> /// /// </summary> /// <param name="i"></param> public void OnEnterRoomClick() { if (GameInfo.isScoketClose) { GameInfo.cs.Closed(); } GameInfo.cs.serverType = ServerType.ListServer; roomID = int.Parse(roomidStr); GameInfo.room_id = roomID; //2017.8.2添加劉磊 開始 GameInfo.operation = 2; //SendGameOperation sendGameOperation = SendGameOperation.CreateBuilder() // .SetOpenid(GameInfo.OpenID) // .SetUnionid(GameInfo.unionid) // .SetOperation(GameInfo.operation) // .SetRoomID(GameInfo.room_id.ToString()) // .Build(); //byte[] body = sendGameOperation.ToByteArray(); SendGameOperation sendGameOperation = new SendGameOperation(); sendGameOperation.openid = GameInfo.OpenID; sendGameOperation.unionid = GameInfo.unionid; sendGameOperation.Operation = GameInfo.operation; sendGameOperation.RoomID = GameInfo.room_id.ToString(); sendGameOperation.GroupID = (int)GameInfo.GroupID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGameOperation); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1020, body.Length, 0, body); GameInfo.cs.Send(data); GameInfo.isScoketClose = true; DebugLog(body); //結束 }
public static int UserHearbeat = 0;//记录心跳异常次数 /// <summary> /// 心跳包 /// </summary> /// <returns></returns> public static int Xintiao() { var hear = new MaintainHeartbeat(); hear.state = 1; hear.openid = GameInfo.OpenID; hear.userID = userID; hear.Latitude = GameInfo.Latitude; if (cs.serverType == ServerType.GameServer) { hear.RoomID = room_id.ToString(); } byte[] body = ProtobufUtility.GetByteFromProtoBuf(hear); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1, body.Length, 0, body); try { GameInfo.cs.Send(data); UserHearbeat++; return(UserHearbeat); } catch (Exception ex) { UserHearbeat++; return(UserHearbeat); } }
//龙宝登录按钮监听方法 void LongbaoDenglu() { if (!agreementTge.isOn) { FICWaringPanel._instance.Show("请阅读并同意用户协议!"); return; } //定位 GPSManager.instance.StartCrt(); //如果证书不为空 if (!string.IsNullOrEmpty(GameInfo.certificate)) { SendLoginPW sendLoginPW = new SendLoginPW(); sendLoginPW.province = GameInfo.province; sendLoginPW.city = GameInfo.city; sendLoginPW.Latitude = GameInfo.Latitude; sendLoginPW.Certificate = GameInfo.certificate; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendLoginPW); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1003, body.Length, 0, body); GameInfo.cs.Send(data); DisableLoginButtons(); GameInfo.loginType = LoginType.longbao; } else { HideLoginButtons(); ShowZhanghaoPanel(); } }
/// <summary> /// 发送创建房间信息 /// </summary> public void OnCreatRoomClick() { if (GameInfo.isScoketClose) { GameInfo.cs.Closed(); } GameInfo.cs.serverType = ServerType.ListServer; GameInfo.room_peo = room_peo; GameInfo.gameCount = count; GameInfo.operation = 1; //SendGameOperation sendGameOperation = SendGameOperation.CreateBuilder() // .SetOpenid(GameInfo.OpenID) // .SetUnionid(GameInfo.unionid) // .SetOperation(GameInfo.operation) // .SetRoomID(GameInfo.room_id.ToString()) // .Build(); //byte[] body = sendGameOperation.ToByteArray(); SendGameOperation sendGameOperation = new SendGameOperation(); sendGameOperation.openid = GameInfo.OpenID; sendGameOperation.unionid = GameInfo.unionid; sendGameOperation.Operation = GameInfo.operation; sendGameOperation.RoomID = GameInfo.room_id.ToString(); sendGameOperation.GroupID = (int)GameInfo.GroupID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGameOperation); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1020, body.Length, 0, body); GameInfo.cs.Send(data); GameInfo.isScoketClose = true; createRoomButton.enabled = false; }
/// <summary> /// 发送礼物表情消息 /// </summary> /// <param name="str">礼物字符串标注("int(语音号),int(发送方位)")</param> public void SendProp(string str) { string[] strs = str.Split(','); //GameObject go = Instantiate(Resources.Load<GameObject>("Game_GYMJ/Prefabs/prop/" + strs[0]), GameUIGO.transform.Find("Fixed_UI/Heads")) as GameObject; // go.GetComponent<RectTransform>().localPosition = GetHeadPos((int)(GameInfo.GetFW(GameInfo.FW))); //go.GetComponent<RectTransform>().localScale = Vector3.one; //go.GetComponent<Image>().SetNativeSize(); // go.GetComponent<RectTransform>().DOLocalMove(GetHeadPos(int.Parse(strs[1])), 2); //StartCoroutine(PropMove(go)); //SendVoice sendGameOperation = SendVoice.CreateBuilder() // .SetOpenid(GameInfo.OpenID) // .SetRoomID(GameInfo.room_id) // .SetVoiceNumber(int.Parse(strs[0])) // .SetFWT(GetTrueFw(int.Parse(strs[1]))) // .Build(); //byte[] body = sendGameOperation.ToByteArray(); SendVoice sendGameOperation = new SendVoice(); sendGameOperation.openid = GameInfo.OpenID; sendGameOperation.RoomID = GameInfo.room_id; sendGameOperation.VoiceNumber = int.Parse(strs[0]); sendGameOperation.FWT = GetTrueFw(int.Parse(strs[1])); byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGameOperation); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 8002, body.Length, 0, body); Debug.Log(data); GameInfo.cs.Send(data); }
//账号密码输入界面-登录按钮监听方法 void ZhanghaoDenglu() { if (!agreementTge.isOn) { FICWaringPanel._instance.Show("请阅读并同意用户协议!"); return; } //定位 GPSManager.instance.StartCrt(); //SendLoginPW来自于谷歌插件 SendLoginPW sendLoginPW = new SendLoginPW(); sendLoginPW.UserAccount = inputUserName.text; sendLoginPW.pwd = inputPasword.text; //省份 sendLoginPW.province = GameInfo.province; //城市 sendLoginPW.city = GameInfo.city; //维度 sendLoginPW.Latitude = GameInfo.Latitude; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendLoginPW); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1003, body.Length, 0, body); GameInfo.cs.Send(data); HideZhanghaoPanel(); GameInfo.loginType = LoginType.longbao; }
void SendLobbyInfo(long groupID) { SendLobbyInfo sendLobbyInfo = new SendLobbyInfo(); sendLobbyInfo.GroupID = groupID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendLobbyInfo); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1080, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 获取朋友圈信息 /// </summary> void SendGroupInfo() { SendGroupInfo sendGroupInfo = new SendGroupInfo(); sendGroupInfo.openid = GameInfo.OpenID; sendGroupInfo.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGroupInfo); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1030, body.Length, 0, body); GameInfo.cs.Send(data); }
void SendQuitGroup() { SendQuitGroup sendQuitGroup = new SendQuitGroup(); sendQuitGroup.GroupID = (int)groupInfo.GroupID; sendQuitGroup.UserID = GameInfo.userID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendQuitGroup); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1090, body.Length, 0, body); GameInfo.cs.Send(data); }
void AddServer() { SendAddServer sendAddServer = new SendAddServer(); sendAddServer.openid = GameInfo.OpenID; sendAddServer.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendAddServer); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1011, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 根据牌桌信息ID请求牌局信息 /// </summary> public void OnSendGetUserGamePlayback(string str) { Newss_Pel.SetActive(true); keyTemp = str; SendGetUserGamePlayback sendGetUserGamePlayback = new SendGetUserGamePlayback(); sendGetUserGamePlayback.RoomInfoID = str; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGetUserGamePlayback); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 9003, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送加入房间 /// </summary> /// <param name="roomId">房间ID</param> public void SendAddRoom(int roomId) { ddzSendAddRoom sendAddRoom = new ddzSendAddRoom(); sendAddRoom.roomID = roomId; sendAddRoom.openid = GameInfo.OpenID; sendAddRoom.Latitude = GameInfo.Latitude; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendAddRoom); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUMD + 2003, body.Length, 0, body); GameInfo.cs.Send(data); }
void SendGetRoomCard() { SendGetRoomCard sendGetRoomCard = new SendGetRoomCard(); sendGetRoomCard.UserID = GameInfo.userID; sendGetRoomCard.openid = GameInfo.OpenID; sendGetRoomCard.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGetRoomCard); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1022, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 查看申请记录 /// </summary> void SendApplyRecord(long groupID = 0) { record = groupID == 0 ? false : true; SendApplyRecord sendApplyRecord = new SendApplyRecord(); sendApplyRecord.UserID = (int)GameInfo.userID; sendApplyRecord.GroupID = groupID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendApplyRecord); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1060, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 请求加入圈子 /// </summary> void SendApplyToJoin(int groupID) { SendApplyToJoin sendApplyToJoin = new SendApplyToJoin(); sendApplyToJoin.GroupID = groupID; sendApplyToJoin.openid = GameInfo.OpenID; sendApplyToJoin.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendApplyToJoin); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1040, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送请求开始游戏 /// </summary> public void SendStart() { ddzSendStart sendStart = new ddzSendStart(); sendStart.roomid = DDZData.room_id; sendStart.openid = GameInfo.OpenID; sendStart.UserID = GameInfo.userID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendStart); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUMD + 2007, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送出牌信息 /// </summary> /// <param name="cardsStr">//牌ID集合 中间以,分隔 比如 103,104,105 不传为过牌</param> public void SendOutCard(string cardsStr) { ddzSendOutCard sendOutCard = new ddzSendOutCard(); sendOutCard.openid = GameInfo.OpenID; sendOutCard.UserID = GameInfo.userID; sendOutCard.FW = DDZData.fw; sendOutCard.cardsStr = cardsStr; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendOutCard); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUMD + 2011, body.Length, 0, body); GameInfo.cs.Send(data); }
public void ReconServer() { GameInfo.cs.Closed(); SendAddServer sendAddServer = new SendAddServer(); sendAddServer.openid = GameInfo.OpenID; sendAddServer.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendAddServer); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1011, body.Length, 0, body); GameInfo.cs.Send(data); ficSGame.isRecon = true; }
/// <summary> /// 发送申请状态 /// </summary> /// <param name="status">申请状态,0申请中,1申请通过,2申请拒绝</param> void SendChangeApplyStatus(int status, long userID) { SendChangeApplyStatus sendChangeApplyStatus = new SendChangeApplyStatus(); sendChangeApplyStatus.UserID = userID; sendChangeApplyStatus.GroupID = groupID; sendChangeApplyStatus.ApplyStatus = status; sendChangeApplyStatus.OperationUserID = GameInfo.userID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendChangeApplyStatus); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1070, body.Length, 0, body); GameInfo.cs.Send(data); }
void SendGroupUserInfoByGroupID() { SendGroupUserInfoByGroupID sendGroupUserInfoByGroupID = new SendGroupUserInfoByGroupID(); sendGroupUserInfoByGroupID.openid = GameInfo.OpenID; sendGroupUserInfoByGroupID.GroupID = (int)groupInfo.GroupID; sendGroupUserInfoByGroupID.unionid = GameInfo.unionid; Debug.Log(groupInfo.GroupID); byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGroupUserInfoByGroupID); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1034, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送播放选择的快捷语音 /// </summary> public void SendQuickVoice(int voiceNum) { SendVoice sencGameOperation = new SendVoice(); sencGameOperation.openid = GameInfo.OpenID; sencGameOperation.RoomID = GameInfo.room_id; sencGameOperation.VoiceNumber = voiceNum; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sencGameOperation); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 8002, body.Length, 0, body); Debug.Log(data); GameInfo.cs.Send(data); GameInfo.isScoketClose = true; }
/// <summary> /// 请求获取玩家战绩 /// </summary> public void OnSendGetUserRecord() { News_Pel.SetActive(true); SendGetUserRecord sendGetUserRecord = new SendGetUserRecord(); sendGetUserRecord.UserID = GameInfo.userID; sendGetUserRecord.openid = GameInfo.OpenID; sendGetUserRecord.unionid = GameInfo.unionid; Debug.Log("请求战绩"); byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGetUserRecord); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 9001, body.Length, 0, body); GameInfo.cs.Send(data); }
void SendQueYiMenMessage(GameInfo.QueType queType) { //发送缺一门消息给服务器 //var qym = SendQYM.CreateBuilder().SetType((int)queType).SetOpenid(GameInfo.OpenID).Build(); //byte[] body = qym.ToByteArray(); var qym = new SendQYM(); qym.type = (int)queType; qym.openid = GameInfo.OpenID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(qym); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 5011, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送叫地主 /// </summary> /// <param name="type">叫牌类型</param> /// <param name="value">叫牌值</param> public void SendCallLandlord(int type, int value) { ddzSendCallLandlord sendCallLandlord = new ddzSendCallLandlord(); sendCallLandlord.FW = DDZData.fw; sendCallLandlord.openid = GameInfo.OpenID; sendCallLandlord.UserID = GameInfo.userID; sendCallLandlord.CallType = type; sendCallLandlord.value = value; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendCallLandlord); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUMD + 2009, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 获取圈内玩家列表,管理用户 /// </summary> void SendGroupUsersManager(string openid, string unionid, Int64 groupID, Int64 delByUserID = 0, Int64 checkRecordByUserID = 0, long addUsers = 0) { SendGroupUsersManager sendPlayerList = new SendGroupUsersManager(); sendPlayerList.openid = openid; sendPlayerList.unionid = unionid; sendPlayerList.GroupID = groupID; sendPlayerList.delByUserID = delByUserID; sendPlayerList.checkRecordByUserID = checkRecordByUserID; sendPlayerList.addUsers = addUsers; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendPlayerList); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 1050, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 请求获取圈子玩家战绩 /// </summary> public void SendGetUserRecord() { GameInfo.isPYQExploits = true; SendGetUserRecord sendGetUserRecord = new SendGetUserRecord(); sendGetUserRecord.UserID = GameInfo.userID; sendGetUserRecord.openid = GameInfo.OpenID; sendGetUserRecord.unionid = GameInfo.unionid; sendGetUserRecord.GroupID = (int)groupInfo.GroupID; Debug.Log("请求圈子战绩" + groupInfo.GroupID); byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendGetUserRecord); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 9001, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 发送创建房间 /// </summary> public void SendDZCreateRoom() { ddzSendDZCreateRoom sendDZCreateRoom = new ddzSendDZCreateRoom(); sendDZCreateRoom.openid = GameInfo.OpenID; sendDZCreateRoom.roomNumber = DDZData.roomInfo.inningNum; sendDZCreateRoom.roomtype = DDZData.roomInfo.playType; sendDZCreateRoom.multiple = DDZData.roomInfo.multiple; sendDZCreateRoom.Latitude = GameInfo.Latitude; sendDZCreateRoom.GroupID = (int)GameInfo.GroupID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendDZCreateRoom); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUMD + 2001, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> /// 碰牌 /// </summary> public void Peng_S() { //碰按钮 GameObject.Find("Main Camera").GetComponent <FICStartGame>().pengButtonGO.SetActive(false); //过按钮 GameObject.Find("Main Camera").GetComponent <FICStartGame>().guoButtonGO.SetActive(false); //杠按钮 GameObject.Find("Main Camera").GetComponent <FICStartGame>().gangButtonGO.SetActive(false); //胡按钮 GameObject.Find("Main Camera").GetComponent <FICStartGame>().huButtonGO.SetActive(false); GameObject qipai = GameObject.Find("Main Camera"); //qipai.GetComponent<FICpaipaipai>().SPengGangPai(GameInfo.pengInfo.Mj.PaiHS, PPTYPE.Peng); //碰牌区生成3张碰杠牌,并加入碰杠牌集合,并消除手牌中相应的牌 myCards.PengPaiEntir(GameInfo.pengInfo.mj.PaiHS); //个人手牌,弃牌,碰牌的父物体 GameObject game = myCards.shouPaiContainerTrans.gameObject; //弃牌区的最后一张牌删除 qipai.GetComponent <FICpaipaipai>().DelQIpai(GameInfo.GetFW(GameInfo.pengInfo.fw)); // 当缺一门的牌确定后,将非缺门牌遮罩,只显示缺门牌,并排序到最右侧1-39筒。41-79条,81-119万,最开始调用的一次,之后的用其他方法 gameObject.GetComponent <FICMaskPai>().OnQueYiMenButtonClick(GameInfo.queType); //var sp = SendPeng.CreateBuilder().SetTypes(1) // .SetState(1) // .SetOpenid(GameInfo.OpenID) // .SetRoomid(GameInfo.room_id) // .SetFW(GameInfo.pengInfo.Fw) // .SetMj(GameInfo.pengInfo.Mj).Build(); //byte[] body = sp.ToByteArray(); var sp = new SendPeng(); sp.types = 1; sp.state = 1; sp.openid = GameInfo.OpenID; sp.roomid = GameInfo.room_id; sp.FW = GameInfo.pengInfo.fw; sp.mj = GameInfo.pengInfo.mj; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sp); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 4001, body.Length, 0, body); //将碰的信息上传 GameInfo.cs.Send(data); GameInfo.pengInfo = null; GameInfo.huPaiInfo = null; GameInfo.returnHByType = null; // 根据传过来的方位和方式显示,碰杠特效 startGame.ShowDeskSkillsOnDirection(FW.South, PPTYPE.Peng); }
/// <summary> /// 发送请求托管 /// </summary> public void OnSendManaged() { //SendManaged sendManaged = SendManaged.CreateBuilder() // .SetState(1) // .SetOpenid(GameInfo.OpenID) // .Build(); //byte[] body = sendManaged.ToByteArray(); SendManaged sendManaged = new SendManaged(); sendManaged.state = 1; sendManaged.openid = GameInfo.OpenID; byte[] body = ProtobufUtility.GetByteFromProtoBuf(sendManaged); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 2012, body.Length, 0, body); GameInfo.cs.Send(data); }
/// <summary> ///发送请求退出房间 /// </summary> public void SendQuitMessage() { //SendRemove quitRequire = SendRemove.CreateBuilder() // .SetOpenid(GameInfo.OpenID) // .SetRoomID(GameInfo.room_id) // .SetUnionid(GameInfo.unionid) // .Build(); //byte[] body = quitRequire.ToByteArray(); SendRemove quitRequire = new SendRemove(); quitRequire.openid = GameInfo.OpenID; quitRequire.RoomID = GameInfo.room_id; quitRequire.unionid = GameInfo.unionid; byte[] body = ProtobufUtility.GetByteFromProtoBuf(quitRequire); byte[] data = CreateHead.CreateMessage(CreateHead.CSXYNUM + 5008, body.Length, 0, body); GameInfo.cs.Send(data); }