public byte byAllRate; //总的进度 public static STaskState ParseResultPackage(byte[] dataBuffer) { STaskState sTaskState; sTaskState = PackageHelper.BytesToStuct <STaskState>(dataBuffer); return(sTaskState); }
CommandCallbackType ECTYPE_CLEARANCEHandle(byte[] dataBuffer, int socketID) { //TraceUtil.Log("============SendEctypeGoBattle##########2"); ECTYPE_CLEARANCE ectype_CLEARANCE = PackageHelper.BytesToStuct <ECTYPE_CLEARANCE>(dataBuffer); //RaiseEvent(EventTypeEnum.RequestEctypeUnlock.ToString(), ectype_CLEARANCE); uint _ectypeid = ectype_CLEARANCE.dwEctypeId; string ectypeid = ectype_CLEARANCE.dwEctypeId.ToString(); //TraceUtil.Log("$$$$$$$$$$$$$$$$$$$$$$$+?????????±±?????ectype_CLEARANCE.dwEctypeID" + ectype_CLEARANCE.dwEctypeId); if (ectypeid.Length > 5) { int _ectypeID = int.Parse(ectypeid.Substring(0, 5)); int _diff = int.Parse(ectypeid.Substring(4, 3)); EctypeSelectConfigData item = EctypeConfigManager.Instance.EctypeSelectConfigList[_ectypeID]; _ectypeid = (uint)item._vectContainer[_diff - 1]; //TraceUtil.Log("#################_ectypeid" + _ectypeid); } //NewbieGuideManager.Instance.SetPassEctypeID(_ectypeid); StroyLineDataManager.Instance.SetPassEctypeID(_ectypeid); return(CommandCallbackType.Continue); }
public static BoxSubMsgEntity ParsePackage(Package package, int offset) { var structLength = Marshal.SizeOf(typeof(BoxSubMsgEntity)); var headLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Header)); var offsetBuffer = package.Data.Skip(offset).Take(structLength).ToArray(); BoxSubMsgEntity boxSubMsgEntity = new BoxSubMsgEntity(); boxSubMsgEntity.m_sMsg_Header = SMsgPropCreateEntity_SC_Header.ParsePackage(package, offset); int of = headLength; of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out boxSubMsgEntity.UID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out boxSubMsgEntity.MapID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out boxSubMsgEntity.BoxX); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out boxSubMsgEntity.BoxY); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out boxSubMsgEntity.Name, 19); //boxSubMsgEntity.UID = BitConverter.ToInt64(offsetBuffer, headLength); //boxSubMsgEntity.MapID = BitConverter.ToUInt32(offsetBuffer, headLength + 8); //boxSubMsgEntity.BoxX = BitConverter.ToInt32(offsetBuffer, headLength + 8 + 4); //boxSubMsgEntity.BoxY = BitConverter.ToInt32(offsetBuffer, headLength + 8 + 4 + 4); //boxSubMsgEntity.Name = offsetBuffer.Skip(headLength + 8 + 4 + 4 + 4).Take(19).ToArray(); boxSubMsgEntity.BaseValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_BaseValue> (offsetBuffer.Skip(of).Take(4 * 2).ToArray()); of += 4 * 2; boxSubMsgEntity.BoxValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_BoxValue> (offsetBuffer.Skip(of).Take(4 * 4).ToArray()); return(boxSubMsgEntity); }
public static SMsgPropCreateEntity_SC_MainPlayer ParsePackage(Package package, int offset) { var structLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_MainPlayer)); var headLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Header)); var offsetBuffer = package.Data.Skip(offset).Take(structLength).ToArray(); SMsgPropCreateEntity_SC_MainPlayer sMsgPropCreateEntity_SC_MainPlayer = new SMsgPropCreateEntity_SC_MainPlayer(); sMsgPropCreateEntity_SC_MainPlayer.m_sMsg_Header = SMsgPropCreateEntity_SC_Header.ParsePackage(package, offset); int of = headLength; of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.ActorID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.UID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.MapID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.m_playerX); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.m_playerY); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_MainPlayer.m_name, 19); byte[] baseValues, playerUnitValues, playerValues; int baseValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_BaseValue>(); int unitValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_Player_UnitValue>(); int playValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_MainPlayer_PlayerValue>(); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out baseValues, baseValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out playerUnitValues, unitValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out playerValues, playValueSize); sMsgPropCreateEntity_SC_MainPlayer.BaseObjectValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_BaseValue>(baseValues); sMsgPropCreateEntity_SC_MainPlayer.UnitValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_Player_UnitValue>(playerUnitValues); sMsgPropCreateEntity_SC_MainPlayer.PlayerValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_MainPlayer_PlayerValue>(playerValues); return(sMsgPropCreateEntity_SC_MainPlayer); }
public UInt32 dwTime; //Îü¸½Ê±¼ä public static SMsgFightAdsorptionEx_SC ParseResultPackage(byte[] pkgData) { SMsgFightAdsorptionEx_SC sMsgFightAdsorptionEx_SC; sMsgFightAdsorptionEx_SC = PackageHelper.BytesToStuct <SMsgFightAdsorptionEx_SC>(pkgData); return(sMsgFightAdsorptionEx_SC); }
public byte byType; //ÀàÐÍ 1:¿ªÊ¼ 0:½áÊø public static SMsgFightClimbs_CS ParseResultPackage(byte[] pkgData) { SMsgFightClimbs_CS sMsgFightClimbs_CS; sMsgFightClimbs_CS = PackageHelper.BytesToStuct <SMsgFightClimbs_CS>(pkgData); return(sMsgFightClimbs_CS); }
public float DirY; //¡¤??¨°y public static SMsgFightChangeDirect_SC ParsePackage(byte[] dataBuffer) { SMsgFightChangeDirect_SC sMsgFightChangeDirect_SC; sMsgFightChangeDirect_SC = PackageHelper.BytesToStuct <SMsgFightChangeDirect_SC>(dataBuffer); return(sMsgFightChangeDirect_SC); }
/// <summary> /// 删除好友消息 /// </summary> CommandCallbackType DelFriendsResultHandle(byte[] dataBuffer, int socketID) { //uint dActorID = BitConverter.ToUInt32(dataBuffer, 0); SMsgDelFriends_SC sMsgDelFriends_SC = PackageHelper.BytesToStuct <SMsgDelFriends_SC>(dataBuffer); FriendDataManager.Instance.DeleteFriendData(sMsgDelFriends_SC.dwbDelActorID); if (FriendDataManager.Instance.CurPanelState == PanelState.MYFRIENDLIST) { FriendDataManager.Instance.IsUpdateFriendList = true; } if (FriendDataManager.Instance.IsDelFriendIsMe) { if (UI.MessageBox.Instance != null) { UI.MessageBox.Instance.ShowTips(4, LanguageTextManager.GetString("IDS_I23_12"), 1f); FriendDataManager.Instance.IsDelFriendIsMe = false; } } UIEventManager.Instance.TriggerUIEvent(UIEventType.DeleteFriendSuccess, null); RaiseEvent(EventTypeEnum.RefreshFriendList.ToString(), null); return(CommandCallbackType.Continue); }
public static SMsgFightTeleport_CSC ParseResultPackage(byte[] pkgData) { SMsgFightTeleport_CSC sMsgFightTeleport_CSC; sMsgFightTeleport_CSC = PackageHelper.BytesToStuct <SMsgFightTeleport_CSC>(pkgData); return(sMsgFightTeleport_CSC); }
CommandCallbackType MainButtonInitDataHandle(byte[] dataBuffer, int socketID) { SMsgInteract_NewbieGuide_SCS sMsgInteract_NewbieGuide_SCS = PackageHelper.BytesToStuct <SMsgInteract_NewbieGuide_SCS>(dataBuffer); GameManager.Instance.MainButtonIndex = sMsgInteract_NewbieGuide_SCS.wGuideIndex; UIEventManager.Instance.TriggerUIEvent(UIEventType.InitMainButton, (int)sMsgInteract_NewbieGuide_SCS.wGuideIndex); return(CommandCallbackType.Continue); }
public uint dwParam2; //按钮参数2 与byBtnType对应 做相应处理 客户端点击操作之后需要提交服务器,按钮 public static SMsgInteractCOMMONBtn_SC ParseResultPackage(byte[] dataBuffer, int offset, int length) { SMsgInteractCOMMONBtn_SC sMsgInteractCOMMONBtn_SC; sMsgInteractCOMMONBtn_SC = PackageHelper.BytesToStuct <SMsgInteractCOMMONBtn_SC>(dataBuffer.Skip(offset).Take(length).ToArray()); TraceUtil.Log("npcButton:ID1:" + sMsgInteractCOMMONBtn_SC.dwParam1 + "," + sMsgInteractCOMMONBtn_SC.dwParam2); return(sMsgInteractCOMMONBtn_SC); }
//Parse receive data buffer to BinPackage public static Package ParseReceiveData(byte[] databuff) { Package package = new Package(); var headLength = 5;// Marshal.SizeOf(package.Head); package.Head = PackageHelper.BytesToStuct <PkgHead>(databuff.Take(headLength).ToArray()); package.Data = databuff.Skip(headLength).ToArray().Take(package.Head.DataLength - 3).ToArray(); return(package); }
/// <summary> /// 好友单属性更新 /// </summary> CommandCallbackType RecvFriendUpdateHandle(byte[] dataBuffer, int socketID) { SMsgUpdateFriendProp_SC sMsgUpdateFriendProp_SC = PackageHelper.BytesToStuct <SMsgUpdateFriendProp_SC>(dataBuffer); FriendDataManager.Instance.UpdateFriendProp(sMsgUpdateFriendProp_SC); //FriendDataManager.Instance.RegUpdateFriendStatus(sMsgUpdateFriendProp_SC); return(CommandCallbackType.Continue); }
public byte byBtnNum; //NPC对话面板上显示在功能按钮个数 public static SMsgInteractCOMMON_SC ParseResultPackage(byte[] dataBuffer) { SMsgInteractCOMMON_SC sMsgInteractCOMMON_SC; // Package package = PackageHelper.ParseReceiveData(dataBuffer); var msgInteractCommonLength = Marshal.SizeOf(typeof(SMsgInteractCOMMON_SC)); sMsgInteractCOMMON_SC = PackageHelper.BytesToStuct <SMsgInteractCOMMON_SC>(dataBuffer.Take(msgInteractCommonLength).ToArray()); return(sMsgInteractCOMMON_SC); }
public SMsgPropCreateEntity_SC_OtherPlayer_PlayerValue SetValue(int index, int value) { var bytes = PackageHelper.StructToBytes <SMsgPropCreateEntity_SC_OtherPlayer_PlayerValue>(this); int offset = index * 4; var source = BitConverter.GetBytes(value); bytes[offset] = source[0]; bytes[offset + 1] = source[1]; bytes[offset + 2] = source[2]; bytes[offset + 3] = source[3]; return(PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_OtherPlayer_PlayerValue>(bytes)); }
public STeamContext UpdateValue(int index, int value) { var bytes = PackageHelper.StructToBytes <STeamContext>(this); int offset = index * 4; var source = BitConverter.GetBytes(value); bytes[offset] = source[0]; bytes[offset + 1] = source[1]; bytes[offset + 2] = source[2]; bytes[offset + 3] = source[3]; return(PackageHelper.BytesToStuct <STeamContext>(bytes)); }
public static int CheckPackageLength(byte[] recvBuffer, int length, out byte masterMsgType) { //CommonTrace.Log("Length:" + length); if (length < 5) //5 Package length field(2) MasterMsgType 1 SubMsgType 2 { masterMsgType = 0; return 5; } var binaryHead = PackageHelper.BytesToStuct<PkgHead>(recvBuffer); masterMsgType = binaryHead.MasterMsgType; return binaryHead.DataLength + 2; //整个包的长度 }
//Parse the data filed buffer to struct of T public static T ParseDataBufferToStruct <T>(byte[] databuff) where T : struct { T obj = default(T); //try //{ Package package = ParseReceiveData(databuff); obj = PackageHelper.BytesToStuct <T>(package.Data); //} //catch //{ // //TraceUtil.Log("收到的字节数组解包异常"); //} return(obj); }
public static void OnRecvUDP(byte[] recvBuffer, int length, BaseSocket socket) { //MultiGameView.Log("Recieve collect Player Request ServiceManager:"); byte commandType; //CommonTrace.Log(string.Format("收到UDP:数据类型{0}", packageType)); var binaryHead = PackageHelper.BytesToStuct<PkgHead>(recvBuffer); commandType = binaryHead.MasterMsgType; int ret = binaryHead.DataLength; if (ServiceMap.ContainsKey(commandType)) { ServiceMap[commandType].SaveResponseHandleToInvoke(recvBuffer.Take(ret).ToArray(), socket.GetSocketId(), commandType); } }
public static SMsgFightFightTo ParseResultPackage(byte[] dataBuffer, out SCmdImpactData[] targetDatas) { SMsgFightFightTo sMsgFightFightTo; int offset = 0; Package package = PackageHelper.ParseReceiveData(dataBuffer); var msgFightLength = Marshal.SizeOf(typeof(SMsgFightFightTo)); var sCmdImpactDataLength = Marshal.SizeOf(typeof(SCmdImpactData)); sMsgFightFightTo = PackageHelper.BytesToStuct <SMsgFightFightTo>(package.Data.Take(msgFightLength).ToArray()); targetDatas = new SCmdImpactData[sMsgFightFightTo.byNum]; offset += msgFightLength; for (int i = 0; i < sMsgFightFightTo.byNum; i++) { targetDatas[i] = PackageHelper.BytesToStuct <SCmdImpactData>(package.Data.Skip(offset).Take(sCmdImpactDataLength).ToArray()); offset += sCmdImpactDataLength; } return(sMsgFightFightTo); }
/// <summary> /// 好友上下线通知 /// </summary> CommandCallbackType RecvFriendRemindHandle(byte[] dataBuffer, int socketID) { SMsgUpdateOnLine_SC sMsgUpdateOnLine_SC = PackageHelper.BytesToStuct <SMsgUpdateOnLine_SC>(dataBuffer); SMsgUpdateFriendProp_SC sMsgUpdateFriendProp_SC = new SMsgUpdateFriendProp_SC(); sMsgUpdateFriendProp_SC.dwFriendActorID = sMsgUpdateOnLine_SC.dwFriendActorID; sMsgUpdateFriendProp_SC.byIndex = 5; sMsgUpdateFriendProp_SC.dwPropNum = sMsgUpdateOnLine_SC.byBeOnLine; FriendDataManager.Instance.UpdateFriendProp(sMsgUpdateFriendProp_SC); FriendDataManager.Instance.SortFriendList(); //FriendDataManager.Instance.RegUpdateFriendStatus(sMsgUpdateFriendProp_SC); if (FriendDataManager.Instance.CurPanelState == PanelState.MYFRIENDLIST) { FriendDataManager.Instance.IsUpdateFriendList = true; } return(CommandCallbackType.Continue); }
public static SMsgPropCreateEntity_SC_Monster ParsePackage(Package package, int offset) { var structLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Monster)); var headLength = Marshal.SizeOf(typeof(SMsgPropCreateEntity_SC_Header)); var offsetBuffer = package.Data.Skip(offset).Take(structLength).ToArray(); SMsgPropCreateEntity_SC_Monster sMsgPropCreateEntity_SC_Monster = new SMsgPropCreateEntity_SC_Monster(); sMsgPropCreateEntity_SC_Monster.m_sMsg_Header = SMsgPropCreateEntity_SC_Header.ParsePackage(package, offset); int of = headLength; of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.UID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MapID); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MonsterX); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.MonsterY); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out sMsgPropCreateEntity_SC_Monster.Name, 19); byte[] baseValues, monsterUnitValues, monsterInvisibleValue, monsterValues; int baseValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_BaseValue>(); int unitVisibleValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_UnitVisibleValue>(); int unitInvisibleValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_UnitInvisibleValue>(); int monsterValueSize = CommonTools.GetStructSize <SMsgPropCreateEntity_SC_MonsterValue>(); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out baseValues, baseValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterUnitValues, unitVisibleValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterInvisibleValue, unitInvisibleValueSize); of += PackageHelper.ReadData(offsetBuffer.Skip(of).ToArray(), out monsterValues, monsterValueSize); sMsgPropCreateEntity_SC_Monster.BaseObjectValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_BaseValue>(baseValues); sMsgPropCreateEntity_SC_Monster.MonsterUnitValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_UnitVisibleValue>(monsterUnitValues); sMsgPropCreateEntity_SC_Monster.MonsterInvisibleValue = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_UnitInvisibleValue>(monsterInvisibleValue); sMsgPropCreateEntity_SC_Monster.MonsterValues = PackageHelper.BytesToStuct <SMsgPropCreateEntity_SC_MonsterValue>(monsterValues); //TraceUtil.Log("PlayerSpeed:" + sMsgPropCreateEntity_SC_Monster.MonsterUnitValues.UNIT_FIELD_SPEED + " " + sMsgPropCreateEntity_SC_Monster.MonsterUnitValues.UNIT_FIELD_SHARD); return(sMsgPropCreateEntity_SC_Monster); }
public static SMsgChatCodeForbid_SC ParsePackage(byte[] dataBuffer) { return(PackageHelper.BytesToStuct <SMsgChatCodeForbid_SC>(dataBuffer)); }
public static SMsgTradeBuyGoods_SC ParsePackage(byte[] dataBuffer) { SMsgTradeBuyGoods_SC sMsgTradeBuyGoods_SC = PackageHelper.BytesToStuct <SMsgTradeBuyGoods_SC>(dataBuffer); return(sMsgTradeBuyGoods_SC); }
public byte bySucess; //是否购买成功 public static SCarryShopBuy_SC ParsePackage(byte[] dataBuffer) { SCarryShopBuy_SC sCarryShopBuy_SC = PackageHelper.BytesToStuct <SCarryShopBuy_SC>(dataBuffer); return(sCarryShopBuy_SC); }
public int nParam3; // 数值(一般表示数值) public static STaskLogContext ParseResultPackage(byte[] dataBuffer, int offset) { var length = Marshal.SizeOf(typeof(STaskLogContext)); return(PackageHelper.BytesToStuct <STaskLogContext>(dataBuffer.Skip(offset).Take(length).ToArray())); }
public int nStatus; // 任务当前状态 nStatus = 1 可执行状态 nStatus = 2 已完成状态 public static STaskLogUpdate ParseResultPackage(byte[] dataBuffer, out int offset) { offset = Marshal.SizeOf(typeof(STaskLogUpdate)); return(PackageHelper.BytesToStuct <STaskLogUpdate>(dataBuffer.Take(offset).ToArray())); }
public byte byStepStute; // 步骤状态 nStatus = 1 正执行状态 nStatus = 2 已完成状态 public static SC_GuideStepInfo ParsePackage(byte[] dataBuffer) { return(PackageHelper.BytesToStuct <SC_GuideStepInfo>(dataBuffer)); }
public static SLoginEmailState_SC ParsePackage(byte[] dataBuffer) { SLoginEmailState_SC sLoginEmailState_SC = PackageHelper.BytesToStuct <SLoginEmailState_SC>(dataBuffer); return(sLoginEmailState_SC); }
public Int64 dwEmailID; //邮件ID public static SEmailUpdate_SC ParsePackage(byte[] dataBuffer) { return(PackageHelper.BytesToStuct <SEmailUpdate_SC>(dataBuffer)); }