Пример #1
0
        private void OnLevelsNameGUI()
        {
            foreach (var externalEditor in _externalEditorData)
            {
                // Draw Level names from other editors (read only)
                externalEditor.LevelSpawnNames = JEMBetterEditor.ContentList(externalEditor.LevelSpawnNames, this,
                                                                             str =>
                {
                    str = EditorGUILayout.TextField(str);
                    return(str);
                },
                                                                             new JEMBetterEditorStyle(externalEditor.name, $"{ nameof(SharedContentEditorWindow)}.{externalEditor.UniqueGUID}.LevelSpawnNames")
                {
                    Readonly = true
                });
            }

            // Draw local editor
            if (_localEditorData == null)
            {
                EditorGUILayout.HelpBox("No local editor data detected.", MessageType.Warning, true);
            }
            else
            {
                _localEditorData.LevelSpawnNames = JEMBetterEditor.ContentList(_localEditorData.LevelSpawnNames, this,
                                                                               str =>
                {
                    str = EditorGUILayout.TextField(str);
                    return(str);
                },
                                                                               new JEMBetterEditorStyle($"Local Shared Data ({_localEditorData.name})", $"{nameof(SharedContentEditorWindow)}.{_localEditorData.UniqueGUID}.LevelSpawnNames"));
            }
        }
Пример #2
0
        /// <inheritdoc />
        public override void OnInspectorGUI()
        {
            _target.Identity = (short)EditorGUILayout.IntField("Identity", _target.Identity);
            JEMBetterEditor.DrawProperty(" ", () =>
            {
                if (GUILayout.Button("Regenerate Identity"))
                {
                    RefreshIdentity();
                }
            });

            _drawNetworkBehaviour.value = EditorGUILayout.BeginFoldoutHeaderGroup(_drawNetworkBehaviour.value, "Network Behaviour");
            if (_drawNetworkBehaviour.value)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;
                _target.NetworkBehaviour.ActiveOnClient = EditorGUILayout.Toggle("Active On Client", _target.NetworkBehaviour.ActiveOnClient);
                _target.NetworkBehaviour.ActiveOnServer = EditorGUILayout.Toggle("Active On Server", _target.NetworkBehaviour.ActiveOnServer);
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            _drawReferences.value = EditorGUILayout.BeginFoldoutHeaderGroup(_drawReferences.value, "References");
            if (_drawReferences.value)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;
                _target.References.ModelRoot         = (GameObject)EditorGUILayout.ObjectField("Model Root", _target.References.ModelRoot, typeof(GameObject), true);
                _target.References.CharacterSettings = (CharacterSettingsReference)EditorGUILayout.ObjectField("Character Settings", _target.References.CharacterSettings, typeof(CharacterSettingsReference), false);
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();

            if (_target.References.ModelRoot == null)
            {
                EditorGUILayout.HelpBox("ModelRoot of level object is not set!", MessageType.Warning, true);
            }
            else if (_target.References.ModelRoot == _target.gameObject)
            {
                EditorGUILayout.HelpBox("Setting this gameObject as ModelRoot may create problems.", MessageType.Warning, true);
            }

            EditorGUILayoutGameUtility.DrawTargetExtras(_target);
        }
