Ejemplo n.º 1
0
        public void DrawGraph(ConfigAssetGroup groupAsset, ConfigAsset asset)
        {
            GUILayoutExtension.HorizontalGroup(() => {
                EditorGUILayout.LabelField(asset.name, GUILayout.Width(150));

                if (GUILayout.Button("打开", GUILayout.Width(50)))
                {
                    ConfigAssetWindow.Open(asset);
                }

                if (GUILayout.Button("删除", GUILayout.Width(50)))
                {
                    groupAsset.RemoveAsset(asset);
                }

                if (GUILayout.Button("重命名", GUILayout.Width(50)))
                {
                    MiscHelper.Input($"输入配置名:", (string name) =>
                    {
                        asset.name = name;
                        EditorUtility.SetDirty(asset);
                        EditorUtility.SetDirty(target);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    });
                }
            });
        }
Ejemplo n.º 2
0
        public override object OnGUI(Rect _position, GUIContent _label)
        {
            base.OnGUI(_position, _label);

            Rect preRect = new Rect(0, _position.y, _position.width / 3, _position.height);

            var target = Target as PropertyInfo;

            GUILayoutExtension.VerticalGroup(() =>
            {
                int maxValue = EditorGUILayout.IntField(GUIHelper.TextContent("Max:", $"{_label.text}最大值"), target.Max);
                if (maxValue != target.Max)
                {
                    target.SetMax(maxValue);
                }

                int minValue = EditorGUILayout.IntField(GUIHelper.TextContent("Min:", $"{_label.text}最小值"), target.Min);
                if (minValue != target.Min)
                {
                    target.SetMin(minValue);
                }

                int currValue = EditorGUILayout.IntField(GUIHelper.TextContent("Curr:", $"{_label.text}初始值"), target.Curr);
                if (currValue != target.Curr)
                {
                    target.Curr = currValue;
                }
            });

            return(Target);
        }
Ejemplo n.º 3
0
 private void DrawSystemSort(SystemSort sort, SystemType systemType)
 {
     GUILayoutExtension.HorizontalGroup(() =>
     {
         EditorGUILayout.LabelField(sort.typeName);
         MiscHelper.Btn("Up", 50, 35, () =>
         {
             sort.sort--;
             UpdateSystemSort();
         });
         MiscHelper.Btn("Down", 50, 35, () =>
         {
             sort.sort++;
             UpdateSystemSort();
         });
         MiscHelper.Btn("Del", 50, 35, () =>
         {
             sortAsset.GetSystemSorts(systemType).Remove(sort);
             UpdateSystemSort();
         });
         MiscHelper.Dropdown(systemType.ToString(), systemTyps, (int x) =>
         {
             SystemType newType = (SystemType)x;
             if (newType == systemType)
             {
                 return;
             }
             sortAsset.GetSystemSorts(systemType).Remove(sort);
             sortAsset.GetSystemSorts(newType).Add(sort);
             UpdateSystemSort();
         });
     });
 }
Ejemplo n.º 4
0
        public void DrawGraph(InternalTimelineGraphGroupAsset groupAsset, InternalTimelineGraphAsset graphAsset)
        {
            GUILayoutExtension.HorizontalGroup(() => {
                EditorGUILayout.LabelField(graphAsset.name, GUILayout.Width(150));

                if (GUILayout.Button("打开", GUILayout.Width(50)))
                {
                    TimelineWindow.Open(graphAsset);
                }

                if (GUILayout.Button("删除", GUILayout.Width(50)))
                {
                    groupAsset.RemoveGraph(graphAsset);
                }

                if (GUILayout.Button("重命名", GUILayout.Width(50)))
                {
                    MiscHelper.Input($"输入{groupAsset.DisplayName}名:", (string name) =>
                    {
                        graphAsset.name = name;
                        EditorUtility.SetDirty(graphAsset);
                        EditorUtility.SetDirty(target);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    });
                }
            });
        }
Ejemplo n.º 5
0
 public virtual void OnInspectorGUI()
 {
     EditorGUI.BeginDisabledGroup(true);
     EditorGUILayout.ObjectField("Script", Script, typeof(MonoScript), false);
     EditorGUI.EndDisabledGroup();
     foreach (var field in Fields)
     {
         GUILayoutExtension.DrawField(field, Target);
     }
 }
