mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
e14a12f2ab
commit
af4dab5546
278 changed files with 468 additions and 668 deletions
26
Assets/Scripts/GUI/SnapToKeyframe.cs
Normal file
26
Assets/Scripts/GUI/SnapToKeyframe.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SnapToKeyframe : MonoBehaviour, IDragHandler
|
||||
{
|
||||
private Slider slider;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
slider = GetComponent<Slider>();
|
||||
}
|
||||
|
||||
public void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
int targetTick = Workspace.FindClosestKeyFrameAtTick((int)slider.value, Mathf.CeilToInt(Workspace.StageWindowSize * 0.01f));
|
||||
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{ slider.value = (float)targetTick; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue