Esempio n. 1
0
        void ShowAdvancedOptions()
        {
            EditorGUILayout.BeginVertical(EditorGuiHelper.MakeBackgroundStyle(EditorGuiHelper.RedColor));

            ShowNameAndEditButton();

            EditorGUI.indentLevel++;

            EditorGUILayout.HelpBox("See documentation for information.", MessageType.Info);

            if (showAdvanced.boolValue)
            {
                ShowTrialTableOptions();
                EditorGUILayout.Space();

                ShowBlockOrderConfiguration();
                EditorGUILayout.Space();
                ShowSettingsFields();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }

            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
        }
Esempio n. 2
0
        void CreateNewBlockOrderDefinition()
        {
            if (!designFileTarget.HasBlocks)
            {
                Debug.LogError($"{TuxLog.Prefix} Tried to make block order definition file, but no block variables have been defined!");
                return;
            }

            BlockOrderDefinition newBlockOrderDefinition = CreateInstance <BlockOrderDefinition>();

            try {
                string savePath = Path.GetDirectoryName(path: AssetDatabase.GetAssetPath(Selection.activeObject)) +
                                  "/New Block Order Definition.asset";
                string uniqueSavePath = EditorGuiHelper.GetUniqueName(savePath);
                AssetDatabase.CreateAsset(newBlockOrderDefinition, uniqueSavePath);
                AssetDatabase.SaveAssets();
            }
            catch (ArgumentNullException) {
                Debug.LogError($"{TuxLog.Prefix} Could not create BlockOrderDefinition. There is probably an error in variable definitions.");
            }

            EditorUtility.FocusProjectWindow();

            Selection.activeObject = newBlockOrderDefinition;
            if (designFileTarget == null)
            {
                throw new NullReferenceException("DesignFileNull");
            }
            newBlockOrderDefinition.Init(designFileTarget);

            List <BlockOrderDefinition> orders = designFileTarget.GetBlockOrderConfigurations;

            orders.Add(newBlockOrderDefinition);
        }
Esempio n. 3
0
        void ShowViewers(Dictionary <string, VariableViewer> viewerDict, string title, Color background)
        {
            EditorGUILayout.LabelField($"{title}: {viewerDict.Count}", EditorStyles.boldLabel);
            EditorGUILayout.BeginVertical(EditorGuiHelper.MakeBackgroundStyle(background));
            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUI.indentLevel++;

            if (viewerDict.Count == 0)
            {
                EditorGUILayout.LabelField("None");
            }

            foreach (KeyValuePair <string, VariableViewer> item in viewerDict)
            {
                item.Value.DrawInspector();
            }

            EditorGUILayout.EndVertical();
            EditorGUI.indentLevel--;
            EditorGUILayout.Space();
        }