mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-15 06:05:10 +00:00
Merge branch 'release_1'
This commit is contained in:
commit
497ad916b7
4 changed files with 362 additions and 117 deletions
File diff suppressed because it is too large
Load diff
|
@ -20,6 +20,11 @@ namespace HeavenStudio.Editor
|
|||
|
||||
public bool selecting = false;
|
||||
|
||||
/// <summary>
|
||||
/// Are we currently drag selecting?
|
||||
/// </summary>
|
||||
public bool ActivelySelecting = false;
|
||||
|
||||
private bool clickedInTimeline = false;
|
||||
|
||||
private TMPro.TMP_Text sizeText;
|
||||
|
@ -86,6 +91,8 @@ namespace HeavenStudio.Editor
|
|||
|
||||
startPosition = MousePosition();
|
||||
selectionBox = new Rect();
|
||||
|
||||
ActivelySelecting = true;
|
||||
}
|
||||
|
||||
// dragging
|
||||
|
@ -105,6 +112,8 @@ namespace HeavenStudio.Editor
|
|||
endPosition = Vector2.zero;
|
||||
SelectEvents();
|
||||
DrawVisual();
|
||||
|
||||
ActivelySelecting = false;
|
||||
}
|
||||
|
||||
timelineLastX = timelineContent.transform.localPosition.x;
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace HeavenStudio.Editor.Track
|
|||
|
||||
[Header("Components")]
|
||||
[SerializeField] private RawImage waveform;
|
||||
public Texture2D resizeCursor;
|
||||
|
||||
public static float SnapInterval() { return instance.snapInterval; }
|
||||
|
||||
|
@ -259,11 +260,11 @@ namespace HeavenStudio.Editor.Track
|
|||
|
||||
ZoomInBTN.onClick.AddListener(delegate
|
||||
{
|
||||
zoomComponent.ZoomIn(1, Vector2.zero);
|
||||
zoomComponent.ZoomIn(0.015f * TimelineContent.localScale.x, Vector2.zero);
|
||||
});
|
||||
ZoomOutBTN.onClick.AddListener(delegate
|
||||
{
|
||||
zoomComponent.ZoomOut(-1, Vector2.zero);
|
||||
zoomComponent.ZoomOut(-0.0125f * TimelineContent.localScale.x, Vector2.zero);
|
||||
});
|
||||
ZoomResetBTN.onClick.AddListener(delegate
|
||||
{
|
||||
|
@ -307,6 +308,8 @@ namespace HeavenStudio.Editor.Track
|
|||
timelineState.SetState(CurrentTimelineState.State.Selection);
|
||||
|
||||
AutoBtnUpdate();
|
||||
|
||||
resizeCursor = Resources.Load<Texture2D>("Cursors/horizontal_resize");
|
||||
}
|
||||
|
||||
public void FitToSong()
|
||||
|
@ -743,9 +746,9 @@ namespace HeavenStudio.Editor.Track
|
|||
var action = EventCaller.instance.GetGameAction(game, eventName.Split(1));
|
||||
GameObject g = Instantiate(TimelineEventObjRef.gameObject, TimelineEventObjRef.parent);
|
||||
g.transform.localPosition = pos;
|
||||
g.transform.GetChild(3).GetComponent<TMP_Text>().text = action.displayName;
|
||||
|
||||
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
||||
eventObj.eventLabel.text = action.displayName;
|
||||
|
||||
if (eventName.Split(1) == "switchGame")
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
||||
|
|
|
@ -7,6 +7,7 @@ using Starpelly;
|
|||
using DG.Tweening;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
|
@ -24,10 +25,22 @@ namespace HeavenStudio.Editor.Track
|
|||
[SerializeField] private RectTransform PosPreviewRef;
|
||||
[SerializeField] public Image Icon;
|
||||
[SerializeField] private Image selectedImage;
|
||||
[SerializeField] private RectTransform outline;
|
||||
[SerializeField] private RectTransform resizeGraphic;
|
||||
[SerializeField] public TMP_Text eventLabel;
|
||||
|
||||
[SerializeField] private RectTransform resizeGraphicHolder;
|
||||
[SerializeField] private RectTransform resizeGraphicLeft;
|
||||
[SerializeField] private RectTransform resizeGraphicRight;
|
||||
[SerializeField] private RectTransform resizeGraphicLine;
|
||||
|
||||
[SerializeField] private RectTransform leftDrag;
|
||||
[SerializeField] private RectTransform rightDrag;
|
||||
|
||||
[SerializeField] private RectTransform outline;
|
||||
[SerializeField] private RectTransform outline1;
|
||||
[SerializeField] private RectTransform outline2;
|
||||
[SerializeField] private RectTransform outline3;
|
||||
[SerializeField] private RectTransform outline4;
|
||||
|
||||
// private GameObject moveTemp;
|
||||
|
||||
[Header("Properties")]
|
||||
|
@ -48,7 +61,6 @@ namespace HeavenStudio.Editor.Track
|
|||
public int eventObjID;
|
||||
|
||||
Timeline tl;
|
||||
Texture2D resizeCursor;
|
||||
float leftSide, rightSide;
|
||||
|
||||
[Header("Colors")]
|
||||
|
@ -62,10 +74,10 @@ namespace HeavenStudio.Editor.Track
|
|||
|
||||
if (!resizable)
|
||||
{
|
||||
Destroy(resizeGraphic.gameObject);
|
||||
Destroy(resizeGraphicHolder.gameObject);
|
||||
}
|
||||
|
||||
// what the fuck????
|
||||
// what the fuck???? -- I wonder if I wrote this?
|
||||
// moveTemp = new GameObject();
|
||||
// moveTemp.transform.SetParent(this.transform.parent);
|
||||
|
||||
|
@ -77,7 +89,6 @@ namespace HeavenStudio.Editor.Track
|
|||
}
|
||||
|
||||
tl = Timeline.instance;
|
||||
resizeCursor = Resources.Load<Texture2D>("Cursors/horizontal_resize");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -116,7 +127,40 @@ namespace HeavenStudio.Editor.Track
|
|||
|
||||
#endregion
|
||||
|
||||
SetColor(entity["track"]);
|
||||
// We need a helper function for this
|
||||
// I'm aware how messy this is, but considering this is all going to be destroyed in a while and nobody
|
||||
// wants to touch it, I think it's fine.
|
||||
if (visible)
|
||||
{
|
||||
var timelineScale = 100.0f / Timeline.instance.TimelineContent.localScale.x;
|
||||
Icon.rectTransform.localScale = new Vector3(timelineScale, Icon.rectTransform.localScale.y, Icon.rectTransform.localScale.z);
|
||||
Icon.rectTransform.anchoredPosition = new Vector2(0.08f * timelineScale, Icon.rectTransform.anchoredPosition.y);
|
||||
|
||||
if (resizeGraphicHolder != null)
|
||||
{
|
||||
resizeGraphicHolder.offsetMin = new Vector2(0.04f * timelineScale, resizeGraphicHolder.offsetMin.y);
|
||||
resizeGraphicHolder.offsetMax = new Vector2(0.04f * -timelineScale, resizeGraphicHolder.offsetMax.y);
|
||||
resizeGraphicLeft.localScale = new Vector3(timelineScale, resizeGraphicLeft.localScale.y, resizeGraphicLeft.localScale.z);
|
||||
resizeGraphicRight.localScale = new Vector3(-timelineScale, resizeGraphicRight.localScale.y, resizeGraphicRight.localScale.z);
|
||||
resizeGraphicLine.offsetMin = new Vector2(0.132f * timelineScale, resizeGraphicLine.offsetMin.y);
|
||||
resizeGraphicLine.offsetMax = new Vector2(0.132f * -timelineScale, resizeGraphicLine.offsetMax.y);
|
||||
}
|
||||
|
||||
eventLabel.rectTransform.offsetMax = new Vector2(0.04f * -timelineScale, eventLabel.rectTransform.offsetMax.y);
|
||||
eventLabel.rectTransform.localScale = new Vector3(timelineScale * 0.01f, eventLabel.rectTransform.localScale.y, eventLabel.rectTransform.localScale.z);
|
||||
|
||||
outline1.localScale = new Vector3(timelineScale, outline1.localScale.y, outline1.localScale.z);
|
||||
outline2.localScale = new Vector3(timelineScale, outline2.localScale.y, outline2.lossyScale.z);
|
||||
outline3.offsetMin = new Vector2(0.04f * timelineScale, outline3.offsetMin.y);
|
||||
outline3.offsetMax = new Vector2(0.04f * -timelineScale, outline3.offsetMax.y);
|
||||
outline4.offsetMin = new Vector2(0.04f * timelineScale, outline4.offsetMin.y);
|
||||
outline4.offsetMax = new Vector2(0.04f * -timelineScale, outline4.offsetMax.y);
|
||||
|
||||
leftDrag.localScale = new Vector3(timelineScale, leftDrag.localScale.y, leftDrag.localScale.z);
|
||||
rightDrag.localScale = new Vector3(timelineScale, rightDrag.localScale.y, rightDrag.localScale.z);
|
||||
|
||||
SetColor(entity["track"]);
|
||||
}
|
||||
|
||||
if (selected)
|
||||
{
|
||||
|
@ -247,10 +291,11 @@ namespace HeavenStudio.Editor.Track
|
|||
OnRightUp();
|
||||
}
|
||||
|
||||
if (!BoxSelection.instance.ActivelySelecting)
|
||||
if (resizing && selected || inResizeRegion && selected)
|
||||
{
|
||||
if (resizable)
|
||||
Cursor.SetCursor(resizeCursor, new Vector2(8, 8), CursorMode.Auto);
|
||||
Cursor.SetCursor(tl.resizeCursor, new Vector2(14, 14), CursorMode.Auto);
|
||||
}
|
||||
// should consider adding this someday
|
||||
// else if (moving && selected || mouseHovering && selected)
|
||||
|
@ -488,7 +533,6 @@ namespace HeavenStudio.Editor.Track
|
|||
c = EditorTheme.theme.properties.Layer5Col.Hex2RGB();
|
||||
break;
|
||||
}
|
||||
|
||||
// c = new Color(c.r, c.g, c.b, 0.85f);
|
||||
transform.GetChild(0).GetComponent<Image>().color = c;
|
||||
|
||||
|
|
Loading…
Reference in a new issue