コード例 #1
0
 /// <summary>
 /// Disposes of the data stored by this TextureAtlas
 /// </summary>
 public void Dispose()
 {
     // Clear the lists
     FrameList.Clear();
     BoundsList.Clear();
     OriginsList.Clear();
     ReuseCount.Clear();
 }
コード例 #2
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            foreach (var entry in BoundsList.GetEntries(mutable))
            {
                CountTarget.SetValue(BoundsList.GetValue(entry).Count, entry);
            }

            return(mutable);
        }
コード例 #3
0
        /// <summary>
        /// Inserts a frame into this TextureAtlas
        /// </summary>
        /// <param name="frame">The frame to pack</param>
        public void InsertFrame(IFrame frame)
        {
            if (FrameList.ContainsReference(frame))
            {
                return;
            }

            if (frame.Animation != null && !_animationList.Contains(frame.Animation))
            {
                _animationList.Add(frame.Animation);
            }

            FrameList.Add(frame);
            BoundsList.Add(new Rectangle());
            OriginsList.Add(new Rectangle(0, 0, frame.Width, frame.Height));
            ReuseCount.Add(0);
        }
コード例 #4
0
ファイル: BoundsEnumerator.cs プロジェクト: voidALPHA/cgc_viz
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            foreach (var entry in BoundsList.GetEntries(payload.Data))
            {
                foreach (var bound in BoundsList.GetValue(entry))
                {
                    BoundDataTarget.SetValue(bound.Data, payload.Data);

                    var iterator =
                        DefaultState.Transmit(new VisualPayload(payload.Data, new VisualDescription(bound)));
                    while (iterator.MoveNext())
                    {
                        yield return(null);
                    }
                }
            }
        }
コード例 #5
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            var extantDataField = new MutableField <T> {
                AbsoluteKey = PerElementAbsoluteKey.GetFirstValue(payload.Data)
            };

            bool valueAssigned = false;

            foreach (var entries in BoundsList.GetEntries(payload.Data))
            {
                var boundsList = BoundsList.GetValue(entries);

                foreach (var bound in boundsList)
                {
                    var useExtantValue = extantDataField.ValidateKey(bound.Data);

                    if (useExtantValue)
                    {
                        DefaultableField.SetValue(
                            extantDataField.GetLastKeyValue(bound.Data), payload.Data);
                        valueAssigned = true;
                    }
                    if (valueAssigned)
                    {
                        break;
                    }
                }
                if (valueAssigned)
                {
                    break;
                }
            }

            if (!valueAssigned)
            {
                DefaultableField.SetValue(DefaultValue.GetFirstValue(payload.Data), payload.Data);
            }

            var iterator = Router.TransmitAll(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
コード例 #6
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            foreach (var entry in BoundsList.GetEntries(payload.Data))
            {
                var visualState = VisibilityState.GetValue(entry);

                foreach (var bound in BoundsList.GetValue(entry))
                {
                    bound.ToggleRenderers(visualState);
                }
            }

            var iterator = Router.TransmitAll(payload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
コード例 #7
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            var boundsList = BoundsList.GetFirstValue(mutable).ToList();

            BoundingBox outgoingBound;

            if (boundsList.Any())
            {
                outgoingBound = boundsList.First();
            }
            else
            {
                outgoingBound = SchemaBound ?? (SchemaBound = BoundingBox.ConstructBoundingBox("Schema Box"));
            }

            FirstBoundTarget.SetValue(outgoingBound, mutable);

            return(mutable);
        }