forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPippidonPlayfield.cs
More file actions
126 lines (112 loc) · 4.04 KB
/
Copy pathPippidonPlayfield.cs
File metadata and controls
126 lines (112 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Pippidon.UI
{
[Cached]
public partial class PippidonPlayfield : ScrollingPlayfield
{
public const float LANE_HEIGHT = 70;
public const int LANE_COUNT = 6;
public BindableInt CurrentLane => pippidon.LanePosition;
private PippidonCharacter pippidon;
[BackgroundDependencyLoader]
private void load()
{
AddRangeInternal(new Drawable[]
{
new LaneContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Child = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding
{
Left = 200,
Top = LANE_HEIGHT / 2,
Bottom = LANE_HEIGHT / 2
},
Children = new Drawable[]
{
HitObjectContainer,
pippidon = new PippidonCharacter
{
Origin = Anchor.Centre,
},
}
},
},
});
}
private partial class LaneContainer : BeatSyncedContainer
{
private OsuColour colours;
private FillFlowContainer fill;
private readonly Container content = new Container
{
RelativeSizeAxes = Axes.Both,
};
protected override Container<Drawable> Content => content;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
this.colours = colours;
InternalChildren = new Drawable[]
{
fill = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Colour = colours.BlueLight,
Direction = FillDirection.Vertical,
},
content,
};
for (int i = 0; i < LANE_COUNT; i++)
{
fill.Add(new Lane
{
RelativeSizeAxes = Axes.X,
Height = LANE_HEIGHT,
});
}
}
private partial class Lane : CompositeDrawable
{
public Lane()
{
InternalChildren = new Drawable[]
{
new Box
{
Colour = Colour4.White,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = 0.95f,
},
};
}
}
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
{
if (effectPoint.KiaiMode)
fill.FlashColour(colours.PinkLight, 800, Easing.In);
}
}
}
}