mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 17:02:57 +08:00
Moved refresh button to directoryselector
This commit is contained in:
parent
4bc858a215
commit
fbbf51851e
@ -43,9 +43,17 @@ namespace osu.Game.Tournament.Screens
|
|||||||
private void load(Storage storage, OsuColour colours)
|
private void load(Storage storage, OsuColour colours)
|
||||||
{
|
{
|
||||||
// begin selection in the parent directory of the current storage location
|
// begin selection in the parent directory of the current storage location
|
||||||
var initialPath = new DirectoryInfo(stableInfo.StablePath.Value).FullName;
|
var initialPath = new DirectoryInfo(storage.GetFullPath(string.Empty)).Parent?.FullName;
|
||||||
|
|
||||||
AddInternal(new Container
|
if (!string.IsNullOrEmpty(stableInfo.StablePath.Value))
|
||||||
|
{
|
||||||
|
// If the original path info for osu! stable is not empty, set it to the parent directory of that location
|
||||||
|
initialPath = new DirectoryInfo(stableInfo.StablePath.Value).Parent?.FullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
CornerRadius = 10,
|
CornerRadius = 10,
|
||||||
@ -89,6 +97,14 @@ namespace osu.Game.Tournament.Screens
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Drawable[]
|
new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(20),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new TriangleButton
|
new TriangleButton
|
||||||
{
|
{
|
||||||
@ -96,22 +112,38 @@ namespace osu.Game.Tournament.Screens
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Width = 300,
|
Width = 300,
|
||||||
Text = "Select stable path",
|
Text = "Select stable path",
|
||||||
Action = () => { start(storage); }
|
Action = () => changePath(storage)
|
||||||
|
},
|
||||||
|
new TriangleButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 300,
|
||||||
|
Text = "Auto detect",
|
||||||
|
Action = autoDetect
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new BackButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
State = { Value = Visibility.Visible },
|
||||||
|
Action = () => sceneManager?.SetScreen(typeof(SetupScreen))
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool checkExists(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
|
private void changePath(Storage storage)
|
||||||
|
|
||||||
private void start(Storage storage)
|
|
||||||
{
|
{
|
||||||
var target = directorySelector.CurrentDirectory.Value.FullName;
|
var target = directorySelector.CurrentDirectory.Value.FullName;
|
||||||
|
|
||||||
if (checkExists(target))
|
if (File.Exists(Path.Combine(target, "ipc.txt")))
|
||||||
{
|
{
|
||||||
stableInfo.StablePath.Value = target;
|
stableInfo.StablePath.Value = target;
|
||||||
|
|
||||||
@ -145,5 +177,22 @@ namespace osu.Game.Tournament.Screens
|
|||||||
// Return an error in the picker that the directory does not contain ipc.txt
|
// Return an error in the picker that the directory does not contain ipc.txt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void autoDetect()
|
||||||
|
{
|
||||||
|
var fileBasedIpc = ipc as FileBasedIPC;
|
||||||
|
fileBasedIpc?.LocateStableStorage();
|
||||||
|
if (fileBasedIpc?.IPCStorage == null)
|
||||||
|
{
|
||||||
|
// Could not auto detect
|
||||||
|
overlay = new DialogOverlay();
|
||||||
|
overlay.Push(new IPCNotFoundDialog());
|
||||||
|
AddInternal(overlay);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sceneManager?.SetScreen(typeof(SetupScreen));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user