mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
New ScriptServer protocol successfully implemented.
Still needs hooking up for all commands in both ends, separation of local and remote LSL-commands, etc.
This commit is contained in:
@@ -30,6 +30,7 @@ using System;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.ScriptEngine.Common;
|
||||
using OpenSim.Region.ScriptEngine.Common.TRPC;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
{
|
||||
@@ -41,14 +42,23 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
{
|
||||
|
||||
System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject> remoteScript = new System.Collections.Generic.Dictionary<uint, ScriptServerInterfaces.ServerRemotingObject>();
|
||||
TCPClient m_TCPClient;
|
||||
TRPC_Remote RPC;
|
||||
int myScriptServerID;
|
||||
|
||||
string remoteHost = "127.0.0.1";
|
||||
int remotePort = 8010;
|
||||
|
||||
private ScriptEngine myScriptEngine;
|
||||
public EventManager(ScriptEngine _ScriptEngine)
|
||||
{
|
||||
myScriptEngine = _ScriptEngine;
|
||||
|
||||
|
||||
|
||||
m_TCPClient = new TCPClient();
|
||||
RPC = new TRPC_Remote(m_TCPClient);
|
||||
RPC.ReceiveCommand += new TRPC_Remote.ReceiveCommandDelegate(RPC_ReceiveCommand);
|
||||
myScriptServerID = m_TCPClient.ConnectAndReturnID(remoteHost, remotePort);
|
||||
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Hooking up to server events");
|
||||
//myScriptEngine.World.EventManager.OnObjectGrab += touch_start;
|
||||
myScriptEngine.World.EventManager.OnRezScript += OnRezScript;
|
||||
@@ -57,16 +67,32 @@ namespace OpenSim.Region.ScriptEngine.RemoteServer
|
||||
|
||||
}
|
||||
|
||||
void RPC_ReceiveCommand(int ID, string Command, params object[] p)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Received command: '" + Command + "'");
|
||||
if (p != null)
|
||||
{
|
||||
for (int i = 0; i < p.Length; i++)
|
||||
{
|
||||
myScriptEngine.Log.Notice("REMOTESERVER", "Param " + i + ": " + p[i].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void OnRezScript(uint localID, LLUUID itemID, string script)
|
||||
{
|
||||
// WE ARE CREATING A NEW SCRIPT ... CREATE SCRIPT, GET A REMOTEID THAT WE MAP FROM LOCALID
|
||||
myScriptEngine.Log.Verbose("RemoteEngine", "Creating new script (with connection)");
|
||||
|
||||
// Temp for now: We have one connection only - this is hardcoded in myScriptServerID
|
||||
RPC.SendCommand(myScriptServerID, "OnRezScript", script);
|
||||
|
||||
ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
|
||||
remoteScript.Add(localID, obj);
|
||||
remoteScript[localID].Events().OnRezScript(localID, itemID, script);
|
||||
//ScriptServerInterfaces.ServerRemotingObject obj = myScriptEngine.m_RemoteServer.Connect("localhost", 1234);
|
||||
//remoteScript.Add(localID, obj);
|
||||
//remoteScript[localID].Events().OnRezScript(localID, itemID, script);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user