mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
v 1.0.0
This commit is contained in:
parent
0828ecd037
commit
2998865184
9821 changed files with 90 additions and 90 deletions
78
Source/Assets/Scripts/GUI/DialogBoxes/DialogBox.cs
Normal file
78
Source/Assets/Scripts/GUI/DialogBoxes/DialogBox.cs
Normal file
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class DialogBox : MonoBehaviour
|
||||
{
|
||||
public List<GameObject> cloneObjects;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Pop()
|
||||
{
|
||||
Initialize();
|
||||
gameObject.SetActive(gameObject.activeSelf == false);
|
||||
}
|
||||
|
||||
public void RemoveCloneObjectsFromParent(Transform parent)
|
||||
{
|
||||
for (int i = 0; i < parent.childCount; i++)
|
||||
{ Destroy(parent.transform.GetChild(i).gameObject); }
|
||||
}
|
||||
|
||||
public GameObject AddCloneObjectToParent(Transform parent, int i = 0)
|
||||
{
|
||||
GameObject cloneObject = null;
|
||||
|
||||
if (cloneObjects != null && cloneObjects.Count > i)
|
||||
{ cloneObject = Instantiate(cloneObjects[i], parent); }
|
||||
|
||||
return cloneObject;
|
||||
}
|
||||
|
||||
public void AddCustomTag(InputField field, ref List<string> tags, ref List<string> customTags)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (tags.Contains(field.text) || customTags.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
customTags.Add(field.text);
|
||||
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void RemoveCustomTag(ref List<string> customTags, string tag)
|
||||
{
|
||||
customTags.Remove(tag);
|
||||
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void AddCustomRace(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
PawnRaceDefs.AddDef(new PawnRaceDef(field.text));
|
||||
|
||||
ApplicationManager.Instance.SavePawnRaceDefs();
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public virtual void Initialize(bool addedNewTag = false) { }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue