フォトンクラウドでHashtableを使用してデータを送信しようとしていますが、正しいeventCodeでデータを受信しますが、キーと値のペアがいくつかの乱数を返します。データ送信中の私のコードは次のようになります:-
void NetworkLogic::sendEvent(void)
{
ExitGames::Common::Hashtable* table =new ExitGames::Common::Hashtable;
table->put<int,int>(4,21);
const ExitGames::Common::Hashtable temp = (const ExitGames::Common::Hashtable)*table;//= new ExitGames::Common::Hashtable;
mLoadBalancingClient.opRaiseEvent(false, temp, 100);
}
データを受信している間、コードは次のようになります:-
void NetworkLogic::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Hashtable& eventContent)
{
// you do not receive your own events, unless you specify yourself as one of the receivers explicitly, so you must start 2 clients, to receive the events, which you have sent, as sendEvent() uses the default receivers of opRaiseEvent() (all players in same room like the sender, except the sender itself)
PhotonPeer_sendDebugOutput(&mLoadBalancingClient, DEBUG_LEVEL_ALL, L"");
cout<<((int)(eventContent.getValue(4)));
}
コンソールに出力されるのは、ランダムな値またはintですが、21である必要があります。ここで何が間違っているのでしょうか。
編集:
私が
次customEventAction()
のステートメントを使用したとき:
cout<<eventContent.getValue(4)->getType()<<endl;
cout<<"Event code = "<<eventCode<<endl;
次の出力が得られました。
i
Event code = d
検索したところ、'i'
その値は、EG_INTEGER
送信している値が正しく受信されていることを意味します。に戻すことができませんでしたint
。そして、なぜイベントコードが次のように来るの'd'
ですか?