mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
61 lines
No EOL
1.6 KiB
C#
61 lines
No EOL
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class StageCard : MonoBehaviour
|
|
{
|
|
private Image banner;
|
|
private Toggle toggle;
|
|
|
|
public void OnNameChange()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnSelectStage()
|
|
{
|
|
if (GetComponent<Toggle>().isOn && Workspace.stageID != transform.GetSiblingIndex())
|
|
{ Workspace.stageID = transform.GetSiblingIndex(); }
|
|
}
|
|
|
|
public void OnMoveStage(int delta)
|
|
{
|
|
if (AnimationController.Instance.MoveAnimationStage(transform.GetSiblingIndex(), delta))
|
|
{
|
|
int siblingCount = transform.parent.childCount;
|
|
int index = Mathf.Clamp(transform.GetSiblingIndex() + delta, 0, siblingCount - 1);
|
|
|
|
transform.SetSiblingIndex(index);
|
|
}
|
|
}
|
|
|
|
public void Start()
|
|
{
|
|
banner = transform.Find("Banner").GetComponent<Image>();
|
|
toggle = GetComponent<Toggle>();
|
|
toggle.group = StageCardManager.Instance.GetComponent<ToggleGroup>();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if (Workspace.stageID == transform.GetSiblingIndex())
|
|
{
|
|
banner.gameObject.SetActive(true);
|
|
|
|
if (toggle.isOn == false)
|
|
{ toggle.isOn = true; }
|
|
}
|
|
|
|
else
|
|
{
|
|
banner.gameObject.SetActive(false);
|
|
|
|
if (toggle.isOn)
|
|
{ toggle.isOn = false; }
|
|
}
|
|
}
|
|
}
|
|
} |