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 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); }
void AddRoleMiniMapUI(INotifyArgs iNotifyArgs) { SMsgPropCreateEntity_SC_Header sMsgPropCreateEntity_SC_Header = (SMsgPropCreateEntity_SC_Header)iNotifyArgs; if (sMsgPropCreateEntity_SC_Header.uidEntity != 0) { GameObject CreatObj = PlayerManager.Instance.FindPlayer(sMsgPropCreateEntity_SC_Header.uidEntity); ShowTeammateMiniMapUI(CreatObj); } }
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); }