mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
* Modernized ScriptManager to new interface-based module calls.
* 'remove redundant this qualifier' ftw
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
|
||||
using Axiom.Math;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
{
|
||||
public interface IScriptHost
|
||||
{
|
||||
string Name { get; set;}
|
||||
string SitName{ get; set;}
|
||||
string TouchName { get; set;}
|
||||
string Name { get; set; }
|
||||
string SitName { get; set; }
|
||||
string TouchName { get; set; }
|
||||
string Description { get; set; }
|
||||
LLUUID UUID { get; }
|
||||
LLUUID ObjectOwner { get;}
|
||||
LLUUID ObjectOwner { get; }
|
||||
LLUUID ObjectCreator { get; }
|
||||
LLVector3 AbsolutePosition { get; }
|
||||
void SetText(string text, Axiom.Math.Vector3 color, double alpha);
|
||||
void SetText(string text, Vector3 color, double alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
|
||||
using System;
|
||||
using Axiom.Math;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
{
|
||||
public class NullScriptHost : IScriptHost
|
||||
{
|
||||
|
||||
LLVector3 m_pos = new LLVector3( 128, 128, 30 );
|
||||
{
|
||||
private LLVector3 m_pos = new LLVector3(128, 128, 30);
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Object"; }
|
||||
@@ -39,18 +38,23 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
}
|
||||
|
||||
public LLUUID ObjectOwner
|
||||
{ get { return LLUUID.Zero; } }
|
||||
{
|
||||
get { return LLUUID.Zero; }
|
||||
}
|
||||
|
||||
public LLUUID ObjectCreator { get { return LLUUID.Zero; } }
|
||||
public LLUUID ObjectCreator
|
||||
{
|
||||
get { return LLUUID.Zero; }
|
||||
}
|
||||
|
||||
public LLVector3 AbsolutePosition
|
||||
{
|
||||
get { return m_pos; }
|
||||
}
|
||||
|
||||
public void SetText(string text, Axiom.Math.Vector3 color, double alpha)
|
||||
public void SetText(string text, Vector3 color, double alpha)
|
||||
{
|
||||
Console.WriteLine("Tried to SetText [{0}] on NullScriptHost", text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,16 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenSim.Region.Environment.Scenes.Scripting;
|
||||
|
||||
//TODO: WHERE TO PLACE THIS?
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
//TODO: WHERE TO PLACE THIS?
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
{
|
||||
public interface ScriptEngineInterface
|
||||
{
|
||||
void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld, OpenSim.Framework.Console.LogBase logger);
|
||||
void InitializeEngine(Scene Sceneworld, LogBase logger);
|
||||
void Shutdown();
|
||||
// void StartScript(string ScriptID, IScriptHost ObjectID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,18 @@
|
||||
*
|
||||
*/
|
||||
/* Original code: Tedd Hansen */
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using OpenSim.Framework.Console;
|
||||
|
||||
namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
{
|
||||
public class ScriptEngineLoader
|
||||
{
|
||||
private OpenSim.Framework.Console.LogBase m_log;
|
||||
public ScriptEngineLoader(OpenSim.Framework.Console.LogBase logger)
|
||||
private LogBase m_log;
|
||||
|
||||
public ScriptEngineLoader(LogBase logger)
|
||||
{
|
||||
m_log = logger;
|
||||
}
|
||||
@@ -47,12 +47,16 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
ScriptEngineInterface ret = null;
|
||||
try
|
||||
{
|
||||
ret = LoadAndInitAssembly(Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
|
||||
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
|
||||
ret =
|
||||
LoadAndInitAssembly(
|
||||
Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"),
|
||||
"OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("ScriptEngine", "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString());
|
||||
m_log.Error("ScriptEngine",
|
||||
"Error loading assembly \"" + EngineName + "\": " + e.Message + ", " +
|
||||
e.StackTrace.ToString());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -107,18 +111,14 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
||||
ScriptEngineInterface ret;
|
||||
//try
|
||||
//{
|
||||
ret = (ScriptEngineInterface)Activator.CreateInstance(t);
|
||||
ret = (ScriptEngineInterface) Activator.CreateInstance(t);
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// m_log.Error("ScriptEngine", "Error initializing type \"" + NameSpace + "\" from \"" + FileName + "\": " + e.ToString());
|
||||
//}
|
||||
|
||||
return ret;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user