示例#1
0
        public GumpAnimation(
            SuperGump gump,
            string name,
            int take,
            long delay,
            long duration,
            bool repeat,
            bool wait,
            object[] args,
            Action <GumpAnimation> handler)
        {
            Gump = gump;
            Name = name ?? String.Empty;

            UID = String.Format("{{{0} {1} {2}}}", Name, Gump.Serial, Gump.User.Serial.Value);

            take = Math.Max(-1, Math.Min(Gump.Entries.Count, take));

            Entries = new Stack <GumpEntry>(take == -1 ? Gump.Entries.Count : take);

            if (take == -1 || take > 0)
            {
                var count = Gump.Entries.Count;

                while (--count >= 0)
                {
                    if (count >= Gump.Entries.Count)
                    {
                        continue;
                    }

                    var e = Gump.Entries[count];

                    if (e == null || e == this || e is GumpAnimation)
                    {
                        continue;
                    }

                    if (e is GumpAnimationBreak)
                    {
                        break;
                    }

                    Entries.Push(e);

                    if (take != -1 && --take <= 0)
                    {
                        break;
                    }
                }
            }

            Handler = handler ?? _EmptyHandler;

            UID   = CryptoGenerator.GenString(CryptoHashType.MD5, UID);
            State = GumpAnimationState.Acquire(UID, delay, duration, repeat, wait);

            Args = args ?? new object[0];
        }
示例#2
0
        public override void Dispose()
        {
            State   = null;
            Handler = null;

            Entries.Free(true);
            Entries = null;

            if (Gump == null || Gump.IsDisposed)
            {
                GumpAnimationState.Free(UID);
            }

            Gump = null;

            base.Dispose();
        }