diff options
author | Adam Frisby | 2007-06-27 06:14:15 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-27 06:14:15 +0000 |
commit | a1e6fff14fa5354ef5719e0eacd280d2f1aaa727 (patch) | |
tree | fbb290a825836c7297b8dfb4a49683ec377b44c4 | |
parent | * Renamed new event manager "SceneEvents" to "EventManager" (diff) | |
download | opensim-SC-a1e6fff14fa5354ef5719e0eacd280d2f1aaa727.zip opensim-SC-a1e6fff14fa5354ef5719e0eacd280d2f1aaa727.tar.gz opensim-SC-a1e6fff14fa5354ef5719e0eacd280d2f1aaa727.tar.bz2 opensim-SC-a1e6fff14fa5354ef5719e0eacd280d2f1aaa727.tar.xz |
The following events now work:
* OnFrame
* OnNewPresence
* OnNewPrimitive
* OnRemovePresence
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/Scene.cs | 12 | ||||
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/SceneEvents.cs | 31 |
2 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/Scene.cs b/OpenSim/OpenSim.Region/Scenes/Scene.cs index fd78fd6..bf2244e 100644 --- a/OpenSim/OpenSim.Region/Scenes/Scene.cs +++ b/OpenSim/OpenSim.Region/Scenes/Scene.cs | |||
@@ -481,19 +481,17 @@ namespace OpenSim.Region.Scenes | |||
481 | { | 481 | { |
482 | try | 482 | try |
483 | { | 483 | { |
484 | |||
485 | // MainLog.Instance.Notice("World.cs: AddNewPrim() - Creating new prim"); | ||
486 | |||
487 | Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); | 484 | Primitive prim = new Primitive(m_regionHandle, this, addPacket, ownerID, this._primCount); |
488 | 485 | ||
489 | this.Entities.Add(prim.uuid, prim); | 486 | this.Entities.Add(prim.uuid, prim); |
490 | this._primCount++; | 487 | this._primCount++; |
488 | |||
489 | // Trigger event for listeners | ||
490 | eventManager.TriggerOnNewPrimitive(prim); | ||
491 | } | 491 | } |
492 | catch (Exception e) | 492 | catch (Exception e) |
493 | { | 493 | { |
494 | 494 | OpenSim.Framework.Console.MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | |
495 | // MainLog.Instance.Warn("World.cs: AddNewPrim() - Failed with exception " + e.ToString()); | ||
496 | |||
497 | } | 495 | } |
498 | } | 496 | } |
499 | 497 | ||
@@ -583,6 +581,8 @@ namespace OpenSim.Region.Scenes | |||
583 | /// <param name="agentID"></param> | 581 | /// <param name="agentID"></param> |
584 | public override void RemoveClient(LLUUID agentID) | 582 | public override void RemoveClient(LLUUID agentID) |
585 | { | 583 | { |
584 | eventManager.TriggerOnRemovePresence(agentID); | ||
585 | |||
586 | return; | 586 | return; |
587 | } | 587 | } |
588 | #endregion | 588 | #endregion |
diff --git a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs b/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs index 86ec9df..2898578 100644 --- a/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs +++ b/OpenSim/OpenSim.Region/Scenes/SceneEvents.cs | |||
@@ -7,17 +7,20 @@ namespace OpenSim.Region.Scenes | |||
7 | /// <summary> | 7 | /// <summary> |
8 | /// A class for triggering remote scene events. | 8 | /// A class for triggering remote scene events. |
9 | /// </summary> | 9 | /// </summary> |
10 | class EventManager | 10 | public class EventManager |
11 | { | 11 | { |
12 | public delegate void OnFrameDelegate(); | 12 | public delegate void OnFrameDelegate(); |
13 | public event OnFrameDelegate OnFrame; | 13 | public event OnFrameDelegate OnFrame; |
14 | 14 | ||
15 | public delegate void OnNewViewerDelegate(); | 15 | public delegate void OnNewPresenceDelegate(ScenePresence presence); |
16 | public event OnNewViewerDelegate OnNewViewer; | 16 | public event OnNewPresenceDelegate OnNewPresence; |
17 | 17 | ||
18 | public delegate void OnNewPrimitiveDelegate(); | 18 | public delegate void OnNewPrimitiveDelegate(Primitive prim); |
19 | public event OnNewPrimitiveDelegate OnNewPrimitive; | 19 | public event OnNewPrimitiveDelegate OnNewPrimitive; |
20 | 20 | ||
21 | public delegate void OnRemovePresenceDelegate(libsecondlife.LLUUID uuid); | ||
22 | public event OnRemovePresenceDelegate OnRemovePresence; | ||
23 | |||
21 | public void TriggerOnFrame() | 24 | public void TriggerOnFrame() |
22 | { | 25 | { |
23 | if (OnFrame != null) | 26 | if (OnFrame != null) |
@@ -25,5 +28,25 @@ namespace OpenSim.Region.Scenes | |||
25 | OnFrame(); | 28 | OnFrame(); |
26 | } | 29 | } |
27 | } | 30 | } |
31 | |||
32 | public void TriggerOnNewPrimitive(Primitive prim) | ||
33 | { | ||
34 | if (OnNewPrimitive != null) | ||
35 | OnNewPrimitive(prim); | ||
36 | } | ||
37 | |||
38 | public void TriggerOnNewPresence(ScenePresence presence) | ||
39 | { | ||
40 | if (OnNewPresence != null) | ||
41 | OnNewPresence(presence); | ||
42 | } | ||
43 | |||
44 | public void TriggerOnRemovePresence(libsecondlife.LLUUID uuid) | ||
45 | { | ||
46 | if (OnRemovePresence != null) | ||
47 | { | ||
48 | OnRemovePresence(uuid); | ||
49 | } | ||
50 | } | ||
28 | } | 51 | } |
29 | } | 52 | } |