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


C++ TSerialize::IsWriting方法代码示例

本文整理汇总了C++中TSerialize::IsWriting方法的典型用法代码示例。如果您正苦于以下问题:C++ TSerialize::IsWriting方法的具体用法?C++ TSerialize::IsWriting怎么用?C++ TSerialize::IsWriting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSerialize的用法示例。


在下文中一共展示了TSerialize::IsWriting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SerializeArray

void SerializeArray(TSerialize ser, const char* szName, T* vec, uint32 count)
{
	ser.BeginGroup(szName);
	if (ser.IsWriting())
	{
		ser.Value("count", count);
		for (uint32 i=0; i<count; ++i)
		{
			ser.BeginGroup("i");
				ser.Value("Value", vec[i]);
			ser.EndGroup();
		}
	}
	else
	{
		uint32 storedCount = 0;
		ser.Value("count", storedCount);
		uint32 toFill = storedCount < count ? storedCount : count;
		uint32 i=0;
		while (toFill--)
		{
			ser.BeginGroup("i");
				ser.Value("Value", vec[i++]);
			ser.EndGroup();
		}
	}
	ser.EndGroup();
}
开发者ID:aronarts,项目名称:FireNET,代码行数:28,代码来源:DialogSession.cpp

示例2: NetSerialize

bool CNetworkBuilding::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags )
{
	if (aspect == POSITION_ASPECT)
	{
		if(gEnv->bServer && !gEnv->IsEditor())
		{
			int cur_state = (int)m_state;
			ws->SetInt(entity_name,"BuildStatus",build_status);
			ws->SetInt(entity_name,"EntityState",cur_state);
		}

		EState newState = m_state;
		ser.EnumValue("cur_state", newState, eState_NotUsed, eState_Done);
		ser.Value( "build_status", build_status);

		if (ser.IsWriting())
		{
			//CryLog("CNetworkBuilding::NetSerialize writing !!!");			
		}

		if (ser.IsReading())
		{
			//CryLog("CNetworkBuilding::NetSerialize reading !!!");
			m_state = newState;
			Building(build_status);
		}
	}

	return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:30,代码来源:NetworkBuilding.cpp

示例3: FullSerialize

//------------------------------------------------------------------------
void CProjectile::FullSerialize(TSerialize ser)
{
	assert(ser.GetSerializationTarget() != eST_Network);

	ser.Value("Remote", m_remote);
	// m_tracerpath should be serialized but the template-template stuff doesn't work under VS2005
	ser.Value("Owner", m_ownerId, 'eid');
	ser.Value("Weapon", m_weaponId, 'eid');
	ser.Value("TrailEffect", m_trailEffectId);
	ser.Value("TrailSound", m_trailSoundId);
	ser.Value("WhizSound", m_whizSoundId);
	ser.Value("Damage", m_damage);
	ser.Value("Destroying", m_destroying);
	ser.Value("LastPos", m_last);
	ser.Value("InitialPos", m_initial_pos);
	ser.Value("ScaledEffectSignaled", m_scaledEffectSignaled);
	ser.Value("HitListener", m_hitListener);
	ser.Value("HitPoints", m_hitPoints);

	bool wasVisible = false;
	if(ser.IsWriting())
		wasVisible = (GetEntity()->GetSlotFlags(0)&(ENTITY_SLOT_RENDER))?true:false;
	ser.Value("Visibility", wasVisible);
	if(ser.IsReading())
	{
		if(wasVisible)
			GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)|ENTITY_SLOT_RENDER);
		else
			GetEntity()->SetSlotFlags(0, GetEntity()->GetSlotFlags(0)&(~ENTITY_SLOT_RENDER));
		InitWithAI();
	}
}
开发者ID:mrwonko,项目名称:CrysisVR,代码行数:33,代码来源:Projectile.cpp

示例4: SerializeWith

void SJointBreakParticleRec::SerializeWith(TSerialize ser)
{
	LOGBREAK("SJointBreakParticleRec");
	CBitArray array(&ser);
	SerializeDirVector(array, vel, 20.f, 8, 8, 8);
	if (ser.IsWriting()) array.WriteToSerializer();
}
开发者ID:aronarts,项目名称:FireNET,代码行数:7,代码来源:ProceduralBreak.cpp

