コード例 #1
0
        static string GetTemplateContent(string proto)
        {
            // hack: its only one way to get current editor script path. :(
            var pathHelper = ScriptableObject.CreateInstance <TemplateGenerator> ();
            var path       = Path.GetDirectoryName(AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(pathHelper)));

            UnityEngine.Object.DestroyImmediate(pathHelper);
            try {
                return(File.ReadAllText(Path.Combine(path, proto)));
            } catch {
                return(null);
            }
        }
コード例 #2
0
        private SPath DetermineInstallationPath()
        {
#if UNITY_EDITOR
            // Juggling to find out where we got installed
            var shim       = CreateInstance <RunLocationShim>();
            var script     = MonoScript.FromScriptableObject(shim);
            var scriptPath = AssetDatabase.GetAssetPath(script).ToSPath().Resolve();
            DestroyImmediate(shim);
            return(scriptPath.Parent);
#else
            return(System.Reflection.Assembly.GetExecutingAssembly().Location.ToSPath().Parent);
#endif
        }
コード例 #3
0
    void iconAssetPath()
    {
        windowIconPath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));

        string iconFilename = "aviwindowicon_light.png";

        if (EditorGUIUtility.isProSkin)
        {
            iconFilename = "aviwindowicon_dark.png";
        }

        windowIconPath = windowIconPath.Substring(0, windowIconPath.LastIndexOf('/')) + "/EditorResources/" + iconFilename;
    }
コード例 #4
0
        private Shapes2DPrefs GetPreferences()
        {
            string path  = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));
            int    index = path.IndexOf("Shapes2D");

            if (index == -1)
            {
                return(null);
            }
            string prefsPath = path.Substring(0, index + 8) + "/Preferences.asset";

            return(AssetDatabase.LoadAssetAtPath <Shapes2DPrefs>(prefsPath));
        }
コード例 #5
0
    void LoadImagePrefab()
    {
        var script = MonoScript.FromScriptableObject(this);

        var    scriptPath    = AssetDatabase.GetAssetPath(script);
        string directoryPath = Path.GetDirectoryName(scriptPath);

        string pluginDir    = Path.GetDirectoryName(directoryPath);
        string prefabsDir   = pluginDir + "/Prefabs";
        string relativePath = prefabsDir + "/SketchImportImage.prefab";

        imagePrefab = (Image)AssetDatabase.LoadAssetAtPath <Image>(relativePath);
    }
コード例 #6
0
        public override void OnInspectorGUI()
        {
            if (nodesArray == null)
            {
                Init();
            }

            GUI.enabled = false;
            EditorGUILayout.ObjectField("Script:", MonoScript.FromScriptableObject((Pathern)target), typeof(Pathern), false);
            GUI.enabled = true;

            CustomInspector();
        }
コード例 #7
0
        void OnEnable()
        {
            logDebugInfo      = serializedObject.FindProperty("logDebugInfo");
            invertYAxis       = serializedObject.FindProperty("invertYAxis");
            enableXInput      = serializedObject.FindProperty("enableXInput");
            useFixedUpdate    = serializedObject.FindProperty("useFixedUpdate");
            dontDestroyOnLoad = serializedObject.FindProperty("dontDestroyOnLoad");
            customProfiles    = serializedObject.FindProperty("customProfiles");

            var path = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this));

            headerTexture = Resources.LoadAssetAtPath <Texture>(Path.GetDirectoryName(path) + "/Images/InControlHeader.png");
        }
コード例 #8
0
    private static string GetOculusProjectNetworkSecConfigPath()
    {
        var    so              = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
        var    script          = MonoScript.FromScriptableObject(so);
        string assetPath       = AssetDatabase.GetAssetPath(script);
        string editorDir       = Directory.GetParent(assetPath).FullName;
        string configAssetPath = Path.GetFullPath(Path.Combine(editorDir, "network_sec_config.xml"));
        Uri    configUri       = new Uri(configAssetPath);
        Uri    projectUri      = new Uri(Application.dataPath);
        Uri    relativeUri     = projectUri.MakeRelativeUri(configUri);

        return(relativeUri.ToString());
    }
