// public CharacterLoadData(ushort _sessionKey, AS_GC_CHAR_LOAD_RESULT_2 _data) // { // creationType_ = eCreationType.CHAR_LOAD_RESULT; // // sessionKey_ = _sessionKey; // uniqKey_ = _data.nCharUniqKey; // charName_ = Encoding.UTF8.GetString(_data.szCharName); // // // race_ = _data.eRace; // class_ = _data.eClass; //// gender_ = _data.gen; // level_ = _data.nLevel; // totExp_ = _data.nTotExp; // // hpCur_ = _data.nHpCur; // hpMax_ = _data.nHpMax; // mpCur_ = _data.nMpCur; // mpMax_ = _data.nMpMax; // // moveSpeed_ = _data.fMoveSpeed; // attackRange_ = _data.fAttDistance; // } public CharacterLoadData( ushort _sessionKey, body_GC_CHAR_SELECT_RESULT_2 _data) { creationType_ = eCreationType.CHAR_LOAD_RESULT; sessionKey_ = _sessionKey; uniqKey_ = _data.nCharUniqKey; if(uniqKey_ == AsUserInfo.Instance.nPrivateShopOpenCharUniqKey) { shopOpening_ = true; Debug.Log("CharacterLoadData::ctor: Shop opening(id:" + uniqKey_ + ")"); } charName_ = AsUtil.GetRealString( Encoding.UTF8.GetString( _data.szCharName)); guildName_ = AsUtil.GetRealString( Encoding.UTF8.GetString( _data.szGuildName)); gender_ = _data.eGender; race_ = _data.eRace; class_ = _data.eClass; gender_ = _data.eGender; level_ = _data.nLevel; totExp_ = _data.nTotExp; hpCur_ = _data.nHpCur; mpCur_ = _data.nMpCur; moveSpeed_ = _data.sFinalStatus.nMoveSpeed * 0.01f; attackRange_ = _data.fAttDistance * 0.01f; sDefaultStatus = _data.sDefaultStatus; sFinalStatus = _data.sFinalStatus; nHairItemIndex = _data.nHair + _data.nHairColor; bCostumeOnOff = AsUserInfo.Instance.isCostumeOnOff; sCharView = AsUserInfo.Instance.getItemViews; sCosItemView = AsUserInfo.Instance.getCosItemView; nGold = _data.nGold; //nSphere = _data.nSphere; #region -Designation designationID = _data.nSubTitleTableIdx; bSubtitleHide = _data.bSubTitleHide; #endregion }
public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // eResult byte[] result = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "eResult", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, result, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( result, 0)); index += sizeof( Int32); body = new body_GC_CHAR_SELECT_RESULT_2(); byte[] tmpData = new byte[body_GC_CHAR_SELECT_RESULT_2.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); index += body_GC_CHAR_SELECT_RESULT_2.size; body.ByteArrayToClass( tmpData); #if USE_OLD_COSTUME // bCostumeOnOff byte[] ingame = new byte[ sizeof( bool)]; headerinfo = infotype.GetField( "bCostumeOnOff", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, ingame, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToBoolean( ingame, 0)); index += sizeof( bool); #else // bCostumeOnOff byte[] ingame = new byte[ sizeof(Int32)]; headerinfo = infotype.GetField( "bCostumeOnOff", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, ingame, 0, sizeof( bool)); headerinfo.SetValue( this, BitConverter.ToInt32( ingame, 0)); index += sizeof( Int32); #endif sNormalItemVeiw = new sITEMVIEW[AsGameDefine.ITEM_SLOT_VIEW_COUNT]; for ( int i = 0; i < AsGameDefine.ITEM_SLOT_VIEW_COUNT; i++) { sNormalItemVeiw[i] = new sITEMVIEW(); tmpData = new byte[sITEMVIEW.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); sNormalItemVeiw[i].ByteArrayToClass( tmpData); index += sITEMVIEW.size; } sCosItemView = new sITEMVIEW[AsGameDefine.ITEM_SLOT_COS_VIEW_COUNT]; for ( int i = 0; i < AsGameDefine.ITEM_SLOT_COS_VIEW_COUNT; i++) { sCosItemView[i] = new sITEMVIEW(); tmpData = new byte[sITEMVIEW.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); sCosItemView[i].ByteArrayToClass( tmpData); index += sITEMVIEW.size; } byte[] channel = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nChannel", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, channel, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( channel, 0)); index += sizeof( Int32); byte[] condition = new byte[ sizeof( UInt32)]; headerinfo = infotype.GetField( "nCondition", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, condition, 0, sizeof( UInt32)); headerinfo.SetValue( this, BitConverter.ToUInt32( condition, 0)); index += sizeof( UInt32); // byte[] PvpPoint = new byte[ sizeof( Int32)]; // headerinfo = infotype.GetField( "nPvpPoint", BINDING_FLAGS_PIG); // Buffer.BlockCopy( data, index, PvpPoint, 0, sizeof( Int32)); // headerinfo.SetValue( this, BitConverter.ToInt32( PvpPoint, 0)); // index += sizeof( Int32); byte[] YesterdayPvpRank = new byte[ sizeof( UInt32)]; headerinfo = infotype.GetField( "nYesterdayPvpRank", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, YesterdayPvpRank, 0, sizeof( UInt32)); headerinfo.SetValue( this, BitConverter.ToUInt32( YesterdayPvpRank, 0)); index += sizeof( UInt32); byte[] YesterdayPvpPoint = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nYesterdayPvpPoint", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, YesterdayPvpPoint, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( YesterdayPvpPoint, 0)); index += sizeof( Int32); byte[] YesterdayPvpRankRate = new byte[ sizeof( UInt32)]; headerinfo = infotype.GetField( "nYesterdayPvpRankRate", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, YesterdayPvpRankRate, 0, sizeof( UInt32)); headerinfo.SetValue( this, BitConverter.ToUInt32( YesterdayPvpRankRate, 0)); index += sizeof( UInt32); byte[] RankPoint = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nRankPoint", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, RankPoint, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( RankPoint, 0)); index += sizeof( Int32); byte[] LevelComplete = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nLevelComplete", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, LevelComplete, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( LevelComplete, 0)); index += sizeof( Int32); byte freeGacha = 0; headerinfo = infotype.GetField("nFreeGachaPoint", BINDING_FLAGS_PIG); freeGacha = data[index]; headerinfo.SetValue(this, freeGacha); index += sizeof(byte); byte[] ResurrectionCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nResurrectionCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, ResurrectionCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( ResurrectionCnt, 0)); index += sizeof( Int32); }