Esempio n. 1
0
 public override bool SameAsset(SimAsset asset)
 {
     if (asset == null) return false;
     if (asset.AssetType != AssetType) return false;
     if (SameAssetBytes(asset)) return true;
     var anim2 = asset as SimSound;
     if (anim2 == null) return false;
     return anim2.Sound.Equals(Sound);
 }
Esempio n. 2
0
 public virtual bool SameAsset(SimAsset asset)
 {
     if (asset == null)
     {
         return(false);
     }
     if (asset.AssetType != AssetType)
     {
         return(false);
     }
     return(SameAssetBytes(asset));
 }
Esempio n. 3
0
 public bool SameAssetBytes(SimAsset asset)
 {
     if (asset == null)
     {
         return(false);
     }
     if (HasData())
     {
         if (asset.HasData())
         {
             byte[] b1 = AssetData;
             byte[] b2 = asset.AssetData;
             return(SameBytes(b1, b2));
         }
     }
     return(false);
 }
        public ThreadStart WithAnim(SimAsset anim, ThreadStart closure)
        {
            var         Client      = GetGridClient();
            AssetThread assetThread = new AssetThread(Client.Self, anim);

            return(() =>
            {
                try
                {
                    assetThread.Start();
                    closure.Invoke();
                }
                finally
                {
                    assetThread.Stop();
                }
            });
        }
Esempio n. 5
0
        public override bool SameAsset(SimAsset asset)
        {
            if (asset == null)
            {
                return(false);
            }
            if (asset.AssetType != AssetType)
            {
                return(false);
            }
            if (SameAssetBytes(asset))
            {
                return(true);
            }
            var anim2 = asset as SimSound;

            if (anim2 == null)
            {
                return(false);
            }
            return(anim2.Sound.Equals(Sound));
        }
        private CogbotEvent AnimEvent(UUID uuid, SimEventType status, int serial)
        {
            SimAsset a = SimAssetStore.FindOrCreateAsset(uuid, AssetType.Animation);

            string headingString;

            switch (status)
            {
            case SimEventType.Start:
            {
                headingString = "eventOccursAt";
                break;
            }

            case SimEventType.Stop:
            {
                headingString = "toLocation";
                break;
            }

            default:
            {
                headingString = "eventOccursAt";
                break;
            }
            }
            object      m  = a.GetMeaning();
            CogbotEvent oe = CreateAEvent(status, "OnAnim", SimEventType.ANIM | SimEventType.REGIONAL,
                                          WorldObjects.ToParameter("doneBy", this),
                                          WorldObjects.ToParameter("isa", a),
                                          WorldObjects.ToParameter(headingString, GetHeading()));

            oe.Serial = serial;
            if (m != null)
            {
                oe.AddParam("isa", m);
            }
            return(oe);
        }
        public override bool SameAsset(SimAsset asset)
        {
            if (asset == null)
            {
                return(false);
            }
            if (asset.AssetType != AssetType)
            {
                return(false);
            }
            if (SameAssetBytes(asset))
            {
                return(true);
            }
            SimAnimation anim2 = asset as SimAnimation;

            if (anim2 == null)
            {
                return(false);
            }
            return(anim2.Reader.Equals(Reader));
        }
Esempio n. 8
0
 internal static void InternAsset(SimAsset asset)
 {
     taskQueue.Enqueue("InternAsset: " + asset, () =>
                       asset.InternOnRegion(WorldObjects.GridMaster));
 }
Esempio n. 9
0
 public static bool SameAsset(SimAsset animation, SimAsset simAnimation)
 {
     if (animation == null || simAnimation == null) return false;
     return (animation.SameAsset(simAnimation));
 }
Esempio n. 10
0
 public AssetThread(AgentManager c, SimAsset amin0)
 {
     ClientSelf = c; //.Self;
     repeat     = !amin0.IsContinuousEffect;
     asset      = amin0;
 }
Esempio n. 11
0
 public virtual bool SameAsset(SimAsset asset)
 {
     if (asset == null) return false;
     if (asset.AssetType != AssetType) return false;
     return SameAssetBytes(asset);
 }
