Monobit Unity Networking ver.2.8.0 Server API Reference (C++)
MunMasterMatchingPlayerInRoom.hpp
Go to the documentation of this file.
1 
7 #ifndef __MUN_MASTER_MATCHING_PLAYER_IN_ROOM_HPP__
8 #define __MUN_MASTER_MATCHING_PLAYER_IN_ROOM_HPP__
9 
10 #include <mrs.hpp>
11 #include <stream/MunStream.hpp>
12 
17 {
18 protected:
20  int32 m_Id;
21 
23  uint32 m_ClientId;
24 
26  std::string m_ClientName;
27 
30 
33 
34 public:
39  int32 GetId() { return m_Id; }
40 
45  uint32 GetClientId() { return m_ClientId; }
46 
51  std::string GetClientName() { return m_ClientName; }
52 
57  void SetClientName( std::string clientName ) { m_ClientName = clientName; }
58 
64 
69  uint16 GetParametersLen() { return m_ParametersLen; }
70 
76  void SetParameters( STREAM::KeyValue* pParameters, uint16 parametersLen ){
77  m_ParametersLen = parametersLen;
78  for ( uint16 i = 0; i < m_ParametersLen; ++i ){
79  m_Parameters[ i ] = pParameters[ i ];
80  }
81  }
82 
88  void UpdateParameters( STREAM::KeyValue* pParameters, uint16 parametersLen ){
89  std::map<std::string, STREAM::Union> parameters;
90  for ( uint16 i = 0; i < m_ParametersLen; ++i ){
91  parameters.insert( std::pair<std::string, STREAM::Union>( m_Parameters[ i ].key.text, m_Parameters[ i ].value ) );
92  }
93  for ( uint16 i = 0; i < parametersLen; ++i ){
94  std::map<std::string, STREAM::Union>::iterator itr = parameters.find( pParameters[ i ].key.text );
95  if ( parameters.end() == itr ){
96  parameters.insert( std::pair<std::string, STREAM::Union>( pParameters[ i ].key.text, pParameters[ i ].value ) );
97  }else{
98  itr->second = pParameters[ i ].value;
99  }
100  }
101  if ( STREAM::PLAYER_PARAMETERS_MAX < parameters.size() ) return;
102 
103  m_ParametersLen = (uint16)parameters.size();
104  uint16 i = 0;
105  for ( std::map<std::string, STREAM::Union>::iterator itr = parameters.begin(); parameters.end() != itr; ++itr ){
106  STREAM::Text key = STREAM::Text( itr->first );
107  m_Parameters[ i++ ] = STREAM::KeyValue( key, itr->second );
108  }
109  }
110 
111 public:
120  MatchingPlayerInRoom( int32 id = 0, uint32 clientId = 0, std::string clientName = "", STREAM::KeyValue* pParameters = NULL, uint16 parametersLen = 0 ) {
121  m_Id = id;
122  m_ClientId = clientId;
123  m_ClientName = clientName;
124  SetParameters( pParameters, parametersLen );
125  }
126 
131 };
132 
133 #endif /* __MUN_MASTER_MATCHING_PLAYER_IN_ROOM_HPP__ */
MUNにおける通信データ情報.
uint16 m_ParametersLen
プレイヤーパラメータの登録数.
Definition: MunMasterMatchingPlayerInRoom.hpp:32
int32 m_Id
プレイヤーID.
Definition: MunMasterMatchingPlayerInRoom.hpp:20
任意のKey-Valueペア.
Definition: MunStream.hpp:602
void SetParameters(STREAM::KeyValue *pParameters, uint16 parametersLen)
プレイヤーパラメータの設定.
Definition: MunMasterMatchingPlayerInRoom.hpp:76
Union value
値情報.
Definition: MunStream.hpp:608
std::string m_ClientName
このプレイヤー情報を持つMUNクライアント名.
Definition: MunMasterMatchingPlayerInRoom.hpp:26
MatchingPlayerInRoom(int32 id=0, uint32 clientId=0, std::string clientName="", STREAM::KeyValue *pParameters=NULL, uint16 parametersLen=0)
コンストラクタ.
Definition: MunMasterMatchingPlayerInRoom.hpp:120
void SetClientName(std::string clientName)
クライアント名の設定.
Definition: MunMasterMatchingPlayerInRoom.hpp:57
std::string GetClientName()
クライアント名の取得.
Definition: MunMasterMatchingPlayerInRoom.hpp:51
マッチングルーム内プレイヤー情報.
Definition: MunMasterMatchingPlayerInRoom.hpp:16
int32 GetId()
プレイヤーIDの取得.
Definition: MunMasterMatchingPlayerInRoom.hpp:39
STREAM::KeyValue m_Parameters[STREAM::PLAYER_PARAMETERS_MAX]
プレイヤーパラメータ.
Definition: MunMasterMatchingPlayerInRoom.hpp:29
uint16 GetParametersLen()
プレイヤーパラメータの登録数の取得.
Definition: MunMasterMatchingPlayerInRoom.hpp:69
uint32 m_ClientId
このプレイヤー情報を持つMUNクライアントID.
Definition: MunMasterMatchingPlayerInRoom.hpp:23
STREAM::KeyValue * GetParameters()
プレイヤーパラメータの取得.
Definition: MunMasterMatchingPlayerInRoom.hpp:63
1つのプレイヤーに対して設定可能な、プレイヤーカスタムパラメータの最大数.
Definition: MunStream.hpp:272
可変長テキスト.
Definition: MunStream.hpp:331
uint32 GetClientId()
このプレイヤー情報を持つMUNクライアントIDの取得.
Definition: MunMasterMatchingPlayerInRoom.hpp:45
void UpdateParameters(STREAM::KeyValue *pParameters, uint16 parametersLen)
プレイヤーパラメータの更新.
Definition: MunMasterMatchingPlayerInRoom.hpp:88
virtual ~MatchingPlayerInRoom()
デストラクタ.
Definition: MunMasterMatchingPlayerInRoom.hpp:130