Example #1
0
        private void load(IFrameBasedClock framedClock)
        {
            try
            {
                drawableRulesetWrapper = new DrawableEditRulesetWrapper <TObject>(CreateDrawableRuleset(Ruleset, workingBeatmap, Array.Empty <Mod>()))
                {
                    Clock = framedClock,
                    ProcessCustomClock = false
                };
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            var layerBelowRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChildren(new Drawable[]
            {
                distanceSnapGridContainer = new Container {
                    RelativeSizeAxes = Axes.Both
                },
                new EditorPlayfieldBorder {
                    RelativeSizeAxes = Axes.Both
                }
            });

            var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = new BlueprintContainer());

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                drawableRulesetWrapper,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            toolboxCollection.Items =
                CompositionTools.Select(t => new RadioButton(t.Name, () => selectTool(t)))
                .Prepend(new RadioButton("选择", () => selectTool(null)))
                .ToList();

            toolboxCollection.Items[0].Select();

            blueprintContainer.SelectionChanged += selectionChanged;
        }
        private void load(OsuGameBase osuGame, IFrameBasedClock framedClock)
        {
            beatmap.BindTo(osuGame.Beatmap);

            try
            {
                rulesetContainer       = CreateRulesetContainer(ruleset, beatmap.Value);
                rulesetContainer.Clock = framedClock;
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            var layerBelowRuleset = new BorderLayer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = CreateLayerContainer()
            };

            var layerAboveRuleset = CreateLayerContainer();

            layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this);

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                rulesetContainer,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            toolboxCollection.Items =
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                .Prepend(new RadioButton("Select", () => setCompositionTool(null)))
                .ToList();

            toolboxCollection.Items[0].Select();
        }
Example #3
0
        private void load(OsuGameBase osuGame)
        {
            try
            {
                rulesetContainer = CreateRulesetContainer(ruleset, osuGame.Beatmap.Value);

                // TODO: should probably be done at a RulesetContainer level to share logic with Player.
                rulesetContainer.Clock = new InterpolatingFramedClock((IAdjustableClock)osuGame.Beatmap.Value.Track ?? new StopwatchClock());
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            ScalableContainer createLayerContainerWithContent(Drawable content)
            {
                var container = CreateLayerContainer();

                container.Child = content;
                layerContainers.Add(container);
                return(container);
            }

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                createLayerContainerWithContent(new Container
                                {
                                    Name             = "Border",
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    BorderColour     = Color4.White,
                                    BorderThickness  = 2,
                                    Child            = new Box {
                                        RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true
                                    }
                                }),
                                rulesetContainer,
                                createLayerContainerWithContent(new SelectionLayer(rulesetContainer.Playfield))
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            toolboxCollection.Items =
                new[] { new RadioButton("Select", () => setCompositionTool(null)) }
            .Concat(
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                )
            .ToList();

            toolboxCollection.Items[0].Select();
        }
Example #4
0
        private void load(OsuGameBase osuGame)
        {
            try
            {
                rulesetContainer = CreateRulesetContainer(ruleset, osuGame.Beatmap.Value);

                // TODO: should probably be done at a RulesetContainer level to share logic with Player.
                rulesetContainer.Clock = new InterpolatingFramedClock((IAdjustableClock)osuGame.Beatmap.Value.Track ?? new StopwatchClock());
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            HitObjectOverlayLayer hitObjectOverlayLayer = CreateHitObjectOverlayLayer();
            SelectionLayer        selectionLayer        = new SelectionLayer(rulesetContainer.Playfield);

            var layerBelowRuleset = new BorderLayer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = CreateLayerContainer()
            };

            var layerAboveRuleset = CreateLayerContainer();

            layerAboveRuleset.Children = new Drawable[]
            {
                selectionLayer,              // Below object overlays for input
                hitObjectOverlayLayer,
                selectionLayer.CreateProxy() // Proxy above object overlays for selections
            };

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                rulesetContainer,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            selectionLayer.ObjectSelected   += hitObjectOverlayLayer.AddOverlay;
            selectionLayer.ObjectDeselected += hitObjectOverlayLayer.RemoveOverlay;

            toolboxCollection.Items =
                new[] { new RadioButton("Select", () => setCompositionTool(null)) }
            .Concat(
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                )
            .ToList();

            toolboxCollection.Items[0].Select();
        }
Example #5
0
        private void load(OsuGameBase osuGame)
        {
            RulesetContainer rulesetContainer;

            try
            {
                rulesetContainer = CreateRulesetContainer(ruleset, osuGame.Beatmap.Value);
            }
            catch (Exception e)
            {
                Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error);
                return;
            }

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            BorderColour     = Color4.White,
                            BorderThickness  = 2,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = 0,
                                    AlwaysPresent    = true,
                                },
                                rulesetContainer
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            rulesetContainer.Clock = new InterpolatingFramedClock((IAdjustableClock)osuGame.Beatmap.Value.Track ?? new StopwatchClock());

            toolboxCollection.Items =
                new[] { new RadioButton("Select", () => setCompositionTool(null)) }
            .Concat(
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                )
            .ToList();

            toolboxCollection.Items[0].Select();
        }
