1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Merge pull request #55 from Tom94/better-addtarget

Better addtarget
This commit is contained in:
Dean Herbert 2016-10-09 20:13:30 +09:00 committed by GitHub
commit de24c86c81
7 changed files with 43 additions and 35 deletions

@ -1 +1 @@
Subproject commit c3a7ebd979c9a6b19871dc84337905f97c56a6aa
Subproject commit 1f770847b245e6d250e63e60c24e9e84131d15e7

View File

@ -19,17 +19,22 @@ namespace osu.Desktop.Tests
{
base.Reset();
KeyCounterCollection kc = new KeyCounterCollection
Children = new[]
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
IsCounting = true
new KeyCounterCollection
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
IsCounting = true,
Counters = new KeyCounter[]
{
new KeyCounterKeyboard(@"Z", Key.Z),
new KeyCounterKeyboard(@"X", Key.X),
new KeyCounterMouse(@"M1", MouseButton.Left),
new KeyCounterMouse(@"M2", MouseButton.Right),
},
},
};
Add(kc);
kc.AddKey(new KeyCounterKeyboard(@"Z", Key.Z));
kc.AddKey(new KeyCounterKeyboard(@"X", Key.X));
kc.AddKey(new KeyCounterMouse(@"M1", MouseButton.Left));
kc.AddKey(new KeyCounterMouse(@"M2", MouseButton.Right));
}
}
}

View File

@ -113,14 +113,17 @@ namespace osu.Game.GameModes.Menu
buttonFlow.Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0);
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"solo", @"freeplay", FontAwesome.user, new Color4(102, 68, 204, 255), OnSolo, wedge_width, Key.P)));
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), OnMulti, 0, Key.M)));
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), OnChart)));
buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.user, new Color4(102, 68, 204, 255), OnSolo, wedge_width, Key.P));
buttonsPlay.Add(new Button(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), OnMulti, 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), OnChart));
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, wedge_width, Key.P)));
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), OnEdit, 0, Key.E)));
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), OnDirect, 0, Key.D)));
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q)));
buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, wedge_width, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), OnEdit, 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), OnDirect, 0, Key.D));
buttonsTopLevel.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q));
buttonFlow.Add(buttonsPlay);
buttonFlow.Add(buttonsTopLevel);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -41,7 +41,7 @@ namespace osu.Game.GameModes
}
else if (bg != null)
{
AddTopLevel(new ParallaxContainer
AddInternal(new ParallaxContainer
{
Depth = float.MinValue,
Children = new[]
@ -51,7 +51,6 @@ namespace osu.Game.GameModes
});
}
base.OnEntering(last);
}

View File

@ -14,21 +14,21 @@ namespace osu.Game.Graphics.Containers
public ParallaxContainer()
{
RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container()
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
private Container content = new Container()
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
private Container content;
protected override Container AddTarget => content;
protected override Container Content => content;
public override void Load()
{
base.Load();
Add(content);
}
protected override bool OnMouseMove(InputState state)

View File

@ -22,18 +22,19 @@ namespace osu.Game.Graphics.UserInterface
set
{
foreach (var k in value)
AddKey(k);
addKey(k);
Children = value;
}
}
public void AddKey(KeyCounter key)
private void addKey(KeyCounter key)
{
counters.Add(key);
key.IsCounting = this.IsCounting;
key.FadeTime = this.FadeTime;
key.KeyDownTextColor = this.KeyDownTextColor;
key.KeyUpTextColor = this.KeyUpTextColor;
base.Add(key);
key.IsCounting = IsCounting;
key.FadeTime = FadeTime;
key.KeyDownTextColor = KeyDownTextColor;
key.KeyUpTextColor = KeyUpTextColor;
}
public void ResetCount()

View File

@ -21,7 +21,7 @@ namespace osu.Game
public Options Options;
public APIAccess API;
protected override Container AddTarget => ratioContainer?.IsLoaded == true ? ratioContainer : base.AddTarget;
protected override Container Content => ratioContainer?.IsLoaded == true ? ratioContainer : base.Content;
private RatioAdjust ratioContainer;