public body2_SC_CHAR_BUFF(body2_SC_PARTY_USER_BUFF _party) { bUpdate = _party.bUpdate; nSkillTableIdx = _party.nSkillTableIdx; nSkillLevelTableIdx = _party.nSkillLevelTableIdx; nSkillLevel = _party.nSkillLevel; nChargeStep = _party.nChargeStep; nPotencyIdx = _party.nPotencyIdx; eType = _party.eType; nDuration = _party.nDuration; }
public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // 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); // bEffect byte[] effect = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bEffect", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, effect, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( effect, 0)); index += sizeof( bool); // nBuffCnt byte[] buffCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nBuffCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, buffCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( buffCnt, 0)); index += sizeof( Int32); if( 0 < nBuffCnt) { body = new body2_SC_PARTY_USER_BUFF[nBuffCnt]; for( int i = 0; i < nBuffCnt; i++) { body[i] = new body2_SC_PARTY_USER_BUFF(); byte[] tmpData = new byte[body2_SC_PARTY_USER_BUFF.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); body[i].ByteArrayToClass( tmpData); index += body2_SC_PARTY_USER_BUFF.size; } } }