2022-09-15 05:17:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2022-09-21 21:15:25 +00:00
|
|
|
|
using System.Reflection;
|
2022-09-15 05:17:44 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
namespace RimWorldAnimationStudio
|
|
|
|
|
{
|
|
|
|
|
public class DialogBox : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public List<GameObject> cloneObjects;
|
|
|
|
|
|
2022-09-21 21:15:25 +00:00
|
|
|
|
public void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-15 05:17:44 +00:00
|
|
|
|
public void Pop()
|
|
|
|
|
{
|
2022-10-25 04:43:25 +00:00
|
|
|
|
Initialize();
|
2022-09-15 05:17:44 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2022-09-21 21:15:25 +00:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-12 05:22:29 +00:00
|
|
|
|
public void RemoveCustomTag(ref List<string> customTags, string tag)
|
|
|
|
|
{
|
|
|
|
|
customTags.Remove(tag);
|
|
|
|
|
|
|
|
|
|
ApplicationManager.Instance.SaveCustomArrays();
|
|
|
|
|
Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-24 07:17:40 +00:00
|
|
|
|
public void AddCustomRace(InputField field)
|
|
|
|
|
{
|
|
|
|
|
if (field?.text == null || field.text == "")
|
|
|
|
|
{ return; }
|
|
|
|
|
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnRaceDefs.AddDef(new PawnRaceDef(field.text));
|
2022-09-24 07:17:40 +00:00
|
|
|
|
|
2022-10-27 05:56:04 +00:00
|
|
|
|
ApplicationManager.Instance.SavePawnRaceDefs();
|
2022-09-24 07:17:40 +00:00
|
|
|
|
Initialize(true);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-21 21:15:25 +00:00
|
|
|
|
public virtual void Initialize(bool addedNewTag = false) { }
|
2022-09-15 05:17:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|