public void ChatOut(string chat, SLChatType type, int channel) { if (!loggedIn) { return; } if (string.IsNullOrEmpty(chat)) { return; } switch (type) { case SLChatType.Say: client.Avatar.Say(chat, channel); break; case SLChatType.Shout: client.Avatar.Shout(chat, channel); break; case SLChatType.Whisper: client.Avatar.Whisper(chat, channel); break; } OnChatSent(new ChatSentEventArgs(chat, type, channel)); }
public ChatEventArgs( string message, SLChatType type, LLVector3 sourcePos, SLSourceType sourceType, LLUUID sourceId, LLUUID ownerId, string fromName, bool audible, byte command, LLUUID commandId) { _message = message; _type = type; _sourcePos = sourcePos; _sourceType = sourceType; _sourceId = sourceId; _ownerId = ownerId; _fromName = fromName; _audible = audible; _command = command; _commandId = commandId; }
public void ChatOut(string chat, SLChatType type, int channel) { if (!loggedIn) return; if (string.IsNullOrEmpty(chat)) return; switch (type) { case SLChatType.Say: client.Avatar.Say(chat, channel); break; case SLChatType.Shout: client.Avatar.Shout(chat, channel); break; case SLChatType.Whisper: client.Avatar.Whisper(chat, channel); break; } OnChatSent(new ChatSentEventArgs(chat, type, channel)); }
private void ChatIncoming(Packet packet, Simulator simulator) { if (packet.Layout.Name != "ChatFromSimulator") { return; } string fromname = string.Empty; //Name of source. LLUUID sourceid = new LLUUID(); //UUID of source, object/avatar LLUUID ownerid = new LLUUID(); //UUID of owner, if object UUID = owner of object, if avatar UUID = same as source SLSourceType sourcetype = SLSourceType.None; SLChatType chattype = SLChatType.Whisper; bool audible = false; //Audible: 1 if audible, 0 if beyond 20m (message is null) LLVector3 position = new LLVector3(); //Region local position of source. string message = string.Empty; //Message from source byte command = 0; //Unused? LLUUID commandID = new LLUUID(); //Unused? ArrayList blocks = packet.Blocks(); foreach (Block block in blocks) { foreach (Field field in block.Fields) { switch (field.Layout.Name) { case "SourceID": sourceid = (LLUUID)field.Data; break; case "OwnerID": ownerid = (LLUUID)field.Data; break; case "FromName": fromname = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty); break; case "SourceType": sourcetype = (SLSourceType)(byte)field.Data; break; case "ChatType": chattype = (SLChatType)(byte)field.Data; break; case "Audible": audible = ((byte)field.Data == 1 ? true : false); break; case "Message": message = System.Text.Encoding.UTF8.GetString((byte[])field.Data).Replace("\0", string.Empty); break; case "Position": position = (LLVector3)field.Data; break; case "Command": command = (byte)field.Data; break; case "CommandID": commandID = (LLUUID)field.Data; break; } } ChatEventArgs eventArgs = new ChatEventArgs( message, chattype, position, sourcetype, sourceid, ownerid, fromname, audible, command, commandID); if (netcomSync != null) { object[] ea = new object[1]; ea[0] = eventArgs; netcomSync.Invoke(new OnChatRaise(OnChatReceived), ea); } else { OnChatReceived(eventArgs); } } }
public ChatSentEventArgs(string message, SLChatType messageType, int channel) { _message = message; _messageType = messageType; _channel = channel; }