从旧版中移植,Prefab未确认

This commit is contained in:
2025-07-24 15:41:28 +08:00
parent 86842492ea
commit 43b824b722
300 changed files with 101926 additions and 14 deletions

View File

@@ -0,0 +1,75 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Convention.WindowsUI;
using Convention.WindowsUI.Variant;
using UnityEngine;
namespace Convention.Workflow
{
[Serializable, ArgPackage]
public class ResourceNodeInfo : StartNodeInfo
{
[NonSerialized] private string l_resource = WorkflowManager.Transformer(nameof(resource));
[InspectorDraw(InspectorDrawType.Text, true, true, nameGenerater: nameof(l_resource))]
public string resource = "unknown";
public ResourceNodeInfo() : this("") { }
public ResourceNodeInfo(string resource, string outmappingName = "value")
{
this.resource = resource;
this.outmapping = new()
{
{
outmappingName, new NodeSlotInfo()
{
slotName = outmappingName,
typeIndicator = "string",
IsInmappingSlot = false,
}
}
};
this.inmapping = new();
this.title = "Resource";
}
protected override NodeInfo CreateTemplate()
{
return new ResourceNodeInfo();
}
protected override void CloneValues([In] NodeInfo clonen)
{
((ResourceNodeInfo)clonen).resource = this.resource;
base.CloneValues(clonen);
}
}
public class ResourceNode : StartNode, IText
{
[Resources, OnlyNotNullMode] public ModernUIInputField InputField;
[Content, OnlyPlayMode] public bool isEditing = false;
public ResourceNodeInfo MyResourceNodeInfo => this.info as ResourceNodeInfo;
public string text { get => ((IText)this.InputField).text; set => ((IText)this.InputField).text = value; }
protected override void Start()
{
base.Start();
InputField.InputFieldSource.Source.onSelect.AddListener(_ => isEditing = true);
InputField.InputFieldSource.Source.onEndEdit.AddListener(str =>
{
MyResourceNodeInfo.resource = str;
isEditing = false;
});
}
private void LateUpdate()
{
if (info != null && this.isEditing == false && RectTransformExtension.IsVisible(this.rectTransform))
{
this.text = this.MyResourceNodeInfo.resource;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 24bfe76a1dd2f914c8222f30cf7e61b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Convention.WindowsUI;
using Convention.WindowsUI.Variant;
using UnityEngine;
namespace Convention.Workflow
{
public class SelectorNodeInfo : StartNodeInfo
{
public virtual IEnumerable<string> EnumNamesGenerater()
{
return new List<string>()
{
WorkflowManager.Transformer("unknown")
};
}
[NonSerialized] private string l_select = WorkflowManager.Transformer(nameof(select));
[InspectorDraw(InspectorDrawType.Enum, true, false, nameGenerater: nameof(l_select), enumGenerater: nameof(EnumNamesGenerater))]
public string select = "";
public SelectorNodeInfo() : this("") { }
public SelectorNodeInfo(string select, string outputName = "select")
{
this.select = select;
this.outmapping = new()
{
{
outputName, new NodeSlotInfo()
{
slotName = outputName,
typeIndicator="string",
IsInmappingSlot=false
}
}
};
this.inmapping = new();
this.title = "Selector";
}
protected override NodeInfo CreateTemplate()
{
return new SelectorNodeInfo();
}
protected override void CloneValues([In] NodeInfo clonen)
{
var info = (SelectorNodeInfo)clonen;
info.select = select;
info.outmapping = new(outmapping);
base.CloneValues(clonen);
}
}
public class SelectorNode : StartNode
{
[Resources, OnlyNotNullMode,SerializeField] private ModernUIDropdown DropDown;
public SelectorNodeInfo MySelectorInfo => info as SelectorNodeInfo;
protected override void Start()
{
base.Start();
DropDown.AddListener(x => MySelectorInfo.select = x);
}
protected virtual void RebuildDropDown(ModernUIDropdown dropdown, SelectorNodeInfo info)
{
foreach (var name in info.EnumNamesGenerater())
{
dropdown.CreateOption(name);
}
dropdown.RefreshImmediate();
if (string.IsNullOrEmpty(info.select) == false)
dropdown.Select(info.select);
}
protected override void WhenSetup(NodeInfo info)
{
RebuildDropDown(DropDown, info as SelectorNodeInfo);
base.WhenSetup(info);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3f9707e651688bd4f89ece4047a68b95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
using System.Linq;
using Convention.WindowsUI;
using Convention.WindowsUI.Variant;
using UnityEngine;
namespace Convention.Workflow
{
public class TextNodeInfo : StartNodeInfo
{
private string l_text => WorkflowManager.Transformer(nameof(text));
[InspectorDraw(InspectorDrawType.Text, nameGenerater: nameof(l_text))]
public string text;
public TextNodeInfo() : this("") { }
public TextNodeInfo(string text, string outmappingName = "text")
{
this.text = text;
this.outmapping = new()
{
{
outmappingName, new NodeSlotInfo()
{
slotName = outmappingName,
typeIndicator = "string",
IsInmappingSlot = false,
}
}
};
this.inmapping = new();
this.title = "Text";
}
protected override NodeInfo CreateTemplate()
{
return new TextNodeInfo();
}
protected override void CloneValues([In] NodeInfo clonen)
{
((TextNodeInfo)clonen).text = text;
base.CloneValues(clonen);
}
}
public class TextNode : StartNode, IText
{
[Resources, OnlyNotNullMode] public ModernUIInputField InputField;
[Content, OnlyPlayMode] public bool isEditing = false;
public TextNodeInfo MyTextNodeInfo => this.info as TextNodeInfo;
public string text { get => ((IText)this.InputField).text; set => ((IText)this.InputField).text = value; }
protected override void Start()
{
base.Start();
InputField.InputFieldSource.Source.onSelect.AddListener(_ => isEditing = true);
InputField.InputFieldSource.Source.onEndEdit.AddListener(str =>
{
MyTextNodeInfo.text = str;
isEditing = false;
});
}
private void LateUpdate()
{
if (info != null && this.isEditing == false && RectTransformExtension.IsVisible(this.rectTransform))
{
this.text = this.MyTextNodeInfo.text;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eaab2d787a0d66642a89d8b957606de5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,96 @@
using System;
using System.Linq;
using Convention.WindowsUI;
using Convention.WindowsUI.Variant;
using UnityEngine;
namespace Convention.Workflow
{
public class ValueNodeInfo : StartNodeInfo
{
[NonSerialized] private string l_value = WorkflowManager.Transformer(nameof(value));
[InspectorDraw(InspectorDrawType.Text, true, true, nameGenerater: nameof(l_value))]
public float value = 0;
[NonSerialized] private string l_min = WorkflowManager.Transformer(nameof(min));
[InspectorDraw(InspectorDrawType.Auto, true, true, nameGenerater: nameof(l_min))]
public float min = 0;
[NonSerialized]private string l_max = WorkflowManager.Transformer(nameof(max));
[InspectorDraw(InspectorDrawType.Auto, true, true, nameGenerater: nameof(l_max))]
public float max = 1;
public ValueNodeInfo() : this(0) { }
public ValueNodeInfo(float value, string outmappingName = "value")
{
this.value = value;
this.outmapping = new()
{
{
outmappingName, new NodeSlotInfo()
{
slotName = outmappingName,
typeIndicator = "float",
IsInmappingSlot = false,
}
}
};
this.inmapping = new();
this.title = "Value";
}
protected override NodeInfo CreateTemplate()
{
return new ValueNodeInfo();
}
protected override void CloneValues([In] NodeInfo clonen)
{
var info = ((ValueNodeInfo)clonen);
info.value = value;
info.min = min;
info.max = max;
base.CloneValues(clonen);
}
}
public class ValueNode : StartNode, IText
{
[Resources, OnlyNotNullMode] public ModernUIInputField InputField;
[Resources, OnlyNotNullMode] public ModernUIFillBar RangeBar;
[Content, OnlyPlayMode] public bool isEditing = false;
public ValueNodeInfo MyValueNodeInfo => this.info as ValueNodeInfo;
public string text { get => ((IText)this.InputField).text; set => ((IText)this.InputField).text = value; }
protected override void Start()
{
base.Start();
InputField.InputFieldSource.Source.onSelect.AddListener(_ => isEditing = true);
InputField.InputFieldSource.Source.onEndEdit.AddListener(str =>
{
if (float.TryParse(str, out float value))
MyValueNodeInfo.value = value;
else
MyValueNodeInfo.value = 0;
isEditing = false;
});
}
protected override void WhenSetup(NodeInfo info)
{
base.WhenSetup(info);
RangeBar.minValue = MyValueNodeInfo.min;
RangeBar.maxValue = MyValueNodeInfo.max;
RangeBar.SetValue(MyValueNodeInfo.value);
}
private void LateUpdate()
{
if (info != null && this.isEditing == false && RectTransformExtension.IsVisible(this.rectTransform))
{
RangeBar.minValue = MyValueNodeInfo.min;
RangeBar.maxValue = MyValueNodeInfo.max;
RangeBar.SetValue(MyValueNodeInfo.value);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8404795928101e843ad4d836cea5c1f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: