From 37446b0392ba423894952f81aa0f938d2bd2de22 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sat, 18 Aug 2007 23:24:38 +0000 Subject: Moved in-AppDomain event execution from Script to OpenSim.Region.ScriptEngine.Executor. Script no longer responsible for handling event calls to itself (and we can create reference cache in Executor). --- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 38 ++++++---------------- .../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 7 ++-- 2 files changed, 14 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/Compiler') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 7334e6f..bfb8913 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -9,8 +9,17 @@ using System.Reflection; namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL { - public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface + public class LSL_BaseClass : MarshalByRefObject, LSL_BuiltIn_Commands_Interface, IScript { + private Executor m_Exec; + public Executor Exec { + get + { + if (m_Exec == null) + m_Exec = new Executor(this); + return m_Exec; + } + } public LSL_BuiltIn_Commands_Interface m_LSL_Functions; @@ -48,33 +57,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL return; } - public void ExecuteEvent(string FunctionName, object[] args) - { - //foreach (MemberInfo mi in this.GetType().GetMembers()) - //{ - //if (mi.ToString().ToLower().Contains("default")) - //{ - // Console.WriteLine("Member found: " + mi.ToString()); - //} - //} - - Type type = this.GetType(); - - Console.WriteLine("ScriptEngine Invoke: \"" + this.State() + "_event_" + FunctionName + "\""); - - try - { - type.InvokeMember(this.State() + "_event_" + FunctionName, BindingFlags.InvokeMethod, null, this, args); - } - catch (Exception e) - { - // TODO: Send to correct place - Console.WriteLine("ScriptEngine Exception attempting to executing script function: " + e.ToString()); - } - - - } - // diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 297a45c..8982bb6 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -16,6 +16,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler /// public class LSL_BuiltIn_Commands: MarshalByRefObject, LSL_BuiltIn_Commands_Interface { + private System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); private ScriptManager m_manager; private IScriptHost m_host; @@ -74,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llWhisper(int channelID, string text) { //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); - Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); + //Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); //type for whisper is 0 World.SimChat(Helpers.StringToField(text), 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); @@ -86,7 +87,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler { //TODO: DO SOMETHING USEFUL HERE //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (int)channelID + ", \"" + (string)text + "\");"); - Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); + //Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); //type for say is 1 World.SimChat(Helpers.StringToField(text), @@ -95,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler public void llShout(int channelID, string text) { - Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); + //Console.WriteLine("llShout Channel " + channelID + ", Text: \"" + text + "\""); //type for shout is 2 World.SimChat(Helpers.StringToField(text), 2, m_host.AbsolutePosition, m_host.Name, m_host.UUID); -- cgit v1.1