From 1313544ac7761ec7d84c14009fc95d5d7316004d Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Fri, 19 Oct 2007 22:02:07 +0000
Subject: * Major structural change: Begun converting Events to use (caller,
args) syntax to conform with .NET guidelines. * OnChatFromViewer has been
converted as an example. * Bug: SimpleApp's NPC client does not implement a
Scene property and will likely crash with a NullReferenceException when it
attempts to chat.
---
OpenSim/Framework/General/Interfaces/IClientAPI.cs | 102 ++++++++++++++++++++-
1 file changed, 101 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index bedea9e..0dad91f 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -34,8 +34,108 @@ using OpenSim.Framework.Types;
namespace OpenSim.Framework.Interfaces
{
+ // Base Args Interface
+ public interface IEventArgs
+ {
+ IScene Scene
+ {
+ get;
+ set;
+ }
+
+ IClientAPI Sender
+ {
+ get;
+ set;
+ }
+ }
+
public delegate void ViewerEffectEventHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock);
- public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+
+ public delegate void ChatFromViewer(Object sender, ChatFromViewerArgs e);
+
+ public enum ChatTypeEnum { Whisper = 0, Say = 1, Shout = 2, Broadcast = 0xFF };
+
+ ///
+ /// ChatFromViewer Arguments
+ ///
+ public class ChatFromViewerArgs : EventArgs, IEventArgs
+ {
+ protected string m_message;
+ protected ChatTypeEnum m_type;
+ protected int m_channel;
+ protected LLVector3 m_position;
+ protected string m_from;
+
+ protected IClientAPI m_sender;
+ protected IScene m_scene;
+
+ ///
+ /// The message sent by the user
+ ///
+ public string Message
+ {
+ get { return m_message; }
+ set { m_message = value; }
+ }
+
+ ///
+ /// The type of message, eg say, shout, broadcast.
+ ///
+ public ChatTypeEnum Type
+ {
+ get { return m_type; }
+ set { m_type = value; }
+ }
+
+ ///
+ /// Which channel was this message sent on? Different channels may have different listeners. Public chat is on channel zero.
+ ///
+ public int Channel
+ {
+ get { return m_channel; }
+ set { m_channel = value; }
+ }
+
+ ///
+ /// The position of the sender at the time of the message broadcast.
+ ///
+ public LLVector3 Position
+ {
+ get { return m_position; }
+ set { m_position = value; }
+ }
+
+ ///
+ /// The name of the sender (needed for scripts)
+ ///
+ public string From
+ {
+ get { return m_from; }
+ set { m_from = value; }
+ }
+
+ ///
+ /// The client responsible for sending the message, or null.
+ ///
+ public IClientAPI Sender
+ {
+ get { return m_sender; }
+ set { m_sender = value; }
+ }
+
+ public IScene Scene
+ {
+ get { return m_scene; }
+ set { m_scene = value; }
+ }
+
+ public ChatFromViewerArgs()
+ {
+ m_position = new LLVector3();
+ }
+ }
+
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list
public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
--
cgit v1.1