SimpleScript.OnScriptEventOptionsAttribute

SimpleScript.OnScriptEventOptionsAttribute Class

Set options for OnScriptEvent events.

Syntax

[Sansar.Script.Interface]
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
protected class SimpleScript.OnScriptEventOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute

See Also

Remarks

If EventName is not set then OnScriptEvent will receive events with the name of the script class.

Example

C# Example
            // Send events to this handler from other simple scripts with: PostScriptEvent("AddPosition", myVector);
            [OnScriptEventOptions(EventName="AddPosition")]
            protected override void OnScriptEvent(object eventData)
            {
                Vector newPos = eventData as Vector;
                if (newPos != null) AllPositions.Add(newPos);
            }
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Members

See Also: Inherited members from SimpleScript.SimpleScriptOptionsAttribute.

Public Constructors

Public Properties

 
Message string . Set the name of the script event to listen for.

Member Details

SimpleScript.OnScriptEventOptionsAttribute Constructor

 

Syntax

public SimpleScript.OnScriptEventOptionsAttribute ()

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Message Property

Set the name of the script event to listen for.

Syntax

[Sansar.Script.Interface]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
[get: Sansar.Script.Interface]
[set: Sansar.Script.Interface]
public string Message { get; set; }

See Also

Value

The name of the script event message to subscribe to.

Remarks

If Message is not set then OnScriptEvent will receive events with the name of the script class. In the following example it will receive events named "MySimpleScript"
C# Example
            // Listen for script events named "MyEvent"
            public class MySimpleScript : SimpleScript
            {
                protected override void OnScriptEvent(ScriptEventData data)
                {
                    // Will get script events named "MySimpleScript"
                }
            }
            

Example

C# Example
            // Listen for script events "MyEvent"
            [OnScriptEventOptions(Message="MyEvent")]
            protected override void OnScriptEvent(ScriptEventData data)
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.