using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace RimWorldAnimationStudio { public class StageCardManager : Singleton { public StageCard stageCardPrefab; public void Initialize() { foreach(AnimationStage stage in Workspace.animationDef.animationStages) { MakeStageCard(stage.stageName); } } public StageCard MakeStageCard(string stageName = null) { StageCard stageCard = Instantiate(stageCardPrefab, transform); if (stageName != null) { stageCard.transform.Find("StageNameField").GetComponent().text = stageName; } return stageCard; } public void OnNewStage() { MakeStageCard(); } public void OnCloneStage() { if (AnimationController.Instance.CloneAnimationStage()) { StageCard stageCard = MakeStageCard(Workspace.animationDef.animationStages[Workspace.stageID + 1].stageName); stageCard.transform.SetSiblingIndex(Workspace.stageID + 1); } } public void OnDeleteStage() { if (AnimationController.Instance.RemoveAnimationStage()) { Destroy(transform.GetChild(Workspace.stageID).gameObject); } } } }