本文整理汇总了C++中ToCryString函数的典型用法代码示例。如果您正苦于以下问题:C++ ToCryString函数的具体用法?C++ ToCryString怎么用?C++ ToCryString使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToCryString函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToCryString
SMonoActorInfo CActorSystem::CreateActor(int channelId, mono::string name, mono::string className, Vec3 pos, Quat rot, Vec3 scale)
{
const char *sClassName = ToCryString(className);
if(IActor *pActor = gEnv->pGameFramework->GetIActorSystem()->CreateActor(channelId, ToCryString(name), sClassName, pos, rot, scale))
return SMonoActorInfo(pActor);
return SMonoActorInfo();
}
示例2: TSerialize
void CScriptbind_CrySerialize::ValueString(ISerialize *ser, mono::string name, mono::string &str, int policy)
{
TSerialize serialize = TSerialize(ser);
if(!ser->IsReading())
serialize.Value(ToCryString(name), ToCryString(str), policy);
else
{
string cryStr;
serialize.Value(ToCryString(name), cryStr, policy);
str = ToMonoString(cryStr.c_str());
}
}
示例3: FindEntity
EntityId CScriptbind_Entity::FindEntity(mono::string name)
{
if(IEntity *pEntity = gEnv->pEntitySystem->FindEntityByName(ToCryString(name)))
return pEntity->GetId();
return 0;
}
示例4:
IAttachment *CScriptbind_Entity::GetAttachmentByName(IEntity *pEnt, mono::string name, int slot)
{
if(auto pAttachmentManager = GetAttachmentManager(pEnt, slot))
return pAttachmentManager->GetInterfaceByName(ToCryString(name));
return nullptr;
}
示例5: LoadTexture
int CScriptbind_Renderer::LoadTexture(mono::string texturePath)
{
if(ITexture *pTexture = gEnv->pRenderer->EF_LoadTexture(ToCryString(texturePath)))
return pTexture->GetTextureID();
return -1;
}
示例6: CRY_ASSERT
void CMonoFlowNode::GetConfiguration(SFlowNodeConfig &config)
{
CRY_ASSERT(m_pScript);
if(mono::object result = m_pScript->CallMethod("GetNodeConfig"))
{
IMonoObject *pResult = *result;
SMonoNodeConfig monoConfig = pResult->Unbox<SMonoNodeConfig>();
config.nFlags |= monoConfig.flags;
config.sDescription = _HELP(ToCryString(monoConfig.description));
config.SetCategory(monoConfig.category);
m_flags = config.nFlags;
m_cloneType = monoConfig.cloneType;
// Ports
IMonoArray *pInputPorts = *monoConfig.inputs;
int numInputs = pInputPorts->GetSize();
auto pInputs = new SInputPortConfig[numInputs + 1];
for(int i = 0; i < numInputs; i++)
{
IMonoObject *pInputObject = *pInputPorts->GetItem(i);
pInputs[i] = pInputObject->Unbox<SMonoInputPortConfig>().Convert();
SAFE_RELEASE(pInputObject);
}
SInputPortConfig nullInputPortConfig = {0};
pInputs[numInputs] = nullInputPortConfig;
config.pInputPorts = pInputs;
SAFE_RELEASE(pInputPorts);
IMonoArray *pOutputPorts = *monoConfig.outputs;
int numOutputs = pOutputPorts->GetSize();
auto pOutputs = new SOutputPortConfig[numOutputs + 1];
for(int i = 0; i < numOutputs; i++)
{
IMonoObject *pOutputObject = *pOutputPorts->GetItem(i);
pOutputs[i] = pOutputObject->Unbox<SMonoOutputPortConfig>().Convert();
SAFE_RELEASE(pOutputObject);
}
SOutputPortConfig nullOutputPortConfig = {0};
pOutputs[numOutputs] = nullOutputPortConfig;
config.pOutputPorts = pOutputs;
SAFE_RELEASE(pOutputPorts);
SAFE_RELEASE(pResult);
}
}
示例7: CFrameProfiler
CFrameProfiler *CScriptbind_Debug::CreateFrameProfiler(mono::string methodName)
{
CFrameProfiler *pFrameProfiler = new CFrameProfiler(GetISystem(), ToCryString(methodName), PROFILE_SCRIPT);
m_frameProfilers.push_back(pFrameProfiler);
return pFrameProfiler;
}
示例8: ToCryString
mono::object CScriptbind_Entity::SpawnEntity(EntitySpawnParams monoParams, bool bAutoInit, SMonoEntityInfo &entityInfo)
{
const char *className = ToCryString(monoParams.sClass);
if(IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(className))
{
SEntitySpawnParams spawnParams;
spawnParams.pClass = pClass;
spawnParams.sName = ToCryString(monoParams.sName);
spawnParams.nFlags = monoParams.flags | ENTITY_FLAG_NO_SAVE;
spawnParams.vPosition = monoParams.pos;
spawnParams.qRotation = monoParams.rot;
spawnParams.vScale = monoParams.scale;
if(IEntity *pEntity = gEnv->pEntitySystem->SpawnEntity(spawnParams, bAutoInit))
{
entityInfo.pEntity = pEntity;
entityInfo.id = pEntity->GetId();
if(IGameObject *pGameObject = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetGameObject(spawnParams.id))
{
if(CMonoEntityExtension *pEntityExtension = static_cast<CMonoEntityExtension *>(pGameObject->QueryExtension(className)))
return pEntityExtension->GetScript()->GetManagedObject();
else
{
MonoWarning("[CryMono] Spawned entity of class %s with id %i, but game object extension query failed!", className, pEntity->GetId());
auto extensionId = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetIGameObjectSystem()->GetID(className);
if(extensionId == IGameObjectSystem::InvalidExtensionID)
MonoWarning("[CryMono] IGameObjectSystem::GetId returned invalid id for extension %s", className);
return nullptr;
}
}
else
{
MonoWarning("[CryMono] Spawned entity of class %s with id %i, but game object was null!", className, pEntity->GetId());
return nullptr;
}
}
}
return nullptr;
}
示例9: ToCryString
SMonoActorInfo CScriptbind_ActorSystem::CreateActor(int channelId, mono::string name, mono::string className, Vec3 pos, Quat rot, Vec3 scale)
{
const char *sClassName = ToCryString(className);
if(IActor *pActor = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetIActorSystem()->CreateActor(channelId, ToCryString(name), sClassName, pos, rot, scale))
return SMonoActorInfo(pActor);
return SMonoActorInfo();
}
示例10: LoadLight
int CScriptbind_Entity::LoadLight(IEntity *pEntity, int slot, SMonoLightParams params)
{
CDLight light;
if(const char *spec = ToCryString(params.specularCubemap))
{
if(strcmp(spec, ""))
light.SetSpecularCubemap(gEnv->pRenderer->EF_LoadTexture(spec));
}
if(const char *diff = ToCryString(params.diffuseCubemap))
{
if(strcmp(diff, ""))
light.SetDiffuseCubemap(gEnv->pRenderer->EF_LoadTexture(diff));
}
if(const char *lightImage = ToCryString(params.lightImage))
{
if(strcmp(lightImage, ""))
light.m_pLightImage = gEnv->pRenderer->EF_LoadTexture(lightImage);
}
light.SetLightColor(params.color);
light.SetPosition(params.origin);
light.SetShadowBiasParams(params.shadowBias, params.shadowSlopeBias);
light.m_fRadius = params.radius;
light.SetSpecularMult(params.specularMultiplier);
light.m_fHDRDynamic = params.hdrDynamic;
light.m_fLightFrustumAngle = params.lightFrustumAngle;
light.m_fShadowUpdateMinRadius = params.shadowUpdateMinRadius;
light.m_nShadowUpdateRatio = params.shadowUpdateRatio;
light.m_nLightStyle = params.lightStyle;
light.m_nLightPhase = params.lightPhase;
light.m_ShadowChanMask = params.shadowChanMask;
return pEntity->LoadLight(slot, &light);
}
示例11: CCGFAttachment
CCGFAttachment *CScriptbind_Entity::BindAttachmentToCGF(IAttachment *pAttachment, mono::string cgf, IMaterial *pMaterial)
{
pAttachment->ClearBinding();
CCGFAttachment *pCGFAttachment = new CCGFAttachment();
pCGFAttachment->pObj = gEnv->p3DEngine->LoadStatObj(ToCryString(cgf));
pCGFAttachment->SetReplacementMaterial(pMaterial);
pAttachment->AddBinding(pCGFAttachment);
return pCGFAttachment;
}
示例12: ToCryString
//-----------------------------------------------------------------------------
void CScriptbind_GameRules::RegisterGameMode(mono::string gamemode)
{
if(IGameFramework *pGameFramework = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework())
{
if(IGameRulesSystem *pGameRulesSystem = pGameFramework->GetIGameRulesSystem())
{
const char *gameModeStr = ToCryString(gamemode);
if(!pGameRulesSystem->HaveGameRules(gameModeStr))
pGameRulesSystem->RegisterGameRules(gameModeStr, "GameRules");
}
}
}
示例13: ToCryString
const char *CEntityPropertyHandler::GetProperty(IEntity *pIEntity, int index) const
{
if (IGameObject *pGameObject = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetGameObject(pIEntity->GetId()))
{
if(CMonoEntityExtension *pEntity = static_cast<CMonoEntityExtension *>(pGameObject->QueryExtension(pIEntity->GetClass()->GetName())))
{
if(mono::object result = pEntity->GetScript()->CallMethod("GetPropertyValue", m_pProperties[index].info.name))
return ToCryString((mono::string)result);
}
}
return "";
}
示例14: CRY_ASSERT
void CScriptbind_ActorSystem::RemoteInvocation(EntityId entityId, EntityId targetId, mono::string methodName, mono::object args, ERMInvocation target, int channelId)
{
CRY_ASSERT(entityId != 0);
IGameObject *pGameObject = static_cast<CScriptSystem *>(GetMonoScriptSystem())->GetIGameFramework()->GetGameObject(entityId);
CRY_ASSERT(pGameObject);
CMonoEntityExtension::RMIParams params(args, ToCryString(methodName), targetId);
if(target & eRMI_ToServer)
pGameObject->InvokeRMI(CMonoActor::SvScriptRMI(), params, target, channelId);
else
pGameObject->InvokeRMI(CMonoActor::ClScriptRMI(), params, target, channelId);
}