コード例 #9
0
        /// <summary>
        /// Draws custom inspector for the asset
        /// </summary>
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Script");
            EditorGUILayout.ObjectField(MonoScript.FromScriptableObject((TesseractOCRSettings)target), typeof(TesseractOCRSettings), false);
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.BeginVertical();
            m_InspectorGUI.OnInspectorGUI();
            EditorGUILayout.EndVertical();
        }
コード例 #10
0
        static public void Initialize()
        {
#if UNITY_EDITOR
            if (!main)
            {
                //Get the Preference
                string[] targetData = AssetDatabase.FindAssets("t:TEXPreference");
                if (targetData.Length > 0)
                {
                    var path = AssetDatabase.GUIDToAssetPath(targetData[0]);
                    main = AssetDatabase.LoadAssetAtPath <TEXPreference>(path);
                    main.MainFolderPath = Path.GetDirectoryName(path);
                    // TEXDraw preference now put into resources files after 3.0
                    if (main.MainFolderPath.Contains("Resources"))
                    {
                        main.MainFolderPath = Path.GetDirectoryName(main.MainFolderPath);
                    }
                    if (targetData.Length > 1)
                    {
                        Debug.LogWarning("You have more than one TEXDraw preference, ensure that only one Preference exist in your Project");
                    }
                }
                else
                {
                    //Create New One
                    main = CreateInstance <TEXPreference>();
                    if (AssetDatabase.IsValidFolder(DefaultTexFolder))
                    {
                        AssetDatabase.CreateAsset(main, DefaultTexFolder + "/Resources/TEXDrawPreference.asset");
                        main.FirstInitialize(DefaultTexFolder);
                    }
                    else
                    {
                        //Find alternative path to the TEXPreference, that's it: Parent path of TEXPreference script.
                        string AlternativePath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(main));
                        AlternativePath = Directory.GetParent(AlternativePath).Parent.FullName;
                        AssetDatabase.CreateAsset(main, AlternativePath + "/Resources/TEXDrawPreference.asset");
                        main.FirstInitialize(AlternativePath);
                    }
                }
            }
#else
            if (!main)
            {
                // The only thing that we can found is in the Resource folder
                main = (TEXPreference)Resources.Load("TEXDrawPreference");
            }
#endif
            // also init the neighborhood
            TEXConfiguration.Initialize();
        }
コード例 #11
0
ファイル: AnimationClipEditor.cs プロジェクト: malering/ET
        /************************************************************************************************************************/

        /// <summary>Draws the regular Inspector then adds a better preview for <see cref="Sprite"/> animations.</summary>
        /// <remarks>Called by the Unity editor to draw the custom Inspector GUI elements.</remarks>
        public override void OnInspectorGUI()
        {
            if (DefaultEditorType == null)
            {
                EditorGUILayout.HelpBox(
                    $"Unable to find type '{DefaultEditorTypeName}' in '{typeof(UnityEditor.Editor).Assembly}'." +
                    $" The {nameof(AnimationClipEditor)} script will need to be fixed" +
                    $" or you can simply delete it to use Unity's regular {nameof(AnimationClip)} Inspector.", MessageType.Error);

                const string Label = "Delete " + nameof(AnimationClipEditor) + " Script";
                if (GUILayout.Button(Label))
                {
                    if (EditorUtility.DisplayDialog(Label,
                                                    $"Are you sure you want to delete the {nameof(AnimationClipEditor)} script?" +
                                                    $" This operation cannot be undone.",
                                                    "Delete", "Cancel"))
                    {
                        var script = MonoScript.FromScriptableObject(this);
                        var path   = AssetDatabase.GetAssetPath(script);
                        AssetDatabase.DeleteAsset(path);
                    }
                }

                return;
            }

            if (TryGetDefaultEditor(out var editor))
            {
                editor.OnInspectorGUI();
            }

            if (GUILayout.Button("Open Animation Window"))
            {
                EditorApplication.ExecuteMenuItem("Window/Animation/Animation");
            }

            var targets = this.targets;

            if (targets.Length == 1)
            {
                var clip = GetTargetClip(out var type);

                DrawEvents(clip);

                if (type == AnimationType.Sprite)
                {
                    InitializeSpritePreview(editor, clip);
                    DrawSpriteFrames(clip);
                }
            }
        }
