参考此链接“ http://recruit.gmo.jp/engineer/jisedai/blog/cocos2d-x_photon/ ”,我正在尝试使用cocos2dx 2.2.6和photon sdk v4运行显示简单网络功能的示例- 0-0-5。该指南建议以这种方式实现 customEventAction:
void NetworkLogic::customEventAction(int playerNr, nByte eventCode, const ExitGames::Common::Object& eventContent)
{
ExitGames::Common::Hashtable* event;
switch (eventCode) {
case 1:
event = ExitGames::Common::ValueObject<ExitGames::Common::Hashtable*>(eventContent).getDataCopy();
float x = ExitGames::Common::ValueObject(event->getValue(1)).getDataCopy();
float y = ExitGames::Common::ValueObject(event->getValue(2)).getDataCopy();
eventQueue.push({static_cast(playerNr), x, y});
break;
}
}
Xcode 给出的错误是:
Cannot refer to class template "ValueObject" without a template argument list
我自己对模板不熟悉,有人可以建议一种适当的方法来提取事件数据以便将其推送到 eventQueue 吗?或者指出上面代码中的错误。提前谢谢了!