Ejemplo n.º 6
0
        private void DrawRequestSort(RequestSort sort)
        {
            GUILayoutExtension.VerticalGroup(() =>
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.TextField(sort.key);
                sort.name = EditorGUILayout.TextField(sort.name);

                if (!sort.isCover && !sort.isCustom)
                {
                    MiscHelper.Btn("Up", 50, 35, () =>
                    {
                        sort.sort--;
                        UpdateSystemSort();
                    });
                    MiscHelper.Btn("Down", 50, 35, () =>
                    {
                        sort.sort++;
                        UpdateSystemSort();
                    });
                    MiscHelper.Btn("Del", 50, 35, () =>
                    {
                        sortAsset.requests.Remove(sort);
                        UpdateSystemSort();
                    });
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("覆盖:");
                bool isCover = EditorGUILayout.Toggle(sort.isCover);
                if (isCover != sort.isCover)
                {
                    sort.isCover = isCover;
                    if (sort.isCover)
                    {
                        sort.isCustom = false;
                    }
                    UpdateSystemSort();
                }

                GUILayout.Label("自定义:");
                bool isCustom = EditorGUILayout.Toggle(sort.isCustom);
                if (isCustom != sort.isCustom)
                {
                    sort.isCustom = isCustom;
                    if (sort.isCustom)
                    {
                        sort.isCover = false;
                    }
                    UpdateSystemSort();
                }
                EditorGUILayout.EndHorizontal();
            });
        }
 private void DrawGraphPath(TimelineGroupPath path)
 {
     GUILayoutExtension.VerticalGroup(() =>
     {
         GUILayout.Label($"{path.typeName}", BigLabel.value);
         string newPath = MiscHelper.FolderPath("分组目录:", path.searchPath);
         if (newPath != path.searchPath)
         {
             path.searchPath = newPath;
             EditorUtility.SetDirty(settingAsset);
         }
     });
 }
Ejemplo n.º 8
0
        private void OnGUI()
        {
            GUILayoutExtension.VerticalGroup(() =>
            {
                InputStr = EditorGUILayout.TextField("请输入:", InputStr);

                EditorGUILayout.Space();

                MiscHelper.Btn("确定", position.width * 0.9f, position.height * 0.5f, () => {
                    if (CallBack != null && InputStr != "")
                    {
                        CallBack(InputStr);
                        Close();
                    }
                });
            });
        }
Ejemplo n.º 9
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label("Graph", bigLabel.value);
            });

            if (Target is BaseGraphView view && view.Model != null)
            {
                GUILayoutExtension.VerticalGroup(() =>
                {
                    GUILayout.Label(string.Concat("Nodes:", view.Model.Nodes.Count), bigLabel.value);
                    GUILayout.Label(string.Concat("Connections:", view.Model.Connections.Count), bigLabel.value);
                });

                EditorGUI.BeginChangeCheck();
                GUILayoutExtension.VerticalGroup(() => {
                    foreach (var property in view.Model)
                    {
                        if (IgnoreProperties.Contains(property.Key))
                        {
                            continue;
                        }

                        object newValue = GUILayoutExtension.DrawField(property.Value.ValueType, property.Value.ValueBoxed, GraphProcessorEditorUtility.GetDisplayName(property.Key), property.Value.ValueTooltip);
                        if (newValue == null || !newValue.Equals(property.Value.ValueBoxed))
                        {
                            view.CommandDispacter.Do(new BindableChangeValueCommand(property.Value, newValue));
                            //property.Value.ValueBoxed = newValue;
                        }
                    }
                });
                if (EditorGUI.EndChangeCheck())
                {
                }
            }
        }
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            ClipModel clipModel = Target as ClipModel;

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label("Clip:" + clipModel.TitleName, bigLabel.value);
            });

            float tStart = EditorGUILayout.FloatField("Start", clipModel.StartTime);

            if (tStart != clipModel.StartTime)
            {
                clipModel.SetStart((float)tStart);
            }

            float tEnd = EditorGUILayout.FloatField("End", clipModel.EndTime);

            if (tEnd != clipModel.EndTime)
            {
                clipModel.SetEnd((float)tEnd);
            }

            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.FloatField("Duration", clipModel.DurationTime);
            EditorGUI.EndDisabledGroup();

            foreach (var field in Fields)
            {
                if (field.Name == "StartTime" || field.Name == "EndTime" || field.Name == "DurationTime")
                {
                    continue;
                }
                DrawFields(field);
            }
        }
