当前位置: 首页>>代码示例>>C++>>正文


C++ IDeserializer类代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:Gavinator98,项目名称:0ad,代码行数:31,代码来源:ScriptComponent.cpp

示例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);
	}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例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);
}
开发者ID:temirio,项目名称:0ad,代码行数:9,代码来源:CCmpPathfinder.cpp

示例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));
		}
	}
开发者ID:righnatios,项目名称:0ad,代码行数:16,代码来源:CCmpCommandQueue.cpp

示例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);
	}
开发者ID:Valvador,项目名称:PyroSpaceFork,代码行数:7,代码来源:CCmpProjectileManager.cpp

示例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;
}
开发者ID:andemi02,项目名称:orkid,代码行数:18,代码来源:AccessorObjectPropertyObject.cpp

示例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);
		}
	}
开发者ID:nem0,项目名称:LumixEngine,代码行数:34,代码来源:prefab_system.cpp

示例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;
}
开发者ID:andemi02,项目名称:orkid,代码行数:44,代码来源:IObjectMapPropertyType.hpp

示例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();
	}
开发者ID:2asoft,项目名称:0ad,代码行数:39,代码来源:CCmpPosition.cpp

示例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);
	}
开发者ID:Valvador,项目名称:PyroSpaceFork,代码行数:6,代码来源:CCmpMotionBall.cpp

示例11: Deserialize

	virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserialize)
	{
		Init(paramNode);
		deserialize.Bool("trigger event", m_TriggerEvent);
	}
开发者ID:krichter722,项目名称:0ad,代码行数:5,代码来源:CCmpTerritoryManager.cpp


注:本文中的IDeserializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。