enable typing animation for chat, maybe

afrisby
Jeff Ames 2007-11-12 20:25:59 +00:00
parent 33086fb3df
commit ad002835d3
5 changed files with 94 additions and 60 deletions

View File

@ -50,6 +50,8 @@ namespace OpenSim.Framework
Whisper = 0, Whisper = 0,
Say = 1, Say = 1,
Shout = 2, Shout = 2,
StartTyping = 4,
StopTyping = 5,
Broadcast = 0xFF Broadcast = 0xFF
} ; } ;

View File

@ -83,11 +83,7 @@ namespace OpenSim.Region.ClientStack
break; break;
case PacketType.ChatFromViewer: case PacketType.ChatFromViewer:
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket) Pack; 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; string fromName = ""; //ClientAvatar.firstname + " " + ClientAvatar.lastname;
byte[] message = inchatpack.ChatData.Message; byte[] message = inchatpack.ChatData.Message;
byte type = inchatpack.ChatData.Type; byte type = inchatpack.ChatData.Type;

View File

@ -143,7 +143,6 @@ namespace OpenSim.Region.Environment.Modules
new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0);
fromName = avatar.Firstname + " " + avatar.Lastname; fromName = avatar.Firstname + " " + avatar.Lastname;
fromAgentID = e.Sender.AgentId; fromAgentID = e.Sender.AgentId;
avatar = null;
} }
string typeName; string typeName;
@ -166,82 +165,101 @@ namespace OpenSim.Region.Environment.Modules
break; break;
} }
m_log.Verbose("CHAT", if (e.Message.Length > 0)
fromName + " (" + e.Channel + " @ " + scene.RegionInfo.RegionName + ") " + typeName + ": " +
e.Message);
if (m_irc.Connected)
{ {
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) if (m_irc.Connected)
{
foreach (Scene m_scene in m_scenes)
{ {
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) if (!presence.IsChildAgent)
{ {
int dis = -100000; int dis = -100000;
LLVector3 avatarRegionPos = presence.AbsolutePosition + LLVector3 avatarRegionPos = presence.AbsolutePosition +
new LLVector3( new LLVector3(
scene.RegionInfo.RegionLocX * 256, scene.RegionInfo.RegionLocX * 256,
scene.RegionInfo.RegionLocY * 256, scene.RegionInfo.RegionLocY * 256,
0); 0);
dis = dis =
Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos)); Math.Abs((int)avatarRegionPos.GetDistanceTo(fromRegionPos));
switch (e.Type) switch (e.Type)
{ {
case ChatTypeEnum.Whisper: case ChatTypeEnum.Whisper:
if (dis < m_whisperdistance) if (dis < m_whisperdistance)
{ {
//should change so the message is sent through the avatar rather than direct to the ClientView //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:
presence.ControllingClient.SendChatMessage(message, presence.ControllingClient.SendChatMessage(message,
type, type,
fromPos, fromPos,
fromName, fromName,
fromAgentID); 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;
}
}
}
} }
} }

View File

@ -53,6 +53,8 @@ namespace OpenSim.Region.Environment.Scenes
private LLVector3 m_requestedSitOffset = new LLVector3(); private LLVector3 m_requestedSitOffset = new LLVector3();
private float m_sitAvatarHeight = 2.0f; private float m_sitAvatarHeight = 2.0f;
private bool m_isTyping = false;
private Quaternion m_bodyRot; private Quaternion m_bodyRot;
private byte[] m_visualParams; private byte[] m_visualParams;
private AvatarWearable[] m_wearables; private AvatarWearable[] m_wearables;
@ -367,7 +369,6 @@ namespace OpenSim.Region.Environment.Scenes
AddToPhysicalScene(); AddToPhysicalScene();
m_physicsActor.Flying = isFlying; m_physicsActor.Flying = isFlying;
m_scene.SendAllSceneObjectsToClient(this); m_scene.SendAllSceneObjectsToClient(this);
} }
@ -662,6 +663,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1); SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1);
} }
else if (m_isTyping)
{
SendAnimPack(Animations.AnimsLLUUID["TYPE"], 1);
}
else else
{ {
SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); SendAnimPack(Animations.AnimsLLUUID["STAND"], 1);
@ -670,7 +675,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
protected void AddNewMovement(Vector3 vec, Quaternion rotation) protected void AddNewMovement(Vector3 vec, Quaternion rotation)
{ {
if (m_isChildAgent) if (m_isChildAgent)
@ -708,6 +712,19 @@ namespace OpenSim.Region.Environment.Scenes
m_forcesList.Add(newVelocity); 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 #endregion
#region Overridden Methods #region Overridden Methods

View File

@ -11,4 +11,5 @@
<animation name="PRE_JUMP">7a4e87fe-de39-6fcb-6223-024b00893244</animation> <animation name="PRE_JUMP">7a4e87fe-de39-6fcb-6223-024b00893244</animation>
<animation name="CROUCH">201f3fdf-cb1f-dbec-201f-7333e328ae7c</animation> <animation name="CROUCH">201f3fdf-cb1f-dbec-201f-7333e328ae7c</animation>
<animation name="CROUCHWALK">47f5f6fb-22e5-ae44-f871-73aaaf4a6022</animation> <animation name="CROUCHWALK">47f5f6fb-22e5-ae44-f871-73aaaf4a6022</animation>
<animation name="TYPE">c541c47f-e0c0-058b-ad1a-d6ae3a4584d9</animation>
</animations> </animations>