mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Stage cards and basic stage management
This commit is contained in:
parent
1dd7781179
commit
f0d46df3d6
200 changed files with 2829 additions and 81 deletions
61
Assets/Scripts/GUI/StageCard.cs
Normal file
61
Assets/Scripts/GUI/StageCard.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/StageCard.cs.meta
Normal file
11
Assets/Scripts/GUI/StageCard.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20b2be62d5fdc4b4992cede005ec2aee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue