private ScrollingTestContainer createStage(ScrollingDirection direction, CrossAction action) { var specialAction = CrossAction.Special1; var stage = new CrossStage(0, new StageDefinition { Columns = 2 }, ref action, ref specialAction); stages.Add(stage); return(new ScrollingTestContainer(direction) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, TimeRange = 2000, Child = stage }); }
private Drawable createColumn(ScrollingDirection direction, CrossAction action, int index) { var column = new Column(index) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Height = 0.85f, AccentColour = Color4.OrangeRed, Action = { Value = action }, }; columns.Add(column); return(new ScrollingTestContainer(direction) { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, TimeRange = 2000, Child = column }); }
/// <summary> /// Generates a list of <see cref="KeyBinding"/>s for a specific number of columns. /// </summary> /// <param name="columns">The number of columns that need to be bound.</param> /// <param name="nextNormalAction">The next <see cref="CrossAction"/> to use for normal columns.</param> /// <returns>The keybindings.</returns> public IEnumerable <KeyBinding> GenerateKeyBindingsFor(int columns, out CrossAction nextNormalAction) { CrossAction currentNormalAction = NormalActionStart; var bindings = new List <KeyBinding>(); for (int i = LeftKeys.Length - columns / 2; i < LeftKeys.Length; i++) { bindings.Add(new KeyBinding(LeftKeys[i], currentNormalAction++)); } if (columns % 2 == 1) { bindings.Add(new KeyBinding(SpecialKey, SpecialAction)); } for (int i = 0; i < columns / 2; i++) { bindings.Add(new KeyBinding(RightKeys[i], currentNormalAction++)); } nextNormalAction = currentNormalAction; return(bindings); }
public CrossStage(int firstColumnIndex, StageDefinition definition, ref CrossAction normalColumnStartAction, ref CrossAction 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 Container <Column> { Name = "Columns", RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Padding = new MarginPadding { Left = COLUMN_SPACING, Right = COLUMN_SPACING }, }, } }, judgements = new JudgementContainer <DrawableCrossJudgement> { 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(firstColumnIndex + i) { IsSpecial = isSpecial, Action = { Value = isSpecial ? specialColumnStartAction++ : normalColumnStartAction++ } }; AddColumn(column); } }
private void btnCross_Click(object sender, EventArgs e) { CrossAction?.Invoke(); }