Ejemplo n.º 11
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }
            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label("Connection", bigLabel.value);
            });

            if (Target is BaseConnectionView view && view.Model != null)
            {
                GUILayoutExtension.VerticalGroup(() => {
                    GUILayout.Label(string.Concat(view.output?.node.title, ":", view.Model.FromPortName, "  >>  ", view.input?.node.title, ":", view.Model.ToPortName), bigLabel.value);
                });

                EditorGUI.BeginChangeCheck();
                GUILayoutExtension.VerticalGroup(() => {
                    foreach (var property in view.Model)
                    {
                        if (IgnoreProperties.Contains(property.Key))
                        {
                            continue;
                        }

                        object newValue = GUILayoutExtension.DrawField(property.Value.ValueType, property.Value.ValueBoxed, GraphProcessorEditorUtility.GetDisplayName(property.Key), property.Value.ValueTooltip);
                        if (!newValue.Equals(property.Value.ValueBoxed))
                        {
                            property.Value.ValueBoxed = newValue;
                        }
                    }
                });

                if (EditorGUI.EndChangeCheck())
                {
                }
            }
        }
Ejemplo n.º 12
0
        public override void OnDraw()
        {
            GUILayout.BeginHorizontal();

            GUILayoutExtension.HorizontalGroup(() => {
                DrawPlayOperate();
                GUILayout.FlexibleSpace();
                DrawSkillLineTime();
            }, EditorStylesExtension.NullStyle, GUILayout.Width(HorWidth), GUILayout.Height(window.ToolbarSize.height));

            GUILayout.FlexibleSpace();
            GUILayout.Label(GetTimelineName());
            GUILayout.FlexibleSpace();

            GUILayoutExtension.HorizontalGroup(() => {
                DrawBtnList();
            }, EditorStylesExtension.NullStyle, GUILayout.Width(HorWidth), GUILayout.Height(window.ToolbarSize.height));

            GUILayout.EndHorizontal();
        }
Ejemplo n.º 13
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            TrackModel trackModel = Target as TrackModel;

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label("Track:" + trackModel.TitleName, bigLabel.value);
            });

            base.OnInspectorGUI();
        }
Ejemplo n.º 14
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            InternalTimelineGraphGroupAsset groupAsset = target as InternalTimelineGraphGroupAsset;

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label($"{groupAsset.DisplayName}:{groupAsset.name}", bigLabel.value);
            });

            GUILayoutExtension.VerticalGroup(() => {
                List <InternalTimelineGraphAsset> graphs = groupAsset.GetAllGraph();
                for (int i = 0; i < graphs.Count; i++)
                {
                    DrawGraph(groupAsset, graphs[i]);
                }
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                if (GUILayout.Button($"创建{groupAsset.DisplayName}", GUILayout.Height(50)))
                {
                    groupAsset.OnClickCreateBtn();
                }

                if (GUILayout.Button($"导出{groupAsset.DisplayName}配置", GUILayout.Height(50)))
                {
                    groupAsset.OnClickExport();
                }
            });
        }
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out BigLabel))
            {
                BigLabel.value              = new GUIStyle(GUI.skin.label);
                BigLabel.value.fontSize     = 18;
                BigLabel.value.fontStyle    = FontStyle.Bold;
                BigLabel.value.alignment    = TextAnchor.MiddleLeft;
                BigLabel.value.stretchWidth = true;
            }

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label($"视图路径设置", BigLabel.value);
            });

            foreach (var item in settingAsset.groupPaths)
            {
                DrawGraphPath(item);
            }
        }
Ejemplo n.º 16
0
    static private void DrawSpecificSlideOptions()
    {
        switch (_selectedSlideTypeEnumVal)
        {
        case ESlideType.Slide:
            break;

        case ESlideType.VideoSlide:
            GUILayoutExtension.DrawHorizontalLine("Slide options");
            _video          = EditorGUILayout.ObjectField("Video  : ", _video, typeof(VideoClip), false) as VideoClip;
            _autoTransition = EditorGUILayout.Toggle("Auto Transition : ", _autoTransition);
            break;

        case ESlideType.TimedSlide:
            GUILayoutExtension.DrawHorizontalLine("Slide options");
            _timeBeforeFadeOut = EditorGUILayout.FloatField("Step duration : ", _timeBeforeFadeOut);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 17
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }
            if (window == null && config == null)
            {
                return;
            }
            GUILayoutExtension.VerticalGroup(() =>
            {
                EditorGUI.BeginDisabledGroup(true);
                EditorGUILayout.ObjectField("Script", Script, typeof(MonoScript), false);
                EditorGUI.EndDisabledGroup();

                bigLabel.value.alignment = TextAnchor.MiddleLeft;
                GUILayout.Label(string.Concat("配置项:", window.currSelAsset.name), bigLabel.value);

                GUILayoutExtension.VerticalGroup(() => {
                    foreach (var field in Fields)
                    {
                        if (AttributeHelper.TryGetFieldAttribute(field, out ConfigValueAttribute attr))
                        {
                            GUILayoutExtension.DrawField(field, Target, GUIHelper.TextContent(attr.Name, attr.Tooltip));
                        }
                        else
                        {
                            GUILayoutExtension.DrawField(field, Target);
                        }
                    }
                });
            });
        }
