Exemplo n.º 1
0
        private Widget CreateAnimationsPane()
        {
            var pane = new ThemedScrollView {
                Padding = new Thickness {
                    Right = 15,
                },
            };
            var list = new Widget {
                Layout = new VBoxLayout(),
            };

            pane.Content.Layout = new VBoxLayout {
                Spacing = AttachmentMetrics.Spacing
            };
            pane.Content.AddNode(list);
            var widgetFactory = new AttachmentWidgetFactory <Model3DAttachment.Animation>(
                w => new AnimationRow(w, attachment.Animations), attachment.Animations);

            widgetFactory.AddHeader(AnimationRow.CreateHeader());
            widgetFactory.AddFooter(AnimationRow.CreateFooter(() => {
                attachment.Animations.Add(new Model3DAttachment.Animation {
                    Name = "Animation",
                });
            }));
            if (!attachment.Animations.Any(a => a.Name == Model3DAttachment.DefaultAnimationName))
            {
                attachment.Animations.Insert(0, new Model3DAttachment.Animation {
                    Name = Model3DAttachment.DefaultAnimationName,
                });
            }
            list.Components.Add(widgetFactory);
            return(pane);
        }
Exemplo n.º 2
0
        public void update(GameTime gameTime, Vector2 pos)
        {
            position = pos;

            frameTimeElapsed += (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (frameTimeElapsed >= frameLength)
            {
                frameTimeElapsed = 0;
                if (frameIndex < animations[animation].frameCount - 1)
                {
                    ++frameIndex;
                }
                else
                {
                    switch (row)
                    {
                    // change the animation to the next row and set the row to the current
                    case AnimationRow.row0:
                        animation = "row 1";
                        row       = AnimationRow.row1;
                        break;

                    case AnimationRow.row1:
                        animation = "row 2";
                        row       = AnimationRow.row2;
                        break;

                    case AnimationRow.row2:
                        animation = "row 3";
                        row       = AnimationRow.row3;
                        break;

                    case AnimationRow.row3:
                        animation = "row 4";
                        row       = AnimationRow.row4;
                        break;

                    case AnimationRow.row4:
                        animation = "row 5";
                        row       = AnimationRow.row5;
                        break;

                    case AnimationRow.row5:
                        animation = "row 0";
                        row       = AnimationRow.row0;
                        break;
                    }

                    frameIndex = 0;
                }
            }
        }
Exemplo n.º 3
0
        private static Widget CreateAnimationsPane(Model3DAttachment attachment)
        {
            var pane = new ThemedScrollView {
                Padding = new Thickness {
                    Right = 10
                },
            };
            var list = new Widget {
                Layout = new VBoxLayout(),
            };

            pane.Content.Layout = new VBoxLayout {
                Spacing = AttachmentMetrics.Spacing
            };
            pane.Content.AddNode(list);
            var widgetFactory = new AttachmentWidgetFactory <Model3DAttachment.Animation>(
                w => new AnimationRow(w, attachment.Animations), attachment.Animations);

            widgetFactory.AddHeader(AnimationRow.CreateHeader());
            widgetFactory.AddFooter(AnimationRow.CreateFooter(() => {
                history.DoTransaction(() => Core.Operations.InsertIntoList.Perform(
                                          attachment.Animations,
                                          attachment.Animations.Count,
                                          new Model3DAttachment.Animation {
                    Name = "Animation",
                }
                                          ));
            }));
            if (attachment.Animations.All(a => a.Name != Model3DAttachment.DefaultAnimationName))
            {
                attachment.Animations.Insert(0, new Model3DAttachment.Animation {
                    Name = Model3DAttachment.DefaultAnimationName,
                });
            }
            list.Components.Add(widgetFactory);
            return(pane);
        }