Skip to content

Commit 6387d4f

Browse files
committed
refactor: Group nodes semantically.
1 parent 8c3ff94 commit 6387d4f

27 files changed

+250
-183
lines changed

Editor/Descriptors/SetCoilUnitDescriptor.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
using Unity.VisualScripting;
18+
using VisualPinball.Unity.Editor;
1819

1920
namespace VisualPinball.Unity.VisualScripting.Editor
2021
{
@@ -25,9 +26,20 @@ public SetCoilUnitDescriptor(SetCoilUnit target) : base(target)
2526
{
2627
}
2728

28-
protected override void DefinedPort(IUnitPort port, UnitPortDescription description)
29+
protected override string DefinedSummary()
2930
{
30-
base.DefinedPort(port, description);
31+
return "This node sets a given coil value to a coil, defined by its ID.";
32+
}
33+
34+
protected override EditorTexture DefinedIcon()
35+
{
36+
var texture = VisualPinball.Unity.Editor.Icons.Coil(VisualPinball.Unity.Editor.IconSize.Large, IconColor.Orange);
37+
return EditorTexture.Single(texture);
38+
}
39+
40+
protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
41+
{
42+
base.DefinedPort(port, desc);
3143

3244
switch (port.key) {
3345
case nameof(SetCoilUnit.Id):
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Visual Pinball Engine
2+
// Copyright (C) 2021 freezy and VPE Team
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
17+
using Unity.VisualScripting;
18+
using VisualPinball.Unity.Editor;
19+
20+
namespace VisualPinball.Unity.VisualScripting.Editor
21+
{
22+
[Descriptor(typeof(SwitchEventUnit))]
23+
public class SwitchEventUnitDescriptor : UnitDescriptor<SwitchEventUnit>
24+
{
25+
public SwitchEventUnitDescriptor(SwitchEventUnit target) : base(target)
26+
{
27+
}
28+
29+
protected override string DefinedSummary()
30+
{
31+
return "This node triggers an event when a switch with a given ID changes.";
32+
}
33+
34+
protected override EditorTexture DefinedIcon() => EditorTexture.Single(VisualPinball.Unity.Editor.Icons.SwitchEvent);
35+
36+
protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
37+
{
38+
base.DefinedPort(port, desc);
39+
40+
switch (port.key) {
41+
case nameof(SetCoilUnit.Id):
42+
description.summary = "The ID of the switch that changed its value.";
43+
break;
44+
case nameof(SetCoilUnit.IsEnabled):
45+
description.summary = "The new value of the switch.";
46+
break;
47+
}
48+
}
49+
}
50+
}

Editor/Descriptors/SwitchEventUnitDescriptor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/VisualPinball.Unity.VisualScripting.Editor.asmdef

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"Unity.VisualScripting.Flow.Editor",
99
"VisualPinball.Unity.VisualScripting.Runtime",
1010
"VisualPinball.Unity",
11+
"VisualPinball.Unity.Editor",
1112
"VisualPinball.Engine"
1213
],
1314
"includePlatforms": [

Runtime/Lamps/Nodes.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

Runtime/Nodes.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)