Ejemplo n.º 18
0
    public static void OnGUI()
    {
        if (_slideController == null && GameObject.FindObjectOfType <SlideController>())
        {
            _slideController = GameObject.FindObjectOfType <SlideController>();
        }
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, true, true);
        GUIStyle guiStyle = new GUIStyle();

        guiStyle.alignment = TextAnchor.MiddleCenter;

        EditorGUILayout.Space();
        _selectedSlideTypeEnumVal = (ESlideType)EditorGUILayout.EnumPopup("Select slide type : ", _selectedSlideTypeEnumVal);
        _slideName = EditorGUILayout.TextField("Slide GameObject name", _slideName);

        DrawSpecificSlideOptions();


        //CANVAS


        GUILayoutExtension.DrawHorizontalLine("More options");

        _addCanvas = EditorGUILayout.Toggle("Canvas : ", _addCanvas);
        if (_addCanvas)
        {
            _canvasRenderMode = (RenderMode)EditorGUILayout.EnumPopup("Canvas type : ", _canvasRenderMode);
            if (_canvasRenderMode == RenderMode.WorldSpace)
            {
                _deviceType             = (apperture.editor.DeviceType)EditorGUILayout.EnumPopup("Device type : ", _deviceType);
                _canvasSizeIfWorldSpace = apperture.editor.DeviceUtility.GetSize(_deviceType);
                EditorGUILayout.BeginHorizontal();
                var oldCol = GUI.contentColor;
                GUI.contentColor = Color.yellow;
                EditorGUILayout.LabelField("Width : " + _canvasSizeIfWorldSpace.x, GUILayout.MaxWidth(100f));
                EditorGUILayout.LabelField("Height : " + _canvasSizeIfWorldSpace.y, GUILayout.MaxWidth(100f));
                GUI.contentColor = oldCol;
                EditorGUILayout.EndHorizontal();
                _eventCamera = EditorGUILayout.ObjectField("Event Camera : ", _eventCamera, typeof(Camera), true) as Camera;
            }
            if (_canvasRenderMode == RenderMode.ScreenSpaceCamera)
            {
                _eventCamera         = EditorGUILayout.ObjectField("Event Camera : ", _eventCamera, typeof(Camera), true) as Camera;
                _canvasPlaneDistance = EditorGUILayout.FloatField("Plane distance : ", _canvasPlaneDistance);
            }

            EditorGUILayout.Space();


            //IMAGES

            GUILayoutExtension.DrawHorizontalLine("Image(s)");
            _addImg = EditorGUILayout.Toggle("Image", _addImg);

            if (_addImg)
            {
                _imgNb = Mathf.Clamp(EditorGUILayout.IntField("Number :", _imgNb), 0, 10);
                GUILayoutExtension.DrawHorizontalLine();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                for (int i = 0; i < _imgNb; i++)
                {
                    EditorGUILayout.LabelField("Image " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { });
                    EditorGUILayout.Space();

                    _imgNames[i]          = EditorGUILayout.TextField("Name :", _imgNames[i]);
                    _imgSprites[i]        = EditorGUILayout.ObjectField("Sprite : ", _imgSprites[i], typeof(Sprite), false) as Sprite;
                    _imgSetNativeSizes[i] = EditorGUILayout.Toggle("Native Size :", _imgSetNativeSizes[i]);
                    _imgAreFullScreen[i]  = EditorGUILayout.Toggle("FullScreen :", _imgAreFullScreen[i]);
                    if (_imgSetNativeSizes[i] == true)
                    {
                        _imgAreFullScreen[i] = false;
                    }
                    if (_imgAreFullScreen[i] != true)
                    {
                        _imgRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Button Pos :", _imgRectPositions[i]);
                        _imgOffSets[i]       = EditorGUILayout.Vector2Field("Offset :", _imgOffSets[i]);
                    }

                    GUILayoutExtension.DrawHorizontalLine();
                    EditorGUILayout.Space();
                }
            }


            //BUTTONS


            GUILayoutExtension.DrawHorizontalLine("Button(s)");
            _addBtn = EditorGUILayout.Toggle("Button", _addBtn);


            if (_addBtn)
            {
                _btnNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _btnNb), 0, 10);
                GUILayoutExtension.DrawHorizontalLine();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                for (int i = 0; i < _btnNb; i++)
                {
                    EditorGUILayout.LabelField("Button " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { });
                    EditorGUILayout.Space();

                    _btnNames[i]             = EditorGUILayout.TextField("Button Name :", _btnNames[i]);
                    _btnSprites[i]           = EditorGUILayout.ObjectField("Button Sprite :", _btnSprites[i], typeof(Sprite), false) as Sprite;
                    _btnSpritesAreNatives[i] = EditorGUILayout.Toggle("Set native :", _btnSpritesAreNatives[i]);
                    if (_btnSpritesAreNatives[i] == false)
                    {
                        _btnSpriteSizes[i] = EditorGUILayout.Vector2Field("Size :", _btnSpriteSizes[i]);
                    }
                    _btnRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Button Pos :", _btnRectPositions[i]);
                    _btnOffSets[i]       = EditorGUILayout.Vector2Field("Offset :", _btnOffSets[i]);
                    _btnTextNames[i]     = EditorGUILayout.TextField("Text Name :", _btnTextNames[i]);
                    _btnTextText[i]      = EditorGUILayout.TextField("Text :", _btnTextText[i]);
                    _btnTextSizes[i]     = EditorGUILayout.IntField("Size :", _btnTextSizes[i]);
                    _btnTextFonts[i]     = (EFontStyle)EditorGUILayout.EnumPopup("Font Style :", _btnTextFonts[i]);
                    _btnColors[i]        = EditorGUILayout.ColorField("Color :", _btnColors[i]);

                    GUILayoutExtension.DrawHorizontalLine();
                    EditorGUILayout.Space();
                }
            }


            //TEXTS


            GUILayoutExtension.DrawHorizontalLine("Text(s)");
            _addTxt = EditorGUILayout.Toggle("Text", _addTxt);


            if (_addTxt)
            {
                _txtNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _txtNb), 0, 10);
                GUILayoutExtension.DrawHorizontalLine();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                for (int i = 0; i < _txtNb; i++)
                {
                    EditorGUILayout.LabelField("Text " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { });
                    EditorGUILayout.Space();

                    _txtNames[i]         = EditorGUILayout.TextField("Text Name :", _txtNames[i]);
                    _txtTexts[i]         = EditorGUILayout.TextField("Text :", _txtTexts[i]);
                    _txtSizes[i]         = EditorGUILayout.IntField("Size :", _txtSizes[i]);
                    _txtFontStyles[i]    = (EFontStyle)EditorGUILayout.EnumPopup("Font Style :", _txtFontStyles[i]);
                    _txtColors[i]        = EditorGUILayout.ColorField("Color :", _txtColors[i]);
                    _txtBoxSizes[i]      = EditorGUILayout.Vector2Field("Taille :", _txtBoxSizes[i]);
                    _txtRectPositions[i] = (ERectPosition)EditorGUILayout.EnumPopup("Text Pos :", _txtRectPositions[i]);
                    _txtOffSets[i]       = EditorGUILayout.Vector2Field("Offset :", _txtOffSets[i]);

                    GUILayoutExtension.DrawHorizontalLine();
                    EditorGUILayout.Space();
                }
            }


            //PREFABS


            GUILayoutExtension.DrawHorizontalLine("Prefabs(s)");
            _addPrefab = EditorGUILayout.Toggle("Prefab", _addPrefab);

            if (_addPrefab)
            {
                _prefabNb = Mathf.Clamp(EditorGUILayout.IntField("Number : ", _prefabNb), 0, 10);
                GUILayoutExtension.DrawHorizontalLine();
                EditorGUILayout.Space();
                EditorGUILayout.Space();

                for (int i = 0; i < _prefabNb; i++)
                {
                    EditorGUILayout.LabelField("Prefab " + (i + 1).ToString(), guiStyle, new GUILayoutOption[] { });
                    EditorGUILayout.Space();

                    _prefabGameObjects[i] = EditorGUILayout.ObjectField("Prefab :", _prefabGameObjects[i], typeof(GameObject), false) as GameObject;

                    GUILayoutExtension.DrawHorizontalLine();
                    EditorGUILayout.Space();
                }
            }
        }

        EditorGUILayout.Space();
        GUILayoutExtension.DrawHorizontalLine();
        EditorGUILayout.Space();


        if (GUILayout.Button("Create step",
                             new GUILayoutOption[]
        {
            GUILayout.Height(50),
        }
                             ))
        {
            CreateStep(_selectedSlideTypeEnumVal);
        }


        GUILayout.EndScrollView();
    }
