From 1eec177d4b11e2793a5d77c20e9112a20138464a Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 27 Jun 2007 09:30:07 +0000 Subject: * Begun reimplementing scripting. --- OpenSim/OpenSim.Scripting/OpenSim.Scripting.csproj | 66 ++++++++++++++++++++++ .../OpenSim.Scripting/Properties/AssemblyInfo.cs | 35 ++++++++++++ OpenSim/OpenSim.Scripting/Script.cs | 32 +++++++++++ OpenSim/OpenSim.Scripting/ScriptAccess.cs | 31 ++++++++++ 4 files changed, 164 insertions(+) create mode 100644 OpenSim/OpenSim.Scripting/OpenSim.Scripting.csproj create mode 100644 OpenSim/OpenSim.Scripting/Properties/AssemblyInfo.cs create mode 100644 OpenSim/OpenSim.Scripting/Script.cs create mode 100644 OpenSim/OpenSim.Scripting/ScriptAccess.cs (limited to 'OpenSim/OpenSim.Scripting') diff --git a/OpenSim/OpenSim.Scripting/OpenSim.Scripting.csproj b/OpenSim/OpenSim.Scripting/OpenSim.Scripting.csproj new file mode 100644 index 0000000..41b852d --- /dev/null +++ b/OpenSim/OpenSim.Scripting/OpenSim.Scripting.csproj @@ -0,0 +1,66 @@ + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {3C3A8BD5-F53C-42D0-8ADE-E2492790788A} + Library + Properties + OpenSim.Scripting + OpenSim.Scripting + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\bin\libsecondlife.dll + + + + + + + + + + + + + {A7CD0630-0000-0000-0000-000000000000} + OpenSim.Framework.Console + + + {8ACA2445-0000-0000-0000-000000000000} + OpenSim.Framework + + + {196916AF-0000-0000-0000-000000000000} + OpenSim.Region + + + + + \ No newline at end of file diff --git a/OpenSim/OpenSim.Scripting/Properties/AssemblyInfo.cs b/OpenSim/OpenSim.Scripting/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f5da4c0 --- /dev/null +++ b/OpenSim/OpenSim.Scripting/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenSim.Scripting")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenSim.Scripting")] +[assembly: AssemblyCopyright("Copyright © 2007")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("61eae1ad-82aa-4c77-8bc5-b5a8c9522b18")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/OpenSim.Scripting/Script.cs b/OpenSim/OpenSim.Scripting/Script.cs new file mode 100644 index 0000000..0f4af00 --- /dev/null +++ b/OpenSim/OpenSim.Scripting/Script.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Framework.Console; +using OpenSim.Framework; +using OpenSim.Region; +using OpenSim.Region.Scenes; + +namespace OpenSim.Scripting +{ + public interface IScript + { + void Initialise(ScriptInfo scriptInfo); + } + + public class TestScript : IScript + { + ScriptInfo script; + + public void Initialise(ScriptInfo scriptInfo) + { + script = scriptInfo; + script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame); + } + + void events_OnFrame() + { + script.logger.Verbose("Hello World!"); + } + } +} diff --git a/OpenSim/OpenSim.Scripting/ScriptAccess.cs b/OpenSim/OpenSim.Scripting/ScriptAccess.cs new file mode 100644 index 0000000..a9fede5 --- /dev/null +++ b/OpenSim/OpenSim.Scripting/ScriptAccess.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; + +using OpenSim.Region.Scenes; +using OpenSim.Framework.Console; + +namespace OpenSim.Scripting +{ + /// + /// Class which provides access to the world + /// + public class ScriptInfo + { + // Reference to world.eventsManager provided for convenience + public EventManager events; + + // The main world + public Scene world; + + // The console + public LogBase logger; + + public ScriptInfo(Scene scene) + { + world = scene; + events = world.eventManager; + logger = OpenSim.Framework.Console.MainLog.Instance; + } + } +} -- cgit v1.1