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


C# Scripting.ScriptThread类代码示例

本文整理汇总了C#中BinaryPhoenix.Fusion.Runtime.Scripting.ScriptThread的典型用法代码示例。如果您正苦于以下问题:C# ScriptThread类的具体用法?C# ScriptThread怎么用?C# ScriptThread使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScriptThread类属于BinaryPhoenix.Fusion.Runtime.Scripting命名空间,在下文中一共展示了ScriptThread类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GameFlag

 public void GameFlag(ScriptThread thread)
 {
     string key = thread.GetStringParameter(0).ToLower();
     if (!Fusion.GlobalInstance.GameFlags.Contains(key))
         return;
     thread.SetReturnValue((string)Fusion.GlobalInstance.GameFlags[key]);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:7,代码来源:Fusion.cs

示例2: CenterEntityOn

        public void CenterEntityOn(ScriptThread thread)
        {
            EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode;
            EntityNode target = ((NativeObject)thread.GetObjectParameter(1)).Object as EntityNode;
            if (entity == null || target == null)
            {
                DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CenterEntityOn with an invalid object.", LogAlertLevel.Error);
                return;
            }

            // Work out the central points.
            Transformation entityTransform = entity.CalculateTransformation();
            Transformation targetTransform = target.CalculateTransformation();

            // If its a camera then we need to invert the coordinates as it uses
            // slightly different ones from normal entities.
            if (entity as CameraNode != null)
            {
                entityTransform.X = -entityTransform.X;
                entityTransform.Y = -entityTransform.Y;
            }
            if (target as CameraNode != null)
            {
                targetTransform.X = -targetTransform.X;
                targetTransform.Y = -targetTransform.Y;
            }

            float targetEntityTransformCenterX = targetTransform.X + ((target.BoundingRectangle.Width / 2) * targetTransform.ScaleX);
            float targetEntityTransformCenterY = targetTransform.Y + ((target.BoundingRectangle.Height / 2) * targetTransform.ScaleY);
            entity.Position(targetEntityTransformCenterX - ((entity.BoundingRectangle.Width / 2) * entityTransform.ScaleX), targetEntityTransformCenterY - ((entity.BoundingRectangle.Height / 2) * entityTransform.ScaleY), entity.Transformation.Z);
        }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:31,代码来源:Entity.cs

示例3: CommandLineValue

        public void CommandLineValue(ScriptThread thread)
        {
            string commandLine = thread.GetStringParameter(0);
            int valueIndex = thread.GetIntegerParameter(1);

            foreach (string arg in Engine.GlobalInstance.CommandLineArguments)
            {
                string[] value = new string[0];
                string command = arg;
                int colonIndex = arg.IndexOf(':');

                // Seperate values and command if a colon exists.
                if (colonIndex >= 0)
                {
                    value = new string[1];
                    value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1);
                    if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' });
                    command = arg.Substring(0, colonIndex);
                }

                if (command.ToLower() == commandLine.ToLower())
                {
                    if (valueIndex < 0 || valueIndex >= value.Length)
                    {
                        DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with an invalid value index.", LogAlertLevel.Error);
                        return;
                    }
                    thread.SetReturnValue(value[valueIndex]);
                    return;
                }
            }

            DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CommandLineValue with a non-existant command line.", LogAlertLevel.Error);
        }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:34,代码来源:Engine.cs

示例4: CommandLineExists

        public void CommandLineExists(ScriptThread thread)
        {
            string commandLine = thread.GetStringParameter(0);

            foreach (string arg in Engine.GlobalInstance.CommandLineArguments)
            {
                string[] value = new string[0];
                string command = arg;
                int colonIndex = arg.IndexOf(':');

                // Seperate values and command if a colon exists.
                if (colonIndex >= 0)
                {
                    value = new string[1];
                    value[0] = arg.Substring(colonIndex + 1, arg.Length - colonIndex - 1);
                    if (value[0].IndexOf(",") >= 0) value = value[0].Split(new char[1] { ',' });
                    command = arg.Substring(0, colonIndex);
                }

                if (command.ToLower() == commandLine.ToLower())
                {
                    thread.SetReturnValue(true);
                    return;
                }
            }

            thread.SetReturnValue(false);
        }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:28,代码来源:Engine.cs

