The following events now work:

* OnFrame
* OnNewPresence
* OnNewPrimitive
* OnRemovePresence
Sugilite
Adam Frisby 2007-06-27 06:14:15 +00:00
parent e56c51c665
commit a1e6fff14f
2 changed files with 33 additions and 10 deletions

View File

@ -481,19 +481,17 @@ namespace OpenSim.Region.Scenes
{ {
try try
{ {
// MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim");
Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount);
this.Entities.Add(prim.uuid, prim); this.Entities.Add(prim.uuid, prim);
this._primCount++; this._primCount++;
// Trigger event for listeners
eventManager.TriggerOnNewPrimitive(prim);
} }
catch (Exception e) catch (Exception e)
{ {
OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
// MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString());
} }
} }
@ -583,6 +581,8 @@ namespace OpenSim.Region.Scenes
/// <param name="agentID"></param> /// <param name="agentID"></param>
public override void RemoveClient(LLUUID agentID) public override void RemoveClient(LLUUID agentID)
{ {
eventManager.TriggerOnRemovePresence(agentID);
return; return;
} }
#endregion #endregion

View File

@ -7,17 +7,20 @@ namespace OpenSim.Region.Scenes
/// <summary> /// <summary>
/// A class for triggering remote scene events. /// A class for triggering remote scene events.
/// </summary> /// </summary>
class EventManager public class EventManager
{ {
public delegate void OnFrameDelegate(); public delegate void OnFrameDelegate();
public event OnFrameDelegate OnFrame; public event OnFrameDelegate OnFrame;
public delegate void OnNewViewerDelegate(); public delegate void OnNewPresenceDelegate(ScenePresence presence);
public event OnNewViewerDelegate OnNewViewer; public event OnNewPresenceDelegate OnNewPresence;
public delegate void OnNewPrimitiveDelegate(); public delegate void OnNewPrimitiveDelegate(Primitive prim);
public event OnNewPrimitiveDelegate OnNewPrimitive; public event OnNewPrimitiveDelegate OnNewPrimitive;
public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid);
public event OnRemovePresenceDelegate OnRemovePresence;
public void TriggerOnFrame() public void TriggerOnFrame()
{ {
if (OnFrame != null) if (OnFrame != null)
@ -25,5 +28,25 @@ namespace OpenSim.Region.Scenes
OnFrame(); OnFrame();
} }
} }
public void TriggerOnNewPrimitive(Primitive prim)
{
if (OnNewPrimitive != null)
OnNewPrimitive(prim);
}
public void TriggerOnNewPresence(ScenePresence presence)
{
if (OnNewPresence != null)
OnNewPresence(presence);
}
public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid)
{
if (OnRemovePresence != null)
{
OnRemovePresence(uuid);
}
}
} }
} }