mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-13 05:05:08 +00:00
cbb912772f
* * in name when changing value * Popup UI and quit basics * Quit button finalized, i think * fix * fixed * right click dropdown prefab * tryna getit to work * woohoo it works * value reset support for text areas * Color reset support * Enums and numbers supported * catchy tune fix
58 lines
No EOL
1.6 KiB
C#
58 lines
No EOL
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System;
|
|
using System.Linq;
|
|
using TMPro;
|
|
using Starpelly;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
namespace HeavenStudio.Editor
|
|
{
|
|
public class EventPropertyPrefab : MonoBehaviour
|
|
{
|
|
public TMP_Text caption;
|
|
protected string _captionText;
|
|
public EventParameterManager parameterManager;
|
|
public string propertyName;
|
|
public List<PropertyCollapse> propertyCollapses = new List<PropertyCollapse>();
|
|
|
|
public void SetProperties(string propertyName, object type, string caption) {}
|
|
public virtual void SetCollapses(object type) { }
|
|
|
|
public void InitProperties(string propertyName, string caption)
|
|
{
|
|
this.parameterManager = EventParameterManager.instance;
|
|
this.propertyName = propertyName;
|
|
|
|
_captionText = caption;
|
|
|
|
this.caption.text = _captionText;
|
|
}
|
|
|
|
public void UpdateCollapse(object type)
|
|
{
|
|
foreach (var p in propertyCollapses)
|
|
{
|
|
foreach (var c in p.collapseables)
|
|
{
|
|
if (c != null) c.SetActive(p.collapseOn(type) && gameObject.activeSelf);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class PropertyCollapse
|
|
{
|
|
public List<GameObject> collapseables;
|
|
public Func<object, bool> collapseOn;
|
|
|
|
public PropertyCollapse(List<GameObject> collapseables, Func<object, bool> collapseOn)
|
|
{
|
|
this.collapseables = collapseables;
|
|
this.collapseOn = collapseOn;
|
|
}
|
|
}
|
|
}
|
|
} |