enable typing animation for chat, maybe
parent
33086fb3df
commit
ad002835d3
|
@ -50,6 +50,8 @@ namespace OpenSim.Framework
|
|||
Whisper = 0,
|
||||
Say = 1,
|
||||
Shout = 2,
|
||||
StartTyping = 4,
|
||||
StopTyping = 5,
|
||||
Broadcast = 0xFF
|
||||
} ;
|
||||
|
||||
|
|
|
@ -83,11 +83,7 @@ namespace OpenSim.Region.ClientStack
|
|||
break;
|
||||
case PacketType.ChatFromViewer:
|
||||
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack;
|
||||
if (Helpers.FieldToUTF8String(inchatpack.ChatData.Message) == "")
|
||||
{
|
||||
//empty message so don't bother with it
|
||||
break;
|
||||
}
|
||||
|
||||
string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
|
||||
byte[] message = inchatpack.ChatData.Message;
|
||||
byte type = inchatpack.ChatData.Type;
|
||||
|
|
|
@ -143,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules
|
|||
new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0);
|
||||
fromName = avatar.Firstname + " " + avatar.Lastname;
|
||||
fromAgentID = e.Sender.AgentId;
|
||||
avatar = null;
|
||||
}
|
||||
|
||||
string typeName;
|
||||
|
@ -166,82 +165,101 @@ namespace OpenSim.Region.Environment.Modules
|
|||
break;
|
||||
}
|
||||
|
||||
m_log.Verbose("CHAT",
|
||||
fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
|
||||
e.Message);
|
||||
|
||||
if (m_irc.Connected)
|
||||
if (e.Message.Length > 0)
|
||||
{
|
||||
m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
|
||||
}
|
||||
m_log.Verbose("CHAT",
|
||||
fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
|
||||
e.Message);
|
||||
|
||||
if (e.Channel == 0)
|
||||
{
|
||||
foreach (Scene m_scene in m_scenes)
|
||||
if (m_irc.Connected)
|
||||
{
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
|
||||
}
|
||||
|
||||
if (e.Channel == 0)
|
||||
{
|
||||
foreach (Scene m_scene in m_scenes)
|
||||
{
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (!presence.IsChildAgent)
|
||||
{
|
||||
int dis = -100000;
|
||||
|
||||
LLVector3 avatarRegionPos = presence.AbsolutePosition +
|
||||
new LLVector3(
|
||||
scene.RegionInfo.RegionLocX * 256,
|
||||
scene.RegionInfo.RegionLocY * 256,
|
||||
0);
|
||||
new LLVector3(
|
||||
scene.RegionInfo.RegionLocX * 256,
|
||||
scene.RegionInfo.RegionLocY * 256,
|
||||
0);
|
||||
dis =
|
||||
Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
|
||||
|
||||
switch (e.Type)
|
||||
{
|
||||
case ChatTypeEnum.Whisper:
|
||||
if (dis < m_whisperdistance)
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Say:
|
||||
if (dis < m_saydistance)
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Shout:
|
||||
if (dis < m_shoutdistance)
|
||||
{
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
|
||||
case ChatTypeEnum.Broadcast:
|
||||
case ChatTypeEnum.Whisper:
|
||||
if (dis < m_whisperdistance)
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Say:
|
||||
if (dis < m_saydistance)
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case ChatTypeEnum.Shout:
|
||||
if (dis < m_shoutdistance)
|
||||
{
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
|
||||
case ChatTypeEnum.Broadcast:
|
||||
presence.ControllingClient.SendChatMessage(message,
|
||||
type,
|
||||
fromPos,
|
||||
fromName,
|
||||
fromAgentID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (avatar != null)
|
||||
{
|
||||
switch (e.Type)
|
||||
{
|
||||
case ChatTypeEnum.StartTyping:
|
||||
avatar.setTyping(true);
|
||||
break;
|
||||
case ChatTypeEnum.StopTyping:
|
||||
avatar.setTyping(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
private LLVector3 m_requestedSitOffset = new LLVector3();
|
||||
private float m_sitAvatarHeight = 2.0f;
|
||||
|
||||
private bool m_isTyping = false;
|
||||
|
||||
private Quaternion m_bodyRot;
|
||||
private byte[] m_visualParams;
|
||||
private AvatarWearable[] m_wearables;
|
||||
|
@ -367,7 +369,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
AddToPhysicalScene();
|
||||
m_physicsActor.Flying = isFlying;
|
||||
|
||||
|
||||
m_scene.SendAllSceneObjectsToClient(this);
|
||||
}
|
||||
|
||||
|
@ -662,6 +663,10 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1);
|
||||
}
|
||||
else if (m_isTyping)
|
||||
{
|
||||
SendAnimPack(Animations.AnimsLLUUID["TYPE"], 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
|
||||
|
@ -670,7 +675,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
protected void AddNewMovement(Vector3 vec, Quaternion rotation)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
|
@ -708,6 +712,19 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_forcesList.Add(newVelocity);
|
||||
}
|
||||
|
||||
public void setTyping(bool typing)
|
||||
{
|
||||
if (m_isChildAgent)
|
||||
{
|
||||
MainLog.Instance.Warn("setTyping called on child agent");
|
||||
return;
|
||||
}
|
||||
|
||||
m_isTyping = typing;
|
||||
|
||||
UpdateMovementAnimations(true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overridden Methods
|
||||
|
|
|
@ -11,4 +11,5 @@
|
|||
<animation name="PRE_JUMP">7a4e87fe-de39-6fcb-6223-024b00893244</animation>
|
||||
<animation name="CROUCH">201f3fdf-cb1f-dbec-201f-7333e328ae7c</animation>
|
||||
<animation name="CROUCHWALK">47f5f6fb-22e5-ae44-f871-73aaaf4a6022</animation>
|
||||
<animation name="TYPE">c541c47f-e0c0-058b-ad1a-d6ae3a4584d9</animation>
|
||||
</animations>
|
||||
|
|
Loading…
Reference in New Issue