Skip to content

Commit

Permalink
Don't allow opening the editor with an auto-imported map.
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Jul 16, 2024
1 parent 91308bc commit 2a72d97
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
19 changes: 19 additions & 0 deletions fluXis.Game/Graphics/UserInterface/Panel/SingleButtonPanel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using fluXis.Game.Graphics.UserInterface.Buttons;
using fluXis.Game.Graphics.UserInterface.Buttons.Presets;
using osu.Framework.Graphics.Sprites;

namespace fluXis.Game.Graphics.UserInterface.Panel;

public partial class SingleButtonPanel : ButtonPanel
{
public SingleButtonPanel(IconUsage icon, string title, string sub, string button = "Okay.")
{
Icon = icon;
Text = title;
SubText = sub;
Buttons = new ButtonData[]
{
new CancelButtonData(button)
};
}
}
14 changes: 4 additions & 10 deletions fluXis.Game/Screens/Edit/Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,10 @@ protected override void LoadComplete()

if (!canSave)
{
panels.Content = new ButtonPanel
{
Icon = FontAwesome6.Solid.ExclamationTriangle,
Text = "This map is from another game!",
SubText = "You can edit and playtest, but not save or upload.",
Buttons = new ButtonData[]
{
new CancelButtonData("Okay")
}
};
panels.Content = new SingleButtonPanel(
FontAwesome6.Solid.ExclamationTriangle,
"This map is from another game!",
"You can edit and playtest, but not save or upload.");
}

backgroundDim.BindValueChanged(updateDim, true);
Expand Down
10 changes: 10 additions & 0 deletions fluXis.Game/Screens/Select/SelectScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using fluXis.Game.Database.Maps;
using fluXis.Game.Database.Score;
using fluXis.Game.Graphics.Background;
using fluXis.Game.Graphics.Sprites;
using fluXis.Game.Graphics.UserInterface;
using fluXis.Game.Graphics.UserInterface.Color;
using fluXis.Game.Graphics.UserInterface.Context;
Expand Down Expand Up @@ -887,6 +888,15 @@ public void EditMap(RealmMap map)
MapStore.Select(map, true);
if (MapStore.CurrentMap == null) return;

if (map.MapSet.AutoImported)
{
panels.Content = new SingleButtonPanel(
FontAwesome6.Solid.ExclamationTriangle,
"This map cannot be edited.",
"This map is auto-imported from a different game and cannot be opened in the editor.");
return;
}

var loadedMap = map.GetMapInfo();
if (loadedMap == null) return;

Expand Down

0 comments on commit 2a72d97

Please sign in to comment.