2022-02-03 22:20:26 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
2022-02-20 13:31:55 +00:00
|
|
|
using System;
|
2022-08-19 01:28:05 +00:00
|
|
|
using System.Linq;
|
2022-02-03 22:20:26 +00:00
|
|
|
using TMPro;
|
2022-02-08 01:07:03 +00:00
|
|
|
using Starpelly;
|
2022-02-03 22:20:26 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-02-04 22:16:22 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio.Editor
|
2022-02-03 22:20:26 +00:00
|
|
|
{
|
|
|
|
public class EventPropertyPrefab : MonoBehaviour
|
|
|
|
{
|
|
|
|
public TMP_Text caption;
|
2023-10-14 01:43:44 +00:00
|
|
|
protected string _captionText;
|
2022-08-23 14:27:30 +00:00
|
|
|
public EventParameterManager parameterManager;
|
|
|
|
public string propertyName;
|
2023-08-16 11:00:27 +00:00
|
|
|
public List<PropertyCollapse> propertyCollapses = new List<PropertyCollapse>();
|
2022-02-04 22:16:22 +00:00
|
|
|
|
2022-08-23 14:27:30 +00:00
|
|
|
public void SetProperties(string propertyName, object type, string caption) {}
|
2023-08-16 11:00:27 +00:00
|
|
|
public virtual void SetCollapses(object type) { }
|
2022-02-03 22:20:26 +00:00
|
|
|
|
2022-08-23 14:27:30 +00:00
|
|
|
public void InitProperties(string propertyName, string caption)
|
2022-02-03 22:20:26 +00:00
|
|
|
{
|
2022-08-23 14:27:30 +00:00
|
|
|
this.parameterManager = EventParameterManager.instance;
|
2022-02-03 22:20:26 +00:00
|
|
|
this.propertyName = propertyName;
|
2023-10-14 01:43:44 +00:00
|
|
|
|
|
|
|
_captionText = caption;
|
|
|
|
|
|
|
|
this.caption.text = _captionText;
|
2022-02-03 22:20:26 +00:00
|
|
|
}
|
2023-08-16 11:00:27 +00:00
|
|
|
|
|
|
|
public void UpdateCollapse(object type)
|
|
|
|
{
|
|
|
|
foreach (var p in propertyCollapses)
|
|
|
|
{
|
|
|
|
foreach (var c in p.collapseables)
|
|
|
|
{
|
2023-10-14 01:43:44 +00:00
|
|
|
if (c != null) c.SetActive(p.collapseOn(type) && gameObject.activeSelf);
|
2023-08-16 11:00:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2022-02-03 22:20:26 +00:00
|
|
|
}
|
|
|
|
}
|