コード例 #1
0
        private SerialNumberType DrawSerialNumberTypePicker()
        {
            EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;

            config.SerialNumberType = (SerialNumberType)EditorGUILayout.EnumPopup("Serial Number", config.SerialNumberType, GUILayout.MinWidth(200));
            return(config.SerialNumberType);
        }
コード例 #2
0
        /// <summary>
        /// Draws and responds to an enum picker for the port plate type
        /// </summary>
        private PortPlateType DrawPortPlateTypePicker(int widgetIndex)
        {
            EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;
            THWidget widget = config.Widgets[widgetIndex];

            widget.PortPlateType = (PortPlateType)EditorGUILayout.EnumPopup("Port Plate Type", widget.PortPlateType, GUILayout.MinWidth(200));
            return(widget.PortPlateType);
        }
コード例 #3
0
        /// <summary>
        /// Draws and responds to an enum picker for the indicator state
        /// </summary>
        private IndicatorState DrawIndicatorStatePicker(int widgetIndex)
        {
            EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;
            THWidget widget = config.Widgets[widgetIndex];

            widget.IndicatorState = (IndicatorState)EditorGUILayout.EnumPopup("Indicator State", widget.IndicatorState, GUILayout.MinWidth(200));
            return(widget.IndicatorState);
        }
コード例 #4
0
        /// <summary>
        /// Draws and responds to an enum picker for the battery type
        /// </summary>
        private BatteryType DrawBatteryTypePicker(int widgetIndex)
        {
            EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;
            THWidget widget = config.Widgets[widgetIndex];

            widget.BatteryType = (BatteryType)EditorGUILayout.EnumPopup("Battery Count", widget.BatteryType, GUILayout.MinWidth(200));
            return(widget.BatteryType);
        }
コード例 #5
0
        /// <summary>
        /// Draws and responds to an enum picker for the widget type
        /// </summary>
        private WidgetType DrawWidgetTypePicker(int widgetIndex)
        {
            EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;
            THWidget widget = config.Widgets[widgetIndex];

            widget.Type = (WidgetType)EditorGUILayout.EnumPopup(widget.Type, GUILayout.MinWidth(120));
            return(widget.Type);
        }
コード例 #6
0
        public static void CreateNewEdgeworkConfiguration()
        {
            if (!AssetDatabase.IsValidFolder("Assets/TestHarness/" + CONFIGURATIONS_FOLDER))
            {
                AssetDatabase.CreateFolder("Assets/TestHarness", CONFIGURATIONS_FOLDER);
            }

            EdgeworkConfiguration config = ScriptableObject.CreateInstance <EdgeworkConfiguration>();
            string path = AssetDatabase.GenerateUniqueAssetPath("Assets/TestHarness/" + CONFIGURATIONS_FOLDER + "/config.asset");

            AssetDatabase.CreateAsset(config, path);
            AssetImporter.GetAtPath(path).assetBundleName = AssetBundler.BUNDLE_FILENAME;

            EditorGUIUtility.PingObject(config);
        }
コード例 #7
0
        public override void OnInspectorGUI()
        {
            if (target != null)
            {
                serializedObject.Update();

                SerialNumberType serialNumberType = DrawSerialNumberTypePicker();
                if (serialNumberType == SerialNumberType.CUSTOM)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("CustomSerialNumber"));
                }

                EdgeworkConfiguration config = (EdgeworkConfiguration)serializedObject.targetObject;
                if (config != null && config.Widgets.Any(x => x.Type == WidgetType.TWOFACTOR))
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("TwoFactorResetTime"));
                }

                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Widgets:");

                SerializedProperty widgetListProperty = serializedObject.FindProperty("Widgets");
                EditorGUI.indentLevel++;
                for (int i = 0; i < widgetListProperty.arraySize; i++)
                {
                    DrawWidget(widgetListProperty, i);
                    EditorGUILayout.Space();
                }
                EditorGUI.indentLevel--;

                EditorGUILayout.Separator();
                EditorGUILayout.Separator();
                EditorGUILayout.Separator();

                if (GUILayout.Button("Add Widget"))
                {
                    AddWidget();
                }
            }

            serializedObject.ApplyModifiedProperties();
        }