Skip to content

Commit 4925a49

Browse files
jsm174freezy
authored andcommitted
cleanup: fix spacing
1 parent 0c9d2e2 commit 4925a49

File tree

6 files changed

+111
-117
lines changed

6 files changed

+111
-117
lines changed

Editor/Inspectors/AttributedEnumInspector.cs

+44-49
Original file line numberDiff line numberDiff line change
@@ -25,65 +25,60 @@
2525

2626
namespace VisualPinball.Unity.VisualScripting.Editor
2727
{
28-
public abstract class AttributedEnumInspector<TEnum> : Inspector
29-
{
30-
private List<TEnum> Enums;
31-
private string[] EnumDescriptions;
28+
public abstract class AttributedEnumInspector<TEnum> : Inspector
29+
{
30+
private List<TEnum> Enums;
31+
private string[] EnumDescriptions;
3232

33-
public AttributedEnumInspector(Metadata metadata) : base(metadata) {
34-
}
33+
public AttributedEnumInspector(Metadata metadata) : base(metadata) {
34+
}
3535

36-
public override void Initialize()
37-
{
38-
Enums = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().ToList();
39-
EnumDescriptions = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().Select(x => GetEnumDescription(x)).ToArray();
36+
public override void Initialize()
37+
{
38+
Enums = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().ToList();
39+
EnumDescriptions = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().Select(x => GetEnumDescription(x)).ToArray();
4040

41-
metadata.instantiate = true;
41+
metadata.instantiate = true;
4242

43-
base.Initialize();
44-
}
43+
base.Initialize();
44+
}
4545

46-
protected override float GetHeight(float width, GUIContent label)
47-
{
48-
return HeightWithLabel(metadata, width, EditorGUIUtility.singleLineHeight, label);
49-
}
46+
protected override float GetHeight(float width, GUIContent label)
47+
{
48+
return HeightWithLabel(metadata, width, EditorGUIUtility.singleLineHeight, label);
49+
}
5050

51-
protected override void OnGUI(Rect position, GUIContent label)
52-
{
53-
position = BeginLabeledBlock(metadata, position, label);
51+
protected override void OnGUI(Rect position, GUIContent label)
52+
{
53+
position = BeginLabeledBlock(metadata, position, label);
5454

55-
var fieldPosition = new Rect
56-
(
57-
position.x,
58-
position.y,
59-
position.width,
60-
EditorGUIUtility.singleLineHeight
61-
);
55+
var fieldPosition = new Rect(
56+
position.x,
57+
position.y,
58+
position.width,
59+
EditorGUIUtility.singleLineHeight);
6260

63-
var index = Enums.FindIndex(c => c.Equals(metadata.value));
64-
var newIndex = EditorGUI.Popup(fieldPosition, index, EnumDescriptions);
61+
var index = Enums.FindIndex(c => c.Equals(metadata.value));
62+
var newIndex = EditorGUI.Popup(fieldPosition, index, EnumDescriptions);
6563

66-
if (EndBlock(metadata))
67-
{
68-
metadata.RecordUndo();
69-
metadata.value = Enums[newIndex];
70-
}
71-
}
64+
if (EndBlock(metadata)) {
65+
metadata.RecordUndo();
66+
metadata.value = Enums[newIndex];
67+
}
68+
}
7269

73-
public override float GetAdaptiveWidth()
74-
{
75-
return Mathf.Max(18, EditorStyles.popup.CalcSize(new GUIContent(GetEnumDescription((TEnum)metadata.value))).x);
76-
}
70+
public override float GetAdaptiveWidth()
71+
{
72+
return Mathf.Max(18, EditorStyles.popup.CalcSize(new GUIContent(GetEnumDescription((TEnum)metadata.value))).x);
73+
}
7774

78-
private string GetEnumDescription(TEnum value)
79-
{
80-
FieldInfo field = value.GetType().GetField(value.ToString());
75+
private string GetEnumDescription(TEnum value)
76+
{
77+
FieldInfo field = value.GetType().GetField(value.ToString());
8178

82-
DescriptionAttribute attribute
83-
= Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute))
84-
as DescriptionAttribute;
79+
DescriptionAttribute attribute = Attribute.GetCustomAttribute(field, typeof(DescriptionAttribute)) as DescriptionAttribute;
8580

86-
return (attribute == null ? value.ToString() : attribute.Description).Replace('/', '\u2215');
87-
}
88-
}
89-
}
81+
return (attribute == null ? value.ToString() : attribute.Description).Replace('/', '\u2215');
82+
}
83+
}
84+
}

