Skip to content

Commit a87ef59

Browse files
committed
Rename GetLampValue to GetLamp.
1 parent 837019a commit a87ef59

File tree

10 files changed

+81
-74
lines changed

10 files changed

+81
-74
lines changed

Editor/Descriptors/GetLampValueUnitDescriptor.cs renamed to Editor/Descriptors/GetLampUnitDescriptor.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17+
// ReSharper disable UnusedType.Global
18+
1719
using Unity.VisualScripting;
1820
using VisualPinball.Unity.Editor;
1921
using IconSize = VisualPinball.Unity.Editor.IconSize;
2022

2123
namespace VisualPinball.Unity.VisualScripting.Editor
2224
{
23-
[Descriptor(typeof(GetLampValueUnit))]
24-
public class GetLampValueUnitDescriptor : UnitDescriptor<GetLampValueUnit>
25+
[Descriptor(typeof(GetLampUnit))]
26+
public class GetLampUnitDescriptor : UnitDescriptor<GetLampUnit>
2527
{
26-
public GetLampValueUnitDescriptor(GetLampValueUnit target) : base(target)
28+
public GetLampUnitDescriptor(GetLampUnit target) : base(target)
2729
{
2830
}
2931

@@ -39,13 +41,13 @@ protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
3941
base.DefinedPort(port, desc);
4042

4143
switch (port.key) {
42-
case nameof(GetLampValueUnit.Id):
44+
case nameof(GetLampUnit.Id):
4345
desc.summary = "The ID of the lamp for which the intensity is returned.";
4446
break;
45-
case nameof(GetLampValueUnit.Value):
47+
case nameof(GetLampUnit.Value):
4648
desc.summary = "The intensity of the lamp.";
4749
break;
48-
case nameof(GetLampValueUnit.IsEnabled):
50+
case nameof(GetLampUnit.IsEnabled):
4951
desc.summary = "Whether the intensity is larger than 0.";
5052
break;
5153
}

Editor/Descriptors/GetLampValueUnitDescriptor.cs.meta renamed to Editor/Descriptors/GetLampUnitDescriptor.cs.meta

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

Editor/Descriptors/LampEventUnitDescriptor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17+
// ReSharper disable UnusedType.Global
18+
1719
using Unity.VisualScripting;
1820

1921
namespace VisualPinball.Unity.VisualScripting.Editor

Editor/Descriptors/SetCoilUnitDescriptor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17+
// ReSharper disable UnusedType.Global
18+
1719
using Unity.VisualScripting;
1820
using VisualPinball.Unity.Editor;
1921

@@ -51,4 +53,4 @@ protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
5153
}
5254
}
5355
}
54-
}
56+
}

Editor/Descriptors/SwitchEventUnitDescriptor.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17+
// ReSharper disable UnusedType.Global
18+
1719
using Unity.VisualScripting;
1820

1921
namespace VisualPinball.Unity.VisualScripting.Editor
@@ -46,4 +48,4 @@ protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
4648
}
4749
}
4850
}
49-
}
51+
}
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,59 @@
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-
// ReSharper disable UnusedType.Global
18-
19-
using System;
20-
using System.Collections.Generic;
21-
using System.Linq;
22-
using Unity.VisualScripting;
23-
using VisualPinball.Unity;
24-
25-
namespace VisualPinball.Unity.VisualScripting.Editor
26-
{
27-
[Widget(typeof(GetLampValueUnit))]
28-
public sealed class GetLampValueUnitWidget : GleUnitWidget<GetLampValueUnit>
29-
{
30-
public GetLampValueUnitWidget(FlowCanvas canvas, GetLampValueUnit unit) : base(canvas, unit)
31-
{
32-
_lampIdInspectorConstructor = meta => new VariableNameInspector(meta, GetNameSuggestions);
33-
}
34-
35-
protected override NodeColorMix baseColor => NodeColorMix.TealReadable;
36-
37-
private VariableNameInspector _lampIdInspector;
38-
private readonly Func<Metadata, VariableNameInspector> _lampIdInspectorConstructor;
39-
40-
public override Inspector GetPortInspector(IUnitPort port, Metadata meta)
41-
{
42-
if (port == unit.Id) {
43-
InspectorProvider.instance.Renew(ref _lampIdInspector, meta, _lampIdInspectorConstructor);
44-
45-
return _lampIdInspector;
46-
}
47-
48-
return base.GetPortInspector(port, meta);
49-
}
50-
51-
private IEnumerable<string> GetNameSuggestions()
52-
{
53-
if (!GameObjectAvailable) {
54-
return new List<string>();
55-
}
56-
var gle = Gle;
57-
return gle == null ? new List<string>() : gle.AvailableLamps.Select(lamp => lamp.Id).ToList();
58-
}
59-
}
60-
}
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+
// ReSharper disable UnusedType.Global
18+
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Linq;
22+
using Unity.VisualScripting;
23+
24+
namespace VisualPinball.Unity.VisualScripting.Editor
25+
{
26+
[Widget(typeof(GetLampUnit))]
27+
public sealed class GetLampUnitWidget : GleUnitWidget<GetLampUnit>
28+
{
29+
public GetLampUnitWidget(FlowCanvas canvas, GetLampUnit unit) : base(canvas, unit)
30+
{
31+
_lampIdInspectorConstructor = meta => new VariableNameInspector(meta, GetNameSuggestions);
32+
}
33+
34+
protected override NodeColorMix baseColor => NodeColorMix.TealReadable;
35+
36+
private VariableNameInspector _lampIdInspector;
37+
private readonly Func<Metadata, VariableNameInspector> _lampIdInspectorConstructor;
38+
39+
public override Inspector GetPortInspector(IUnitPort port, Metadata meta)
40+
{
41+
if (port == unit.Id) {
42+
InspectorProvider.instance.Renew(ref _lampIdInspector, meta, _lampIdInspectorConstructor);
43+
44+
return _lampIdInspector;
45+
}
46+
47+
return base.GetPortInspector(port, meta);
48+
}
49+
50+
private IEnumerable<string> GetNameSuggestions()
51+
{
52+
if (!GameObjectAvailable) {
53+
return new List<string>();
54+
}
55+
var gle = Gle;
56+
return gle == null ? new List<string>() : gle.AvailableLamps.Select(lamp => lamp.Id).ToList();
57+
}
58+
}
59+
}

Editor/Widgets/GetLampValueUnitWidget.cs.meta renamed to Editor/Widgets/GetLampUnitWidget.cs.meta

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

Runtime/Nodes/Coils/SetCoilUnit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected override void Definition()
5353

5454
private ControlOutput Process(Flow flow)
5555
{
56-
if (!AssertGle(flow)) {
56+
if (!AssertGle(flow)) {
5757
Debug.LogError("Cannot find GLE.");
5858
return OutputTrigger;
5959
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace VisualPinball.Unity.VisualScripting
2121
{
2222
[UnitTitle("Get Lamp Value")]
2323
[UnitCategory("Visual Pinball")]
24-
public class GetLampValueUnit : GleUnit
24+
public class GetLampUnit : GleUnit
2525
{
2626
[DoNotSerialize]
2727
[PortLabel("Lamp ID")]
@@ -47,7 +47,7 @@ protected override void Definition()
4747

4848
private float GetValue(Flow flow)
4949
{
50-
if (!AssertGle(flow)) {
50+
if (!AssertGle(flow)) {
5151
Debug.LogError("Cannot find GLE.");
5252
return 0;
5353
}
@@ -57,7 +57,7 @@ private float GetValue(Flow flow)
5757

5858
private bool GetEnabled(Flow flow)
5959
{
60-
if (!AssertGle(flow)) {
60+
if (!AssertGle(flow)) {
6161
Debug.LogError("Cannot find GLE.");
6262
return false;
6363
}
File renamed without changes.

0 commit comments

Comments
 (0)