public ViewSystemGlobalSettingWindow(string name, ViewSystemVisualEditor editor, ViewSystemDataReaderV2 dataReader)
     : base(name, editor)
 {
     this.dataReader       = dataReader;
     m_ShowEventScript     = new AnimBool(true);
     m_ShowUserBreakPoints = new AnimBool(true);
     m_ShowEventScript.valueChanged.AddListener(editor.Repaint);
     m_ShowUserBreakPoints.valueChanged.AddListener(editor.Repaint);
 }
 public ViewSystemNodeWindow(string name, ViewSystemVisualEditor editor)
 {
     this.editor = editor;
     this.name   = name;
     rect        = new Rect(editor.position.width * 0.3f,
                            editor.position.height * 0.3f,
                            rect.width,
                            rect.height);
     show = false;
 }
        public ViewSystemVerifier(ViewSystemVisualEditor editor, ViewSystemSaveData saveData)
        {
            this.saveData = saveData;
            this.editor   = editor;
            windowStyle   = new GUIStyle(Drawer.windowStyle);
            RectOffset padding = windowStyle.padding;

            padding.left   = 0;
            padding.right  = 1;
            padding.bottom = 0;
        }
 public ViewPageNavigationWindow(string name, ViewSystemVisualEditor editor)
     : base(name, editor)
 {
     // windowStyle = new GUIStyle(Drawer.windowStyle);
     // RectOffset padding = windowStyle.padding;
     // padding.left = 0;
     // padding.right = 1;
     // padding.bottom = 0;
     EditorPrefs.SetBool(s_ShowNavigationKey, false);
     s_ShowNavigation = EditorPrefs.GetBool(s_ShowNavigationKey);
 }
 public void SetViewPageItem(ViewPageItem viewPageItem)
 {
     this.viewPageItem       = viewPageItem;
     currentSelectGameObject = null;
     if (viewPageItem == null)
     {
         return;
     }
     target = viewPageItem.viewElement.gameObject;
     CacheHierarchy();
     RebuildModifyReorderableList();
     if (ViewSystemVisualEditor.RequireAutoRefreshMethodDatabase())
     {
         ViewSystemVisualEditor.RefreshMethodDatabase();
     }
 }
        public void VerifyEvents()
        {
            ViewSystemVisualEditor.RefreshMethodDatabase();
            RefreshEventDatas();
            eventDataNeedToFix.Clear();
            foreach (var vpi in allEventDatas)
            {
                foreach (var item in vpi.eventDatas)
                {
                    var t = MacacaGames.Utility.GetType(item.scriptName);
                    if (t == null)
                    {
                        ViewSystemLog.LogError(item.targetComponentType + " still not fixed cannot be found, will ignore while verify property");
                        eventDataNeedToFix.Add(item);
                        continue;
                    }

                    if (t.GetMethod(item.methodName, bindingFlags) == null)
                    {
                        ViewSystemLog.LogError($"{item.methodName} in {item.scriptName} cannot be found");
                        eventDataNeedToFix.Add(item);
                        continue;
                    }
                }
            }
            if (eventDataNeedToFix.Count > 0)
            {
                if (EditorUtility.DisplayDialog(
                        "Something goes wrong!",
                        "There are some event data is missing, do you want to open fixer window",
                        "Yes, Please",
                        "Not now"))
                {
                    var window = ScriptableObject.CreateInstance <EventFixerWindow>();
                    window.SetData(eventDataNeedToFix, ViewSystemVisualEditor.classMethodInfo, () =>
                    {
                        //Make sure SetDirty
                        EditorUtility.SetDirty(saveData);
                    });
                    window.ShowUtility();
                }
            }
            else
            {
                ViewSystemLog.Log("Great, all events looks good!");
            }
        }
        public OverridePopupWindow(string name, ViewSystemVisualEditor editor, ViewSystemNodeInspector sideBar)
            : base(name, editor)
        {
            this.sideBar      = sideBar;
            removeButtonStyle = new GUIStyle
            {
                fixedWidth = 25f,
                active     =
                {
                    background = CMEditorUtility.CreatePixelTexture("Dark Pixel (List GUI)", new Color32(100, 100, 100, 255))
                },
                imagePosition = ImagePosition.ImageOnly,
                alignment     = TextAnchor.MiddleCenter
            };

            resizeable = true;
        }
        public void OnEnable()
        {
            Instance = this;
            RefreshData();

            // Each editor window contains a root VisualElement object
            VisualElement root = rootVisualElement;

            // Import UXML
            var           visualTree            = Resources.Load <VisualTreeAsset>("ViewSystemNodeEditorUIElementUxml");
            VisualElement visulaElementFromUXML = visualTree.CloneTree();
            var           styleSheet            = Resources.Load <StyleSheet>("ViewSystemNodeEditorUIElementUss");

            visulaElementFromUXML.styleSheets.Add(styleSheet);
            visulaElementFromUXML.style.flexGrow = 1;


            toolbarContianer = new IMGUIContainer(DrawMenuBar);
            toolbarContianer.style.flexGrow = 1;
            visulaElementFromUXML.Q("toolbar").Add(toolbarContianer);

            inspectorContianer = new IMGUIContainer(DrawInspector);
            inspectorContianer.style.flexGrow = 1;
            visulaElementFromUXML.Q("inspector").Add(inspectorContianer);
            if (EditorGUIUtility.isProSkin)
            {
                visulaElementFromUXML.Q("inspector").style.backgroundColor = new StyleColor(new Color(0.3f, 0.3f, 0.3f));
            }
            nodeViewContianer = new IMGUIContainer(DrawNode);
            nodeViewContianer.style.flexGrow = 1;
            visulaElementFromUXML.Q("node-view").Add(nodeViewContianer);

            var dragger = visulaElementFromUXML.Q("dragger");

            dragger.AddManipulator(new VisualElementResizer());

            root.Add(visulaElementFromUXML);
        }