Ejemplo n.º 19
0
        private void DrawCom(BaseCom baseCom)
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            List <FieldInfo> serFields   = new List <FieldInfo>();
            List <FieldInfo> noSerFields = new List <FieldInfo>();

            foreach (var item in ReflectionHelper.GetFieldInfos(baseCom.GetType()))
            {
                bool ignore = false;
                foreach (var ignoreName in IgnoreFieldName)
                {
                    if (item.Name.Contains(ignoreName))
                    {
                        ignore = true;
                        continue;
                    }
                }
                if (ignore)
                {
                    continue;
                }

                if (AttributeHelper.TryGetFieldAttribute(item, out NonSerializedAttribute attr))
                {
                    noSerFields.Add(item);
                }
                else
                {
                    serFields.Add(item);
                }
            }

            _serFoldout = EditorGUILayout.Foldout(_serFoldout, "Serialized:");
            if (_serFoldout)
            {
                foreach (var item in serFields)
                {
                    object newValue = GUILayoutExtension.DrawField(item.FieldType, item.GetValue(baseCom), GraphProcessorEditorUtility.GetDisplayName(item.Name), "");
                    if (newValue == null || !newValue.Equals(item.GetValue(baseCom)))
                    {
                        item.SetValue(baseCom, newValue);
                    }
                }
            }

            _noSerFoldout = EditorGUILayout.Foldout(_noSerFoldout, "NoSerialized:");
            if (_noSerFoldout)
            {
                EditorGUI.BeginDisabledGroup(true);
                foreach (var item in noSerFields)
                {
                    GUILayoutExtension.DrawField(item.FieldType, item.GetValue(baseCom), GraphProcessorEditorUtility.GetDisplayName(item.Name), "");
                }
                EditorGUI.EndDisabledGroup();
            }
        }
