51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class StageCardManager : Singleton<StageCardManager>
|
|
{
|
|
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<InputField>().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); }
|
|
}
|
|
}
|
|
}
|