Esempio n. 12
0
 public bool SameAssetBytes(SimAsset asset)
 {
     if (asset == null) return false;
     if (HasData())
     {
         if (asset.HasData())
         {
             byte[] b1 = AssetData;
             byte[] b2 = asset.AssetData;
             return SameBytes(b1, b2);
         }
     }
     return false;
 }
Esempio n. 13
0
 public AssetThread(AgentManager c, SimAsset amin0)
 {
     ClientSelf = c; //.Self;
     repeat = !amin0.IsContinuousEffect;
     asset = amin0;
 }
Esempio n. 14
0
        protected override List <SimAsset> GetParts()
        {
            AssetGesture gestureAsset = GetGesture();

            //            StringBuilder sb = new StringBuilder();
            //sb.Append("2\n");
            if (gestureAsset == null)
            {
                return(null);
            }
            Name = gestureAsset.Trigger;
            //sb.Append(TriggerKey + "\n");
            //sb.Append(TriggerKeyMask + "\n");
            //sb.Append(Trigger + "\n");
            Name = gestureAsset.ReplaceWith;//sb.Append(ReplaceWith + "\n");

            List <GestureStep> Sequence = gestureAsset.Sequence;
            int count = 0;

            if (Sequence != null)
            {
                count = Sequence.Count;
            }
            List <SimAsset> parts = new List <SimAsset>(count);

            //sb.Append(count + "\n");
            _Length = 0;
            for (int i = 0; i < count; i++)
            {
                GestureStep step = Sequence[i];
                // sb.Append((int)step.GestureStepType + "\n");
                SimAsset asset;

                switch (step.GestureStepType)
                {
                case GestureStepType.EOF:
                    goto Finish;

                case GestureStepType.Animation:
                    GestureStepAnimation animstep = (GestureStepAnimation)step;
                    asset      = SimAssetStore.FindOrCreateAsset(animstep.ID, AssetType.Animation);
                    asset.Name = animstep.Name;
                    if (animstep.AnimationStart)
                    {
                        parts.Add(asset);
                        //                            sb.Append("0\n");
                        _Length += asset.Length;
                    }
                    else
                    {
                        //             sb.Append("1\n");
                    }
                    break;

                case GestureStepType.Sound:
                    GestureStepSound soundstep = (GestureStepSound)step;
                    asset      = SimAssetStore.FindOrCreateAsset(soundstep.ID, AssetType.Sound);
                    asset.Name = soundstep.Name;
                    parts.Add(asset);
                    _Length += asset.Length;
                    break;

                case GestureStepType.Chat:
                    GestureStepChat chatstep = (GestureStepChat)step;
                    Name = chatstep.Text;
                    //sb.Append(chatstep.Text + "\n");
                    //sb.Append("0\n");
                    _Length += 10;
                    break;

                case GestureStepType.Wait:
                    GestureStepWait waitstep = (GestureStepWait)step;
                    //sb.AppendFormat("{0:0.000000}\n", waitstep.WaitTime);
                    int waitflags = 0;

                    if (waitstep.WaitForTime)
                    {
                        waitflags |= 0x01;
                        _Length   += waitstep.WaitTime;
                    }
                    if (waitstep.WaitForAnimation)
                    {
                        waitflags |= 0x02;
                        _Length   += 10;
                    }
                    //sb.Append(waitflags + "\n");
                    break;
                }
            }
Finish:

            if (parts.Count == 1)
            {
                SimAsset A = parts[0];
                if (A is SimAnimation)
                {
                    AnimationGestures[A.AssetID] = this;
                    if (A.Item == null)
                    {
                        A.Item = Item;
                    }
                }
            }
            return(parts);
        }
        static void PutType(string anims, UUID uUID)
        {
            SimAsset a = SimAssetStore.FindAsset(uUID);

            a.AddType(anims);
        }
Esempio n. 16
0
 public ThreadStart WithAnim(SimAsset anim, ThreadStart closure)
 {
     var Client = GetGridClient();
     AssetThread assetThread = new AssetThread(Client.Self, anim);
     return () =>
                {
                    try
                    {
                        assetThread.Start();
                        closure.Invoke();
                    }
                    finally
                    {
                        assetThread.Stop();
                    }
                };
 }