Пример #3
0
        private void OnAssetBundlesSettingsGUI()
        {
            EditorGUIUtility.labelWidth += 25f;
            var cfg = JEMAssetsBuilderConfiguration.Configuration;

            GUILayout.Label("JEM AssetBuilder Settings", EditorStyles.boldLabel);
            cfg.PackageExtension = EditorGUILayout.TextField("Package Extension", cfg.PackageExtension);

            if (cfg.PackageExtension.Length != 0 && cfg.PackageExtension[0] == '.')
            {
                EditorGUILayout.HelpBox("Package extension starts with '.'!", MessageType.Warning, true);
            }

            EditorGUILayout.TextField("Directory", cfg.PackageDirectory);
            JEMBetterEditor.DrawProperty(" ", () =>
            {
                if (GUILayout.Button("Select"))
                {
                    var directory        = EditorUtility.OpenFolderPanel("Select directory of package", cfg.PackageDirectory, "");
                    cfg.PackageDirectory = ExtensionPath.ResolveRelativeFilePath(directory);
                }
            });

            cfg.CompressAssetBundles = EditorGUILayout.Toggle("Asset Bundles Compression", cfg.CompressAssetBundles);
            if (cfg.CompressAssetBundles)
            {
                EditorGUI.indentLevel++;
                cfg.ChunkBasedAssetBundlesCompression = EditorGUILayout.Toggle("Chunk Based", cfg.ChunkBasedAssetBundlesCompression);
                if (cfg.ChunkBasedAssetBundlesCompression)
                {
                    EditorGUILayout.HelpBox("Chunk Compressed (LZ4) compression method.", MessageType.Info, true);
                }
                else
                {
                    EditorGUILayout.HelpBox("Stream Compressed (LZMA) compression method.", MessageType.Info, true);
                }

                EditorGUI.indentLevel--;
            }
            EditorGUIUtility.labelWidth -= 25f;
        }
        /// <inheritdoc />
        public override void OnInspectorGUI()
        {
            EditorGUILayout.HelpBox("SLUI UNITY EVENT HELPER - This script is needed because of UnityEvents\n" +
                                    "design that is not allowing to get or set parameters.", MessageType.Info, true);

            EditorGUILayout.LabelField("Events", EditorStyles.boldLabel);
            _target.Items = JEMBetterEditor.ExperimentalList(_target.Items, _target, o =>
            {
                EditorGUILayout.BeginVertical();
                GUILayout.Label("Parameters", EditorStyles.boldLabel);
                o.obj = JEMBetterEditor.ExperimentalList(o.obj, _target, s =>
                {
                    s = EditorGUILayout.TextField(s);
                    return(s);
                }, new JEMBetterEditorStyle("Objects", $"{nameof(SLUIUnityEventHelperEditor)}.Obj_{_target.Items.IndexOf(o)}")
                {
                    FoldoutHeaderType = JEMBetterEditorHeaderType.None
                });

                CheckEvent(_target.Items.IndexOf(o), o.obj);
                EditorGUILayout.EndVertical();
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                return(o);
            }, new JEMBetterEditorStyle("Events", $"{nameof(SLUIUnityEventHelperEditor)}.Events")
            {
                FoldoutHeaderType = JEMBetterEditorHeaderType.None
            });

            var button = _target.GetComponent <Button>();

            if (button == null)
            {
                return;
            }
            if (_target.Items.Count != button.onClick.GetPersistentEventCount())
            {
                EditorGUILayout.HelpBox("Error. You have defined invalid amount of events.", MessageType.Error, true);
            }
        }
Пример #5
0
        protected void DrawDatabaseItemGUI()
        {
            var item = (DatabaseItem)target;

            _drawDatabaseItemSettings.value = EditorGUILayout.BeginFoldoutHeaderGroup(_drawDatabaseItemSettings.value, "Database Item Settings");
            if (_drawDatabaseItemSettings.value)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;

                EditorGUILayout.LabelField("Unique Identity", item.Identity.ToString());
                JEMBetterEditor.DrawProperty(" ", () =>
                {
                    if (GUILayout.Button("Regenerate"))
                    {
                        bool canRegenerate = true;
                        if (item.Identity != 0)
                        {
                            canRegenerate = EditorUtility.DisplayDialog("Regenerate?",
                                                                        "Are you sure you want to regenerate the identity of this object? All references will be lost!",
                                                                        "Yes", "No");
                        }

                        if (canRegenerate)
                        {
                            RegenerateIdentity();
                        }
                    }
                });

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

            // Draw extras
            EditorGUILayoutGameUtility.DrawTargetExtras(target);
        }