コード例 #12
0
    public static void GenerateManifestForSubmission()
    {
        var    so        = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
        var    script    = MonoScript.FromScriptableObject(so);
        string assetPath = AssetDatabase.GetAssetPath(script);
        string editorDir = Directory.GetParent(assetPath).FullName;
        string srcFile   = editorDir + "/AndroidManifest.OVRSubmission.xml";

        if (!File.Exists(srcFile))
        {
            Debug.LogError("Cannot find Android manifest template for submission." +
                           " Please delete the OVR folder and reimport the Oculus Utilities.");
            return;
        }

        string manifestFolder = Application.dataPath + "/Plugins/Android";

        if (!Directory.Exists(manifestFolder))
        {
            Directory.CreateDirectory(manifestFolder);
        }

        string dstFile = manifestFolder + "/AndroidManifest.xml";

        if (File.Exists(dstFile))
        {
            Debug.LogWarning("Cannot create Oculus store-compatible manifest due to conflicting file: \""
                             + dstFile + "\". Please remove it and try again.");
            return;
        }

        string manifestText = File.ReadAllText(srcFile);
        int    dofTextIndex = manifestText.IndexOf("<!-- Request the headset DoF mode -->");

        if (dofTextIndex != -1)
        {
            if (OVRDeviceSelector.isTargetDeviceQuest)
            {
                string headTrackingFeatureText = string.Format("<uses-feature android:name=\"android.hardware.vr.headtracking\" android:version=\"1\" android:required=\"{0}\" />",
                                                               OVRDeviceSelector.isTargetDeviceGearVrOrGo ? "false" : "true");
                manifestText = manifestText.Insert(dofTextIndex, headTrackingFeatureText);
            }
        }
        else
        {
            Debug.LogWarning("Manifest error: unable to locate headset DoF mode");
        }

        System.IO.File.WriteAllText(dstFile, manifestText);
        AssetDatabase.Refresh();
    }
コード例 #13
0
        static void DiscoverProfiles()
        {
            var unityInputDeviceProfileType = typeof(InControl.UnityInputDeviceProfile);
            var autoDiscoverAttributeType   = typeof(InControl.AutoDiscover);

            var code2 = "";

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var type in assembly.GetTypes())
                {
                    if (type.IsSubclassOf(unityInputDeviceProfileType))
                    {
                        var typeAttrs = type.GetCustomAttributes(autoDiscoverAttributeType, false);
                        if (typeAttrs != null && typeAttrs.Length > 0)
                        {
                            code2 += "\t\t\t\"" + type.FullName + "\"," + Environment.NewLine;
                        }
                    }
                }
            }

            var instance = ScriptableObject.CreateInstance <UnityInputDeviceProfileList>();
            var filePath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(instance));

            ScriptableObject.DestroyImmediate(instance);

            string code1 = @"using System;
using UnityEngine;


namespace InControl
{
	public class UnityInputDeviceProfileList : ScriptableObject
	{
		public static string[] Profiles = new string[] 
		{
";

            string code3 =
                @"		};
	}
}";

            var code = Regex.Replace(code1 + code2 + code3, @"\r\n?|\n", Environment.NewLine);

            if (PutFileContents(filePath, code))
            {
                Debug.Log("InControl has updated the autodiscover profiles list.");
            }
        }
