mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 05:35:08 +00:00
74f54df651
* put things in better places oh this looks. so much fucking better. wow * new icons and stuff * modifier, zoom formula, tab name tab name is future proofing. also, dllnotfoundexception when using the file explorer? wtf * dialog placement mostly working basically ready to pr. just gotta merge stuff into it * a few tweaks! all good now --------- Co-authored-by: ev <85412919+iloveoatmeal2022@users.noreply.github.com>
119 lines
No EOL
3.4 KiB
C#
119 lines
No EOL
3.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Editor.Track;
|
|
using HeavenStudio.InputSystem;
|
|
|
|
namespace HeavenStudio.Editor
|
|
{
|
|
public class Selections : MonoBehaviour
|
|
{
|
|
public List<TimelineEventObj> eventsSelected = new List<TimelineEventObj>();
|
|
|
|
public static Selections instance { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
// Should never happen to begin with.
|
|
/*
|
|
var buggedSelections = eventsSelected.FindAll(c => c == null);
|
|
if (buggedSelections.Count > 0)
|
|
{
|
|
for (int i = 0; i < buggedSelections.Count; i++)
|
|
Deselect(buggedSelections[i]);
|
|
}
|
|
*/
|
|
if (Editor.instance.isShortcutsEnabled)
|
|
{
|
|
if (Input.GetKey(InputKeyboard.MODIFIER))
|
|
if (Input.GetKeyDown(KeyCode.A))
|
|
SelectAll();
|
|
}
|
|
}
|
|
|
|
public void ClickSelect(TimelineEventObj eventToAdd)
|
|
{
|
|
DeselectAll();
|
|
eventsSelected.Add(eventToAdd);
|
|
eventToAdd.selected = true;
|
|
eventToAdd.OnSelect();
|
|
|
|
TimelineBlockManager.Instance.SortMarkers();
|
|
|
|
// CommandManager.instance.Execute(new Commands.Selection(new List<TimelineEventObj>() { eventToAdd } ));
|
|
}
|
|
|
|
public void ShiftClickSelect(TimelineEventObj eventToAdd)
|
|
{
|
|
if (!eventsSelected.Contains(eventToAdd))
|
|
{
|
|
eventToAdd.selected = true;
|
|
eventToAdd.OnSelect();
|
|
eventsSelected.Add(eventToAdd);
|
|
}
|
|
else
|
|
{
|
|
eventToAdd.selected = false;
|
|
eventToAdd.OnDeselect();
|
|
eventsSelected.Remove(eventToAdd);
|
|
}
|
|
TimelineBlockManager.Instance.SortMarkers();
|
|
}
|
|
|
|
public void DragSelect(TimelineEventObj eventToAdd)
|
|
{
|
|
if (!eventsSelected.Contains(eventToAdd))
|
|
{
|
|
eventToAdd.selected = true;
|
|
eventsSelected.Add(eventToAdd);
|
|
eventToAdd.OnSelect();
|
|
}
|
|
}
|
|
|
|
public void SelectAll()
|
|
{
|
|
return;
|
|
/*
|
|
DeselectAll();
|
|
var eventObjs = Timeline.instance.eventObjs;
|
|
for (int i = 0; i < eventObjs.Count; i++)
|
|
{
|
|
eventObjs[i].selected = true;
|
|
eventObjs[i].OnSelect();
|
|
|
|
eventsSelected.Add(eventObjs[i]);
|
|
}
|
|
TimelineBlockManager.Instance.SortMarkers();
|
|
*/
|
|
}
|
|
|
|
public void DeselectAll()
|
|
{
|
|
foreach (var @event in eventsSelected)
|
|
{
|
|
@event.selected = false;
|
|
@event.OnSelect();
|
|
}
|
|
eventsSelected.Clear();
|
|
TimelineBlockManager.Instance.SortMarkers();
|
|
}
|
|
|
|
public void Deselect(TimelineEventObj eventToDeselect)
|
|
{
|
|
if (eventsSelected.Contains(eventToDeselect))
|
|
{
|
|
eventToDeselect.selected = false;
|
|
eventToDeselect.OnDeselect();
|
|
eventsSelected.Remove(eventToDeselect);
|
|
}
|
|
TimelineBlockManager.Instance.SortMarkers();
|
|
}
|
|
}
|
|
} |