Пример #6
0
        private void OnAssetBundlesSettingsGUI()
        {
            var cfg = JEMAssetsBuilderConfiguration.Configuration;

            GUILayout.Label("JEM AssetBuilder Settings", EditorStyles.boldLabel);
            cfg.PackageExtension = EditorGUILayout.TextField("Package Extension", cfg.PackageExtension);

            if (cfg.PackageExtension.Length != 0 && cfg.PackageExtension[0] == '.')
            {
                EditorGUILayout.HelpBox("Package extension starts with '.'!", MessageType.Warning, true);
            }

            EditorGUILayout.TextField("Directory", cfg.PackageDirectory);
            JEMBetterEditor.DrawProperty(" ", () =>
            {
                if (GUILayout.Button("Select"))
                {
                    var directory        = EditorUtility.OpenFolderPanel("Select directory of package", cfg.PackageDirectory, "");
                    cfg.PackageDirectory = ExtensionPath.ResolveRelativeFilePath(directory);
                }
            });
        }
Пример #7
0
        /// <inheritdoc />
        public override void OnInspectorGUI()
        {
            _drawDatabaseItemContent.value = EditorGUILayout.BeginFoldoutHeaderGroup(_drawDatabaseItemContent.value, $"{JEMBetterEditor.FixedPropertyName(target.GetType().Name)} Content");
            if (_drawDatabaseItemContent.value)
            {
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                EditorGUI.indentLevel++;
                // invoke base method
                base.OnInspectorGUI();
                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }

            EditorGUILayout.EndFoldoutHeaderGroup();

            // And draw the content...
            DrawDatabaseItemGUI();
        }
        private void InternalDrawFlags()
        {
            if (!(JEMEditorConfiguration.Configuration?.UpdateFlags ?? false))
            {
                return;
            }

            if (_drawFlags.value)
            {
                if (GUILayout.Button("Flags (Hide)"))
                {
                    _drawFlags.value = false;
                }
            }
            else
            {
                if (GUILayout.Button("Flags (Show)"))
                {
                    _drawFlags.value = true;
                }
            }

            if (EditorGUILayout.BeginFadeGroup(_drawFlags.faded))
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    for (var index = 0; index < JEMBuildFlags.Flags.Count; index++)
                    {
                        var flag = JEMBuildFlags.Flags[index];
                        if (flag.Equals(default(BuildFlag)))
                        {
                            continue;
                        }

                        EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                        {
                            GUILayout.Label(flag.Name);
                            var enabled = EditorGUILayout.Toggle(flag.Enabled, GUILayout.Width(30));
                            if (enabled != flag.Enabled)
                            {
                                JEMBuildFlags.SetFlagActive(flag.Name, enabled);
                            }

                            if (GUILayout.Button("X", GUILayout.Width(30)))
                            {
                                JEMBuildFlags.RemoveFlag(flag.Name);
                            }
                        }
                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.BeginHorizontal(EditorStyles.helpBox);
                    {
                        _newFlag = EditorGUILayout.TextField(_newFlag);
                        if (GUILayout.Button("Add", GUILayout.Width(50)))
                        {
                            if (!string.IsNullOrEmpty(_newFlag) && !string.IsNullOrWhiteSpace(_newFlag))
                            {
                                if (JEMBuildFlags.AddFlag(_newFlag))
                                {
                                    _newFlag = string.Empty;
                                }
                            }
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    if (GUILayout.Button("Force Reload"))
                    {
                        JEMBuildFlags.SaveFlags();
                        JEMBuildFlags.ApplyFlags();
                    }

                    if (GUILayout.Button("Refresh/Apply"))
                    {
                        JEMBuildFlags.SaveFlags();
                        JEMBuildFlags.LoadFlags();
                        JEMBuildFlags.ApplyFlags();
                    }
                }
                EditorGUILayout.EndVertical();
                EditorGUILayout.Space();
            }

            JEMBetterEditor.FixedEndFadeGroup(_drawFlags.faded);
        }