コード例 #1
0
ファイル: ManiaStage.cs プロジェクト: queenslushyy/osu
        public ManiaStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction)
        {
            this.firstColumnIndex = firstColumnIndex;

            Name = "Stage";

            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Y;
            AutoSizeAxes     = Axes.X;

            InternalChildren = new Drawable[]
            {
                new Container
                {
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            Name             = "Columns mask",
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,
                            Masking          = true,
                            CornerRadius     = 5,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Name             = "Background",
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black
                                },
                                columnFlow = new FillFlowContainer <Column>
                                {
                                    Name             = "Columns",
                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,
                                    Direction        = FillDirection.Horizontal,
                                    Padding          = new MarginPadding {
                                        Left = 1, Right = 1
                                    },
                                    Spacing = new Vector2(1, 0)
                                },
                            }
                        },
                        new Container
                        {
                            Name               = "Barlines mask",
                            Anchor             = Anchor.TopCentre,
                            Origin             = Anchor.TopCentre,
                            RelativeSizeAxes   = Axes.Y,
                            Width              = 1366, // Bar lines should only be masked on the vertical axis
                            BypassAutoSizeAxes = Axes.Both,
                            Masking            = true,
                            Child              = barLineContainer = new Container
                            {
                                Name             = "Bar lines",
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Y,
                                Child            = HitObjectContainer
                            }
                        },
                        judgements = new JudgementContainer <DrawableManiaJudgement>
                        {
                            Anchor             = Anchor.TopCentre,
                            Origin             = Anchor.Centre,
                            AutoSizeAxes       = Axes.Both,
                            Y                  = HIT_TARGET_POSITION + 150,
                            BypassAutoSizeAxes = Axes.Both
                        },
                        topLevelContainer = new Container {
                            RelativeSizeAxes = Axes.Both
                        }
                    }
                }
            };

            for (int i = 0; i < definition.Columns; i++)
            {
                var isSpecial = definition.IsSpecialColumn(i);
                var column    = new Column
                {
                    IsSpecial = isSpecial,
                    Action    = { Value = isSpecial ? specialColumnStartAction++ : normalColumnStartAction++ }
                };

                AddColumn(column);
            }

            Direction.BindValueChanged(d =>
            {
                barLineContainer.Padding = new MarginPadding
                {
                    Top    = d == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0,
                    Bottom = d == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0,
                };
            }, true);
        }
コード例 #2
0
        public ManiaPlayfield(int columnCount)
            : base(Axes.Y)
        {
            this.columnCount = columnCount;

            if (columnCount <= 0)
            {
                throw new ArgumentException("Can't have zero or fewer columns.");
            }

            Inverted.Value = true;

            Container topLevelContainer;

            InternalChildren = new Drawable[]
            {
                new Container
                {
                    Name             = "Playfield elements",
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes     = Axes.X,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            Name             = "Columns mask",
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Name             = "Background",
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black
                                },
                                columns = new FillFlowContainer <Column>
                                {
                                    Name             = "Columns",
                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,
                                    Direction        = FillDirection.Horizontal,
                                    Padding          = new MarginPadding {
                                        Left = 1, Right = 1
                                    },
                                    Spacing = new Vector2(1, 0)
                                },
                            }
                        },
                        new Container
                        {
                            Name               = "Barlines mask",
                            Anchor             = Anchor.TopCentre,
                            Origin             = Anchor.TopCentre,
                            RelativeSizeAxes   = Axes.Y,
                            Width              = 1366, // Bar lines should only be masked on the vertical axis
                            BypassAutoSizeAxes = Axes.Both,
                            Masking            = true,
                            Child              = content = new Container
                            {
                                Name             = "Bar lines",
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Y,
                                Padding          = new MarginPadding {
                                    Top = HIT_TARGET_POSITION
                                }
                            }
                        },
                        judgements = new Container <DrawableManiaJudgement>
                        {
                            Anchor             = Anchor.TopCentre,
                            Origin             = Anchor.Centre,
                            AutoSizeAxes       = Axes.Both,
                            Y                  = HIT_TARGET_POSITION + 150,
                            BypassAutoSizeAxes = Axes.Both
                        },
                        topLevelContainer = new Container {
                            RelativeSizeAxes = Axes.Both
                        }
                    }
                }
            };

            var currentAction = ManiaAction.Key1;

            for (int i = 0; i < columnCount; i++)
            {
                var c = new Column();
                c.VisibleTimeRange.BindTo(VisibleTimeRange);

                c.IsSpecial = isSpecialColumn(i);
                c.Action    = c.IsSpecial ? ManiaAction.Special : currentAction++;

                topLevelContainer.Add(c.TopLevelContainer.CreateProxy());

                columns.Add(c);
                AddNested(c);
            }

            Inverted.ValueChanged += invertedChanged;
            Inverted.TriggerChange();
        }
コード例 #3
0
ファイル: ManiaStage.cs プロジェクト: queenslushyy/osu
 public void AddColumn(Column c)
 {
     topLevelContainer.Add(c.TopLevelContainer.CreateProxy());
     columnFlow.Add(c);
     AddNested(c);
 }