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

View File

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