Ejemplo n.º 20
0
        private void OnGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            //¹¤¾ßÀ¸
            GUILayoutExtension.HorizontalGroup(() =>
            {
                string selMap = currSelAsset == null ? "Null" : currSelAsset.name;
                GUILayout.Label($"µ±Ç°ÅäÖÃ:{selMap}", bigLabel.value);

                if (currSelAsset != null)
                {
                    if (GUILayout.Button("±£´æÅäÖÃ", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight)))
                    {
                        SaveAsset(currSelAsset);
                    }
                }
            }, GUILayout.Height(50));

            if (currSelAsset != null)
            {
                GUILayoutExtension.ScrollView(ref ScrollPos, () =>
                {
                    GUILayoutExtension.HorizontalGroup(() =>
                    {
                        EditorGUILayout.Space(35);
                        //×Ö¶Î
                        foreach (var fieldInfo in fields.Keys)
                        {
                            ConfigValueAttribute attr = fields[fieldInfo];
                            Rect rect = GetFieldRect(fieldInfo);
                            EditorGUI.LabelField(rect, GUIHelper.TextContent(attr.Name, attr.Tooltip), bigLabel.value);
                        }
                    });

                    for (int i = 0; i < configs.Count; i++)
                    {
                        IConfig config = configs[i];
                        GUILayoutExtension.HorizontalGroup(() =>
                        {
                            GUI.color = Color.white;
                            if (IsInSel(config))
                            {
                                GUI.color = SelectColor;
                            }
                            MiscHelper.Btn("Ñ¡Ôñ", 35, 35, () =>
                            {
                                OnClickSelBtn(config);
                            });
                            foreach (var fieldInfo in fields.Keys)
                            {
                                object value = fieldInfo.GetValue(config);
                                //float height = GUIExtension.GetHeight(fieldInfo.FieldType, value, GUIHelper.TextContent(""));
                                object newValue = GUIExtension.DrawField(GetFieldRect(fieldInfo), value, GUIHelper.TextContent(""));
                                if (newValue == null || !newValue.Equals(value))
                                {
                                    CommandDispacter.Do(new ChangeValueCommand(config, fieldInfo, newValue));
                                }
                            }
                            GUI.color = Color.white;
                        });
                    }
                });
            }
            OnHandleEvent(Event.current);
        }
