mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Hide placement when cursor is not in the playfield
This commit is contained in:
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.States;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
@ -18,7 +19,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
public class BlueprintContainer : CompositeDrawable
|
||||
{
|
||||
private SelectionBlueprintContainer selectionBlueprints;
|
||||
|
||||
private Container<PlacementBlueprint> placementBlueprintContainer;
|
||||
private PlacementBlueprint currentPlacement;
|
||||
|
||||
private SelectionBox selectionBox;
|
||||
|
||||
private IEnumerable<SelectionBlueprint> selections => selectionBlueprints.Children.Where(c => c.IsAlive);
|
||||
@ -26,6 +30,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
[Resolved]
|
||||
private HitObjectComposer composer { get; set; }
|
||||
|
||||
private InputManager inputManager;
|
||||
|
||||
public BlueprintContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
@ -53,6 +59,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
AddBlueprintFor(obj);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
}
|
||||
|
||||
private HitObjectCompositionTool currentTool;
|
||||
|
||||
/// <summary>
|
||||
@ -117,16 +130,27 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (composer.RulesetContainer.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position))
|
||||
currentPlacement?.Show();
|
||||
else if (currentPlacement?.PlacementBegun == false)
|
||||
currentPlacement?.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the current placement tool.
|
||||
/// </summary>
|
||||
private void refreshTool()
|
||||
{
|
||||
placementBlueprintContainer.Clear();
|
||||
currentPlacement = null;
|
||||
|
||||
var blueprint = CurrentTool?.CreatePlacementBlueprint();
|
||||
if (blueprint != null)
|
||||
placementBlueprintContainer.Child = blueprint;
|
||||
placementBlueprintContainer.Child = currentPlacement = blueprint;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user