コード例 #1
0
ファイル: LayerManager.cs プロジェクト: thyawan/storybrew
        public void MoveToOsbLayer(EditorStoryboardLayer layer, OsbLayer osbLayer)
        {
            var firstLayer = layers.FirstOrDefault(l => l.OsbLayer == osbLayer);

            if (firstLayer != null)
            {
                MoveToLayer(layer, firstLayer);
            }
            else
            {
                layer.OsbLayer = osbLayer;
            }
        }
コード例 #2
0
 public OsbAnimationWriter(OsbAnimation osbAnimation, AnimatedValue <CommandPosition> moveTimeline,
                           AnimatedValue <CommandDecimal> moveXTimeline,
                           AnimatedValue <CommandDecimal> moveYTimeline,
                           AnimatedValue <CommandDecimal> scaleTimeline,
                           AnimatedValue <CommandScale> scaleVecTimeline,
                           AnimatedValue <CommandDecimal> rotateTimeline,
                           AnimatedValue <CommandDecimal> fadeTimeline,
                           AnimatedValue <CommandColor> colorTimeline,
                           TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
     : base(osbAnimation, moveTimeline,
            moveXTimeline,
            moveYTimeline,
            scaleTimeline,
            scaleVecTimeline,
            rotateTimeline,
            fadeTimeline,
            colorTimeline,
            writer, exportSettings, layer)
 {
     this.osbAnimation = osbAnimation;
 }
コード例 #3
0
 public OsbSpriteWriter(OsbSprite osbSprite, AnimatedValue <CommandPosition> moveTimeline,
                        AnimatedValue <CommandDecimal> moveXTimeline,
                        AnimatedValue <CommandDecimal> moveYTimeline,
                        AnimatedValue <CommandDecimal> scaleTimeline,
                        AnimatedValue <CommandScale> scaleVecTimeline,
                        AnimatedValue <CommandDecimal> rotateTimeline,
                        AnimatedValue <CommandDecimal> fadeTimeline,
                        AnimatedValue <CommandColor> colorTimeline,
                        TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     this.osbSprite        = osbSprite;
     this.moveTimeline     = moveTimeline;
     this.moveXTimeline    = moveXTimeline;
     this.moveYTimeline    = moveYTimeline;
     this.scaleTimeline    = scaleTimeline;
     this.scaleVecTimeline = scaleVecTimeline;
     this.rotateTimeline   = rotateTimeline;
     this.fadeTimeline     = fadeTimeline;
     this.colorTimeline    = colorTimeline;
     TextWriter            = writer;
     ExportSettings        = exportSettings;
     OsbLayer = layer;
 }
コード例 #4
0
ファイル: OsbSample.cs プロジェクト: starrodkirby86/storybrew
 public override void WriteOsb(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 => writer.WriteLine($"Sample,{((int)Time).ToString(exportSettings.NumberFormat)},{layer},\"{AudioPath}\",{((int)Volume).ToString(exportSettings.NumberFormat)}");
コード例 #5
0
        public override void WriteOsb(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
        {
            if (commands.Count == 0)
            {
                return;
            }

            WriteHeader(writer, exportSettings, layer);
            foreach (var command in commands)
            {
                command.WriteOsb(writer, exportSettings, 1);
            }
        }
コード例 #6
0
 protected virtual void WriteHeader(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     writer.Write($"Sprite,{layer},{Origin.ToString()},\"{TexturePath.Trim()}\"");
     if (!moveTimeline.HasCommands && !moveXTimeline.HasCommands)
     {
         writer.Write($",{InitialPosition.X.ToString(exportSettings.NumberFormat)}");
     }
     else
     {
         writer.Write($",0");
     }
     if (!moveTimeline.HasCommands && !moveYTimeline.HasCommands)
     {
         writer.WriteLine($",{InitialPosition.Y.ToString(exportSettings.NumberFormat)}");
     }
     else
     {
         writer.WriteLine($",0");
     }
 }
コード例 #7
0
        public override void WriteOsb(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
        {
            if (CommandCount == 0)
            {
                return;
            }

            var osbSpriteWriter = OsbWriterFactory.CreateWriter(this, moveTimeline,
                                                                moveXTimeline,
                                                                moveYTimeline,
                                                                scaleTimeline,
                                                                scaleVecTimeline,
                                                                rotateTimeline,
                                                                fadeTimeline,
                                                                colorTimeline,
                                                                writer, exportSettings, layer);

            osbSpriteWriter.WriteOsb();
        }
コード例 #8
0
ファイル: StoryboardObject.cs プロジェクト: thyawan/storybrew
 public abstract void WriteOsb(TextWriter writer, ExportSettings exportSettings, OsbLayer layer);
コード例 #9
0
ファイル: OsbWriterFactory.cs プロジェクト: thyawan/storybrew
 public static OsbSpriteWriter CreateWriter(OsbSprite osbSprite, AnimatedValue <CommandPosition> moveTimeline,
                                            AnimatedValue <CommandDecimal> moveXTimeline,
                                            AnimatedValue <CommandDecimal> moveYTimeline,
                                            AnimatedValue <CommandDecimal> scaleTimeline,
                                            AnimatedValue <CommandScale> scaleVecTimeline,
                                            AnimatedValue <CommandDecimal> rotateTimeline,
                                            AnimatedValue <CommandDecimal> fadeTimeline,
                                            AnimatedValue <CommandColor> colorTimeline,
                                            TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     if (osbSprite is OsbAnimation osbAnimation)
     {
         return(new OsbAnimationWriter(osbAnimation, moveTimeline,
                                       moveXTimeline,
                                       moveYTimeline,
                                       scaleTimeline,
                                       scaleVecTimeline,
                                       rotateTimeline,
                                       fadeTimeline,
                                       colorTimeline,
                                       writer, exportSettings, layer));
     }
     else
     {
         return(new OsbSpriteWriter(osbSprite, moveTimeline,
                                    moveXTimeline,
                                    moveYTimeline,
                                    scaleTimeline,
                                    scaleVecTimeline,
                                    rotateTimeline,
                                    fadeTimeline,
                                    colorTimeline,
                                    writer, exportSettings, layer));
     }
 }
コード例 #10
0
ファイル: LayerList.cs プロジェクト: starrodkirby86/storybrew
        private void buildLayers(OsbLayer osbLayer, bool diffSpecific)
        {
            var layers = layerManager.FindLayers(l => l.OsbLayer == osbLayer && l.DiffSpecific == diffSpecific);

            var index = 0;

            foreach (var layer in layers)
            {
                var effect = layer.Effect;

                Widget layerRoot;
                Label  nameLabel, detailsLabel;
                Button moveUpButton, moveDownButton, moveToTopButton, moveToBottomButton, diffSpecificButton, osbLayerButton, showHideButton;
                layersLayout.Add(layerRoot = new LinearLayout(Manager)
                {
                    AnchorFrom  = BoxAlignment.Centre,
                    AnchorTo    = BoxAlignment.Centre,
                    Horizontal  = true,
                    FitChildren = true,
                    Fill        = true,
                    Children    = new Widget[]
                    {
                        new LinearLayout(Manager)
                        {
                            StyleName = "condensed",
                            Children  = new Widget[]
                            {
                                nameLabel = new Label(Manager)
                                {
                                    StyleName  = "listItem",
                                    Text       = layer.Name,
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                                detailsLabel = new Label(Manager)
                                {
                                    StyleName  = "listItemSecondary",
                                    Text       = getLayerDetails(layer, effect),
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                            },
                        },
                        diffSpecificButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = layer.DiffSpecific ? IconFont.FileO : IconFont.FilesO,
                            Tooltip    = layer.DiffSpecific ? "Diff. specific\n(exports to .osu)" : "All diffs\n(exports to .osb)",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        osbLayerButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.ThLarge,
                            Tooltip    = "Osb Layer",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        new LinearLayout(Manager)
                        {
                            StyleName = "condensed",
                            CanGrow   = false,
                            Children  = new Widget[]
                            {
                                moveUpButton = new Button(Manager)
                                {
                                    StyleName  = "icon",
                                    Icon       = IconFont.AngleUp,
                                    Tooltip    = "Up",
                                    AnchorFrom = BoxAlignment.Centre,
                                    AnchorTo   = BoxAlignment.Centre,
                                    CanGrow    = false,
                                    Disabled   = index == 0,
                                },
                                moveDownButton = new Button(Manager)
                                {
                                    StyleName  = "icon",
                                    Icon       = IconFont.AngleDown,
                                    Tooltip    = "Down",
                                    AnchorFrom = BoxAlignment.Centre,
                                    AnchorTo   = BoxAlignment.Centre,
                                    CanGrow    = false,
                                    Disabled   = index == layers.Count - 1,
                                },
                            },
                        },
                        new LinearLayout(Manager)
                        {
                            StyleName = "condensed",
                            CanGrow   = false,
                            Children  = new Widget[]
                            {
                                moveToTopButton = new Button(Manager)
                                {
                                    StyleName  = "icon",
                                    Icon       = IconFont.AngleDoubleUp,
                                    Tooltip    = "Move to top",
                                    AnchorFrom = BoxAlignment.Centre,
                                    AnchorTo   = BoxAlignment.Centre,
                                    CanGrow    = false,
                                    Disabled   = index == 0,
                                },
                                moveToBottomButton = new Button(Manager)
                                {
                                    StyleName  = "icon",
                                    Icon       = IconFont.AngleDoubleDown,
                                    Tooltip    = "Move to bottom",
                                    AnchorFrom = BoxAlignment.Centre,
                                    AnchorTo   = BoxAlignment.Centre,
                                    CanGrow    = false,
                                    Disabled   = index == layers.Count - 1,
                                },
                            },
                        },
                        showHideButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = layer.Visible ? IconFont.Eye : IconFont.EyeSlash,
                            Tooltip    = "Show/Hide",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            Checkable  = true,
                            Checked    = layer.Visible,
                            CanGrow    = false,
                        },
                    },
                });

                var la = layer;

                ChangedHandler changedHandler;
                EventHandler   effectChangedHandler;
                layer.OnChanged += changedHandler = (sender, e) =>
                {
                    nameLabel.Text             = la.Name;
                    diffSpecificButton.Icon    = la.DiffSpecific ? IconFont.FileO : IconFont.FilesO;
                    diffSpecificButton.Tooltip = la.DiffSpecific ? "Diff. specific\n(exports to .osu)" : "All diffs\n(exports to .osb)";
                    showHideButton.Icon        = la.Visible ? IconFont.Eye : IconFont.EyeSlash;
                    showHideButton.Checked     = la.Visible;
                };
                effect.OnChanged    += effectChangedHandler = (sender, e) => detailsLabel.Text = getLayerDetails(la, effect);
                layerRoot.OnHovered += (sender, e) =>
                {
                    la.Highlight = e.Hovered;
                    OnLayerPreselect?.Invoke(e.Hovered ? la : null);
                };
                layerRoot.OnClickDown += (sender, e) =>
                {
                    OnLayerSelected?.Invoke(la);
                    return(true);
                };
                layerRoot.OnDisposed += (sender, e) =>
                {
                    la.Highlight      = false;
                    la.OnChanged     -= changedHandler;
                    effect.OnChanged -= effectChangedHandler;
                };

                moveUpButton.OnClick          += (sender, e) => layerManager.MoveUp(la);
                moveDownButton.OnClick        += (sender, e) => layerManager.MoveDown(la);
                moveToTopButton.OnClick       += (sender, e) => layerManager.MoveToTop(la);
                moveToBottomButton.OnClick    += (sender, e) => layerManager.MoveToBottom(la);
                diffSpecificButton.OnClick    += (sender, e) => la.DiffSpecific = !la.DiffSpecific;
                osbLayerButton.OnClick        += (sender, e) => Manager.ScreenLayerManager.ShowContextMenu("Choose an osb layer", selectedOsbLayer => la.OsbLayer = selectedOsbLayer, Project.OsbLayers);
                showHideButton.OnValueChanged += (sender, e) => la.Visible = showHideButton.Checked;
                index++;
            }
        }
コード例 #11
0
 protected override void WriteHeader(TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 => writer.WriteLine($"Animation,{layer},{Origin.ToString()},\"{TexturePath.Trim()}\",{InitialPosition.X.ToString(exportSettings.NumberFormat)},{InitialPosition.Y.ToString(exportSettings.NumberFormat)},{FrameCount},{FrameDelay},{LoopType}");
コード例 #12
0
ファイル: LayerList.cs プロジェクト: thyawan/storybrew
        private void buildLayers(OsbLayer osbLayer, bool diffSpecific)
        {
            var layers = layerManager.FindLayers(l => l.OsbLayer == osbLayer && l.DiffSpecific == diffSpecific);

            var index = 0;

            foreach (var layer in layers)
            {
                var effect = layer.Effect;

                Widget layerRoot;
                Label  nameLabel, detailsLabel;
                Button diffSpecificButton, showHideButton;
                layersLayout.Add(layerRoot = new LinearLayout(Manager)
                {
                    AnchorFrom  = BoxAlignment.Centre,
                    AnchorTo    = BoxAlignment.Centre,
                    Horizontal  = true,
                    FitChildren = true,
                    Fill        = true,
                    Children    = new Widget[]
                    {
                        new Label(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = IconFont.Reorder,
                            Tooltip    = "Drag to reorder",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        new LinearLayout(Manager)
                        {
                            StyleName = "condensed",
                            Children  = new Widget[]
                            {
                                nameLabel = new Label(Manager)
                                {
                                    StyleName  = "listItem",
                                    Text       = layer.Name,
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                                detailsLabel = new Label(Manager)
                                {
                                    StyleName  = "listItemSecondary",
                                    Text       = getLayerDetails(layer, effect),
                                    AnchorFrom = BoxAlignment.Left,
                                    AnchorTo   = BoxAlignment.Left,
                                },
                            },
                        },
                        diffSpecificButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = layer.DiffSpecific ? IconFont.FileO : IconFont.FilesO,
                            Tooltip    = layer.DiffSpecific ? "Diff. specific\n(exports to .osu)" : "All diffs\n(exports to .osb)",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            CanGrow    = false,
                        },
                        showHideButton = new Button(Manager)
                        {
                            StyleName  = "icon",
                            Icon       = layer.Visible ? IconFont.Eye : IconFont.EyeSlash,
                            Tooltip    = "Show/Hide",
                            AnchorFrom = BoxAlignment.Centre,
                            AnchorTo   = BoxAlignment.Centre,
                            Checkable  = true,
                            Checked    = layer.Visible,
                            CanGrow    = false,
                        },
                    },
                });

                var la = layer;

                layerRoot.GetDragData = () => la;
                layerRoot.HandleDrop  = data =>
                {
                    if (data is EditorStoryboardLayer droppedLayer)
                    {
                        if (droppedLayer.Guid != la.Guid)
                        {
                            var dndLayer = layerManager.Layers.FirstOrDefault(l => l.Guid == droppedLayer.Guid);
                            if (dndLayer != null)
                            {
                                layerManager.MoveToLayer(dndLayer, la);
                            }
                        }
                        return(true);
                    }
                    return(false);
                };

                ChangedHandler changedHandler;
                EventHandler   effectChangedHandler;
                layer.OnChanged += changedHandler = (sender, e) =>
                {
                    nameLabel.Text             = la.Name;
                    diffSpecificButton.Icon    = la.DiffSpecific ? IconFont.FileO : IconFont.FilesO;
                    diffSpecificButton.Tooltip = la.DiffSpecific ? "Diff. specific\n(exports to .osu)" : "All diffs\n(exports to .osb)";
                    showHideButton.Icon        = la.Visible ? IconFont.Eye : IconFont.EyeSlash;
                    showHideButton.Checked     = la.Visible;
                };
                effect.OnChanged    += effectChangedHandler = (sender, e) => detailsLabel.Text = getLayerDetails(la, effect);
                layerRoot.OnHovered += (evt, e) =>
                {
                    la.Highlight = e.Hovered;
                    OnLayerPreselect?.Invoke(e.Hovered ? la : null);
                };
                var handledClick = false;
                layerRoot.OnClickDown += (evt, e) =>
                {
                    handledClick = true;
                    return(true);
                };
                layerRoot.OnClickUp += (evt, e) =>
                {
                    if (handledClick && (evt.RelatedTarget == layerRoot || evt.RelatedTarget.HasAncestor(layerRoot)))
                    {
                        OnLayerSelected?.Invoke(la);
                    }

                    handledClick = false;
                };
                layerRoot.OnDisposed += (sender, e) =>
                {
                    la.Highlight      = false;
                    la.OnChanged     -= changedHandler;
                    effect.OnChanged -= effectChangedHandler;
                };

                diffSpecificButton.OnClick    += (sender, e) => la.DiffSpecific = !la.DiffSpecific;
                showHideButton.OnValueChanged += (sender, e) => la.Visible = showHideButton.Checked;
                index++;
            }
        }