merge and property
This commit is contained in:
2025-12-24 17:36:01 +09:00
parent d4764e304f
commit 6b78b68229
109 changed files with 14167 additions and 625 deletions

View File

@@ -0,0 +1,101 @@
using Simulator.Data;
using System.Collections.Generic;
using UnityEngine;
using UVC.UI.Window.PropertyWindow;
public class ProcessorProperty : 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.Processor:
InitSourceProperty(data as ProcessorDataClass);
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 InitSourceProperty(ProcessorDataClass processor)
{
List<IPropertyEntry> entries = new List<IPropertyEntry>
{
new StringProperty("name", "이름", processor.name)
{
IsReadOnly = true
},
new StringProperty("label", "라벨", processor.label)
{
IsReadOnly = false
}.Bind(
setter: v => { processor.label = v; SaveChange(processor, v, "label"); }
),
new Vector2Property("Position", "X,Y 좌표(m)", new Vector2(processor.physical.position.x, processor.physical.position.z))
{
IsReadOnly = false
}.Bind(
setter: v => { processor.physical.position.x = v.x; processor.physical.position.z = v.y; SaveChange(processor, v, "physical.position"); }
),
new ListProperty("processing_type","처리 유형",new List<string>(){ "combine","seperate","transform" },processor.processor_type)
{
IsReadOnly = false
}.Bind(
setter: v => { processor.processor_type=v; SaveChange(processor, v, "processing_type"); }
),
CreateDynamicVisibilityTestGroup()
};
propertyWindow.LoadMixedProperties(entries);
}
private void OnPropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
{
Debug.Log($"[PropertyChanged] Id:{e.PropertyId}, Type:{e.PropertyType}, Value:{e.NewValue}");
// 동적 그룹 표시/비표시 테스트
if (e.PropertyId == "display_mode_TimePolicy")
{
string selectedMode = e.NewValue.ToString();
// HandleDisplayModeChanged_TimePolicy(selectedMode);
}
if (e.PropertyId == "display_mode_CountPolicy")
{
string selectedMode = e.NewValue.ToString();
//HandleDisplayModeChanged_CountPolicy(selectedMode);
}
if (e.PropertyId == "display_mode_DefectPolicy")
{
string selectedMode = e.NewValue.ToString();
//HandleDisplayModeChanged_DefectPolicy(selectedMode);
}
}
private PropertyGroup CreateDynamicVisibilityTestGroup()
{
var group = new PropertyGroup("dynamic_test", "투입 개체", isExpanded: true);
int count = 0;
foreach(var prefab in PrefabManager.Instance.prefabDict)
{
var property = new BoolProperty($"prefab{count}", prefab.Key, false);
group.AddItem(property);
}
return group;
}
}