本文整理汇总了C++中IDeserializer类的典型用法代码示例。如果您正苦于以下问题:C++ IDeserializer类的具体用法?C++ IDeserializer怎么用?C++ IDeserializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDeserializer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Deserialize
void CComponentTypeScript::Deserialize(const CParamNode& paramNode, IDeserializer& deserialize, entity_id_t ent)
{
JSContext* cx = m_ScriptInterface.GetContext();
JSAutoRequest rq(cx);
m_ScriptInterface.SetProperty(m_Instance, "entity", (int)ent, true, false);
m_ScriptInterface.SetProperty(m_Instance, "template", paramNode, true, false);
// Support a custom "Deserialize" function, to which we pass the deserialized data
// instead of automatically adding the deserialized properties onto the object
if (m_HasCustomDeserialize)
{
JS::RootedValue val(cx);
// If Serialize = null, we'll still call Deserialize but with undefined argument
if (!m_HasNullSerialize)
deserialize.ScriptVal("object", &val);
if (!m_ScriptInterface.CallFunctionVoid(m_Instance, "Deserialize", val))
LOGERROR("Script Deserialize call failed");
}
else
{
if (!m_HasNullSerialize)
{
// Use ScriptObjectAppend so we don't lose the carefully-constructed
// prototype/parent of this object
deserialize.ScriptObjectAppend("object", m_Instance);
}
}
}
示例2: Deserialize
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
deserialize.NumberFixed_Unbounded("r", m_R);
deserialize.NumberFixed_Unbounded("g", m_G);
deserialize.NumberFixed_Unbounded("b", m_B);
}
示例3: Deserialize
void CCmpPathfinder::Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
SerializeVector<SerializeLongRequest>()(deserialize, "long requests", m_AsyncLongPathRequests);
SerializeVector<SerializeShortRequest>()(deserialize, "short requests", m_AsyncShortPathRequests);
deserialize.NumberU32_Unbounded("next ticket", m_NextAsyncTicket);
deserialize.NumberU16_Unbounded("same turn moves count", m_SameTurnMovesCount);
}
示例4: Deserialize
virtual void Deserialize(const CParamNode& UNUSED(paramNode), IDeserializer& deserialize)
{
JSContext* cx = GetSimContext().GetScriptInterface().GetContext();
JSAutoRequest rq(cx);
u32 numCmds;
deserialize.NumberU32_Unbounded("num commands", numCmds);
for (size_t i = 0; i < numCmds; ++i)
{
i32 player;
JS::RootedValue data(cx);
deserialize.NumberI32_Unbounded("player", player);
deserialize.ScriptVal("data", &data);
m_LocalQueue.emplace_back(SimulationCommand(player, cx, data));
}
}
示例5: Deserialize
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
// The attack code stores the id so that the projectile gets deleted when it hits the target
deserialize.NumberU32_Unbounded("next id", m_NextId);
}
示例6: Deserialize
bool AccessorObjectPropertyObject::Deserialize(IDeserializer &serializer, Object *object) const
{
Object *object_property = (object->*mObjectAccessor)();
Command command;
serializer.BeginCommand(command);
OrkAssertI(command.Type() == Command::EOBJECT,
"AccessorObjectPropertyObject::Deserialize::Expected an Object command!\n");
if(command.Type() == Command::EOBJECT)
{
object_property->Deserialize(serializer);
}
serializer.EndCommand(command);
return true;
}
示例7: deserialize
void deserialize(IDeserializer& serializer) override
{
int count;
serializer.read(&count);
reserve({count-1});
auto* mng = m_editor.getEngine().getResourceManager().get(PrefabResource::TYPE);
for (;;)
{
char tmp[MAX_PATH_LENGTH];
serializer.read(tmp, lengthOf(tmp));
if (tmp[0] == 0) break;
auto* res = (PrefabResource*)mng->load(Path(tmp));
m_resources.insert(res->getPath().getHash(), res);
}
while(m_editor.getEngine().getFileSystem().hasWork())
m_editor.getEngine().getFileSystem().updateAsyncTransactions();
for (;;)
{
u32 res_hash;
serializer.read(&res_hash);
if (res_hash == 0) break;
Vec3 pos;
serializer.read(&pos);
Quat rot;
serializer.read(&rot);
float scale;
serializer.read(&scale);
doInstantiatePrefab(*m_resources[res_hash], pos, rot, scale);
}
}
示例8:
bool IObjectMapPropertyType<KeyType, ValueType>::DoDeserialize(
BidirectionalSerializer &bidi, KeyType &key, ValueType &value)
{
IDeserializer *deserializer = bidi.Deserializer();
Command item;
if(deserializer->BeginCommand(item))
{
OrkAssert(item.Type() == Command::EITEM);
if(item.Type() != Command::EITEM)
{
deserializer->EndCommand(item);
bidi.Fail();
return false;
}
Command attribute;
deserializer->BeginCommand(attribute);
OrkAssert(attribute.Type() == Command::EATTRIBUTE);
OrkAssert(attribute.Name() == "key");
if(attribute.Type() != Command::EATTRIBUTE || attribute.Name() != "key")
{
deserializer->EndCommand(attribute);
bidi.Fail();
return false;
}
deserializer->Hint("map_key");
bidi | key;
deserializer->EndCommand(attribute);
deserializer->Hint("map_value");
bidi | value;
deserializer->EndCommand(item);
return true;
}
return false;
}
示例9: Deserialize
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
deserialize.Bool("in world", m_InWorld);
if (m_InWorld)
{
deserialize.NumberFixed_Unbounded("x", m_X);
deserialize.NumberFixed_Unbounded("y", m_Y);
deserialize.NumberFixed_Unbounded("z", m_Z);
deserialize.NumberFixed_Unbounded("last x", m_LastX);
deserialize.NumberFixed_Unbounded("last y diff", m_LastYDifference);
deserialize.NumberFixed_Unbounded("last z", m_LastZ);
}
deserialize.NumberI32_Unbounded("territory", m_Territory);
deserialize.NumberFixed_Unbounded("rot x", m_RotX);
deserialize.NumberFixed_Unbounded("rot y", m_RotY);
deserialize.NumberFixed_Unbounded("rot z", m_RotZ);
deserialize.NumberFixed_Unbounded("altitude", m_Y);
deserialize.Bool("relative", m_RelativeToGround);
deserialize.Bool("floating", m_Floating);
deserialize.NumberFixed_Unbounded("constructionprogress", m_ConstructionProgress);
// TODO: should there be range checks on all these values?
m_InterpolatedRotY = m_RotY.ToFloat();
deserialize.NumberU32_Unbounded("turret parent", m_TurretParent);
if (m_TurretParent != INVALID_ENTITY)
{
deserialize.NumberFixed_Unbounded("x", m_TurretPosition.X);
deserialize.NumberFixed_Unbounded("y", m_TurretPosition.Y);
deserialize.NumberFixed_Unbounded("z", m_TurretPosition.Z);
}
if (m_InWorld)
UpdateXZRotation();
UpdateMessageSubscriptions();
}
示例10: Deserialize
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
deserialize.NumberFloat_Unbounded("speed x", m_SpeedX);
deserialize.NumberFloat_Unbounded("speed z", m_SpeedZ);
}
示例11: Deserialize
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
{
Init(paramNode);
deserialize.Bool("trigger event", m_TriggerEvent);
}