示例5: Serialize

	void CColorGradientManager::Serialize(TSerialize serializer)
	{
		if(serializer.IsReading())
			Reset();

		serializer.BeginGroup("ColorGradientManager");
		{
			int numToLoad = (int)m_colorGradientsToLoad.size();
			int numLoaded = (int)m_currentGradients.size();
			int numGradients = numToLoad + numLoaded;
			serializer.Value("ColorGradientCount", numGradients);
			if(serializer.IsWriting())
			{
				for(int i=0; i<numToLoad; ++i)
				{
					LoadingColorGradient& gradient = m_colorGradientsToLoad[i];
					serializer.BeginGroup("ColorGradient");
					serializer.Value("FilePath", gradient.m_filePath);
					serializer.Value("FadeInTime", gradient.m_fadeInTimeInSeconds);
					serializer.EndGroup();
				}
				for(int i=0; i<numLoaded; ++i)
				{
					LoadedColorGradient& gradient = m_currentGradients[i];
					serializer.BeginGroup("ColorGradient");
					serializer.Value("FilePath", gradient.m_filePath);
					serializer.Value("BlendAmount", gradient.m_layer.m_blendAmount);
					serializer.Value("FadeInTime", gradient.m_fadeInTimeInSeconds);
					serializer.Value("ElapsedTime", gradient.m_elapsedTime);
					serializer.Value("MaximumBlendAmount", gradient.m_maximumBlendAmount);
					serializer.EndGroup();
				}
			}
			else
			{
				m_currentGradients.reserve(numGradients);
				for(int i=0; i<numGradients; ++i)
				{
					serializer.BeginGroup("ColorGradient");
					string filePath;
					float blendAmount = 1.0f;
					float fadeInTimeInSeconds = 0.0f;
					serializer.Value("FilePath", filePath);
					serializer.Value("BlendAmount", blendAmount);
					serializer.Value("FadeInTime", fadeInTimeInSeconds);
					const int textureID = GetColorGradingController().LoadColorChart(filePath);
					LoadedColorGradient gradient(filePath, SColorChartLayer(textureID, blendAmount), fadeInTimeInSeconds);

					// Optional
					serializer.ValueWithDefault("ElapsedTime", gradient.m_elapsedTime, 0.0f);
					serializer.ValueWithDefault("MaximumBlendAmount", gradient.m_maximumBlendAmount, 1.0f);

					m_currentGradients.push_back(gradient);
					serializer.EndGroup();
				}
			}
			serializer.EndGroup();
		}
	}
开发者ID:danielasun,项目名称:dbho-GameSDK,代码行数:59,代码来源:ColorGradientManager.cpp

示例6: NetSerialize

//------------------------------------------------------------------------
bool CProjectile::NetSerialize(TSerialize ser, EEntityAspects aspect, uint8 profile, int pflags)
{
	if(aspect == eEA_Physics)
	{
		pe_type type = PE_NONE;

		switch(profile)
		{
		case ePT_Rigid:
			type = PE_RIGID;
			break;

		case ePT_Particle:
			type = PE_PARTICLE;
			break;

		case ePT_None:
			return true;

		case ePT_Static:
		{
			Vec3 pos = GetEntity()->GetWorldPos();
			Quat ori = GetEntity()->GetWorldRotation();
			ser.Value("pos", pos, 'wrld');
			ser.Value("ori", ori, 'ori1');

			if(ser.IsReading())
				GetEntity()->SetWorldTM(Matrix34::Create(Vec3(1,1,1), ori, pos));
		}

		return true;

		default:
			return false;
		}

		IEntityPhysicalProxy *pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS);

		if(ser.IsWriting())
		{
			if(!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type)
			{
				gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot(ser, type, 0);
				return true;
			}
		}
		else if(!pEPP)
		{
			return false;
		}

		pEPP->SerializeTyped(ser, type, pflags);
	}

	return true;
}
开发者ID:Hellraiser666,项目名称:CryGame,代码行数:57,代码来源:Projectile.cpp

