OSDN Git Service

RAD-182: Animation not stopped after standing up
authorLatif Khalifa <latifer@streamgrid.net>
Sat, 28 Aug 2010 10:41:39 +0000 (10:41 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sat, 28 Aug 2010 10:41:39 +0000 (10:41 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@732 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/Core/StateManager.cs

index c259705..9b1e577 100644 (file)
@@ -178,10 +178,13 @@ namespace Radegast
             return ret;
         }
 
+        public Dictionary<UUID, string> KnownAnimations;
+
         public StateManager(RadegastInstance instance)
         {
             this.instance = instance;
             this.instance.ClientChanged += new EventHandler<ClientChangedEventArgs>(instance_ClientChanged);
+            KnownAnimations = Animations.ToDictionary();
 
             beamTimer = new System.Timers.Timer();
             beamTimer.Enabled = false;
@@ -693,6 +696,29 @@ namespace Radegast
             {
                 SitStateChanged(this, new SitEventArgs(this.sitting));
             }
+
+            if (!this.sitting)
+            {
+                StopAllAnimations();
+            }
+        }
+
+        public void StopAllAnimations()
+        {
+            Dictionary<UUID, bool> stop = new Dictionary<UUID,bool>();
+            
+            client.Self.SignaledAnimations.ForEach((UUID anim) =>
+            {
+                if (!KnownAnimations.ContainsKey(anim))
+                {
+                    stop.Add(anim, false);
+                }
+            });
+
+            if (stop.Count > 0)
+            {
+                client.Self.Animate(stop, true);
+            }
         }
 
         public Vector3d GlobalPosition(Simulator sim, Vector3 pos)