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


C# ScriptThread.CopyValueArrayFromThread方法代码示例

本文整理汇总了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;
        }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:63,代码来源:Entity.cs


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