コード例 #14
0
ファイル: Window.cs プロジェクト: devknit/FolderPreset
        void OnEnable()
        {
            Undo.undoRedoPerformed += Repaint;

            if (presets == null)
            {
                string[] paths = AssetDatabase.FindAssets(kSettingsFileName);
                for (int i0 = 0; i0 < paths.Length; ++i0)
                {
                    presets = AssetDatabase.LoadAssetAtPath <PresetDirectories>(
                        AssetDatabase.GUIDToAssetPath(paths[i0])) as PresetDirectories;
                    if ((presets?.IsValid() ?? false) != false)
                    {
                        break;
                    }
                }
            }
            if (presets == null)
            {
                presets = ScriptableObject.CreateInstance <PresetDirectories>();
                string path = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(presets));
                path = path.Substring(0, path.LastIndexOf("/"));
                AssetDatabase.CreateAsset(presets, path + "/" + kSettingsFileName + ".asset");
                AssetDatabase.SaveAssets();
            }
            presets.Verify();

            if (current == null)
            {
                if (Selection.activeObject != null)
                {
                    current = AssetDatabase.GetAssetPath(Selection.activeObject);
                }
                if (string.IsNullOrEmpty(current) != false)
                {
                    Close();
                    return;
                }
                if (AssetDatabase.IsValidFolder(current) == false)
                {
                    current = Path.GetDirectoryName(current);
                }

                if (AssetDatabase.IsValidFolder(current) == false)
                {
                    Close();
                    return;
                }
            }
        }
