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
a55ba7b95b
commit
5ca7e486f8
243 changed files with 1065 additions and 625 deletions
|
@ -11,6 +11,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class KeyframeSlider : Slider, IPointerClickHandler, IBeginDragHandler, IEndDragHandler
|
||||
{
|
||||
public int keyframeID;
|
||||
public AnimationTimeline timeline;
|
||||
public Transform ghostSliders;
|
||||
public Slider ghostSliderPrefab;
|
||||
|
@ -18,33 +19,32 @@ namespace RimWorldAnimationStudio
|
|||
public GameObject soundIcon;
|
||||
public int maxGhosts = 4;
|
||||
|
||||
public int actorID;
|
||||
public int keyframeID;
|
||||
|
||||
private PawnAnimationClip clip;
|
||||
private PawnKeyframe keyframe;
|
||||
|
||||
private float dragTimeStart = -1f;
|
||||
private int dragTickStart = -1;
|
||||
|
||||
public KeyframeSlider linkedSlider;
|
||||
public PawnKeyframe pivotKeyframe;
|
||||
public int linkedOffset;
|
||||
|
||||
private PawnAnimationClip clip { get { return Workspace.GetPawnAnimationClip(actorID); } }
|
||||
private PawnKeyframe keyframe { get { return Workspace.GetPawnKeyframe(keyframeID); } }
|
||||
|
||||
private int actorID;
|
||||
private float dragTimeStart = -1f;
|
||||
private int dragTickStart = -1;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
|
||||
onValueChanged.AddListener(delegate (float value) { OnValueChanged(); });
|
||||
}
|
||||
|
||||
public void Initialize(AnimationTimeline timeline, int actorID, int keyframeID)
|
||||
{
|
||||
this.timeline = timeline;
|
||||
this.clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
this.keyframe = Workspace.GetPawnKeyframe(keyframeID);
|
||||
|
||||
this.actorID = actorID;
|
||||
this.keyframeID = keyframeID;
|
||||
|
||||
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(keyframeID);
|
||||
maxValue = Workspace.StageWindowSize;
|
||||
value = keyframe.atTick.Value;
|
||||
|
||||
onValueChanged.AddListener(delegate (float value) { OnValueChanged(); });
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
|
@ -119,7 +119,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
List<PawnKeyframe> selectedKeyframes = Workspace.GetPawnKeyframesByID(Workspace.keyframeID).Except(new List<PawnKeyframe>() { keyframe })?.ToList();
|
||||
|
||||
// Link other slected keyframes to the movement of this one
|
||||
// Link other selected keyframes to the movement of this one
|
||||
if (selectedKeyframes.NotNullOrEmpty())
|
||||
{
|
||||
pivotKeyframe = keyframe.atTick <= selectedKeyframes.Min(x => x.atTick) ?
|
||||
|
@ -215,6 +215,8 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
base.Update();
|
||||
|
||||
if (keyframe == null) return;
|
||||
|
||||
// Update outdated values
|
||||
if (Workspace.keyframeID.NullOrEmpty() || Workspace.keyframeID.Contains(keyframeID) == false)
|
||||
{ linkedSlider = null; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue