7 #ifndef __MUN_ROOM_PLAYER_INFO_HPP__ 8 #define __MUN_ROOM_PLAYER_INFO_HPP__ 44 uint16 m_GroupWriteRecordOptions;
46 uint16 m_GroupWriteRecordPayloadType;
48 uint32 m_GroupWriteRecordCount;
75 void SetName(std::string name) { m_Name = name; }
95 m_ParametersLen = parametersLen;
97 m_Parameters[ i ] = pParameters[ i ];
107 std::map<std::string, STREAM::Union> parameters;
109 parameters.insert( std::pair<std::string, STREAM::Union>( m_Parameters[ i ].key.text, m_Parameters[ i ].
value ) );
111 for ( uint16 i = 0; i < parametersLen; ++i ){
112 std::map<std::string, STREAM::Union>::iterator itr = parameters.find( pParameters[ i ].key.text );
113 if ( parameters.end() == itr ){
114 parameters.insert( std::pair<std::string, STREAM::Union>( pParameters[ i ].key.text, pParameters[ i ].
value ) );
116 itr->second = pParameters[ i ].
value;
121 m_ParametersLen = (uint16)parameters.size();
123 for ( std::map<std::string, STREAM::Union>::iterator itr = parameters.begin(); parameters.end() != itr; ++itr ){
158 MunRoomPlayerInfo( MrsConnection connection = NULL, int32
id = 0, std::string name =
"", uint32 clientUidForMasterServer = 0, uint64 clientUidForProxyServer = 0, uint64 roomId = 0,
STREAM::KeyValue* pParameters = NULL, uint16 parametersLen = 0 ) {
159 m_Connection = connection;
162 m_clientUidForMasterServer = clientUidForMasterServer;
163 m_clientUidForProxyServer = clientUidForProxyServer;
167 m_GroupWriteRecordOptions = 0;
168 m_GroupWriteRecordPayloadType = 0;
169 m_GroupWriteRecordCount = 0;
177 void FlushGroupWriteRecord(){
178 if ( 0 == m_GroupWriteRecordPayloadType )
return;
181 mrs_write_record( m_Connection, m_GroupWriteRecordOptions, m_GroupWriteRecordPayloadType, m_GroupWriteRecordBuffer.GetData(), m_GroupWriteRecordBuffer.GetDataLen() );
183 m_GroupWriteRecordOptions = 0;
184 m_GroupWriteRecordPayloadType = 0;
185 m_GroupWriteRecordCount = 0;
186 m_GroupWriteRecordBuffer.Unread( 0xFFFFFFFF );
187 m_GroupWriteRecordBuffer.Unwrite( 0xFFFFFFFF );
190 void GroupWriteRecord( uint16 options, uint16 payload_type,
const void* payload, uint32 payload_len,
bool is_group ){
192 if ( ( m_GroupWriteRecordOptions != options ) || ( m_GroupWriteRecordPayloadType != payload_type ) ){
193 FlushGroupWriteRecord();
194 m_GroupWriteRecordOptions = options;
195 m_GroupWriteRecordPayloadType = payload_type;
198 m_GroupWriteRecordBuffer.Write( payload, payload_len );
199 ++m_GroupWriteRecordCount;
201 FlushGroupWriteRecord();
202 mrs_write_record( m_Connection, options, payload_type, payload, payload_len );
207 FlushGroupWriteRecord();
std::string GetName()
プレイヤーIDの取得.
Definition: MunRoomPlayerInfo.hpp:69
mrs::Buffer の拡張クラス.
Definition: MunBuffer.hpp:17
void SetParameters(STREAM::KeyValue *pParameters, uint16 parametersLen)
プレイヤーパラメータの設定.
Definition: MunRoomPlayerInfo.hpp:94
MrsConnection m_Connection
MUNクライアントの接続情報.
Definition: MunRoomPlayerInfo.hpp:21
uint16 m_ParametersLen
プレイヤーパラメータの登録数.
Definition: MunRoomPlayerInfo.hpp:33
void SetName(std::string name)
プレイヤーIDの設定.
Definition: MunRoomPlayerInfo.hpp:75
virtual ~MunRoomPlayerInfo()
デストラクタ.
Definition: MunRoomPlayerInfo.hpp:175
int32 GetId()
プレイヤーIDの取得.
Definition: MunRoomPlayerInfo.hpp:63
uint64 GetClientIdForProxyServer()
mun_proxyサーバ上のクライアント識別用ユニークIDの取得.
Definition: MunRoomPlayerInfo.hpp:139
MrsConnection GetConnection()
MUNクライアントの接続情報の取得.
Definition: MunRoomPlayerInfo.hpp:57
任意のKey-Valueペア.
Definition: MunStream.hpp:602
STREAM::KeyValue m_Parameters[STREAM::PLAYER_PARAMETERS_MAX]
プレイヤーパラメータ.
Definition: MunRoomPlayerInfo.hpp:30
uint32 m_clientUidForMasterServer
mun_masterサーバ上のクライアント識別用ユニークID.
Definition: MunRoomPlayerInfo.hpp:36
uint64 GetRoomId()
所属するルームIDの取得.
Definition: MunRoomPlayerInfo.hpp:145
STREAM::KeyValue * GetParameters()
プレイヤーパラメータの取得.
Definition: MunRoomPlayerInfo.hpp:81
Union value
値情報.
Definition: MunStream.hpp:608
MunRoomPlayerInfo(MrsConnection connection=NULL, int32 id=0, std::string name="", uint32 clientUidForMasterServer=0, uint64 clientUidForProxyServer=0, uint64 roomId=0, STREAM::KeyValue *pParameters=NULL, uint16 parametersLen=0)
コンストラクタ.
Definition: MunRoomPlayerInfo.hpp:158
int32 m_Id
プレイヤーID.
Definition: MunRoomPlayerInfo.hpp:24
uint64 m_RoomId
所属するルームID.
Definition: MunRoomPlayerInfo.hpp:42
void UpdateParameters(STREAM::KeyValue *pParameters, uint16 parametersLen)
プレイヤーパラメータの更新.
Definition: MunRoomPlayerInfo.hpp:106
std::string m_Name
プレイヤー名.
Definition: MunRoomPlayerInfo.hpp:27
uint64 m_clientUidForProxyServer
mun_proxyサーバ上のクライアント識別用ユニークID.
Definition: MunRoomPlayerInfo.hpp:39
uint32 GetClientIdForMasterServer()
mun_masterサーバ上のクライアント識別用ユニークIDの取得.
Definition: MunRoomPlayerInfo.hpp:133
1つのプレイヤーに対して設定可能な、プレイヤーカスタムパラメータの最大数.
Definition: MunStream.hpp:272
可変長テキスト.
Definition: MunStream.hpp:331
ルーム内プレイヤー情報クラス.
Definition: MunRoomPlayerInfo.hpp:17
uint16 GetParametersLen()
プレイヤーパラメータの登録数の取得.
Definition: MunRoomPlayerInfo.hpp:87