Esempio n. 9
0
 public ViewBreakpointWindow(string name, ViewSystemVisualEditor editor)
     : base(name, editor)
 {
 }
 private static void OpenWindow()
 {
     Instance = GetWindow <ViewSystemVisualEditor>();
     Instance.titleContent = new GUIContent("View System Visual Editor");
     Instance.minSize      = new Vector2(600, 400);
 }
Esempio n. 11
0
 public ViewPageOrderWindow(string name, ViewSystemVisualEditor editor, ViewSystemDataReaderV2 dataReader)
     : base(name, editor)
 {
     this.dataReader = dataReader;
     RebuildList();
 }
        void DrawEvent()
        {
            // EditorGUILayout.HelpBox(" also the target MonoBahaviour required to assign in GlobalSetting", MessageType.Info);
            // if (GUILayout.Button("Setting"))
            // {
            //     ViewSystemVisualEditor.globalSettingWindow.show = true;
            // }
            using (var horizon = new GUILayout.HorizontalScope(GUILayout.Height(40)))
            {
                EditorGUILayout.HelpBox("Only the method which has \"Component\" parameters will be shown. If you don't see your method in dropdown list, you can try 'Refresh'. (Very slow)", MessageType.Info);
                if (GUILayout.Button(new GUIContent(EditorGUIUtility.FindTexture("d_Refresh@2x"), "Refresh"), Drawer.removeButtonStyle, GUILayout.Width(40)))
                {
                    ViewSystemVisualEditor.RefreshMethodDatabase();
                }
            }

            if (ViewSystemVisualEditor.classMethodInfo.Count == 0)
            {
                return;
            }

            using (var scrollViewScope = new GUILayout.ScrollViewScope(scrollPositionEvent))
            {
                scrollPositionEvent = scrollViewScope.scrollPosition;

                foreach (var item in viewPageItem.eventDatas.ToArray())
                {
                    using (var horizon = new EditorGUILayout.HorizontalScope("box"))
                    {
                        using (var vertical = new EditorGUILayout.VerticalScope())
                        {
                            using (var horizon2 = new EditorGUILayout.HorizontalScope())
                            {
                                Transform targetObject;

                                if (!string.IsNullOrEmpty(item.targetTransformPath))
                                {
                                    targetObject = viewPageItem.viewElement.transform.Find(item.targetTransformPath);
                                }
                                else
                                {
                                    targetObject = viewPageItem.viewElement.transform;
                                }

                                if (targetObject == null)
                                {
                                    using (var vertical2 = new EditorGUILayout.VerticalScope())
                                    {
                                        GUILayout.Label(new GUIContent($"Target GameObject is Missing : [{viewPageItem.viewElement.name}/{item.targetTransformPath}]", Drawer.miniErrorIcon));
                                        item.targetTransformPath = EditorGUILayout.TextField(item.targetTransformPath);
                                        if (GUILayout.Button(new GUIContent("Remove item!")))
                                        {
                                            viewPageItem.eventDatas.RemoveAll(m => m == item);
                                        }
                                    }
                                    continue;
                                }

                                UnityEngine.Object targetComponent = targetObject.GetComponent(item.targetComponentType);

                                if (targetComponent == null)
                                {
                                    using (var vertical2 = new EditorGUILayout.VerticalScope())
                                    {
                                        GUILayout.Label(new GUIContent($"ComponentType : [{item.targetComponentType}] is missing!", Drawer.miniErrorIcon), GUILayout.Height(EditorGUIUtility.singleLineHeight));
                                        GUILayout.Label(new GUIContent($"Use Toolvar>Verifiers>Verify Override to fix the problem."));
                                        if (GUILayout.Button(new GUIContent("Remove item!")))
                                        {
                                            viewPageItem.eventDatas.RemoveAll(m => m == item);
                                        }
                                    }
                                    continue;
                                }
                                using (var vertical2 = new GUILayout.VerticalScope())
                                {
                                    GUIContent l = new GUIContent(target.name + (string.IsNullOrEmpty(item.targetTransformPath) ? "" : ("/" + item.targetTransformPath)), EditorGUIUtility.FindTexture("Prefab Icon"));
                                    GUILayout.Label(l, GUILayout.Height(EditorGUIUtility.singleLineHeight));
                                    // GUILayout.Label(Drawer.arrowIcon, GUILayout.Height(20));
                                    using (var horizon3 = new GUILayout.HorizontalScope())
                                    {
                                        GUILayout.Space(20);
                                        var _cachedContent = new GUIContent(EditorGUIUtility.ObjectContent(targetComponent, targetComponent.GetType()));
                                        GUILayout.Label(_cachedContent, GUILayout.Height(EditorGUIUtility.singleLineHeight));
                                    }
                                }
                            }
                            int currentSelectClass = 0;
                            CMEditorLayout.GroupedPopupData[] groupDatas = null;
                            if (!string.IsNullOrEmpty(item.scriptName) && !ViewSystemVisualEditor.classMethodInfo.TryGetValue(item.scriptName, out groupDatas))
                            {
                                GUILayout.Label("Target class name not found");
                            }
                            else
                            {
                                currentSelectClass = string.IsNullOrEmpty(item.scriptName) ? 0 : ViewSystemVisualEditor.classMethodInfo.Values.ToList().IndexOf(groupDatas);

                                using (var check = new EditorGUI.ChangeCheckScope())
                                {
                                    currentSelectClass = EditorGUILayout.Popup("Event Script", currentSelectClass, ViewSystemVisualEditor.classMethodInfo.Select(m => m.Key).ToArray());
                                    if (check.changed)
                                    {
                                        if (currentSelectClass != 0)
                                        {
                                            var c = ViewSystemVisualEditor.classMethodInfo.ElementAt(currentSelectClass);
                                            item.scriptName = c.Key;
                                            item.methodName = "";
                                        }
                                        else
                                        {
                                            item.scriptName = "";
                                            item.methodName = "";
                                        }
                                    }
                                }
                                if (currentSelectClass != 0)
                                {
                                    using (var check = new EditorGUI.ChangeCheckScope())
                                    {
                                        using (var horizon2 = new EditorGUILayout.HorizontalScope())
                                        {
                                            var c       = ViewSystemVisualEditor.classMethodInfo.ElementAt(currentSelectClass).Value;
                                            var current = c.SingleOrDefault(m => m.name == item.methodName);

                                            CMEditorLayout.GroupedPopupField(item.GetHashCode(), new GUIContent("Event Method"), c, current,
                                                                             (select) =>
                                            {
                                                item.methodName = select.name;
                                            }
                                                                             );
                                        }
                                    }
                                }
                            }
                        }
                        if (GUILayout.Button(ReorderableList.defaultBehaviours.iconToolbarMinus, removeButtonStyle, GUILayout.Height(EditorGUIUtility.singleLineHeight * 2)))
                        {
                            viewPageItem.eventDatas.Remove(item);
                        }
                    }
                }
            }
        }
 public ViewSystemDataReaderV2(ViewSystemVisualEditor editor)
 {
     this.editor = editor;
 }