Beispiel #1
0
        /// <summary>
        /// Try to force update the scene and object to refresh
        /// </summary>
        private IEnumerator SetDirtyWithDelay()
        {
            yield return(new WaitForFixedUpdate());

            EditorUtility.SetDirty(j_TargetObjectTrans);
            SceneView.RepaintAll();            //.Repaint();
            j_EditerCoroutine = null;
        }
Beispiel #2
0
        /// <summary>
        /// Make GUI for icon and text selection on inspector
        /// Change the layout on selecting icon show icons from scriptable object
        /// </summary>
        private void RenderIconTextGUI()
        {
            bool labelFoldout = SessionState.GetBool(label_Key, true);
            bool iconFoldout  = SessionState.GetBool(icon_Key, true);

            EditorGUILayout.PropertyField(j_IconStyleProp);

            j_TargetObj.SetIconStyle(j_TargetObj.IconStyle);

            switch (j_TargetObj.IconStyle)
            {
            case ThemeIconStyle.Text:

                using (new EditorGUI.IndentLevelScope(1))
                {
                    using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        labelFoldout = EditorGUILayout.Foldout(labelFoldout, "Labels", true);

                        if (labelFoldout)
                        {
                            EditorGUI.BeginChangeCheck();

                            EditorGUILayout.PropertyField(j_MainLabelTextProp);

                            if (j_MainLabelTextProp.objectReferenceValue != null)
                            {
                                Component          mainLabelText   = (Component)j_MainLabelTextProp.objectReferenceValue;
                                SerializedObject   labelTextObject = new SerializedObject(mainLabelText);
                                SerializedProperty textProp        = labelTextObject.FindProperty(text_PropertyPath);

                                EditorGUILayout.PropertyField(textProp, new GUIContent(mainLabelText_String));
                                EditorGUILayout.Space();

                                if (EditorGUI.EndChangeCheck())
                                {
                                    labelTextObject.ApplyModifiedProperties();
                                }
                            }
                        }
                    }
                }
                break;

            case ThemeIconStyle.Sprite:

                using (new EditorGUI.IndentLevelScope(1))
                {
                    using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
                    {
                        iconFoldout = EditorGUILayout.Foldout(iconFoldout, icon_Key, true);
                        if (iconFoldout && themeDataRef != null)
                        {
                            DrawIconSpriteEditor(true, themeDataRef.themeData);
                        }
                    }
                }
                break;

            case ThemeIconStyle.None:
                break;

            default:
                break;
            }
            SessionState.SetBool(label_Key, labelFoldout);
            SessionState.SetBool(icon_Key, iconFoldout);

            serializedObject.ApplyModifiedProperties();

            if (GUI.changed)
            {
                j_EditerCoroutine = EditorCoroutines.EditorCoroutines.StartCoroutine(SetDirtyWithDelay(), this);
            }
        }