-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
132 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
fluXis.Game/Screens/Edit/Tabs/Design/Playfield/EditorDesignPlayfieldManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using System.Linq; | ||
using fluXis.Game.Map.Structures.Events; | ||
using fluXis.Game.Screens.Gameplay.Ruleset; | ||
using fluXis.Shared.Components.Maps; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
|
||
namespace fluXis.Game.Screens.Edit.Tabs.Design.Playfield; | ||
|
||
public partial class EditorDesignPlayfieldManager : CompositeDrawable | ||
{ | ||
[Resolved] | ||
private EditorMap map { get; set; } | ||
|
||
[Resolved] | ||
private EditorClock clock { get; set; } | ||
|
||
private LaneSwitchManager laneSwitchManager; | ||
private DependencyContainer dependencies; | ||
|
||
public int Count { get; } | ||
|
||
public EditorDesignPlayfieldManager(DualMode mode) | ||
{ | ||
Count = mode > DualMode.Disabled ? 2 : 1; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
RelativeSizeAxes = Axes.Both; | ||
|
||
dependencies.CacheAs(laneSwitchManager = new LaneSwitchManager(map.MapEvents.LaneSwitchEvents, map.RealmMap.KeyCount) | ||
{ | ||
KeepTransforms = true, | ||
Clock = clock | ||
}); | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
laneSwitchManager, | ||
new GridContainer | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Content = new[] | ||
{ | ||
Enumerable.Range(0, Count) | ||
.Select(i => new EditorDesignPlayfield(i)) | ||
.ToArray() | ||
} | ||
} | ||
}; | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
map.LaneSwitchEventAdded += reloadLaneSwitches; | ||
map.LaneSwitchEventUpdated += reloadLaneSwitches; | ||
map.LaneSwitchEventRemoved += reloadLaneSwitches; | ||
|
||
reloadLaneSwitches(null); | ||
} | ||
|
||
protected override void Dispose(bool isDisposing) | ||
{ | ||
base.Dispose(isDisposing); | ||
|
||
map.LaneSwitchEventAdded -= reloadLaneSwitches; | ||
map.LaneSwitchEventUpdated -= reloadLaneSwitches; | ||
map.LaneSwitchEventRemoved -= reloadLaneSwitches; | ||
} | ||
|
||
private void reloadLaneSwitches(LaneSwitchEvent _) | ||
{ | ||
laneSwitchManager.Rebuild(map.MapEvents.LaneSwitchEvents, map.RealmMap.KeyCount); | ||
} | ||
|
||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) | ||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
public enum DualMode | ||
{ | ||
Disabled, | ||
Enabled | ||
Mirrored | ||
} |