mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
58 lines
2 KiB
C#
58 lines
2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class StageLoopsCard : MonoBehaviour
|
|
{
|
|
public InputField stageLoopsNormalField;
|
|
public InputField stageLoopsQuickField;
|
|
|
|
public void Start()
|
|
{
|
|
EventsManager.onAnimationChanged.AddListener(delegate { UpdateInputFields(); });
|
|
EventsManager.onStageIDChanged.AddListener(delegate { UpdateInputFields(); });
|
|
EventsManager.onAnimationStageChanged.AddListener(delegate { UpdateInputFields(); });
|
|
|
|
stageLoopsNormalField.onEndEdit.AddListener(delegate { OnStageLoopsNormalFieldChange(); });
|
|
stageLoopsQuickField.onEndEdit.AddListener(delegate { OnStageLoopsFastFieldChange(); });
|
|
|
|
UpdateInputFields();
|
|
}
|
|
|
|
public void OnStageLoopsNormalFieldChange()
|
|
{
|
|
if (Workspace.animationDef == null) return;
|
|
|
|
Workspace.GetCurrentAnimationStage().StageLoopsNormal = int.Parse(stageLoopsNormalField.text);
|
|
|
|
EventsManager.OnAnimationStageChanged(Workspace.GetCurrentAnimationStage());
|
|
Workspace.RecordEvent("Cycle count (normal)");
|
|
|
|
UpdateInputFields();
|
|
}
|
|
|
|
public void OnStageLoopsFastFieldChange()
|
|
{
|
|
if (Workspace.animationDef == null) return;
|
|
|
|
Workspace.GetCurrentAnimationStage().StageLoopsQuick = int.Parse(stageLoopsQuickField.text);
|
|
|
|
EventsManager.OnAnimationStageChanged(Workspace.GetCurrentAnimationStage());
|
|
Workspace.RecordEvent("Cycle count (fast)");
|
|
|
|
UpdateInputFields();
|
|
}
|
|
|
|
public void UpdateInputFields()
|
|
{
|
|
stageLoopsNormalField.SetTextWithoutNotify(Workspace.GetCurrentAnimationStage().StageLoopsNormal.ToString());
|
|
stageLoopsQuickField.SetTextWithoutNotify(Workspace.GetCurrentAnimationStage().StageLoopsQuick.ToString());
|
|
}
|
|
}
|
|
}
|