本文整理汇总了C#中BinaryPhoenix.Fusion.Runtime.Scripting.ScriptThread.CopyValueFromThread方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptThread.CopyValueFromThread方法的具体用法?C# ScriptThread.CopyValueFromThread怎么用?C# ScriptThread.CopyValueFromThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryPhoenix.Fusion.Runtime.Scripting.ScriptThread
的用法示例。
在下文中一共展示了ScriptThread.CopyValueFromThread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMember
/// <summary>
/// Invoked when a script wants to set the value of an indexed 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>
/// <param name="index">Index of member to it wants set.</param>
/// <returns>True if successfull or false if not.</returns>
public override bool GetMember(ScriptThread thread, VariableSymbol variable, RuntimeValue indexer)
{
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.DataType != processSymbol.DataType.DataType || processSymbol.DataType.IsArray != true)
return false;
// Grab the arrays variable.
RuntimeValue indexValue = process[0].GetRuntimeValueArrayElement(runtimeValue.MemoryIndex, indexer.IntegerLiteral);
// Copy value into calling thread.
RuntimeValue copiedValue = thread.CopyValueFromThread(indexValue, thread, process[0]);
// Set the return register to our newly copied value.
thread.Registers[(int)Register.Return] = copiedValue;
// 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;
}