示例5: DistanceToPoint

 public void DistanceToPoint(ScriptThread thread)
 {
     double vectorX = thread.GetDoubleParameter(0) - thread.GetDoubleParameter(2);
     double vectorY = thread.GetDoubleParameter(1) - thread.GetDoubleParameter(3);
     double distance = Math.Sqrt(vectorX * vectorX + vectorY * vectorY);
     thread.SetReturnValue(distance);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:7,代码来源:Mathmatics.cs

示例6: CharacterCount

 public void CharacterCount(ScriptThread thread)
 {
     string haystack = thread.GetStringParameter(0);
     string needle = thread.GetStringParameter(1);
     int count = 0;
     for (int i = 0; i < haystack.Length; i++)
         if (haystack[i] == needle[0]) count++;
     thread.SetReturnValue(count);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:9,代码来源:String.cs

示例7: SeekStream

 public void SeekStream(ScriptThread thread)
 {
     ScriptStream stream = ((NativeObject)thread.GetObjectParameter(0)).Object as ScriptStream;
     if (stream == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called SeekStream with an invalid object.", LogAlertLevel.Error);
         return;
     }
     stream.Stream.Position = thread.GetIntegerParameter(1);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:IO.cs

示例8: OpenStream

 public void OpenStream(ScriptThread thread)
 {
     Stream stream = StreamFactory.RequestStream(thread.GetStringParameter(0), (StreamMode)thread.GetIntegerParameter(1));
     if (stream == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called OpenStream with an unreachable url.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(new StreamScriptObject(new ScriptStream(stream)));
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:IO.cs

示例9: ExecuteFile

 public void ExecuteFile(ScriptThread thread)
 {
     Process process = new Process();
     process.StartInfo.FileName = thread.GetStringParameter(0);
     process.StartInfo.Arguments = thread.GetStringParameter(1);
     process.StartInfo.Verb = "Open";
     process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
     process.Start();
     if (thread.GetBooleanParameter(2) == true) process.WaitForExit();
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Runtime.cs

示例10: ChannelLooping

 public void ChannelLooping(ScriptThread thread)
 {
     ISampleBuffer sound = ((NativeObject)thread.GetObjectParameter(0)).Object as ISampleBuffer;
     if (sound == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called ChannelLooping with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(sound.Looping);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Audio.cs

示例11: CameraClearColor

 public void CameraClearColor(ScriptThread thread)
 {
     CameraNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as CameraNode;
     if (entity == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CameraClearColor with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(entity.ClearColor);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Entity.cs

示例12: ActivateCamera

 public void ActivateCamera(ScriptThread thread)
 {
     CameraNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as CameraNode;
     if (entity == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called AttachCameraToSceneGraph with an invalid object.", LogAlertLevel.Error);
         return;
     }
     Engine.GlobalInstance.Map.SceneGraph.AttachCamera(entity);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Entity.cs

示例13: ActivateProcess

 public void ActivateProcess(ScriptThread thread)
 {
     Runtime.Processes.Process process = ((NativeObject)thread.GetObjectParameter(0)).Object as Runtime.Processes.Process;
     if (process == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called ActivateProcess with an invalid object.", LogAlertLevel.Error);
         return;
     }
     ProcessManager.AttachProcess(process);
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Process.cs

示例14: StopThread

 public void StopThread(ScriptThread thread)
 {
     ScriptThread actionThread = ((NativeObject)thread.GetObjectParameter(0)).Object as ScriptThread;
     if (actionThread == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called StopThread with an invalid object.", LogAlertLevel.Error);
         return;
     }
     actionThread.Stop();
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Thread.cs

示例15: CreateAnimationProcessB

 public void CreateAnimationProcessB(ScriptThread thread)
 {
     EntityNode entity = ((NativeObject)thread.GetObjectParameter(0)).Object as EntityNode;
     if (entity == null)
     {
         DebugLogger.WriteLog((thread.Process.Url != null && thread.Process.Url != "" ? thread.Process.Url : "A script") + " called CreateAnimationProcess with an invalid object.", LogAlertLevel.Error);
         return;
     }
     thread.SetReturnValue(new ProcessScriptObject(new AnimationProcess(entity, (AnimationMode)thread.GetIntegerParameter(1), thread.GetIntegerParameter(2), thread.GetIntegerParameter(3), thread.GetIntegerParameter(4))));
 }
开发者ID:HampsterEater,项目名称:FusionGameEngine,代码行数:10,代码来源:Process.cs


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