本文整理汇总了C#中ChatSourceType类的典型用法代码示例。如果您正苦于以下问题:C# ChatSourceType类的具体用法?C# ChatSourceType怎么用?C# ChatSourceType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatSourceType类属于命名空间,在下文中一共展示了ChatSourceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Self_OnChat
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position)
{
if (fromName != _Client.Self.Name && type == ChatType.Normal && audible == ChatAudibleLevel.Fully)
{
string str = "<" + fromName + "> " + message;
_IRC.SendMessage(_AutoJoinChannel, str);
Console.WriteLine("[SL->IRC] " + str);
}
}
示例2: ChatEventArgs
public ChatEventArgs(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
{
this.message = message;
this.audible = audible;
this.type = type;
this.sourceType = sourceType;
this.fromName = fromName;
this.id = id;
this.ownerid = ownerid;
this.position = position;
}
示例3: Self_OnChat
public void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type,
ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
{
Console.WriteLine(fromName+":" + message);
if (message.Length > 0 && message.ToLower().Contains(Client.Self.FirstName.ToLower()) && Client.Self.AgentID != id) {
WebRequest request = WebRequest.Create("http://www.mr-technicl.com/slfutura.php?nick="+ fromName + "&message="+ message);
WebResponse response = request.GetResponse();
StreamReader input = new StreamReader(response.GetResponseStream());
string say = input.ReadToEnd();
input.Close();
libsecondlife.Utilities.Realism.Chat(Client, say, ChatType.Normal, 25);
}
}
示例4: ProcessChat
private void ProcessChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, OpenMetaverse.UUID id, OpenMetaverse.UUID ownerid, OpenMetaverse.Vector3 position)
{
string msg = JsonUtil.SerializeMessage(JsonType.ChatReceived, new JsonChatReceived(
message,
(int)type,
fromName,
id.ToString(),
ownerid.ToString(),
position.X,
position.Y,
position.Z
));
Ox.EventFire(msg, true);
}
示例5: SendChatMessageToNeighbors
public bool SendChatMessageToNeighbors(OSChatMessage message, ChatSourceType type, RegionInfo region)
{
bool RetVal = false;
if (!m_KnownNeighbors.ContainsKey(region.RegionID))
return RetVal;
foreach (GridRegion neighbor in m_KnownNeighbors[region.RegionID])
{
if (neighbor.RegionID == region.RegionID)
continue;
Scene scene = FindSceneByUUID(region.RegionID);
if (scene != null)
{
IChatModule chatModule = scene.RequestModuleInterface<IChatModule>();
if (chatModule != null && !RetVal)
{
chatModule.DeliverChatToAvatars(type, message);
RetVal = true;
}
}
}
return RetVal;
}
示例6: chatCallback
private void chatCallback(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype,
string fromName, UUID id, UUID ownerid, Vector3 position)
{
// This is weird -- we get start/stop typing chats from
// other avatars, and we get messages back that we sent.
// (Tested on OpenSim r3187)
// So we explicitly check for those cases here.
if ((int)type < 4 && id != m_user.Self.AgentID)
{
m_log.Debug("Chat: " + fromName + ": " + message);
if (OnChat != null)
{
OnChat(message, audible, type, sourcetype,
fromName, id, ownerid, position);
}
}
}
示例7: TrySendChatMessage
public virtual void TrySendChatMessage(IScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src, float Range)
{
if (type == ChatTypeEnum.Custom)
{
Vector3 fromRegionPos = fromPos + regionPos;
Vector3 toRegionPos = presence.AbsolutePosition +
new Vector3(presence.Scene.RegionInfo.RegionLocX,
presence.Scene.RegionInfo.RegionLocY, 0);
int dis = (int) Util.GetDistanceTo(toRegionPos, fromRegionPos);
//Set the best fitting setting for custom
if (dis < m_whisperdistance)
type = ChatTypeEnum.Whisper;
else if (dis > m_saydistance)
type = ChatTypeEnum.Shout;
else if (dis > m_whisperdistance && dis < m_saydistance)
type = ChatTypeEnum.Say;
}
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
fromAgentID, (byte) src, (byte) ChatAudibleLevel.Fully);
}
示例8: OnNetworkChat
private void OnNetworkChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, UUID id, UUID ownerid, Vector3 position)
{
UserInterface.OnNetworkChat(message, audible, type, sourcetype, fromName, id, ownerid, position);
}
示例9: DeliverChatToAvatars
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
{
string fromName = c.From;
UUID fromID = UUID.Zero;
UUID ownerID = UUID.Zero;
UUID targetID = c.TargetUUID;
string message = c.Message;
Scene scene = (Scene)c.Scene;
Vector3 fromPos = c.Position;
Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
switch (sourceType)
{
case ChatSourceType.Agent:
ScenePresence avatar = scene.GetScenePresence(c.Sender.AgentId);
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
ownerID = c.Sender.AgentId;
break;
case ChatSourceType.Object:
fromID = c.SenderUUID;
if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
break;
}
// TODO: iterate over message
if (message.Length >= 1000) // libomv limit
message = message.Substring(0, 1000);
// m_log.DebugFormat(
// "[CHAT]: DCTA: fromID {0} fromName {1}, region{2}, cType {3}, sType {4}, targetID {5}",
// fromID, fromName, scene.RegionInfo.RegionName, c.Type, sourceType, targetID);
HashSet<UUID> receiverIDs = new HashSet<UUID>();
if (targetID == UUID.Zero)
{
// This should use ForEachClient, but clients don't have a position.
// If camera is moved into client, then camera position can be used
scene.ForEachScenePresence(
delegate(ScenePresence presence)
{
if (TrySendChatMessage(
presence, fromPos, regionPos, fromID, ownerID, fromName, c.Type, message, sourceType, false))
receiverIDs.Add(presence.UUID);
}
);
}
else
{
// This is a send to a specific client eg from llRegionSayTo
// no need to check distance etc, jand send is as say
ScenePresence presence = scene.GetScenePresence(targetID);
if (presence != null && !presence.IsChildAgent)
{
if (TrySendChatMessage(
presence, fromPos, regionPos, fromID, ownerID, fromName, ChatTypeEnum.Say, message, sourceType, true))
receiverIDs.Add(presence.UUID);
}
}
scene.EventManager.TriggerOnChatToClients(
fromID, receiverIDs, message, c.Type, fromPos, fromName, sourceType, ChatAudibleLevel.Fully);
}
示例10: DeliverChatToAvatars
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
{
string fromName = c.From;
UUID fromID = UUID.Zero;
UUID destID = c.DestinationUUID;
string message = c.Message;
IScene scene = c.Scene;
Vector3 fromPos = c.Position;
Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
switch (sourceType)
{
case ChatSourceType.Agent:
if (!(scene is Scene))
{
m_log.WarnFormat("[CHAT]: scene {0} is not a Scene object, cannot obtain scene presence for {1}",
scene.RegionInfo.RegionName, c.Sender.AgentId);
return;
}
ScenePresence avatar = (scene as Scene).GetScenePresence(c.Sender.AgentId);
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
break;
case ChatSourceType.Object:
fromID = c.SenderUUID;
break;
}
// TODO: iterate over message
if (message.Length >= 1000) // libomv limit
message = message.Substring(0, 1000);
// m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType);
foreach (Scene s in m_scenes)
{
s.ForEachScenePresence(delegate(ScenePresence presence)
{
if (!presence.IsChildAgent)
if ((destID == UUID.Zero) || (destID == presence.UUID))
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName,
c.Type, message, sourceType);
});
}
}
示例11: Self_OnChat
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position)
{
if (id == client.Self.AgentID || message == "")
return;
if (message == "Claudius, go away.")
{
Disconnect();
return;
}
if (message == "Claudius, info.")
{
string reply = fromName + ", your id is '" + id + ", your ownerId is '" + ownerid +
", and your location is '" + position + ".";
client.Self.Chat(reply, 0, ChatType.Normal);
client.Self.Chat("Mine is " + client.Self.SimPosition + ".", 0, ChatType.Normal);
return;
}
if (message == "Claudius, come here.")
{
Console.WriteLine("About to follow");
/*
client.Self.AutoPilotLocal(Convert.ToInt32(position.X), Convert.ToInt32(position.Y), position.Z);
Console.WriteLine("Going to: " + position );
*/
GoToPosition(position);
return;
}
if (message.StartsWith("Claudius, go to:"))
{
String dest = message.Substring(message.IndexOf(':') + 1);
List<Vector3> wayPointList = WaypointService.GetWayPoints(client.Self.SimPosition, dest);
TraverseWayPoints(wayPointList);
return;
}
client.Self.Chat(message, 0, ChatType.Normal);
}
示例12: DeliverChatToAvatars
protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c)
{
string fromName = c.From;
UUID fromID = UUID.Zero;
string message = c.Message;
IScene scene = c.Scene;
Vector3 fromPos = c.Position;
Vector3 regionPos = new Vector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
switch (sourceType)
{
case ChatSourceType.Agent:
if (!(scene is Scene))
{
m_log.WarnFormat("[CHAT]: scene {0} is not a Scene object, cannot obtain scene presence for {1}",
scene.RegionInfo.RegionName, c.Sender.AgentId);
return;
}
ScenePresence avatar = (scene as Scene).GetScenePresence(c.Sender.AgentId);
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
//Always send this so it fires on typing start and end
avatar.SendScriptEventToAttachments("changed", new object[] { Changed.STATE });
break;
case ChatSourceType.Object:
fromID = c.SenderUUID;
break;
}
// TODO: iterate over message
if (message.Length >= 1000) // libomv limit
message = message.Substring(0, 1000);
// m_log.DebugFormat("[CHAT]: DCTA: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, c.Type, sourceType);
foreach (Scene s in m_scenes)
{
List<ScenePresence> ScenePresences = s.ScenePresences;
foreach (ScenePresence presence in ScenePresences)
{
// don't send stuff to child agents
if (!presence.IsChildAgent)
{
//Block this out early so we don't look through the mutes if the message shouldn't even be sent
Vector3 fromRegionPos = fromPos + regionPos;
Vector3 toRegionPos = presence.AbsolutePosition +
new Vector3(presence.Scene.RegionInfo.RegionLocX * Constants.RegionSize,
presence.Scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
int dis = (int)Util.GetDistanceTo(toRegionPos, fromRegionPos);
//Check for max range
if (c.Type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
c.Type == ChatTypeEnum.Say && dis > m_saydistance ||
c.Type == ChatTypeEnum.Shout && dis > m_shoutdistance ||
c.Type == ChatTypeEnum.Custom && dis > c.Range)
{
continue;
}
//The client actually does this on its own, we don't need to
/*//Check whether the user is muted
bool IsMuted = false;
if (message != "" && m_useMuteListModule)
{
Dictionary<UUID, bool> cache = new Dictionary<UUID,bool>();
//Check the cache first so that we don't kill the server
if (IsMutedCache.TryGetValue(presence.UUID, out cache))
{
//If the cache doesn't contain the person, they arn't used
if (!cache.TryGetValue(fromID, out IsMuted))
{
cache[fromID] = IsMuted = false;
}
}
else
{
cache = new Dictionary<UUID, bool>();
//This loads all mutes into the list
MuteList[] List = MuteListConnector.GetMuteList(presence.UUID);
foreach (MuteList mute in List)
{
cache[mute.MuteID] = true;
}
IsMutedCache[presence.UUID] = cache;
}
}
if (!IsMuted)
*/
TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, c.Range);
}
}
}
}
示例13: Add
public void Add(string _message, ChatAudibleLevel _audible, ChatType _type, ChatSourceType _sourcetype, string _fromName, UUID _id, UUID _ownerid, Vector3 _position)
{
Reference.Log.Debug(_message + " ChatAudibleLevel:" + _audible.ToString() + " ChatType:" + _type.ToString() + " ChatSourceType:" + _sourcetype.ToString() + " FromName:" + _fromName);
// name.
string fromName = _fromName + ":";
lock (messageHistory)
{
messageHistory.Add(fromName);
Reference.Viewer.GuiManager.ChatAddMessage(fromName);
}
// message.
string msg = _message;
if (_message.Length > maxMessageLength)
{
string tail = "・・・";
msg = _message.Substring(0, maxMessageLength - tail.Length);
msg += tail;
}
// wide-char space -> 2 char space.
msg = msg.Replace(" ", " ");
// trim space.
msg = msg.Trim();
List<int> colLen = new List<int>();
int colMaxLen = 16 * 2;
int lenCounter = 0;
for (int i = 0; i < msg.Length; i++)
{
char c = msg[i];
if (c < '!' || '~' < c)
{
lenCounter += 2;
}
else
{
lenCounter += 1;
}
if ((lenCounter >= colMaxLen) || ((i + 1) == msg.Length))
{
colLen.Add(i + 1);
lenCounter = 0;
}
}
List<string> msgList = new List<string>();
for (int i = 0; i < colLen.Count; i++)
{
int start = (i > 0 ? colLen[i - 1] : 0);
int length = (i > 0 ? colLen[i] - colLen[i - 1] : colLen[i]);
string text = msg.Substring(start, length);
msgList.Add(text);
}
for (int i = 0; i < msgList.Count; i++)
{
// message.
string addMessage = " " + msgList[i];
lock (messageHistory)
{
messageHistory.Add(addMessage);
Reference.Viewer.GuiManager.ChatAddMessage(addMessage);
}
}
Reference.Viewer.Adapter.CallReceiveMessaged(_id.ToString(), _fromName, _message);
}
示例14: InformNeighborOfChatMessage
protected void InformNeighborOfChatMessage(OSChatMessage message, ChatSourceType type, GridRegion region, RegionInfo thisRegion)
{
string uri = MakeUri(region, "/region/" + thisRegion.RegionID + "/");
//m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
// Fill it in
Dictionary<string, object> args = new Dictionary<string, object>();
try
{
args = Util.OSDToDictionary(thisRegion.PackRegionInfoData());
}
catch (Exception e)
{
m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message);
return;
}
args["MESSAGE"] = WebUtils.BuildQueryString(message.ToKVP());
args["TYPE"] = (int)type;
args["METHOD"] = "inform_neighbors_of_chat_message";
string queryString = WebUtils.BuildQueryString(args);
SynchronousRestFormsRequester.MakeRequest("POST", uri, queryString);
}
示例15: TrySendChatMessage
protected virtual void TrySendChatMessage(IScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src)
{
// don't send stuff to child agents
if (presence.IsChildAgent) return;
Vector3 fromRegionPos = fromPos + regionPos;
Vector3 toRegionPos = presence.AbsolutePosition +
new Vector3(presence.Scene.RegionInfo.RegionLocX,
presence.Scene.RegionInfo.RegionLocY, 0);
int dis = (int) Util.GetDistanceTo(toRegionPos, fromRegionPos);
if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance ||
type == ChatTypeEnum.Say && dis > m_saydistance ||
type == ChatTypeEnum.Shout && dis > m_shoutdistance)
{
return;
}
presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName,
fromAgentID, (byte) src, (byte) ChatAudibleLevel.Fully);
}