/// <summary> /// 下注 /// </summary> public void DownBET(CBETItem _BetItem) { if (CBETManger._instance.m_cBetTop.m_cGameGold.m_iNum > m_lCurrentChip) { if (m_bIsBetTime) { CMusicManger_JSYS._instance.PlaySound("InputScore"); //获取游戏记录 NPacket packet = NPacketPool.GetEnablePacket(); packet.CreateHead(MainCmd.MDM_GF_GAME, SubCmd.SUB_C_PLAY_BET); CMD_C_PlayBet playBet; playBet.nAnimalIndex = _BetItem.m_iBetID; playBet.lBetChip = m_lCurrentChip; byte[] dataBuffer = GameConvert.StructToByteArray <CMD_C_PlayBet>(playBet); int len = Marshal.SizeOf(typeof(CMD_C_PlayBet)); packet.AddBytes(dataBuffer, len); CGameEngine.Instance.Send(packet); } else { AddTiShi("非下注时间无法下注"); } } else { AddTiShi("金币不足,请充值"); } }
public static void WhatTheFuck() { GameConvert.ByteToStruct <STEnjoyGameAtt>(null, 0); GameConvert.StructToByteArray <STEnjoyGameAtt>(new STEnjoyGameAtt()); typeof(GameConvert).MakeGenericType(typeof(STEnjoyGameAtt)); GameConvert.ByteToStruct <CMD_S_ContinueJettons_temp>(null, 0); GameConvert.StructToByteArray <CMD_S_ContinueJettons_temp>(new CMD_S_ContinueJettons_temp()); GameConvert.ByteToStruct <STAnimalInfo>(null, 0); GameConvert.StructToByteArray <STAnimalInfo>(new STAnimalInfo()); GameConvert.ByteToStruct <STAnimalPrize>(null, 0); GameConvert.StructToByteArray <STAnimalPrize>(new STAnimalPrize()); GameConvert.ByteToStruct <STEnjoyGamePrizeInfo>(null, 0); GameConvert.StructToByteArray <STEnjoyGamePrizeInfo>(new STEnjoyGamePrizeInfo()); GameConvert.ByteToStruct <STAnimalAttArray>(null, 0); GameConvert.StructToByteArray <STAnimalAttArray>(new STAnimalAttArray()); GameConvert.ByteToStruct <STAnimalAtt>(null, 0); GameConvert.StructToByteArray <STAnimalAtt>(new STAnimalAtt()); GameConvert.ByteToStruct <STEnjoyGameAtt>(null, 0); GameConvert.StructToByteArray <STEnjoyGameAtt>(new STEnjoyGameAtt()); GameConvert.ByteToStruct <GamePrizeRecord>(null, 0); GameConvert.StructToByteArray <GamePrizeRecord>(new GamePrizeRecord()); }
public byte[] ToBytes(Packet packet) { var pHead = new CMD_Head_8(); pHead.MainCmdID = (ushort)packet.MainCmd; pHead.SubCmdID = (ushort)packet.SubCmd; pHead.CheckCode = (byte)packet.CheckCode; pHead.DataSize = (ushort)(CommonDefine.TCP_HEAD_8_SIZE + packet.DataSize); pHead.MessageVer = (byte)CommonDefine.VERSION; var buffer = ByteBufferPool.PopPacket(); byte[] headBuffer = GameConvert.StructToByteArray <CMD_Head_8>(pHead); buffer.Position = 0; buffer.PushByteArray(headBuffer); if (packet.Data != null) { buffer.PushByteArray(packet.Data); } var bytes = buffer.ToByteArray(); ByteBufferPool.DropPacket(buffer); if (EnableEncrypt) { bytes = Encrypt(bytes); } return(bytes); }
public void SendUserSettings() { CMD_GF_GameOption option = new CMD_GF_GameOption(); byte[] dataBuffer = GameConvert.StructToByteArray(option); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_GAME_FRAME, CMD_Fishing.SUB_GF_GAME_OPTION, 0, dataBuffer); }
public void SendUserRegist(string name, Byte gender, string password, string referrerID) { string pwd = MD5Util.GetMD5Hash(password); var register = new CMD_GP_RegisterAccounts(); register.cbGender = gender; register.wFaceID = gender; register.szAccounts = name; register.szNickName = name; register.szInsurePass = pwd; register.szLogonPass = pwd; register.szSpreader = referrerID; register.szMachineID = GameApp.GameData.MAC; register.cbValidateFlags = GameHelper.GetServerSidePlatform(); register.dwPlazaVersion = (uint)GameVersion.ProcessVersion(GameApp.GameData.Version); //Logger.Net.Log("send regist request|username:"******" |password:" + pwd); byte[] dataBuffer = GameConvert.StructToByteArray(register); SendToHallSvr(MainCommand.MDM_GP_LOGON, SubCommand.SUB_GP_REGISTER_ACCOUNTS, 0, dataBuffer); //TODO 移除 GameApp.GameData.Account = name; GameApp.GameData.Password = pwd; }
//发送资料请求 public void SendGetUserInfoRequest() { var req = new CMD_GP_QueryIndividual(); req.dwUserID = GameApp.GameData.UserInfo.UserID; byte[] dataBuffer = GameConvert.StructToByteArray(req); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_QUERY_INDIVIDUAL, 0, dataBuffer); }
//发送刷新用户信息请求 public void SendRefreshUserInfo() { var Request = new CMD_GP_UserRequest(); Request.dwUserID = GameApp.GameData.UserInfo.UserID; byte[] dataBuffer = GameConvert.StructToByteArray(Request); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_REFRASH_USER_INFO, 0, dataBuffer); }
//发送登陆流水日志 public void SendLogonRecordRequest() { var Logon = new CMD_GP_UserRequest(); Logon.dwUserID = GameApp.GameData.UserInfo.UserID; byte[] dataBuffer = GameConvert.StructToByteArray(Logon); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_LOGON_RECORD, 0, dataBuffer); }
//获取版本和网址信息 public void ReqGetVersionInfo() { var info = new CMD_GP_RequestUpdateInfo(); info.cbDeviceType = GameHelper.GetServerSidePlatform(); info.dwPlazaVersion = (uint)GameVersion.ProcessVersion(GameApp.GameData.Version); byte[] dataBuffer = GameConvert.StructToByteArray(info); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_GET_VERSION_INFO, 0, dataBuffer); }
public void C_S_GunPowerUp(UInt32 power) { CMD_CS_GF_GUN_POWER_UP gunPowerUp = new CMD_CS_GF_GUN_POWER_UP(); gunPowerUp.gsUpScore = power; byte[] dataBuffer = GameConvert.StructToByteArray(gunPowerUp); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_USER_GUN_POWER_UP, 0, dataBuffer); }
///发送打开保险柜请求 public void SendOpenSafetyBoxRequest(string dwPassword) { var safetyBoxVerity = new CMD_GH_SafetyBoxVerify(); safetyBoxVerity.dwUserID = GameApp.GameData.UserInfo.UserID; safetyBoxVerity.dwMD5Pass = MD5Util.GetMD5Hash(dwPassword); byte[] dataBuffer = GameConvert.StructToByteArray(safetyBoxVerity); GameApp.Network.SendToSvr(ConnectionID.Lobby, MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_SAFETYBOX_VERIFY, 0, dataBuffer); }
public void UserBuyBullet(UInt32 wScore) { CMD_CS_GF_BUY_BULLET buyScore = new CMD_CS_GF_BUY_BULLET(); buyScore.gsScore = wScore; byte[] dataBuffer = GameConvert.StructToByteArray(buyScore); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_USER_BUY_BULLET, 0, dataBuffer); }
public void SendUserSitDown(UInt32 RoomID, UInt32 Desk, UInt32 Chair, string pwd) { var sitdown = new CMD_GR_UserSitDown(); sitdown.szPassword = pwd; sitdown.wChairID = (ushort)Chair; sitdown.wTableID = (ushort)Desk; byte[] dataBuffer = GameConvert.StructToByteArray(sitdown); GameApp.Network.SendToSvr(ConnectionID.Game, MainCommand.MDM_GR_USER, SubCommand.SUB_GR_USER_SITDOWN, 0, dataBuffer); }
public void SendUserUp(ushort table, ushort chair, bool force) { var standup = new CMD_GR_UserStandUp(); standup.wTableID = table; standup.wChairID = chair; standup.cbForceLeave = (byte)(force ? 1 : 0); byte[] dataBuffer = GameConvert.StructToByteArray(standup); GameApp.Network.SendToSvr(ConnectionID.Game, MainCommand.MDM_GR_USER, SubCommand.SUB_GR_USER_STANDUP, 0, dataBuffer); }
//绑定请求 public void SendLockAccountRequest(string dwPassword, UInt32 dwCommanType) { var LockAccount = new CMD_GP_ModifyMachine(); LockAccount.cbBind = (byte)dwCommanType; LockAccount.dwUserID = GameApp.GameData.UserInfo.UserID; LockAccount.szPassword = MD5Util.GetMD5Hash(dwPassword); LockAccount.szMachineID = GameApp.GameData.MAC; byte[] dataBuffer = GameConvert.StructToByteArray(LockAccount); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_LOCK_OR_UNLOCK_ACCOUNT, 0, dataBuffer); }
//发送玩家反馈 public void SendUserSuggestion(string type, string suggest, string phone) { var UserSuggestion = new CMD_GP_UserSuggestion(); UserSuggestion.dwUserID = GameApp.GameData.UserInfo.UserID; UserSuggestion.dwType = type; UserSuggestion.dwUserSuggestion = suggest; UserSuggestion.dwCellPhone = phone; byte[] dataBuffer = GameConvert.StructToByteArray(UserSuggestion); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_USER_SUGGESTION, 0, dataBuffer); }
///发送存钱请求 public void SendCheckInMoneyRequest(Int64 dwMoney) { var saveScore = new CMD_GP_UserSaveScore(); saveScore.lSaveScore = dwMoney; saveScore.szMachineID = GameApp.GameData.MAC; saveScore.dwUserID = GameApp.GameData.UserInfo.UserID; byte[] dataBuffer = GameConvert.StructToByteArray(saveScore); GameApp.Network.SendToSvr(ConnectionID.Lobby, MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_USER_SAVE_SCORE, 0, dataBuffer); }
///发送取钱请求 public void SendCheckOutMoneyRequest(Int64 dwMoney, string dwPassword) { var takeScore = new CMD_GP_UserTakeScore(); takeScore.lTakeScore = dwMoney; takeScore.dwUserID = GameApp.GameData.UserInfo.UserID; takeScore.szPassword = MD5Util.GetMD5Hash(dwPassword); takeScore.szMachineID = GameApp.GameData.MAC; byte[] dataBuffer = GameConvert.StructToByteArray(takeScore); GameApp.Network.SendToSvr(ConnectionID.Lobby, MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_USER_TAKE_SCORE, 0, dataBuffer); }
public void C_S_WinFromCache(uint _serverID, uint _bulletPower, uint _multi) { CMD_CS_GF_GET_SCORE_CACHE cahce = new CMD_CS_GF_GET_SCORE_CACHE(); cahce.gsNPCId = _serverID; cahce.gsPower = _bulletPower; cahce.gsRate = _multi; byte[] dataBuffer = GameConvert.StructToByteArray(cahce); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_WIN_FROM_CACHE, 0, dataBuffer); }
public void SendLoginGameSvr(uint nid, uint uid, string pwd, string mac) { var logon = new CMD_GR_LogonUserID(); logon.dwUserID = uid; logon.szMachineID = mac; logon.szPassword = pwd; logon.wKindID = (ushort)nid; byte[] dataBuffer = GameConvert.StructToByteArray(logon); GameApp.Network.SendToSvr(ConnectionID.Game, MainCommand.MDM_GR_LOGON, SubCommand.SUB_GR_LOGON_USERID, 0, dataBuffer); }
public void C_S_BulletAttack(uint gsServerId, uint gsCost, uint gsPower, uint gsRate) { CMD_CS_GF_BULLET_ATTACK bulletAttack = new CMD_CS_GF_BULLET_ATTACK(); bulletAttack.gsServerId = gsServerId; bulletAttack.gsCost = gsCost; bulletAttack.gsPower = gsPower; bulletAttack.gsRate = gsRate; byte[] dataBuffer = GameConvert.StructToByteArray(bulletAttack); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_BULLET_ATTACK, 0, dataBuffer); }
//发送游戏流水日志 public void SendGameRecordRequest(uint kind, uint page, uint pageSize, ulong time) { var Request = new CMD_GP_GameRecordRequest(); Request.dwUserID = GameApp.GameData.UserInfo.UserID; Request.dwGameKind = kind; Request.dwPage = page; Request.dwPageSize = pageSize; Request.dwTime = time; byte[] dataBuffer = GameConvert.StructToByteArray(Request); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_GAME_RECORD, 0, dataBuffer); }
//修改头像 public void SendChangeUserFace(string name, string ident, string phone, string im, uint head) { var req = new CMD_GP_SystemFaceInfo(); req.wFaceID = (UInt16)head; req.dwUserID = GameApp.GameData.UserInfo.UserID; req.szPassword = GameApp.GameData.Password; req.szMachineID = GameApp.GameData.MAC; byte[] dataBuffer = GameConvert.StructToByteArray(req); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_SYSTEM_FACE_INFO, 0, dataBuffer); }
public static bool AppendDescDataString(ref ByteBuffer buffer, ushort type, string text) { byte[] textBytes = System.Text.Encoding.Unicode.GetBytes(text); tagDataDescribe desc = new tagDataDescribe(); desc.wDataDescribe = type; desc.wDataSize = (ushort)textBytes.Length; byte[] descBytes = GameConvert.StructToByteArray <tagDataDescribe>(desc); buffer.PushByteArray(descBytes); buffer.PushByteArray(textBytes); return(true); }
public void SendLoginHallSvr(string wName, string wPassword, string mac) { var logon = new CMD_GP_LogonAccounts(); logon.szAccounts = wName; logon.szPassword = wPassword; logon.szMachineID = mac; logon.dwPlazaVersion = (uint)GameVersion.ProcessVersion(GameApp.GameData.Version); logon.cbValidateFlags = GameHelper.GetServerSidePlatform(); byte[] dataBuffer = GameConvert.StructToByteArray(logon); //Logger.Net.Log("send login request|username:"******"|password:" + wPassword); SendToHallSvr(MainCommand.MDM_GP_LOGON, SubCommand.SUB_GP_LOGON_ACCOUNTS, 0, dataBuffer); }
public void C_S_RobotGunFire(uint _chair, uint _serverID, float _rot, float _X, float _Y, uint _costValue, uint _serverTime) { CMD_CS_GF_ROBOT_GUN_FIRE robotGunFire = new CMD_CS_GF_ROBOT_GUN_FIRE(); robotGunFire.gsRoboChair = _chair; robotGunFire.gsSsrverId = _serverID; robotGunFire.gsRot = _rot; robotGunFire.gsZ = _X; robotGunFire.gsY = _Y; robotGunFire.gsCostVal = _costValue; robotGunFire.gsServerTime = _serverTime; byte[] dataBuffer = GameConvert.StructToByteArray(robotGunFire); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_ROBOT_GUN_FIRE, 0, dataBuffer); }
public void C_S_GunFire(float gsRot, float gsZ, float gsY, uint gsServerID, uint gsCostVal, uint gsServerTime) { CMD_CS_GF_USER_FIRE userFire = new CMD_CS_GF_USER_FIRE(); userFire.gsRot = gsRot; userFire.gsZ = gsZ; userFire.gsY = gsY; userFire.gsServerId = gsServerID; userFire.gsCostVal = gsCostVal; userFire.gsServerTime = gsServerTime; byte[] dataBuffer = GameConvert.StructToByteArray(userFire); Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_USER_GUN_FIRE, 0, dataBuffer); //Debug.LogWarning(" ================================================================================= CMD_CS_GF_USER_FIRE "); }
public void C_S_RobotBulletAttack(uint _robotChair, uint _serverID, uint _cost, uint _power, uint _multi) { CMD_CS_GF_ROBOT_BULLET_ATTACK robotBulletAttack = new CMD_CS_GF_ROBOT_BULLET_ATTACK(); robotBulletAttack.gsRobotChair = _robotChair; robotBulletAttack.gsNpcID = _serverID; robotBulletAttack.gsCost = _cost; robotBulletAttack.gsPower = _power; robotBulletAttack.gsRate = _multi; byte[] dataBuffer = GameConvert.StructToByteArray(robotBulletAttack); if (Fishing.Instance != null) { Fishing.Instance.SendMessageToGameCenter(CMD_Fishing.MDM_GF_INFO, CMD_Fishing.SUB_CS_GF_ROBOT_BULLET_ATTACK, 0, dataBuffer); } }
//修改资料 public void SendChangeUserInformation(string name, string nickName, string phone, string im, uint head, string UnderWrite) { var req = new CMD_GP_ModifyIndividual(); req.cbGender = GameApp.GameData.UserInfo.Gender; req.dwUserID = GameApp.GameData.UserInfo.UserID; req.szPassword = GameApp.GameData.Password; GameApp.GameData.TempNickName = nickName; byte[] dataBuffer = GameConvert.StructToByteArray(req); var buffer = ByteBufferPool.PopPacket(dataBuffer); if (!string.IsNullOrEmpty(nickName)) { ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_NICKNAME, nickName /*GameApp.GameData.UserInfo.NickName*/); } //ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_USER_NOTE, ident); if (!string.IsNullOrEmpty(name)) { ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_COMPELLATION, name); } if (!string.IsNullOrEmpty(im)) { ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_QQ, im); } if (!string.IsNullOrEmpty(phone)) { ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_MOBILE_PHONE, phone); } if (!string.IsNullOrEmpty(UnderWrite)) { ProtoHelper.AppendDescDataString(ref buffer, CommonDefine.DTP_GP_UI_UNDER_WRITE, UnderWrite); } var data = buffer.ToByteArray(); ByteBufferPool.DropPacket(buffer); SendToHallSvr(MainCommand.MDM_GP_USER_SERVICE, SubCommand.SUB_GP_MODIFY_INDIVIDUAL, 0, data); }
public bool SendData(int nChannelID, int nMainID, int nSubID, int nHandleCode, byte[] bytes) { IPC_Head_t head = new IPC_Head_t(); head.wMainCmdID = (UInt32)nMainID; head.wSubCmdID = (UInt32)nSubID; head.wHandleCode = (UInt32)nHandleCode; head.wDataSize = IPC_HEADER_LEN; if (bytes != null) { UInt32 tempDataBufferSize = (UInt32)bytes.Length; head.wDataSize += tempDataBufferSize; } ByteBuffer buffer = ByteBufferPool.PopPacket(); byte[] headBuffer = GameConvert.StructToByteArray <IPC_Head_t> (head); buffer.Position = 0; buffer.PushByteArray(headBuffer); if (bytes != null) { buffer.PushByteArray(bytes); } DATA_BUFFER sendData = new DATA_BUFFER(); sendData.buf = buffer.ToByteArray(); sendData.len = (UInt32)buffer.Length; mSendBufferQueue.Enqueue(new Send_Buffer(sendData, nChannelID)); ByteBufferPool.DropPacket(buffer); //LogUtil.Log ("IPC push messge |chan:"+nChannelID+"|main:"+nMainID+"|sub:"+nSubID+"|len:"+sendData.len); return(true); }