Example #6
0
        private void load(IBindable <WorkingBeatmap> beatmap, IFrameBasedClock framedClock)
        {
            Beatmap.BindTo(beatmap);

            try
            {
                DrawableRuleset       = CreateDrawableRuleset();
                DrawableRuleset.Clock = framedClock;
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            var layerBelowRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();

            layerBelowRuleset.Child = new EditorPlayfieldBorder {
                RelativeSizeAxes = Axes.Both
            };

            var layerAboveRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();

            layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                DrawableRuleset,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            toolboxCollection.Items =
                CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t))
                .Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null))
                .ToList();

            toolboxCollection.Items[0].Select();
        }
Example #7
0
        private void load([NotNull] OsuGameBase osuGame, [NotNull] IAdjustableClock adjustableClock, [NotNull] IFrameBasedClock framedClock, [CanBeNull] BindableBeatDivisor beatDivisor)
        {
            this.adjustableClock = adjustableClock;

            if (beatDivisor != null)
            {
                this.beatDivisor.BindTo(beatDivisor);
            }

            beatmap.BindTo(osuGame.Beatmap);

            try
            {
                rulesetContainer       = CreateRulesetContainer(ruleset, beatmap.Value);
                rulesetContainer.Clock = framedClock;
            }
            catch (Exception e)
            {
                Logger.Error(e, "Could not load beatmap sucessfully!");
                return;
            }

            HitObjectMaskLayer hitObjectMaskLayer = new HitObjectMaskLayer(this);
            SelectionLayer     selectionLayer     = new SelectionLayer(rulesetContainer.Playfield);

            var layerBelowRuleset = new BorderLayer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = CreateLayerContainer()
            };

            var layerAboveRuleset = CreateLayerContainer();

            layerAboveRuleset.Children = new Drawable[]
            {
                selectionLayer,              // Below object overlays for input
                hitObjectMaskLayer,
                selectionLayer.CreateProxy() // Proxy above object overlays for selections
            };

            layerContainers.Add(layerBelowRuleset);
            layerContainers.Add(layerAboveRuleset);

            RadioButtonCollection toolboxCollection;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Name             = "Sidebar",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Right = 10
                            },
                            Children = new Drawable[]
                            {
                                new ToolboxGroup {
                                    Child = toolboxCollection = new RadioButtonCollection {
                                        RelativeSizeAxes = Axes.X
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            Name             = "Content",
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                layerBelowRuleset,
                                rulesetContainer,
                                layerAboveRuleset
                            }
                        }
                    },
                },
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 200),
                }
            };

            selectionLayer.ObjectSelected    += hitObjectMaskLayer.AddOverlay;
            selectionLayer.ObjectDeselected  += hitObjectMaskLayer.RemoveOverlay;
            selectionLayer.SelectionCleared  += hitObjectMaskLayer.RemoveSelectionOverlay;
            selectionLayer.SelectionFinished += hitObjectMaskLayer.AddSelectionOverlay;

            toolboxCollection.Items =
                new[] { new RadioButton("Select", () => setCompositionTool(null)) }
            .Concat(
                CompositionTools.Select(t => new RadioButton(t.Name, () => setCompositionTool(t)))
                )
            .ToList();

            toolboxCollection.Items[0].Select();
        }