Skip to content

Commit 8adbca8

Browse files
committed
Update score reel scoring.
1 parent 986ae87 commit 8adbca8

File tree

6 files changed

+166
-272
lines changed

6 files changed

+166
-272
lines changed

Editor/Descriptors/UpdateDisplayUnitDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected override void DefinedPort(IUnitPort port, UnitPortDescription desc)
4747
case nameof(UpdateDisplayUnit.TextInput):
4848
desc.summary = "Sets the display to a new text value.";
4949
break;
50-
case nameof(UpdateDisplayUnit.FrameInput):
50+
case nameof(UpdateDisplayUnit.SegmentInput):
5151
desc.summary = "Updates the display with new frame data.";
5252
break;
5353
}
Lines changed: 90 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,93 @@
1-
// Visual Pinball Engine
2-
// Copyright (C) 2022 freezy and VPE Team
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/>.
316
//
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.
17+
// using UnityEditor;
18+
// using UnityEngine;
819
//
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.
20+
// namespace VisualPinball.Unity.VisualScripting.Editor
21+
// {
22+
// [CustomPropertyDrawer(typeof(DisplayDefinition))]
23+
// public class DisplayDefinitionPropertyDrawer : PropertyDrawer
24+
// {
25+
// private const float Padding = 2f;
26+
//
27+
// public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
28+
// {
29+
// return base.GetPropertyHeight(property, label);
30+
// // var f = property.FindPropertyRelative(nameof(DisplayDefinition.SupportedFormats));
31+
// //
32+
// // return 5 * (EditorGUIUtility.singleLineHeight + Padding);
33+
// }
34+
//
35+
// public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
36+
// {
37+
// var idProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Id));
38+
// var widthProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Width));
39+
// var heightProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Height));
40+
//
41+
// var contentPosition = position;
42+
// contentPosition.height = EditorGUIUtility.singleLineHeight;
43+
//
44+
// //EditorGUI.BeginProperty(position, label, property);
45+
// EditorGUI.PropertyField(contentPosition, idProperty, new GUIContent("ID:"));
46+
// //EditorGUI.EndProperty();
47+
// position.y += EditorGUIUtility.singleLineHeight + Padding;
48+
//
49+
// contentPosition = EditorGUI.PrefixLabel(position, new GUIContent("Size:"));
50+
// contentPosition.height = EditorGUIUtility.singleLineHeight;
51+
//
52+
// var half = contentPosition.width / 2;
53+
// GUI.skin.label.padding = new RectOffset(3, 3, 6, 6);
54+
//
55+
// //show the X and Y from the point
56+
// var oldLabelWidth = EditorGUIUtility.labelWidth;
57+
// EditorGUIUtility.labelWidth = 14f;
58+
// contentPosition.width *= 0.5f;
59+
// EditorGUI.indentLevel = 0;
60+
//
61+
// // Begin/end property & change check make each field
62+
// // behave correctly when multi-object editing.
63+
// EditorGUI.BeginProperty(contentPosition, label, widthProperty);
64+
// {
65+
// EditorGUI.BeginChangeCheck();
66+
// var newVal = EditorGUI.IntField(contentPosition, new GUIContent("W"), widthProperty.intValue);
67+
// if (EditorGUI.EndChangeCheck())
68+
// widthProperty.intValue = newVal;
69+
// }
70+
// EditorGUI.EndProperty();
71+
//
72+
// contentPosition.x += half;
73+
// EditorGUI.BeginProperty(contentPosition, label, heightProperty);
74+
// {
75+
// EditorGUI.BeginChangeCheck();
76+
// var newVal = EditorGUI.IntField(contentPosition, new GUIContent("H"), heightProperty.intValue);
77+
// if (EditorGUI.EndChangeCheck())
78+
// heightProperty.intValue = newVal;
79+
// }
80+
// EditorGUI.EndProperty();
81+
//
82+
// EditorGUIUtility.labelWidth = oldLabelWidth;
83+
//
84+
// var supportedFormatsProperty = property.FindPropertyRelative(nameof(DisplayDefinition.SupportedFormats));
85+
//
86+
// position.y += EditorGUIUtility.singleLineHeight + Padding;
87+
// contentPosition = position;
88+
// contentPosition.height = EditorGUIUtility.singleLineHeight;
89+
// EditorGUI.PropertyField(contentPosition, supportedFormatsProperty, new GUIContent("Supported Formats:"));
90+
// }
91+
// }
92+
// }
1393
//
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;
18-
using UnityEditor;
19-
using UnityEngine;
20-
21-
namespace VisualPinball.Unity.VisualScripting.Editor
22-
{
23-
[CustomPropertyDrawer(typeof(DisplayDefinition))]
24-
public class DisplayDefinitionPropertyDrawer : PropertyDrawer
25-
{
26-
private const float Padding = 2f;
27-
28-
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
29-
{
30-
return 5 * (EditorGUIUtility.singleLineHeight + Padding);
31-
}
32-
33-
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
34-
{
35-
var idProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Id));
36-
var widthProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Width));
37-
var heightProperty = property.FindPropertyRelative(nameof(DisplayDefinition.Height));
38-
39-
var contentPosition = position;
40-
contentPosition.height = EditorGUIUtility.singleLineHeight;
41-
42-
//EditorGUI.BeginProperty(position, label, property);
43-
EditorGUI.PropertyField(contentPosition, idProperty, new GUIContent("ID:"));
44-
//EditorGUI.EndProperty();
45-
position.y += EditorGUIUtility.singleLineHeight + Padding;
46-
47-
contentPosition = EditorGUI.PrefixLabel(position, new GUIContent("Size:"));
48-
contentPosition.height = EditorGUIUtility.singleLineHeight;
49-
50-
var half = contentPosition.width / 2;
51-
GUI.skin.label.padding = new RectOffset(3, 3, 6, 6);
52-
53-
//show the X and Y from the point
54-
var oldLabelWidth = EditorGUIUtility.labelWidth;
55-
EditorGUIUtility.labelWidth = 14f;
56-
contentPosition.width *= 0.5f;
57-
EditorGUI.indentLevel = 0;
58-
59-
// Begin/end property & change check make each field
60-
// behave correctly when multi-object editing.
61-
EditorGUI.BeginProperty(contentPosition, label, widthProperty);
62-
{
63-
EditorGUI.BeginChangeCheck();
64-
var newVal = EditorGUI.IntField(contentPosition, new GUIContent("W"), widthProperty.intValue);
65-
if (EditorGUI.EndChangeCheck())
66-
widthProperty.intValue = newVal;
67-
}
68-
EditorGUI.EndProperty();
69-
70-
contentPosition.x += half;
71-
EditorGUI.BeginProperty(contentPosition, label, heightProperty);
72-
{
73-
EditorGUI.BeginChangeCheck();
74-
var newVal = EditorGUI.IntField(contentPosition, new GUIContent("H"), heightProperty.intValue);
75-
if (EditorGUI.EndChangeCheck())
76-
heightProperty.intValue = newVal;
77-
}
78-
EditorGUI.EndProperty();
79-
80-
EditorGUIUtility.labelWidth = oldLabelWidth;
81-
82-
var supportsNumericInputProperty = property.FindPropertyRelative(nameof(DisplayDefinition.SupportsNumericInput));
83-
var supportsTextInputProperty = property.FindPropertyRelative(nameof(DisplayDefinition.SupportsTextInput));
84-
var supportsImageInputProperty = property.FindPropertyRelative(nameof(DisplayDefinition.SupportsImageInput));
85-
86-
87-
position.y += EditorGUIUtility.singleLineHeight + Padding;
88-
contentPosition = position;
89-
contentPosition.height = EditorGUIUtility.singleLineHeight;
90-
EditorGUI.PropertyField(contentPosition, supportsNumericInputProperty, new GUIContent("Numeric:"));
91-
contentPosition.y += EditorGUIUtility.singleLineHeight + Padding;
92-
EditorGUI.PropertyField(contentPosition, supportsTextInputProperty, new GUIContent("Text:"));
93-
contentPosition.y += EditorGUIUtility.singleLineHeight + Padding;
94-
EditorGUI.PropertyField(contentPosition, supportsImageInputProperty, new GUIContent("Data:"));
95-
}
96-
}
97-
}
98-

Runtime/Display/DisplayDefinition.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// ReSharper disable InconsistentNaming
1818

1919
using System;
20+
using System.Collections.Generic;
2021

2122
namespace VisualPinball.Unity.VisualScripting
2223
{
@@ -27,9 +28,14 @@ public class DisplayDefinition
2728
public int Width = 128;
2829
public int Height = 32;
2930

30-
public bool SupportsNumericInput;
31-
public bool SupportsTextInput;
32-
public bool SupportsImageInput = true;
31+
public DisplayFrameFormat[] SupportedFormats = {
32+
DisplayFrameFormat.AlphaNumeric
33+
};
34+
35+
public bool Supports(DisplayFrameFormat format)
36+
{
37+
return SupportedFormats != null && Array.IndexOf(SupportedFormats, format) >= 0;
38+
}
3339

3440
public DisplayConfig DisplayConfig => new(Id, Width, Height);
3541
}

Runtime/Display/ScoreConverter.cs

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

Runtime/Display/ScoreConverter.cs.meta

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

0 commit comments

Comments
 (0)