Make sure you can only select when the selection state is set

This commit is contained in:
Braedon 2022-01-30 14:04:15 -05:00
parent bc8f7419be
commit a910701b1c
4 changed files with 139 additions and 146 deletions

View file

@ -1,17 +1,18 @@
fileFormatVersion: 2
guid: e60958662eed5413d86143a0a69b731e
timeCreated: 1491979494
licenseType: Pro
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
data:
first:
'': Any
- first:
: Any
second:
enabled: 0
settings:
@ -27,113 +28,97 @@ PluginImporter:
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 1
data:
first:
'': Editor
- first:
: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
- first:
Any:
second:
enabled: 0
settings: {}
data:
first:
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
data:
first:
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
data:
first:
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
data:
first:
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
- first:
iPhone: iOS
second:
enabled: 0

View file

@ -20,6 +20,8 @@ namespace RhythmHeavenMania.Editor
public bool selecting = false;
private bool clickedInTimeline = false;
public static BoxSelection instance { get; private set; }
private void Awake()
@ -46,7 +48,7 @@ namespace RhythmHeavenMania.Editor
return;
}
if (Conductor.instance.NotStopped())
if (Conductor.instance.NotStopped() || !Timeline.instance.timelineState.selected)
{
startPosition = Vector2.zero;
endPosition = Vector2.zero;
@ -57,12 +59,14 @@ namespace RhythmHeavenMania.Editor
// click
if (Input.GetMouseButtonDown(0))
{
clickedInTimeline = Timeline.instance.CheckIfMouseInTimeline();
startPosition = MousePosition();
selectionBox = new Rect();
}
// dragging
if (Input.GetMouseButton(0))
if (Input.GetMouseButton(0) && clickedInTimeline)
{
endPosition = MousePosition();
DrawVisual();

View file

@ -134,6 +134,7 @@ namespace RhythmHeavenMania.Editor
}
}
if (Timeline.instance.timelineState.selected == true)
if (Input.GetMouseButtonUp(0) && Timeline.instance.CheckIfMouseInTimeline())
{
List<TimelineEventObj> selectedEvents = Timeline.instance.eventObjs.FindAll(c => c.selected == true && c.eligibleToMove == true);

View file

@ -66,7 +66,7 @@ namespace RhythmHeavenMania.Editor.Track
selected = Selections.instance.eventsSelected.Contains(this);
entity = GameManager.instance.Beatmap.entities.Find(a => a.eventObj == this);
mouseHovering = RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Camera.main);
mouseHovering = RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition, Camera.main) && Timeline.instance.timelineState.selected;
#region Optimizations
@ -117,7 +117,7 @@ namespace RhythmHeavenMania.Editor.Track
if (!resizing)
{
if (Input.GetMouseButtonUp(0) && Timeline.instance.CheckIfMouseInTimeline())
if (Input.GetMouseButtonUp(0) && Timeline.instance.CheckIfMouseInTimeline() && Timeline.instance.timelineState.selected)
{
if (Timeline.instance.eventObjs.FindAll(c => c.mouseHovering).Count == 0 && Timeline.instance.eventObjs.FindAll(c => c.moving).Count == 0 && !BoxSelection.instance.selecting && Timeline.instance.eventObjs.FindAll(c => c.resizing).Count == 0)
{
@ -197,6 +197,8 @@ namespace RhythmHeavenMania.Editor.Track
#region ClickEvents
public void OnClick()
{
if (Input.GetMouseButton(0) && Timeline.instance.timelineState.selected)
{
if (Input.GetKey(KeyCode.LeftShift))
{
@ -210,10 +212,11 @@ namespace RhythmHeavenMania.Editor.Track
}
}
}
}
public void OnDown()
{
if (selected)
if (selected && Timeline.instance.timelineState.selected)
{
lastPos_ = transform.localPosition;
@ -235,7 +238,7 @@ namespace RhythmHeavenMania.Editor.Track
// lastPos_ = this.lastPos_;
// previousPos = this.transform.localPosition;
if (selected)
if (selected && Timeline.instance.timelineState.selected)
{
if (eligibleToMove)
{