public new void PacketBytesToClass( byte[] data) { try { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // nSessionIdx byte[] sessionIdx = new byte[ sizeof( UInt16)]; headerinfo = infotype.GetField( "nSessionIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, sessionIdx, 0, sizeof( UInt16)); headerinfo.SetValue( this, BitConverter.ToUInt16( sessionIdx, 0)); index += sizeof( UInt16); // nCharUniqKey byte[] charUniqKey = new byte[ sizeof( UInt32)]; headerinfo = infotype.GetField( "nCharUniqKey", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, charUniqKey, 0, sizeof( UInt32)); headerinfo.SetValue( this, BitConverter.ToUInt32( charUniqKey, 0)); index += sizeof( UInt32); // nSkillTableIdx byte[] skillTableIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nSkillTableIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, skillTableIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( skillTableIdx, 0)); index += sizeof( Int32); // nSkillLevel byte[] skillLevel = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nSkillLevel", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, skillLevel, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( skillLevel, 0)); index += sizeof( Int32); // nActionTableIdx byte[] actionTableIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nActionTableIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, actionTableIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( actionTableIdx, 0)); index += sizeof( Int32); // nChargeStep byte[] chargeStep = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nChargeStep", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, chargeStep, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( chargeStep, 0)); index += sizeof( Int32); // bCasting byte[] casting = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bCasting", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, casting, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( casting, 0)); index += sizeof( bool); // bReady byte[] ready = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bReady", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, ready, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( ready, 0)); index += sizeof( bool); // nNpcIdx for( int i=0; i<TargetDecider.MAX_SKILL_TARGET; ++i) { byte[] npcIdx = new byte[ sizeof( Int32)]; Buffer.BlockCopy( data, index, npcIdx, 0, sizeof( Int32)); nNpcIdx[i] = BitConverter.ToInt32( npcIdx, 0); index += sizeof( Int32); } // nCharIdx for( int i=0; i<TargetDecider.MAX_SKILL_TARGET; ++i) { byte[] charIdx = new byte[ sizeof( UInt32)]; Buffer.BlockCopy( data, index, charIdx, 0, sizeof( UInt32)); nMainCharUniqKey[i] = BitConverter.ToUInt32( charIdx, 0); index += sizeof( UInt32); } // sTargeting byte[] targetting = new byte[12]; headerinfo = infotype.GetField( "sTargeting", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, targetting, 0, 12); headerinfo.SetValue( this, new Vector3( BitConverter.ToSingle( targetting, 0), BitConverter.ToSingle( targetting, 4), BitConverter.ToSingle( targetting, 8))); index += 12; // sDirection byte[] direction = new byte[12]; headerinfo = infotype.GetField( "sDirection", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, direction, 0, 12); headerinfo.SetValue( this, new Vector3( BitConverter.ToSingle( direction, 0), BitConverter.ToSingle( direction, 4), BitConverter.ToSingle( direction, 8))); index += 12; // nCoolTime byte[] coolTime = new byte[ sizeof( UInt32)]; headerinfo = infotype.GetField( "nCoolTime", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, coolTime, 0, sizeof( UInt32)); headerinfo.SetValue( this, BitConverter.ToUInt32( coolTime, 0)); index += sizeof( UInt32); // nHpCur byte[] hpCur = new byte[ sizeof( Single)]; headerinfo = infotype.GetField( "nHpCur", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, hpCur, 0, sizeof( Single)); headerinfo.SetValue( this, BitConverter.ToSingle( hpCur, 0)); index += sizeof( Single); // nHpHeal byte[] hpHeal = new byte[ sizeof( Single)]; headerinfo = infotype.GetField( "nHpHeal", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, hpHeal, 0, sizeof( Single)); headerinfo.SetValue( this, BitConverter.ToSingle( hpHeal, 0)); index += sizeof( Single); // nNpcCnt byte[] npcCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nNpcCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, npcCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( npcCnt, 0)); index += sizeof( Int32); // nCharCnt byte[] charCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nCharCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, charCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( charCnt, 0)); index += sizeof( Int32); bodyNpc = new AS_SC_CHAR_ATTACK_NPC_2[nNpcCnt]; for( int i = 0; i < nNpcCnt; i++) { bodyNpc[i] = new AS_SC_CHAR_ATTACK_NPC_2(); byte[] tmpData = new byte[AS_SC_CHAR_ATTACK_NPC_2.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); bodyNpc[i].ByteArrayToClass( tmpData); index += AS_SC_CHAR_ATTACK_NPC_2.size; } bodyChar = new AS_SC_CHAR_ATTACK_NPC_3[nCharCnt]; for( int i = 0; i < nCharCnt; i++) { bodyChar[i] = new AS_SC_CHAR_ATTACK_NPC_3(); byte[] tmpData = new byte[AS_SC_CHAR_ATTACK_NPC_3.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); bodyChar[i].ByteArrayToClass( tmpData); index += AS_SC_CHAR_ATTACK_NPC_3.size; } } catch { Debug.LogError( "AsProtocol_Commmon::AS_SC_CHAR_ATTACK_NPC_2: error in constructor"); } }
public Msg_OtherCharAttackNpc3( Msg_OtherCharAttackNpc1 _parent, AS_SC_CHAR_ATTACK_NPC_3 _info) { m_MessageType = eMessageType.CHAR_ATTACK_NPC3; parent_ = _parent; sessionIdx_ = _info.nSessionIdx; charUniqKey_ = _info.nCharUniqKey; hpCur_ = _info.fHpCur; mpCur_ = _info.fMpCur; eDamageType = ( eDAMAGETYPE)_info.eDamageType; damage_ = _info.fDamage; hpHeal_ = _info.fHpHeal; mpHeal_ = _info.fMpHeal; reflection_ = _info.fReflection; drain_ = _info.fDrain; knockBack_ = _info.bKnockBack; }