mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 03:02:54 +08:00
Fix some weird private field names
This commit is contained in:
parent
f3ec98d85f
commit
77b9989e11
@ -12,14 +12,14 @@ namespace osu.Game.Rulesets.Catch.MathUtils
|
|||||||
{
|
{
|
||||||
private const double int_to_real = 1.0 / (int.MaxValue + 1.0);
|
private const double int_to_real = 1.0 / (int.MaxValue + 1.0);
|
||||||
private const uint int_mask = 0x7FFFFFFF;
|
private const uint int_mask = 0x7FFFFFFF;
|
||||||
private const uint y = 842502087;
|
private const uint y_initial = 842502087;
|
||||||
private const uint z = 3579807591;
|
private const uint z_initial = 3579807591;
|
||||||
private const uint w = 273326509;
|
private const uint w_initial = 273326509;
|
||||||
private uint _x, _y = y, _z = z, _w = w;
|
private uint x, y = y_initial, z = z_initial, w = w_initial;
|
||||||
|
|
||||||
public FastRandom(int seed)
|
public FastRandom(int seed)
|
||||||
{
|
{
|
||||||
_x = (uint)seed;
|
x = (uint)seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FastRandom()
|
public FastRandom()
|
||||||
@ -33,11 +33,11 @@ namespace osu.Game.Rulesets.Catch.MathUtils
|
|||||||
/// <returns>The random value.</returns>
|
/// <returns>The random value.</returns>
|
||||||
public uint NextUInt()
|
public uint NextUInt()
|
||||||
{
|
{
|
||||||
uint t = _x ^ (_x << 11);
|
uint t = x ^ (x << 11);
|
||||||
_x = _y;
|
x = y;
|
||||||
_y = _z;
|
y = z;
|
||||||
_z = _w;
|
z = w;
|
||||||
return _w = _w ^ (_w >> 19) ^ t ^ (t >> 8);
|
return w = w ^ (w >> 19) ^ t ^ (t >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -83,22 +83,16 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScrollState _scrollState;
|
private ScrollState scrollState;
|
||||||
|
|
||||||
private ScrollState scrollState
|
private void setScrollState(ScrollState newstate)
|
||||||
{
|
{
|
||||||
get => _scrollState;
|
if (scrollState == newstate)
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_scrollState == value)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_scrollState = value;
|
|
||||||
|
|
||||||
delayedStateChangeDelegate?.Cancel();
|
delayedStateChangeDelegate?.Cancel();
|
||||||
|
|
||||||
switch (value)
|
switch (scrollState = newstate)
|
||||||
{
|
{
|
||||||
case ScrollState.Scrolling:
|
case ScrollState.Scrolling:
|
||||||
resetSelected();
|
resetSelected();
|
||||||
@ -113,7 +107,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
speedTo(0f, 2000);
|
speedTo(0f, 2000);
|
||||||
tracker.FadeIn(200);
|
tracker.FadeIn(200);
|
||||||
|
|
||||||
delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Stopped, 2300);
|
delayedStateChangeDelegate = Scheduler.AddDelayed(() => setScrollState(ScrollState.Stopped), 2300);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollState.Stopped:
|
case ScrollState.Stopped:
|
||||||
@ -153,7 +147,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
st.Selected = true;
|
st.Selected = true;
|
||||||
OnSelected?.Invoke(st.Team);
|
OnSelected?.Invoke(st.Team);
|
||||||
|
|
||||||
delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Idle, 10000);
|
delayedStateChangeDelegate = Scheduler.AddDelayed(() => setScrollState(ScrollState.Idle), 10000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollState.Idle:
|
case ScrollState.Idle:
|
||||||
@ -166,7 +160,6 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void AddTeam(TournamentTeam team)
|
public void AddTeam(TournamentTeam team)
|
||||||
{
|
{
|
||||||
@ -176,7 +169,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
availableTeams.Add(team);
|
availableTeams.Add(team);
|
||||||
|
|
||||||
RemoveAll(c => c is ScrollingTeam);
|
RemoveAll(c => c is ScrollingTeam);
|
||||||
scrollState = ScrollState.Idle;
|
setScrollState(ScrollState.Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTeams(IEnumerable<TournamentTeam> teams)
|
public void AddTeams(IEnumerable<TournamentTeam> teams)
|
||||||
@ -192,7 +185,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
{
|
{
|
||||||
availableTeams.Clear();
|
availableTeams.Clear();
|
||||||
RemoveAll(c => c is ScrollingTeam);
|
RemoveAll(c => c is ScrollingTeam);
|
||||||
scrollState = ScrollState.Idle;
|
setScrollState(ScrollState.Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveTeam(TournamentTeam team)
|
public void RemoveTeam(TournamentTeam team)
|
||||||
@ -217,7 +210,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
if (availableTeams.Count == 0)
|
if (availableTeams.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scrollState = ScrollState.Scrolling;
|
setScrollState(ScrollState.Scrolling);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopScrolling()
|
public void StopScrolling()
|
||||||
@ -232,13 +225,13 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollState = ScrollState.Stopping;
|
setScrollState(ScrollState.Stopping);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
scrollState = ScrollState.Idle;
|
setScrollState(ScrollState.Idle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -305,7 +298,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
private void speedTo(float value, double duration = 0, Easing easing = Easing.None) =>
|
private void speedTo(float value, double duration = 0, Easing easing = Easing.None) =>
|
||||||
this.TransformTo(nameof(speed), value, duration, easing);
|
this.TransformTo(nameof(speed), value, duration, easing);
|
||||||
|
|
||||||
private enum ScrollState
|
protected enum ScrollState
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Idle,
|
Idle,
|
||||||
|
@ -45,23 +45,25 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[JsonProperty("beatmap")]
|
[JsonProperty("beatmap")]
|
||||||
private APIBeatmap apiBeatmap { get; set; }
|
private APIBeatmap apiBeatmap { get; set; }
|
||||||
|
|
||||||
|
private APIMod[] allowedModsBacking;
|
||||||
|
|
||||||
[JsonProperty("allowed_mods")]
|
[JsonProperty("allowed_mods")]
|
||||||
private APIMod[] allowedMods
|
private APIMod[] allowedMods
|
||||||
{
|
{
|
||||||
get => AllowedMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
get => AllowedMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
||||||
set => _allowedMods = value;
|
set => allowedModsBacking = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private APIMod[] requiredModsBacking;
|
||||||
|
|
||||||
[JsonProperty("required_mods")]
|
[JsonProperty("required_mods")]
|
||||||
private APIMod[] requiredMods
|
private APIMod[] requiredMods
|
||||||
{
|
{
|
||||||
get => RequiredMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
get => RequiredMods.Select(m => new APIMod { Acronym = m.Acronym }).ToArray();
|
||||||
set => _requiredMods = value;
|
set => requiredModsBacking = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
private APIMod[] _allowedMods;
|
|
||||||
private APIMod[] _requiredMods;
|
|
||||||
|
|
||||||
public void MapObjects(BeatmapManager beatmaps, RulesetStore rulesets)
|
public void MapObjects(BeatmapManager beatmaps, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
@ -70,20 +72,20 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
Beatmap = apiBeatmap == null ? beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == BeatmapID) : apiBeatmap.ToBeatmap(rulesets);
|
Beatmap = apiBeatmap == null ? beatmaps.QueryBeatmap(b => b.OnlineBeatmapID == BeatmapID) : apiBeatmap.ToBeatmap(rulesets);
|
||||||
Ruleset = rulesets.GetRuleset(RulesetID);
|
Ruleset = rulesets.GetRuleset(RulesetID);
|
||||||
|
|
||||||
if (_allowedMods != null)
|
if (allowedModsBacking != null)
|
||||||
{
|
{
|
||||||
AllowedMods.Clear();
|
AllowedMods.Clear();
|
||||||
AllowedMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => _allowedMods.Any(m => m.Acronym == mod.Acronym)));
|
AllowedMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => allowedModsBacking.Any(m => m.Acronym == mod.Acronym)));
|
||||||
|
|
||||||
_allowedMods = null;
|
allowedModsBacking = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_requiredMods != null)
|
if (requiredModsBacking != null)
|
||||||
{
|
{
|
||||||
RequiredMods.Clear();
|
RequiredMods.Clear();
|
||||||
RequiredMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => _requiredMods.Any(m => m.Acronym == mod.Acronym)));
|
RequiredMods.AddRange(Ruleset.CreateInstance().GetAllMods().Where(mod => requiredModsBacking.Any(m => m.Acronym == mod.Acronym)));
|
||||||
|
|
||||||
_requiredMods = null;
|
requiredModsBacking = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,26 +188,22 @@ namespace osu.Game.Screens.Play
|
|||||||
InternalButtons.Add(button);
|
InternalButtons.Add(button);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _selectionIndex = -1;
|
private int selectionIndex = -1;
|
||||||
|
|
||||||
private int selectionIndex
|
private void setSelected(int value)
|
||||||
{
|
{
|
||||||
get => _selectionIndex;
|
if (selectionIndex == value)
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_selectionIndex == value)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Deselect the previously-selected button
|
// Deselect the previously-selected button
|
||||||
if (_selectionIndex != -1)
|
if (selectionIndex != -1)
|
||||||
InternalButtons[_selectionIndex].Selected.Value = false;
|
InternalButtons[selectionIndex].Selected.Value = false;
|
||||||
|
|
||||||
_selectionIndex = value;
|
selectionIndex = value;
|
||||||
|
|
||||||
// Select the newly-selected button
|
// Select the newly-selected button
|
||||||
if (_selectionIndex != -1)
|
if (selectionIndex != -1)
|
||||||
InternalButtons[_selectionIndex].Selected.Value = true;
|
InternalButtons[selectionIndex].Selected.Value = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
@ -218,16 +214,16 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
case Key.Up:
|
case Key.Up:
|
||||||
if (selectionIndex == -1 || selectionIndex == 0)
|
if (selectionIndex == -1 || selectionIndex == 0)
|
||||||
selectionIndex = InternalButtons.Count - 1;
|
setSelected(InternalButtons.Count - 1);
|
||||||
else
|
else
|
||||||
selectionIndex--;
|
setSelected(selectionIndex--);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Key.Down:
|
case Key.Down:
|
||||||
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
|
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
|
||||||
selectionIndex = 0;
|
setSelected(0);
|
||||||
else
|
else
|
||||||
selectionIndex++;
|
setSelected(selectionIndex++);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user