Example #1
0
        public NotePlayfield(int columns)
        {
            Columns = columns;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            InternalChildren = new Drawable[]
            {
                new Container
                {
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Top = 30, Bottom = 30
                    },
                    Masking      = true,
                    CornerRadius = 5,
                    Children     = new Drawable[]
                    {
                        new Container
                        {
                            Name             = "Background mask",
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Masking          = true,
                            CornerRadius     = 5,
                            Children         = new Drawable[]
                            {
                                new SkinnableDrawable(new KaraokeSkinComponent(KaraokeSkinComponents.StageBackground), _ => null)
                                {
                                    RelativeSizeAxes = Axes.Both
                                },
                                new Box
                                {
                                    Name             = "Background",
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Black,
                                    Alpha            = 0.5f
                                },
                                columnFlow = new FillFlowContainer <DefaultColumnBackground>
                                {
                                    Name             = "Columns",
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Top = COLUMN_SPACING, Bottom = COLUMN_SPACING
                                    },
                                    Spacing = new Vector2(0, COLUMN_SPACING)
                                },
                                centerLine = new CenterLine
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                judgementArea = new Container
                                {
                                    RelativeSizeAxes     = Axes.Both,
                                    RelativePositionAxes = Axes.X,
                                    Children             = new[]
                                    {
                                        judgements = new JudgementContainer <DrawableNoteJudgement>
                                        {
                                            Anchor             = Anchor.CentreLeft,
                                            Origin             = Anchor.CentreLeft,
                                            AutoSizeAxes       = Axes.Both,
                                            BypassAutoSizeAxes = Axes.Both
                                        },
                                        judgementLine = new SkinnableDrawable(new KaraokeSkinComponent(KaraokeSkinComponents.JudgementLine), _ => new DefaultJudgementLine())
                                        {
                                            RelativeSizeAxes = Axes.Y,
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                        },
                                        saitenMarker = new SaitenMarker
                                        {
                                            Alpha = 0
                                        }
                                    }
                                },
                                hitObjectArea = new Container
                                {
                                    Depth                = 1,
                                    RelativeSizeAxes     = Axes.Both,
                                    RelativePositionAxes = Axes.X,
                                    Children             = new Drawable[]
                                    {
                                        hitObjectsContainer = new Container
                                        {
                                            Name             = "Hit objects",
                                            RelativeSizeAxes = Axes.Both,
                                            Child            = HitObjectContainer
                                        },
                                        replaySaitenVisualization = new SaitenVisualization
                                        {
                                            Name             = "Saiten Visualization",
                                            RelativeSizeAxes = Axes.Both,
                                            PathRadius       = 1.5f,
                                            Alpha            = 0.6f
                                        },
                                        realTimeSaitenVisualization = new RealTimeSaitenVisualization
                                        {
                                            Name              = "Saiten Visualization",
                                            RelativeSizeAxes  = Axes.Both,
                                            Masking           = true,
                                            PathRadius        = 2.5f,
                                            OrientatePosition = SaitenVisualization.SaitenOrientatePosition.End
                                        },
                                    }
                                }
                            },
                        }
                    }
                }
            };

            for (int i = 0; i < columns; i++)
            {
                var column = new DefaultColumnBackground(i)
                {
                    IsSpecial = i % 2 == 0
                };

                AddColumn(column);
            }

            Direction.BindValueChanged(dir =>
            {
                bool left = dir.NewValue == ScrollingDirection.Left;

                //TODO : will apply in skin
                var judgementAreaPercentage = 0.4f;
                var judgementPadding        = 10;

                judgementArea.Size = new Vector2(judgementAreaPercentage, 1);
                judgementArea.X    = left ? 0 : 1 - judgementAreaPercentage;

                judgementLine.Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft;
                saitenMarker.Anchor  = saitenMarker.Origin = left ? Anchor.CentreRight : Anchor.CentreLeft;
                saitenMarker.Scale   = left ? new Vector2(1, 1) : new Vector2(-1, 1);

                judgements.Anchor = judgements.Origin = left ? Anchor.CentreRight : Anchor.CentreLeft;
                judgements.X      = left ? -judgementPadding : judgementPadding;

                hitObjectArea.Size = new Vector2(1 - judgementAreaPercentage, 1);
                hitObjectArea.X    = left ? judgementAreaPercentage : 0;

                realTimeSaitenVisualization.Anchor = left ? Anchor.CentreLeft : Anchor.CentreRight;
                realTimeSaitenVisualization.Origin = left ? Anchor.CentreRight : Anchor.CentreLeft;
            }, true);
        }
Example #2
0
        protected ScrollingNotePlayfield(int columns)
        {
            Columns = columns;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;
            InternalChildren = new Drawable[]
            {
                new Container
                {
                    Anchor           = Anchor.CentreLeft,
                    Origin           = Anchor.CentreLeft,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Masking          = true,
                    CornerRadius     = 5,
                    Children         = new Drawable[]
                    {
                        BackgroundLayer = new Container
                        {
                            Name             = "Background mask",
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Masking          = true,
                            CornerRadius     = 5,
                            Children         = new Drawable[]
                            {
                                // background
                                columnFlow = new FillFlowContainer <DefaultColumnBackground>
                                {
                                    Name             = "Columns",
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding {
                                        Top = COLUMN_SPACING, Bottom = COLUMN_SPACING
                                    },
                                    Spacing = new Vector2(0, COLUMN_SPACING)
                                },
                                // center line
                            }
                        },
                        HitObjectLayer = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                // judgement
                                HitObjectArea = new Container
                                {
                                    Depth                = 1,
                                    RelativeSizeAxes     = Axes.Both,
                                    RelativePositionAxes = Axes.X,
                                    Children             = new Drawable[]
                                    {
                                        new Container
                                        {
                                            Name             = "Hit objects",
                                            RelativeSizeAxes = Axes.Both,
                                            Child            = HitObjectContainer
                                        },
                                        // scoring visualization
                                    }
                                }
                            },
                        },
                    }
                },
                // other things like microphone status
            };

            for (int i = 0; i < columns; i++)
            {
                var column = new DefaultColumnBackground(i)
                {
                    IsSpecial = i % 2 == 0
                };

                columnFlow.Add(column);
            }

            RegisterPool <Note, DrawableNote>(50);
            RegisterPool <BarLine, DrawableBarLine>(15);
        }
Example #3
0
 public void AddColumn(DefaultColumnBackground c)
 {
     columnFlow.Add(c);
 }
Example #4
0
 protected void AddColumn(DefaultColumnBackground c)
 {
     columnFlow.Add(c);
 }