using Simulator.Data; using System.Collections.Generic; using UnityEngine; using UVC.UI.Window.PropertyWindow; public class SinkProperty : MonoBehaviour { [SerializeField] private PropertyWindow propertyWindow; private void Awake() { //propertyWindow.PropertyValueChanged += OnPropertyValueChanged; } public void SetProertyWindow(ComponentType type, ComponentDataBase data) { Debug.Log(data); switch (type) { case ComponentType.Sink: InitSinkProperty(data as SinkDataClass); break; } } void SaveChange(object source, object value, string name) { var path = PathIndexer.GetNodePath(source); Patch updateData = new Patch(); updateData.value = value; UpdateValueStack.AddPatch($"{path}.{name}", value); } public void InitSinkProperty(SinkDataClass sink) { List entries = new List { new StringProperty("name", "이름", sink.name) { IsReadOnly=true }, new StringProperty("label", "라벨", sink.label) { IsReadOnly=false }.Bind( setter: v => {sink.label = v;SaveChange(sink,v,"label"); } ), new Vector2Property("Position","X,Y 좌표(m)", new Vector2(sink.physical.position.x,sink.physical.position.z)) { IsReadOnly=false }.Bind( setter: v => {sink.physical.position.x = v.x;sink.physical.position.z = v.y; SaveChange(sink,v,"physical.position"); } ) }; propertyWindow.LoadMixedProperties(entries); } }