Editor/Inspectors/CompareTypeInspector.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
namespace VisualPinball.Unity.VisualScripting.Editor
2020
{
21-
[Inspector(typeof(CompareType))]
22-
public class CompareTypeInspector : AttributedEnumInspector<CompareType>
23-
{
24-
public CompareTypeInspector(Metadata metadata) : base(metadata)
25-
{
26-
}
27-
}
28-
}
21+
[Inspector(typeof(CompareType))]
22+
public class CompareTypeInspector : AttributedEnumInspector<CompareType>
23+
{
24+
public CompareTypeInspector(Metadata metadata) : base(metadata)
25+
{
26+
}
27+
}
28+
}

Editor/Inspectors/LampDataTypeInspector.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
namespace VisualPinball.Unity.VisualScripting.Editor
2020
{
21-
[Inspector(typeof(LampDataType))]
22-
public class LampDataTypeInspector : AttributedEnumInspector<LampDataType>
23-
{
24-
public LampDataTypeInspector(Metadata metadata) : base(metadata)
25-
{
26-
}
27-
}
28-
}
21+
[Inspector(typeof(LampDataType))]
22+
public class LampDataTypeInspector : AttributedEnumInspector<LampDataType>
23+
{
24+
public LampDataTypeInspector(Metadata metadata) : base(metadata)
25+
{
26+
}
27+
}
28+
}

Runtime/Nodes/Lamps/LampDataType.cs

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
// Visual Pinball Engine
2-
// Copyright (C) 2022 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 System.ComponentModel;
18-
1+
// Visual Pinball Engine
2+
// Copyright (C) 2022 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 System.ComponentModel;
18+
1919
namespace VisualPinball.Unity.VisualScripting
2020
{
2121
public enum LampDataType
22-
{
22+
{
2323
[Description("On/Off")]
2424
OnOff,
2525

Runtime/Nodes/Lamps/SwitchLampUnit.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ private ControlOutput Process(Flow flow)
139139

140140
var match = false;
141141

142-
switch(ValueCompareType)
143-
{
142+
switch(ValueCompareType) {
144143
case CompareType.NotEqual:
145144
match = lampIdValue.value != sourceValue;
146145
break;

Runtime/Nodes/Logic/CompareType.cs

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
// Visual Pinball Engine
2-
// Copyright (C) 2022 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 System.ComponentModel;
18-
1+
// Visual Pinball Engine
2+
// Copyright (C) 2022 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 System.ComponentModel;
18+
1919
namespace VisualPinball.Unity.VisualScripting
2020
{
2121
public enum CompareType
2222
{
23-
[Description("=")]
24-
Equal,
23+
[Description("=")]
24+
Equal,
2525

26-
[Description("\u2260")]
27-
NotEqual,
26+
[Description("\u2260")]
27+
NotEqual,
2828

29-
[Description("<")]
30-
LessThan,
29+
[Description("<")]
30+
LessThan,
3131

32-
[Description("\u2264")]
33-
LessThanEqual,
32+
[Description("\u2264")]
33+
LessThanEqual,
3434

35-
[Description(">")]
36-
GreaterThan,
35+
[Description(">")]
36+
GreaterThan,
3737

38-
[Description("\u2265")]
39-
GreaterThanEqual
40-
}
38+
[Description("\u2265")]
39+
GreaterThanEqual
40+
}
4141
}

0 commit comments

Comments
 (0)