using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using UIKit; using UnityEditor; using UnityEngine; namespace UIKit.Editor { public class UIKitInspectorUtility { public static void LayoutStyleGUI (SerializedObject serializedObject) { serializedObject.Update (); // var colorInfo = serializedObject.FindProperty ("m_ColorInfo"); // var colorType = colorInfo.FindPropertyRelative ("ColorType"); // var alpha = colorInfo.FindPropertyRelative ("Alpha"); // var alphaModified = colorInfo.FindPropertyRelative ("AlphaModified"); // var systemColor = colorInfo.FindPropertyRelative ("SystemColor"); // var themeColor = colorInfo.FindPropertyRelative ("ThemeColor"); // EditorGUILayout.PropertyField (colorType); // if (colorType.intValue == (int) JNColorType.System) { // EditorGUILayout.PropertyField (systemColor); // } else if (colorType.intValue == (int) JNColorType.Theme) { // EditorGUILayout.PropertyField (themeColor); // } // EditorGUILayout.PropertyField (alphaModified); // if (alphaModified.boolValue) { // EditorGUILayout.PropertyField (alpha); // } serializedObject.ApplyModifiedProperties (); // if (colorType.intValue != (int) JNColorType.Fixed) { // colorTemplate.OnColorTemplateChanged (); // } } [MenuItem ("CONTEXT/Component/Move To Top")] private static void MoveToTop (MenuCommand menuCommand) { Component c = (Component) menuCommand.context; Component[] allComponents = c.GetComponents<Component> (); int iOffset = 0; for (int i = 0; i < allComponents.Length; i++) { if (allComponents[i] == c) { iOffset = i; break; } } for (int i = 0; i < iOffset - 1; i++) { UnityEditorInternal.ComponentUtility.MoveComponentUp (c); } EditorApplication.MarkSceneDirty (); } [MenuItem ("CONTEXT/Component/Move To Bottom")] private static void MoveToBottom (MenuCommand menuCommand) { Component c = (Component) menuCommand.context; Component[] allComponents = c.GetComponents<Component> (); int iOffset = 0; for (int i = 0; i < allComponents.Length; i++) { if (allComponents[i] == c) { iOffset = i; break; } } for (; iOffset < allComponents.Length; iOffset++) { UnityEditorInternal.ComponentUtility.MoveComponentDown (c); } EditorApplication.MarkSceneDirty (); } [MenuItem ("CONTEXT/UIView/Add To Color Palette")] private static void AddToColorPalette (MenuCommand menuCommand) { UIView uiView = (UIView) menuCommand.context; UIColorPaletteController.Default.AddColor (uiView.ColorId, uiView.Element.GetColor ()); } [MenuItem ("CONTEXT/UIView/Add To Style Sheet")] private static void AddToStyleSheet (MenuCommand menuCommand) { UIView uiView = (UIView) menuCommand.context; UIStyleSheetController.Default.AddStyle (uiView.StyleId, uiView.Element.GetStyle ()); } } }