示例7: NetSerialize

//-----------------------------------------------------------------------------
bool CNetworkedPhysicsEntity::NetSerialize( TSerialize ser, EEntityAspects aspect, uint8 profile, int flags )
{
	NET_PROFILE_SCOPE("NetworkedPhysicsEntity", ser.IsReading());

	if (aspect == eEA_Physics)
	{
		pe_type type = PE_NONE;
		
		switch (profile)
		{
			case ePhys_PhysicalizedRigid:
			{
				type = PE_RIGID;
				break;
			}
			case ePhys_PhysicalizedStatic:
			{
				type = PE_STATIC;

				// Serialise the position ourselves - physics system won't do it for static entities
				const Matrix34 &worldTM = GetEntity()->GetWorldTM();
				Vec3 worldPos = worldTM.GetTranslation();
				ser.Value("worldPos", worldPos, 'wrld');
				if (ser.IsReading())
				{
					Matrix34 newTM = worldTM;
					newTM.SetTranslation(worldPos);
					GetEntity()->SetWorldTM(newTM);
				}

				break;
			}
		}

		if (type == PE_NONE)
			return true;

		IEntityPhysicalProxy * pEPP = (IEntityPhysicalProxy *) GetEntity()->GetProxy(ENTITY_PROXY_PHYSICS);
		if (ser.IsWriting())
		{
			if (!pEPP || !pEPP->GetPhysicalEntity() || pEPP->GetPhysicalEntity()->GetType() != type)
			{
				gEnv->pPhysicalWorld->SerializeGarbageTypedSnapshot( ser, type, 0 );
				return true;
			}
		}
		else if (!pEPP)
		{
			return false;
		}

		pEPP->SerializeTyped( ser, type, flags );
	}
	return true;
}
开发者ID:Xydrel,项目名称:Infected,代码行数:56,代码来源:NetworkedPhysicsEntity.cpp

示例8: Serialize

