本文整理汇总了C#中BinaryPhoenix.Fusion.Runtime.Scripting.ScriptThread.CopyValueArrayFromThread方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptThread.CopyValueArrayFromThread方法的具体用法?C# ScriptThread.CopyValueArrayFromThread怎么用?C# ScriptThread.CopyValueArrayFromThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryPhoenix.Fusion.Runtime.Scripting.ScriptThread
的用法示例。
在下文中一共展示了ScriptThread.CopyValueArrayFromThread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMember
/// <summary>
/// Invoked when a script wants to set the value of a member of this object.
/// </summary>
/// <param name="thread">Script thread that invoked this function.</param>
/// <param name="variable">Symbol describing the member that it wants set.</param>
/// <param name="value">Value it wants the member to be set to.</param>
/// <returns>True if successfull or false if not.</returns>
public override bool GetMember(ScriptThread thread, VariableSymbol variable)
{
if (_nativeObject is ScriptedEntityNode)
{
// Check the script process is valid.
ScriptProcess process = ((ScriptedEntityNode)_nativeObject).ScriptProcess;
if (process == null) return false;
// See if we can get the symbol they are after.
VariableSymbol processSymbol = process.GetSymbol(variable.Identifier, SymbolType.Variable) as VariableSymbol;
if (processSymbol == null)
return false;
// Grab the variable runtime value. (This can probably be optimized).
RuntimeValue runtimeValue= process[0].GetRuntimeValueGlobal(processSymbol.Identifier);
// Check its public.
if (processSymbol.AccessModifier != SymbolAccessModifier.Public)
return false;
// Check data types are correct.
if (variable.DataType != processSymbol.DataType)
return false;
// Copy value into calling thread.
if (variable.DataType.IsArray == true)
{
thread.Registers[(int)Register.Return].MemoryIndex = (short)thread.CopyValueArrayFromThread(runtimeValue, thread, process[0]);
}
else
thread.Registers[(int)Register.Return] = thread.CopyValueFromThread(runtimeValue, thread, process[0]);
// Set the return register to our newly copied value.
// Return.
return true;
}
else if (_nativeObject is EntityNode)
{
}
else if (_nativeObject is EmitterNode)
{
}
else if (_nativeObject is TilemapSegmentNode)
{
}
else if ((_nativeObject as SceneNode) != null)
{
}
return false;
}