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,145 +1,130 @@
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
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 1
data:
first:
'': Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
data:
first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
data:
first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
data:
first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
data:
first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
data:
first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
data:
first:
iPhone: iOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
- first:
: Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXIntel: 1
Exclude OSXIntel64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 1
- first:
: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
OS: AnyOS
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXIntel
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXIntel64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

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)
{
@ -198,22 +198,25 @@ namespace RhythmHeavenMania.Editor.Track
public void OnClick()
{
if (Input.GetKey(KeyCode.LeftShift))
if (Input.GetMouseButton(0) && Timeline.instance.timelineState.selected)
{
Selections.instance.ShiftClickSelect(this);
}
else
{
if (!selected)
if (Input.GetKey(KeyCode.LeftShift))
{
Selections.instance.ClickSelect(this);
Selections.instance.ShiftClickSelect(this);
}
else
{
if (!selected)
{
Selections.instance.ClickSelect(this);
}
}
}
}
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)
{