Ejemplo n.º 21
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            ConfigAssetGroup groupAsset = target as ConfigAssetGroup;

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label($"Config:{groupAsset.name}", bigLabel.value);
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                List <Type> cnfTypes   = new List <Type>();
                List <string> cnfNames = new List <string>();
                foreach (var item in ReflectionHelper.GetChildTypes <IConfig>())
                {
                    string displayName = item.Name;
                    if (AttributeHelper.TryGetTypeAttribute(item, out ConfigAttribute attr))
                    {
                        displayName = attr.DisplayName;
                    }
                    cnfNames.Add(displayName);
                    cnfTypes.Add(item);
                }
                if (groupAsset.configTypeFullName == null)
                {
                    EditorGUILayout.HelpBox("没有选择配置类!!!", MessageType.Error);
                    MiscHelper.Dropdown($"选择的配置类", cnfNames, (int a) => {
                        groupAsset.configTypeFullName = cnfTypes[a].FullName;
                        groupAsset.configTypeName     = cnfTypes[a].Name;
                    }, 300);
                }
                else
                {
                    MiscHelper.Dropdown(groupAsset.configTypeFullName, cnfNames, (int a) => {
                        groupAsset.configTypeFullName = cnfTypes[a].FullName;
                        groupAsset.configTypeName     = cnfTypes[a].Name;
                    }, 300);
                }
            });

            GUILayoutExtension.VerticalGroup(() => {
                List <ConfigAsset> assets = groupAsset.GetAllAsset();
                for (int i = 0; i < assets.Count; i++)
                {
                    DrawGraph(groupAsset, assets[i]);
                }
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                if (GUILayout.Button($"创建配置", GUILayout.Height(50)))
                {
                    MiscHelper.Input($"输入配置名:", (string name) =>
                    {
                        groupAsset.CreateAsset(name);
                    });
                }
            });
        }
