static public void SendPartyCreate( int _MapIdx, sPARTYOPTION stOption) { if( AsPartyManager.Instance.IsPartying) { StringBuilder sb = new StringBuilder(); sb.Append( AsTableManager.Instance.GetTbl_String( 117)); sb.Append( "[P00001]"); //string strMsg = AsTableManager.Instance.GetTbl_String( 117) + "[P00001]"; AsChatManager.Instance.InsertChat( sb.ToString(), eCHATTYPE.eCHATTYPE_SYSTEM); return; } AS_CS_PARTY_CREATE packetData = new AS_CS_PARTY_CREATE( _MapIdx, stOption); byte[] data = packetData.ClassToPacketBytes(); Send( data); #if _PARTY_LOG_ Debug.Log( "Send AS_CS_PARTY_CREATE "); #endif }
public AS_CS_PARTY_CREATE( int _MapIdx, sPARTYOPTION stOption) { Category = (byte)PACKET_CATEGORY._CATEGORY_CS; Protocol = (byte)PROTOCOL_CS.CS_PARTY_CREATE; nMapIdx = _MapIdx; szPartyName = stOption.szPartyName; bPublic = stOption.bPublic; nMaxUser = stOption.nMaxUser; ePurpose = (int)stOption.ePurpose; eDivide = (int)stOption.eDivide; eGrade = (int)stOption.eGrade; }
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); // nPartyIdx byte[] partyIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nPartyIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, partyIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( partyIdx, 0)); index += sizeof( Int32); // nMapIdx byte[] mapIdx = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nMapIdx", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, mapIdx, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( mapIdx, 0)); index += sizeof( Int32); sOption = new sPARTYOPTION(); byte[] tmpData = new byte[sPARTYOPTION.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); sOption.ByteArrayToClass( tmpData); index += sPARTYOPTION.size; // nUserCnt byte[] userCnt = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "nUserCnt", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, userCnt, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( userCnt, 0)); index += sizeof( Int32); if( 0 < nUserCnt) { body = new sPARTYDETAILINFO[nUserCnt]; for( int i = 0; i < nUserCnt; i++) { body[i] = new sPARTYDETAILINFO(); tmpData = new byte[sPARTYDETAILINFO.size]; Buffer.BlockCopy( data, index, tmpData, 0, tmpData.Length); body[i].ByteArrayToClass( tmpData); index += sPARTYDETAILINFO.size; } } }
public AS_CS_PARTY_SETTING( int _MapIdx, sPARTYOPTION stOption) { Category = (byte)PACKET_CATEGORY._CATEGORY_CS; Protocol = (byte)PROTOCOL_CS.CS_PARTY_SETTING; if( AsPartyManager.Instance.PartyMapIdx == AsPartyManager.Instance.BeforeMapIdx) nMapIdx = 0; else nMapIdx = _MapIdx; szPartyName = stOption.szPartyName; bPublic = stOption.bPublic; nMaxUser = stOption.nMaxUser; ePurpose = (int)stOption.ePurpose; eDivide = (int)stOption.eDivide; eGrade = (int)stOption.eGrade; }
static public void SendPartySetting( int _MapIdx, sPARTYOPTION stOption) { if( !AsPartyManager.Instance.IsCaptain) { StringBuilder sb = new StringBuilder(); sb.Append( AsTableManager.Instance.GetTbl_String( 117)); sb.Append( "[P00004]"); // string strMsg = AsTableManager.Instance.GetTbl_String( 117) + "[P00004]"; AsChatManager.Instance.InsertChat( sb.ToString(), eCHATTYPE.eCHATTYPE_SYSTEM); return; } AS_CS_PARTY_SETTING packetData = new AS_CS_PARTY_SETTING( _MapIdx, stOption); byte[] data = packetData.ClassToPacketBytes(); Send( data); #if _PARTY_LOG_ Debug.Log( "Send AS_CS_PARTY_SETTING" + packetData.bPublic.ToString() + packetData.ePurpose.ToString() + "Divide:"+ packetData.eDivide.ToString() + "eGrade" + packetData.eGrade.ToString()); #endif }
void CreateOption() { m_PartyOption = new sPARTYOPTION(); string strPartyName= "Party"; AsUserEntity userEntity = AsUserInfo.Instance.GetCurrentUserEntity(); if( null != userEntity /*&& m_PartyName.Length > 0*/)//#21568 { StringBuilder sb = new StringBuilder(); sb.Append( userEntity.GetProperty<string>( eComponentProperty.NAME)); sb.Append( AsTableManager.Instance.GetTbl_String(1357)); strPartyName = sb.ToString(); } byte[] szPartyName = System.Text.UTF8Encoding.UTF8.GetBytes( strPartyName.ToCharArray(), 0, strPartyName.Length); int length = ( AsGameDefine.MAX_PARTYNAME_LEN <szPartyName.Length) ? AsGameDefine.MAX_PARTYNAME_LEN : szPartyName.Length; System.Buffer.BlockCopy( szPartyName, 0, m_PartyOption.szPartyName, 0, length); m_PartyOption.bPublic = true; m_PartyOption.ePurpose = ( int)ePARTYPURPOSE.ePARTYPURPOSE_HUNT; m_PartyOption.eDivide = ( int)ePARTYITEMDIVIDE.ePARTYITEMDIVIDE_EQUIP;//.ePARTYITEMDIVIDE_FREE; m_PartyOption.eGrade = ( int)eEQUIPITEM_GRADE.eEQUIPITEM_GRADE_MAGIC; m_PartyOption.nMaxUser = AsGameDefine.MAX_PARTY_USER; }
public void PartyUserRemoveAll() { DestroyMessageBox(); PartyIdx = 0; IsPartying = false; IsCaptain = false; m_bPartyNotice = false; m_PartyNotice = string.Empty; m_PartyOption = null; CreateOption(); AsMyProperty instance = FindObjectOfType( typeof( AsMyProperty)) as AsMyProperty; if( instance) AsMyProperty.Instance.SetCaptain( false); m_TempPartyMembers.Clear(); foreach( KeyValuePair<uint, AS_PARTY_USER> member in m_PartyMembers) { AS_PARTY_USER new_member = new AS_PARTY_USER(); new_member.nCharUniqKey = member.Value.nCharUniqKey; new_member.nSessionIdx = member.Value.nSessionIdx; new_member.strCharName = member.Value.strCharName; new_member.eRace = member.Value.eRace; new_member.eClass = member.Value.eClass; new_member.nLevel = member.Value.nLevel; new_member.fHpCur = member.Value.fHpCur; new_member.fHpMax = member.Value.fHpMax; m_TempPartyMembers.Add( new_member.nCharUniqKey, new_member); } m_PartyMembers.Clear(); AllClosePartyUI(); if( AsHudDlgMgr.Instance != null) { if( AsHudDlgMgr.Instance.partyAndQuestToggleMgr != null) { if (AsPartyManager.Instance.IsPartying == true) if( GetPartyMemberList().Count <= 1) AsHudDlgMgr.Instance.partyAndQuestToggleMgr.DelPartyProcess(); } } QuestMessageBroadCaster.BrocastQuest(QuestMessages.QM_ADD_PARTY, new AchAddParty(m_PartyMembers.Count)); }