コード例 #15
0
        static void DiscoverProfiles()
        {
            var nativeInputDeviceProfileType = typeof(NativeInputDeviceProfile);

            var code2 = "";

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                try
                {
                    foreach (var type in assembly.GetTypes())
                    {
                        if (type.IsSubclassOf(nativeInputDeviceProfileType))
                        {
                            code2 += "\t\t\t\"" + type.FullName + "\"," + Environment.NewLine;
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            var instance = ScriptableObject.CreateInstance <NativeInputDeviceProfileList>();
            var filePath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(instance));

            ScriptableObject.DestroyImmediate(instance);

            string code1 = @"namespace InControl
{
	using UnityEngine;


	public class NativeInputDeviceProfileList : ScriptableObject
	{
		public static string[] Profiles = new string[] 
		{
";

            string code3 = @"		};
	}
}";

            var code = FixNewLines(code1 + code2 + code3);

            if (PutFileContents(filePath, code))
            {
                Debug.Log("InControl has updated the native profiles list.");
            }
        }
コード例 #16
0
        public override void GetImportDependentAssets(HashSet <int> dependencies)
        {
            base.GetImportDependentAssets(dependencies);

            if (m_customType != null)
            {
                var function   = ScriptableObject.CreateInstance(m_customType);
                var monoScript = MonoScript.FromScriptableObject(function);
                if (monoScript != null)
                {
                    dependencies.Add(monoScript.GetInstanceID());
                }
            }
        }
コード例 #17
0
        /// <summary>
        /// Load prefs
        /// </summary>
        // -----------------------------------------------------------------------------------------------
        protected void loadPrefs()
        {
            MonoScript script     = MonoScript.FromScriptableObject(this);
            string     scriptpath = AssetDatabase.GetAssetPath(script);
            string     sopath     = Path.GetDirectoryName(scriptpath) + "/" + Path.GetFileNameWithoutExtension(scriptpath) + "Prefs.asset";

            BuildAssetBundlesWindowPrefs prefs = AssetDatabase.LoadAssetAtPath <BuildAssetBundlesWindowPrefs>(sopath);

            if (prefs)
            {
                this.m_buildPlatforms = prefs.buildPlatforms;
                this.m_encryptionInfo = prefs.encryptionInfo;
            }
        }
コード例 #18
0
    void OnEnable()
    {
        _factory         = target as TerrainFactory;
        state_Prop       = serializedObject.FindProperty("_generationType");
        mapIdType_Prop   = serializedObject.FindProperty("_mapIdType");
        sampleCount_Prop = serializedObject.FindProperty("_sampleCount");
        heightMod_Prop   = serializedObject.FindProperty("_heightModifier");
        mapId_Prop       = serializedObject.FindProperty("_mapId");
        material_Prop    = serializedObject.FindProperty("_baseMaterial");

        customMapId_Prop = serializedObject.FindProperty("_customMapId");

        script = MonoScript.FromScriptableObject((TerrainFactory)target);
    }
コード例 #19
0
        public static void GenerateCLRBinding()
        {
            var types = new List <Type>
            {
                typeof(IHotfixEntry),
                typeof(IDebug)
            };

            var ms   = MonoScript.FromScriptableObject(CreateInstance(typeof(Generater)));
            var path = Path.GetDirectoryName(AssetDatabase.GetAssetPath(ms));

            path = Path.Combine(path, ".." + Path.DirectorySeparatorChar);
            BindingCodeGenerator.GenerateBindingCode(types, Path.Combine(path, "Runtime/Generated/CLR"));
        }
コード例 #20
0
    /*******************************
    * Path and Asset Generation.
    *******************************/
    private void updatePaths()
    {
        MonoScript ms = MonoScript.FromScriptableObject(this);

        scriptPath    = AssetDatabase.GetAssetPath(ms).Replace("SnailMarker3AnimationCreatorEditor.cs", "");
        rootPath      = scriptPath.Replace("AnimationGenerator/Editor/", "");
        generatedPath = rootPath + "Generated/" + avatarTransform.name;
        templatesPath = rootPath + "Templates";

        scriptPath    = scriptPath.Replace("/", "\\");
        rootPath      = rootPath.Replace("/", "\\");
        generatedPath = generatedPath.Replace("/", "\\");
        templatesPath = templatesPath.Replace("/", "\\");
    }
コード例 #21
0
        string GetFullPath()
        {
            var script   = MonoScript.FromScriptableObject(this);
            var path     = AssetDatabase.GetAssetPath(script);
            var pathList = path.Split('/').ToList();

            pathList.RemoveAt(0);
            pathList.RemoveAt(pathList.Count - 1);
            pathList.RemoveAt(pathList.Count - 1);
            pathList.Add("Generated/");
            path = "/" + string.Join("/", pathList.ToArray());
            Debug.Log(path);
            return(Application.dataPath + path);
        }
コード例 #22
0
        /// <summary>
        /// Draw a mono script from a scriptable object with label.
        /// </summary>
        /// <param name="scriptable"></param>
        /// <param name="label"></param>
        private static void ScriptField(ScriptableObject scriptable, string label)
        {
            if (scriptable == null)
            {
                return;
            }

            EditorGUILayout.ObjectField(
                label,
                MonoScript.FromScriptableObject(scriptable),
                typeof(MonoScript),
                false
                );
        }
コード例 #23
0
        void OnEnable()
        {
            _factory        = target as VectorTileFactory;
            _visualizerList = serializedObject.FindProperty("Visualizers");
            mapId_Prop      = serializedObject.FindProperty("_mapId");
            script          = MonoScript.FromScriptableObject(_factory);

            if (string.IsNullOrEmpty(mapId_Prop.stringValue))
            {
                mapId_Prop.stringValue = _defaultMapId;
                serializedObject.ApplyModifiedProperties();
                Repaint();
            }
        }
コード例 #24
0
        // used by subclasses to draw error icons
        protected virtual string GetErrorText(TimelineClip clip)
        {
            if (clip.asset == null)
            {
                return(ClipDrawer.Styles.NoPlayableAssetError);
            }
            var playableAsset = clip.asset as ScriptableObject;

            if (playableAsset == null || MonoScript.FromScriptableObject(playableAsset) == null)
            {
                return(ClipDrawer.Styles.ScriptLoadError);
            }
            return(null);
        }
コード例 #25
0
        private void OnEnable()
        {
            if (!_isOpening)
            {
                AnimationGraphAsset = null;
            }
            else
            {
                _isOpening = false;
            }

            string resourcesPath = $"{AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(this)).Replace($"/{nameof(AnimationGraphEditor)}.cs", "")}/Resources";

            _styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>($"{resourcesPath}/{_ussPath}");

            _toolbar = new Toolbar();

            _closeButton = new ToolbarButton(CloseAnimationGraph)
            {
                text = "Close"
            };
            _closeButton.style.display = DisplayStyle.None;

            _assetName = new Label();
            _assetName.style.unityTextAlign = TextAnchor.MiddleLeft;
            _assetName.style.display        = DisplayStyle.None;

            _saveButton = new ToolbarButton(SaveAnimationGraph)
            {
                text = "Save"
            };

            _closeToAssetNameSpacer = new ToolbarSpacer();
            _closeToAssetNameSpacer.style.display = DisplayStyle.None;

            _assetNameToSaveSpacer = new ToolbarSpacer();
            _assetNameToSaveSpacer.style.display = DisplayStyle.None;

            _toolbar.Add(_closeButton);
            _toolbar.Add(_closeToAssetNameSpacer);
            _toolbar.Add(_assetName);
            _toolbar.Add(_assetNameToSaveSpacer);
            _toolbar.Add(_saveButton);

            CreateGraphView();

            StateMachineEditor.Editor?.Close();

            rootVisualElement.Add(_toolbar);
        }
コード例 #26
0
    void OnEnable()
    {
        MonoScript script   = MonoScript.FromScriptableObject(this);
        string     path     = AssetDatabase.GetAssetPath(script);
        string     logoPath = Path.GetDirectoryName(path) + "/logo.png";

        //m_Logo = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/Paroxe/FilmicTonemappingDeluxe/Editor/logo.png", typeof(Texture2D));
        m_Logo = (Texture2D)AssetDatabase.LoadAssetAtPath(logoPath, typeof(Texture2D));

        if (m_Logo != null)
        {
            m_Logo.hideFlags = HideFlags.HideAndDontSave;
        }
    }
コード例 #27
0
        static void DiscoverProfiles()
        {
            var nativeInputDeviceProfileType = typeof(NativeInputDeviceProfile);

            var names = new List <string>();

            foreach (var type in Reflector.AllAssemblyTypes)
            {
                if (type.IsSubclassOf(nativeInputDeviceProfileType))
                {
                    names.Add(type.FullName);
                }
            }

            names.Sort();

            var code2 = "";

            foreach (var name in names)
            {
                code2 += "\t\t\t\"" + name + "\"," + Environment.NewLine;
            }

            var instance = ScriptableObject.CreateInstance <NativeInputDeviceProfileList>();
            var filePath = AssetDatabase.GetAssetPath(MonoScript.FromScriptableObject(instance));

            UnityEngine.Object.DestroyImmediate(instance);

            const string code1 = @"namespace InControl
{
	using UnityEngine;


	public class NativeInputDeviceProfileList : ScriptableObject
	{
		public static readonly string[] Profiles = new string[]
		{
";

            const string code3 = @"		};
	}
}";

            var code = FixNewLines(code1 + code2 + code3);

            if (PutFileContents(filePath, code))
            {
                Debug.Log("InControl has updated the native profiles list.");
            }
        }
コード例 #28
0
        public override void OnInspectorGUI()
        {
            var typeAsset = target as BaseTypeAsset;

            GUI.enabled = false;
            EditorGUILayout.ObjectField("Script:", MonoScript.FromScriptableObject(typeAsset),
                                        typeAsset.GetType(), false);

            var binary = Convert.ToString(typeAsset.bitmaskValue, 2).PadLeft(sizeof(int) * 8, '0');

            EditorGUILayout.TextField("Flag", binary);

            GUI.enabled = true;
        }
コード例 #29
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            GUI.enabled = false;
            EditorGUILayout.ObjectField("Script", MonoScript.FromScriptableObject(target as ScriptableObject), typeof(MonoScript), false);
            GUI.enabled = true;

            EditorGUILayout.Space(); EditorGUILayout.LabelField("Mode", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_RunModeInEditor);
            EditorGUILayout.PropertyField(m_RunModeInApp);
            EditorGUILayout.HelpBox("Develop Mode is only available in Editor", MessageType.Info);
            if (m_RunModeInApp.enumValueIndex == (int)RunMode.Develop)
            {
                m_RunModeInApp.enumValueIndex = (int)RunMode.Package;
            }

            EditorGUILayout.Space(); EditorGUILayout.LabelField("Quality", EditorStyles.boldLabel);
            m_SleepTimeout.intValue = EditorGUILayout.IntPopup("Sleep Timeout", Screen.sleepTimeout,
                                                               new string[] { "Never Sleep", "System Setting" },
                                                               new int[] { SleepTimeout.NeverSleep, SleepTimeout.SystemSetting }
                                                               );
            EditorGUILayout.PropertyField(m_RunInBackground);
            QualitySettings.vSyncCount = EditorGUILayout.IntSlider("V Sync Count", QualitySettings.vSyncCount, 0, 4);
            if (QualitySettings.vSyncCount == 0)
            {
                EditorGUILayout.PropertyField(m_TargetFrameRate);
            }
            else
            {
                EditorGUILayout.HelpBox("If the 'QualitySettings.vSyncCount' property is set, the 'Application.targetFrameRate' will be ignored", MessageType.Info);
            }

            EditorGUILayout.Space(); EditorGUILayout.LabelField("Update", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(m_AndroidServer);
            EditorGUILayout.PropertyField(m_IOSServer);
            EditorGUILayout.PropertyField(m_DefaultServer);
            EditorGUILayout.PropertyField(m_FileListName);
            EditorGUILayout.PropertyField(m_IgnorePrefix);
            EditorGUILayout.PropertyField(m_IgnoreSuffix);
#if XLUA
            EditorGUILayout.Space(); EditorGUILayout.LabelField("Lua", EditorStyles.boldLabel);
            float labelWidth = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 30;
            luaFolderList.DoLayoutList();
            luaBundleList.DoLayoutList();
            EditorGUIUtility.labelWidth = labelWidth;
#endif
            serializedObject.ApplyModifiedProperties();
        }
コード例 #30
0
        private void OnGUI()
        {
            if (EditorApplication.isCompiling)
            {
                this.ShowNotification(new GUIContent("Compiling Scripts", EditorGUIUtility.IconContent("BuildSettings.Editor").image));
            }
            else
            {
                this.RemoveNotification();
            }

            if (RelativePath == "")
            {
                string     editorPath                       = "Common/Editor/Welcome/";
                MonoScript welcomeWindowScript              = MonoScript.FromScriptableObject(this);
                string     welcomeWindowScriptFullPath      = AssetDatabase.GetAssetPath(welcomeWindowScript);
                int        welcomeWindowScriptFullPathIndex = welcomeWindowScriptFullPath.IndexOf(editorPath);
                RelativePath = welcomeWindowScriptFullPath.Substring(0, welcomeWindowScriptFullPathIndex);
            }

            Rect welcomeImageRect = new Rect(0, 0, 500, 200);

            UnityEngine.GUI.DrawTexture(welcomeImageRect, WelcomeBanner);
            GUILayout.Space(220);

            GUILayout.BeginArea(new Rect(EditorGUILayout.GetControlRect().x + 10, 220, WelcomeWindowWidth - 20, WelcomeWindowHeight));

            EditorGUILayout.LabelField("Welcome to the TopDown Engine!\n"
                                       , RegularTextStyle);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("GETTING STARTED", LargeTextStyle);
            EditorGUILayout.LabelField("You can start by having a look at the documentation, or open the Demos folder and start looking at all the engine's features. Have fun with your project!", RegularTextStyle);

            EditorGUILayout.Space();
            if (GUILayout.Button(new GUIContent(" Open Documentation", EditorGUIUtility.IconContent("_Help").image), GUILayout.MaxWidth(185f)))
            {
                Application.OpenURL(DOCUMENTATION_URL);
            }

            GUILayout.EndArea();

            Rect areaRect = new Rect(0, WelcomeWindowHeight - 20, WelcomeWindowWidth, WelcomeWindowHeight - 20);

            GUILayout.BeginArea(areaRect);
            EditorGUILayout.LabelField("Copyright © 2018 More Mountains", FooterTextStyle);
            GUILayout.EndArea();
        }