Ejemplo n.º 22
0
        private void OnGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            //工具栏
            GUILayoutExtension.HorizontalGroup(() =>
            {
                string selMap = currSelMap == null ? "Null" : currSelMap.mapId.ToString();
                GUILayout.Label($"当前地图:{selMap}", bigLabel.value);

                if (GUILayout.Button("加载地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight)))
                {
                    List <string> mapNames = new List <string>();
                    for (int i = 0; i < maps.Count; i++)
                    {
                        mapNames.Add(maps[i].mapId.ToString());
                    }
                    MiscHelper.Menu(mapNames, (string selMap) =>
                    {
                        ED_MapCom mapAsset = GetMap(int.Parse(selMap));
                        GameObject mapGo   = (GameObject)PrefabUtility.InstantiatePrefab(mapAsset.gameObject);
                        OnChangeMap(mapGo.GetComponent <ED_MapCom>());
                    });
                }

                if (currSelMap != null)
                {
                    if (GUILayout.Button("保存地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight)))
                    {
                        SaveMap(currSelMap);
                        Refresh();
                    }
                }

                if (GUILayout.Button("新建地图", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight)))
                {
                    MiscHelper.Input("输入地图Id", (string x) =>
                    {
                        if (GetMap(int.Parse(x)) != null)
                        {
                            Debug.LogError($"地图Id重复>>>>{x}");
                            return;
                        }
                        SaveMap(currSelMap);
                        ED_MapCom mapCom = MapEditorDef.CreateMapGo(x);
                        mapCom.SetUid(GetMapStartUid());
                        OnChangeMap(mapCom);
                    });
                }

                if (GUILayout.Button("导出所有配置", GUILayout.Width(BtnWidth), GUILayout.Height(BtnHeight)))
                {
                    ED_MapCom.ActorCnfs   = MapEditorWindow.ActorCnfs;
                    List <ED_MapCom> maps = MapSetting.GetAllMaps();
                    for (int i = 0; i < maps.Count; i++)
                    {
                        GameObject mapGo    = GameObject.Instantiate(maps[i].gameObject);
                        ED_MapCom eD_MapCom = mapGo.GetComponent <ED_MapCom>();
                        MapModel model      = eD_MapCom.ExportData();

                        string filePath = MapSetting.GetMapModelSavePath(model.mapId.ToString());
                        IOHelper.WriteText(JsonMapper.ToJson(model), filePath);

                        DestroyImmediate(eD_MapCom.gameObject);
                        Debug.Log($"地图配置生成成功>>>>{filePath}");
                    }
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh();
                }
            }, GUILayout.Height(50));

            GUILayoutExtension.HorizontalGroup(() =>
            {
                //演员分组列表
                GUILayoutExtension.VerticalGroup(() =>
                {
                    GUILayout.Label("演员列表", bigLabel.value);
                    for (int i = 0; i < ActorCnfs.Count; i++)
                    {
                        if (GUILayout.Button($"{ActorCnfs[i].name}-{ActorCnfs[i].id}", GUILayout.Width(100), GUILayout.Height(BtnHeight)))
                        {
                            ED_ActorCom actorCom   = currSelMap.CreateActor(ActorCnfs[i]);
                            Selection.activeObject = actorCom;
                        }
                    }
                }, GUILayout.Width(50));
            });
        }
Ejemplo n.º 23
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            MiscHelper.Btn("清除废弃请求", 250, 35, () =>
            {
                for (int i = 0; i < sortAsset.requests.Count; i++)
                {
                    RequestSort request = sortAsset.requests[i];
                    if (!Enum.TryParse <RequestId>(request.key, out RequestId id))
                    {
                        sortAsset.requests.RemoveAt(i);
                    }
                }
                UpdateSystemSort();
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label($"请求排序", bigLabel.value);
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label(" ----------- 覆盖请求 ----------- ", bigLabel.value);
                for (int i = 0; i < coverReqests.Count; i++)
                {
                    DrawRequestSort(coverReqests[i]);
                }

                GUILayout.Label(" ----------- 自定义规则请求 ----------- ", bigLabel.value);
                for (int i = 0; i < customReqests.Count; i++)
                {
                    DrawRequestSort(customReqests[i]);
                }

                GUILayout.Label(" ----------- 排序请求 ----------- ", bigLabel.value);
                for (int i = 0; i < sortReqests.Count; i++)
                {
                    DrawRequestSort(sortReqests[i]);
                }

                if (GUILayout.Button("创建请求", GUILayout.Height(50)))
                {
                    MiscHelper.Input("输入请求名", (x) =>
                    {
                        if (sortAsset.GetSort(x) != null)
                        {
                            Debug.LogError($"请求重复>>>>{x}");
                            return;
                        }
                        RequestSort sort = new RequestSort();
                        sort.key         = x;
                        sort.name        = x;
                        sort.sort        = sortAsset.requests.Count;
                        sortAsset.requests.Add(sort);
                        GenCode();
                    });
                }

                if (GUILayout.Button("生成请求代码", GUILayout.Height(50)))
                {
                    GenCode();
                }
            });
        }
Ejemplo n.º 24
0
        public override void OnInspectorGUI()
        {
            if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel))
            {
                bigLabel.value              = new GUIStyle(GUI.skin.label);
                bigLabel.value.fontSize     = 18;
                bigLabel.value.fontStyle    = FontStyle.Bold;
                bigLabel.value.alignment    = TextAnchor.MiddleLeft;
                bigLabel.value.stretchWidth = true;
            }

            MiscHelper.Btn("清除废弃系统", 250, 35, () =>
            {
                for (int i = 0; i < sortAsset.updateSystems.Count; i++)
                {
                    SystemSort sort = sortAsset.updateSystems[i];
                    if (ReflectionHelper.GetType(sort.typeFullName) == null)
                    {
                        sortAsset.updateSystems.RemoveAt(i);
                    }
                }

                for (int i = 0; i < sortAsset.fixedUpdateSystems.Count; i++)
                {
                    SystemSort sort = sortAsset.fixedUpdateSystems[i];
                    if (ReflectionHelper.GetType(sort.typeFullName) == null)
                    {
                        sortAsset.fixedUpdateSystems.RemoveAt(i);
                    }
                }

                for (int i = 0; i < sortAsset.threadSystems.Count; i++)
                {
                    SystemSort sort = sortAsset.threadSystems[i];
                    if (ReflectionHelper.GetType(sort.typeFullName) == null)
                    {
                        sortAsset.threadSystems.RemoveAt(i);
                    }
                }

                UpdateSystemSort();
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label($"系统运行排序", bigLabel.value);
            });

            GUILayoutExtension.VerticalGroup(() =>
            {
                GUILayout.Label(" ----------- Update ----------- ", bigLabel.value);
                List <SystemSort> upSorts = sortAsset.GetSystemSorts(SystemType.Update);
                for (int i = 0; i < upSorts.Count; i++)
                {
                    DrawSystemSort(upSorts[i], SystemType.Update);
                }

                GUILayout.Label(" ----------- FixedUpdate ----------- ", bigLabel.value);
                List <SystemSort> fixedSorts = sortAsset.GetSystemSorts(SystemType.FixedUpdate);
                for (int i = 0; i < fixedSorts.Count; i++)
                {
                    DrawSystemSort(fixedSorts[i], SystemType.FixedUpdate);
                }

                //GUILayout.Label(" ----------- Thread ----------- ", bigLabel.value);
                //List<SystemSort> threadSorts = sortAsset.GetSystemSorts(SystemType.Thread);
                //for (int i = 0; i < threadSorts.Count; i++)
                //{
                //    DrawSystemSort(threadSorts[i], SystemType.Thread);
                //}
            });
        }
 public virtual void DrawFields(FieldInfo fieldInfo)
 {
     GUILayoutExtension.DrawField(fieldInfo, Target);
 }
Ejemplo n.º 26
0
 void Init(object _target)
 {
     Target = _target;
     Script = EditorExtension.FindScriptFromType(Target.GetType());
     Fields = ReflectionHelper.GetFieldInfos(Target.GetType()).Where(field => GUILayoutExtension.CanDraw(field)).ToList();
 }