//------------------------------------------------------------------------
void CVehicleDamagesGroup::Serialize(TSerialize ser, EEntityAspects aspects)
{
	ser.BeginGroup("SubGroups");
	for (TDamagesSubGroupVector::iterator ite = m_damageSubGroups.begin(); 
		ite != m_damageSubGroups.end(); ++ite)
	{
		ser.BeginGroup("SubGroup");

		SDamagesSubGroup& subGroup = *ite;
		TVehicleDamageBehaviorVector& damageBehaviors = subGroup.m_damageBehaviors;

		for (TVehicleDamageBehaviorVector::iterator behaviorIte = damageBehaviors.begin(); behaviorIte != damageBehaviors.end(); ++behaviorIte)
		{
			IVehicleDamageBehavior* pBehavior = *behaviorIte;
			ser.BeginGroup("Behavior");
			pBehavior->Serialize(ser, aspects);
			ser.EndGroup();
		}
		ser.EndGroup();
	}
	ser.EndGroup();

	int size = m_delayedSubGroups.size();
	ser.Value("DelayedSubGroupEntries", size);
	if(ser.IsWriting())
	{
		for (TDelayedDamagesSubGroupList::iterator ite = m_delayedSubGroups.begin(); ite != m_delayedSubGroups.end(); ++ite)
		{
			ser.BeginGroup("SubGroup");
			SDelayedDamagesSubGroupInfo& delayedInfo = *ite;
			ser.Value("delayedInfoId", delayedInfo.subGroupId);
			ser.Value("delayedInfoDelay", delayedInfo.delay);
			delayedInfo.behaviorParams.Serialize(ser, m_pVehicle);
			ser.EndGroup();
		}
	}
	else if(ser.IsReading())
	{
		m_delayedSubGroups.clear();  
		for(int i = 0; i < size; ++i)
		{	
			ser.BeginGroup("SubGroup");
			SDelayedDamagesSubGroupInfo delayInfo;
			ser.Value("delayedInfoId", delayInfo.subGroupId);
			ser.Value("delayedInfoDelay", delayInfo.delay);	
			delayInfo.behaviorParams.Serialize(ser, m_pVehicle);
			ser.EndGroup();
		}
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:51,代码来源:VehicleDamagesGroup.cpp

示例9:

void CMonoEntityExtension::RMIParams::SerializeWith(TSerialize ser)
{
	IMonoArray *pArgs;
	int length;

	if(args != nullptr)
	{
		pArgs = *args;
		length = pArgs->GetSize();
	}
	else
		length = 0;

	ser.Value("length", length);

	ser.Value("methodName", methodName);
	ser.Value("targetId", targetId, 'eid');

	if(length > 0)
	{
		if(ser.IsWriting())
		{
			for(int i = 0; i < length; i++)
			{
				IMonoObject *pItem = *pArgs->GetItem(i);
				pItem->GetAnyValue().SerializeWith(ser);
				SAFE_RELEASE(pItem);
			}
		}
		else
		{
			pArgs = g_pScriptSystem->GetScriptDomain()->CreateArray(length);

			for(int i = 0; i < length; i++)
			{
				MonoAnyValue value;
				value.SerializeWith(ser);
				pArgs->InsertAny(value, i);
			}

			args = pArgs->GetManagedObject();
		}

		pArgs->Release();
	}
}
开发者ID:nathanpapke,项目名称:CryMono,代码行数:46,代码来源:MonoEntity.cpp

示例10: Serialize

void CAIGroupProxy::Serialize(TSerialize ser)
{
	if(m_script && m_script->HaveValue("OnSaveAI") && m_script->HaveValue("OnLoadAI"))
	{
		SmartScriptTable saved(m_script->GetScriptSystem());
		if (ser.IsWriting())
			Script::CallMethod(m_script, "OnSaveAI", saved);
		ser.Value("ScriptData", saved.GetPtr());
		if (ser.IsReading())
			Script::CallMethod(m_script, "OnLoadAI", saved);
	}

	string behaviorName = GetCurrentBehaviorName();
	ser.Value("BehaviorName", behaviorName);

	if (ser.IsReading())
		SetBehaviour(behaviorName.c_str(), false);
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:18,代码来源:AIGroupProxy.cpp

示例11: Serialize

//------------------------------------------------------------------------
void CVehiclePartEntity::Serialize(TSerialize serializer, EEntityAspects aspects)
{
	CVehiclePartBase::Serialize(serializer, aspects);

	bool saveGame = serializer.GetSerializationTarget() != eST_Network ;

	if( saveGame )
	{
		uint32	flags = 0;

		if(serializer.IsWriting())
		{
			if(m_hidden)
			{
				flags |= Flags::Hidden;
			}

			if(m_entityAttached)
			{
				flags |= Flags::EntityAttached;
			}

			if (m_destroyed)
			{
				flags |= Flags::Destroyed;
			}
		}

		serializer.Value("entityId", m_entityId);
		serializer.Value("flags", flags);

		if(serializer.IsReading())
		{
			m_hidden         = !!(flags & Flags::Hidden);
			m_entityAttached = !!(flags & Flags::EntityAttached);
			m_destroyed      = !!(flags & Flags::Destroyed);
		}
	}
	else
	{
		serializer.Value("netId",m_entityNetId,'ui16');
	}

}
开发者ID:aronarts,项目名称:FireNET,代码行数:45,代码来源:VehiclePartEntity.cpp

示例12: Serialize

//------------------------------------------------------------------------
void CVehicleSeatActionRotateTurret::Serialize(TSerialize ser, EEntityAspects aspects)
{
	// MR: for network, only turret parts are serialized
	// for savegame, all parts are serialized (by CVehicle)
	if (ser.GetSerializationTarget() == eST_Network)
	{
		for (int i = 0; i < eVTRT_NumRotationTypes; ++i)
		{
			if (m_rotations[i].m_pPart)
			{
				m_rotations[i].m_pPart->Serialize(ser, aspects);
			}
		}
	}
	else
	{
		// save rotation details
		CryFixedStringT<16> tag;
		for (int i = 0; i < eVTRT_NumRotationTypes; ++i)
		{
			if (m_rotations[i].m_pPart)
			{
				Quat     q;
				Matrix34 currentTM = m_rotations[i].m_pPart->GetLocalBaseTM();
				if (ser.IsWriting())
					q = Quat(currentTM);

				tag = (i == eVTRT_Pitch) ? "rotation_pitch" : "rotation_yaw";
				ser.Value(tag.c_str(), q, 'ori1');

				if (ser.IsReading())
				{
					Matrix34 newTM(q);
					newTM.SetTranslation(currentTM.GetTranslation());
					m_rotations[i].m_pPart->SetLocalBaseTM(newTM);
					m_rotations[i].m_orientation.Set(q);
				}
			}
		}
	}
}
开发者ID:joewan,项目名称:pycmake,代码行数:42,代码来源:VehicleSeatActionRotateTurret.cpp

示例13: Serialize

void CMultipleGrabHandler::Serialize(TSerialize ser)
{
	int numHandlers;
	if (ser.IsWriting())
		numHandlers = m_handlers.size();

	ser.Value("numHandlers", numHandlers);

	if (ser.IsReading())
	{
		for (int i=0; i < numHandlers; ++i)
		{
			m_handlers.push_back (new CAnimatedGrabHandler (m_pActor));
		}
	}

	std::vector <CAnimatedGrabHandler*>::iterator it = m_handlers.begin();
	std::vector <CAnimatedGrabHandler*>::iterator end = m_handlers.end();
	for ( ; it != end; ++it)
		(*it)->Serialize (ser);
}
开发者ID:AiYong,项目名称:CryGame,代码行数:21,代码来源:GrabHandler.cpp

示例14: SerializeWith

void SDeclareExplosiveObjectState::SerializeWith( TSerialize ser )
{
	LOGBREAK("SDeclareExplosiveObjectState: %s", ser.IsReading() ? "Reading:" : "Writing");

	ser.Value("breakId", breakId, 'brId');
	ser.Value("isEnt", isEnt);
	if (isEnt)
	{
		if (ser.IsWriting())
			CRY_ASSERT(CCryAction::GetCryAction()->GetGameContext()->GetNetContext()->IsBound(entId));
		ser.Value("entid", entId, 'eid');
		ser.Value("entpos", entPos);
		ser.Value("entrot", entRot);
		ser.Value("entscale", entScale);
	}
	else
	{
		ser.Value("eventPos", eventPos);
		ser.Value("hash", hash);
	}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:21,代码来源:ExplosiveObjectState.cpp

示例15: FullSerialize

void CMonoEntityExtension::FullSerialize(TSerialize ser)
{
	IEntity *pEntity = GetEntity();

	ser.BeginGroup("Properties");
	auto pPropertyHandler = static_cast<CEntityPropertyHandler *>(pEntity->GetClass()->GetPropertyHandler());
	for(int i = 0; i < pPropertyHandler->GetPropertyCount(); i++)
	{
		if(ser.IsWriting())
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			ser.Value(propertyInfo.name, pPropertyHandler->GetProperty(pEntity, i));
		}
		else
		{
			IEntityPropertyHandler::SPropertyInfo propertyInfo;
			pPropertyHandler->GetPropertyInfo(i, propertyInfo);

			char *propertyValue = nullptr;
			ser.ValueChar(propertyInfo.name, propertyValue, 0);

			pPropertyHandler->SetProperty(pEntity, i, propertyValue);
		}
	}

	ser.EndGroup();

	ser.BeginGroup("ManagedEntity");

	IMonoArray *pArgs = CreateMonoArray(1);
	pArgs->InsertNativePointer(&ser);

	m_pScript->GetClass()->InvokeArray(m_pScript->GetManagedObject(), "InternalFullSerialize", pArgs);
	pArgs->Release();

	ser.EndGroup();
}
开发者ID:nathanpapke,项目名称:CryMono,代码行数:39,代码来源:MonoEntity.cpp


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