Exemplo n.º 1
0
        public static void PreferencesGUI()
        {
            if (!PrefsLoaded)
            {
                LoadDefaults();
                PrefsLoaded = true;
            }

            PathButtonContent.text = string.IsNullOrEmpty(GlobalFolder) ? "Click to select folder" : GlobalFolder;

            GlobalDefaultMode = (FolderMode)EditorGUILayout.EnumPopup("New Impostor Default Path", GlobalDefaultMode ? FolderMode.Global : FolderMode.RelativeToPrefab) == FolderMode.Global;
            EditorGUILayout.BeginHorizontal();
            if (GlobalDefaultMode)
            {
                EditorGUI.BeginChangeCheck();
                GlobalFolder = EditorGUILayout.TextField("Global Folder", GlobalFolder);
                if (EditorGUI.EndChangeCheck())
                {
                    GlobalFolder = GlobalFolder.TrimStart(new char[] { '/', '*', '.', ' ' });
                    GlobalFolder = "/" + GlobalFolder;
                    GlobalFolder = GlobalFolder.TrimEnd(new char[] { '/', '*', '.', ' ' });
                    EditorPrefs.SetString(PrefGlobalFolder, GlobalFolder);
                }
                if (GUILayout.Button("...", "minibutton", GUILayout.Width(20) /*GUILayout.MaxWidth( Screen.width * 0.5f )*/))
                {
                    string oneLevelUp = Application.dataPath + "/../";
                    string directory  = Path.GetFullPath(oneLevelUp).Replace("\\", "/");
                    string fullpath   = directory + GlobalFolder;
                    string folderpath = EditorUtility.SaveFolderPanel("Save Impostor to folder", FileUtil.GetProjectRelativePath(fullpath), null);

                    folderpath = FileUtil.GetProjectRelativePath(folderpath);
                    if (!string.IsNullOrEmpty(folderpath))
                    {
                        GlobalFolder = folderpath;
                        GlobalFolder = GlobalFolder.TrimStart(new char[] { '/', '*', '.', ' ' });
                        GlobalFolder = "/" + GlobalFolder;
                        GlobalFolder = GlobalFolder.TrimEnd(new char[] { '/', '*', '.', ' ' });
                        EditorPrefs.SetString(PrefGlobalFolder, GlobalFolder);
                    }
                }
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                GlobalRelativeFolder = EditorGUILayout.TextField("Relative to Prefab Folder", GlobalRelativeFolder);
                if (EditorGUI.EndChangeCheck())
                {
                    GlobalRelativeFolder = GlobalRelativeFolder.TrimStart(new char[] { '/', '*', '.', ' ' });
                    GlobalRelativeFolder = "/" + GlobalRelativeFolder;
                    GlobalRelativeFolder = GlobalRelativeFolder.TrimEnd(new char[] { '/', '*', '.', ' ' });
                    EditorPrefs.SetString(PrefGlobalRelativeFolder, GlobalRelativeFolder);
                }
                EditorGUI.BeginDisabledGroup(true);
                GUILayout.Button("...", "minibutton", GUILayout.Width(20));
                EditorGUI.EndDisabledGroup();
            }

            EditorGUILayout.EndHorizontal();

            GlobalTexImport      = EditorGUILayout.Popup("Texture Importer Settings", GlobalTexImport, new string[] { "Ask if resolution is different", "Don't ask, always change", "Don't ask, never change" });
            GlobalCreateLodGroup = EditorGUILayout.Toggle("Create LODGroup if not present", GlobalCreateLodGroup);
            GUILayout.Space(5);
            GUILayout.Label("Suffixes", "boldlabel");
            GlobalAlbedoAlpha        = EditorGUILayout.TextField("Albedo & Alpha", GlobalAlbedoAlpha);
            GlobalSpecularSmoothness = EditorGUILayout.TextField("Specular & Smoothness", GlobalSpecularSmoothness);
            GlobalNormalDepth        = EditorGUILayout.TextField("Normal & Depth", GlobalNormalDepth);
            GlobalEmissionOcclusion  = EditorGUILayout.TextField("Emission & Occlusion", GlobalEmissionOcclusion);
            if (GUI.changed)
            {
                EditorPrefs.SetBool(PrefGlobalDefault, GlobalDefaultMode);
                EditorPrefs.SetInt(PrefGlobalTexImport, GlobalTexImport);
                EditorPrefs.SetBool(PrefGlobalCreateLodGroup, GlobalCreateLodGroup);

                EditorPrefs.SetString(PrefGlobalGBuffer0Name, GlobalAlbedoAlpha);
                EditorPrefs.SetString(PrefGlobalGBuffer1Name, GlobalSpecularSmoothness);
                EditorPrefs.SetString(PrefGlobalGBuffer2Name, GlobalNormalDepth);
                EditorPrefs.SetString(PrefGlobalGBuffer3Name, GlobalEmissionOcclusion);
            }
        }
Exemplo n.º 2
0
        private void OnDrawPackages()
        {
            var margin       = 5f;
            var autoRect     = EditorGUILayout.GetControlRect(GUILayout.Height(1f));
            var treeViewTop  = autoRect.yMax;
            var bottomHeight = 21f;
            var treeViewRect = new Rect(5, treeViewTop + margin, position.width - 10,
                                        position.height - treeViewTop - bottomHeight - margin * 3f);
            var bottomRect = new Rect(5, treeViewRect.yMax + margin, treeViewRect.width, bottomHeight);

            _treeView.OnContextMenu(treeViewRect);
            _treeView.OnGUI(treeViewRect);
            GUILayout.BeginArea(bottomRect);
            using (new EditorGUILayout.HorizontalScope())
            {
                if (GUILayout.Button("Add Bundle"))
                {
                    _data.bundles.Add(new BundleBuilderData.BundleInfo()
                    {
                        id   = ++_data.id,
                        name = $"bundle_{_data.id}{BundleBuilderData.FileExt}",
                    });
                    _treeView.Reload();
                }

                if (GUILayout.Button("Add Asset List"))
                {
                    CreateAssetListData();
                }

                GUI.color = Color.red;
                if (GUILayout.Button("Delete"))
                {
                    _treeView.DeleteSelectedItems();
                }

                GUI.color = _GUIColor;

                GUILayout.FlexibleSpace();
                GUILayout.Space(20f);
                if (GUILayout.Button("Reload"))
                {
                    Reload();
                }

                GUILayout.Space(20f);
                EditorGUILayout.LabelField("Targets", GUILayout.Width(46f));
                var platforms = (PackagePlatform)EditorGUILayout.EnumPopup(_platform, GUILayout.Width(90f));
                if (platforms != _platform)
                {
                    _platform = platforms;
                    EditorPrefs.SetInt(KeyForPackagePlatforms, (int)_platform);
                }

                if (GUILayout.Button("Build Packages"))
                {
                    BundleBuilder.BuildPackages(_data, "", _platform);
                }
            }

            GUILayout.EndArea();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Saves channel color to EditorPrefs.
 /// </summary>
 static void SetChannel(Color32 color, string name)
 {
     EditorPrefs.SetInt("GrapherCH" + name + "R", color.r);
     EditorPrefs.SetInt("GrapherCH" + name + "G", color.g);
     EditorPrefs.SetInt("GrapherCH" + name + "B", color.b);
 }
Exemplo n.º 4
0
        public static void PreferencesGUI()
        {
            if (!PrefsLoaded)
            {
                LoadDefaults();
                PrefsLoaded = true;
            }

            var cache = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 250;
            EditorGUI.BeginChangeCheck();
            GlobalStartUp = (ShowOption)EditorGUILayout.EnumPopup(StartUp, GlobalStartUp);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetInt(PrefStartUp, (int)GlobalStartUp);
            }

            EditorGUI.BeginChangeCheck();
            GlobalAutoSRP = EditorGUILayout.Toggle(AutoSRP, GlobalAutoSRP);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefAutoSRP, GlobalAutoSRP);
            }

            EditorGUI.BeginChangeCheck();
            GlobalDefineSymbol = EditorGUILayout.Toggle(DefineSymbol, GlobalDefineSymbol);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefDefineSymbol, GlobalDefineSymbol);
                if (GlobalDefineSymbol)
                {
                    IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                }
                else
                {
                    IOUtils.RemoveAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
                }
            }

            EditorGUI.BeginChangeCheck();
            GlobalClearLog = EditorGUILayout.Toggle(ClearLog, GlobalClearLog);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefClearLog, GlobalClearLog);
            }

            EditorGUI.BeginChangeCheck();
            GlobalUpdateOnSceneSave = EditorGUILayout.Toggle(UpdateOnSceneSave, GlobalUpdateOnSceneSave);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefUpdateOnSceneSave, GlobalUpdateOnSceneSave);
            }

#if UNITY_2019_4_OR_NEWER
            EditorGUI.BeginChangeCheck();
            GlobalShowAsyncMsg = EditorGUILayout.Toggle(ShowAsyncMsg, GlobalShowAsyncMsg);
            if (EditorGUI.EndChangeCheck())
            {
                EditorPrefs.SetBool(PrefShowAsyncMsg, GlobalShowAsyncMsg);
            }
#endif
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Reset and Forget All"))
            {
                EditorPrefs.DeleteKey(PrefStartUp);
                GlobalStartUp = ShowOption.Always;

                EditorPrefs.DeleteKey(PrefAutoSRP);
                GlobalAutoSRP = true;

                EditorPrefs.DeleteKey(PrefDefineSymbol);
                GlobalDefineSymbol = true;
                IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);

                EditorPrefs.DeleteKey(PrefClearLog);
                GlobalClearLog = true;

                EditorPrefs.DeleteKey(PrefUpdateOnSceneSave);
                GlobalUpdateOnSceneSave = true;

#if UNITY_2019_4_OR_NEWER
                EditorPrefs.DeleteKey(PrefShowAsyncMsg);
                GlobalShowAsyncMsg = true;
#endif
            }
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.labelWidth = cache;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Set the saved <see cref="int"/> from the <see cref="EditorPrefs"/>.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public static void Set(string key, int value)
 {
     Debug.Assert(!string.IsNullOrWhiteSpace(key));
     EditorPrefs.SetInt($"{Application.productName}_{key}", value);
 }
Exemplo n.º 6
0
 public static void SetInt(string key, int value)
 {
     EditorPrefs.SetInt(key, value);
 }
Exemplo n.º 7
0
 protected virtual void OnDisable()
 {
     EditorPrefs.SetInt("SceneSwitcher.scenesSource", (int)this.scenesSource);
     EditorPrefs.SetInt("SceneSwitcher.openSceneMode", (int)this.openSceneMode);
 }
Exemplo n.º 8
0
    /// <summary>
    /// Save the specified integer value in settings.
    /// </summary>

    static public void SetInt(string name, int val)
    {
        EditorPrefs.SetInt(name, val);
    }
 private void SaveInspectorSettings()
 {
     EditorPrefs.SetBool("TerrainFillHeightmapUsingNeighbors", m_FillHeightmapUsingNeighbors);
     EditorPrefs.SetInt("TerrainFillAddressMode", (int)m_FillAddressMode);
 }
Exemplo n.º 10
0
 private static void SetPrefsInt(string key, int value)
 {
     EditorPrefs.SetInt(Application.productName + "." + key, value);
 }
Exemplo n.º 11
0
        static void SceneInfoArea()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("场景格子", GUILayout.Width(50));
                if (GUILayout.Button("显示"))
                {
                    _showGrid = true;
                }
                if (GUILayout.Button("隐藏"))
                {
                    _showGrid = false;
                }
            }
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();
            {
                EditorGUI.BeginChangeCheck();
                GUILayout.Label("格子尺寸", GUILayout.Width(50));
                float cubeSizeX = EditorGUILayout.FloatField(_cubeSize.x);
                float cubeSizeY = EditorGUILayout.FloatField(_cubeSize.y);
                float cubeSizeZ = EditorGUILayout.FloatField(_cubeSize.z);
                cubeSizeX = Mathf.Clamp(cubeSizeX, float.MinValue, float.MaxValue);
                cubeSizeY = Mathf.Clamp(cubeSizeY, float.MinValue, float.MaxValue);
                cubeSizeZ = Mathf.Clamp(cubeSizeZ, float.MinValue, float.MaxValue);
                EditorPrefs.SetFloat("BlockCube X", cubeSizeX);
                EditorPrefs.SetFloat("BlockCube Y", cubeSizeY);
                EditorPrefs.SetFloat("BlockCube Z", cubeSizeZ);
                _cubeSize = new Vector3(cubeSizeX, cubeSizeY, cubeSizeZ);
                if (EditorGUI.EndChangeCheck())
                {
                    MapBlockTool.UpdateBlockPos();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("矩阵规格", GUILayout.Width(50));
                int sceneSizeX = EditorGUILayout.IntField(_sceneSizeX);
                GUILayout.Label("X", EditorStyles.label);
                int sceneSizeZ = EditorGUILayout.IntField(_sceneSizeZ);
                sceneSizeX = Mathf.Clamp(sceneSizeX, int.MinValue, int.MaxValue);
                sceneSizeZ = Mathf.Clamp(sceneSizeZ, int.MinValue, int.MaxValue);
                EditorPrefs.SetInt("BlockSceneSize X", sceneSizeX);
                EditorPrefs.SetInt("BlockSceneSize Z", sceneSizeZ);
                _sceneSizeX = sceneSizeX;
                _sceneSizeZ = sceneSizeZ;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("层次调节", GUILayout.Width(50));
                int floorNum = EditorGUILayout.IntField(_floorNum);
                _floorNum = Mathf.Clamp(floorNum, 0, 10);
            }
            GUILayout.EndHorizontal();
        }
 private void OnDisable()
 {
     EditorPrefs.SetString(EditorCommon.GetProjectRelatedEditorPrefsKey(EDITOR_PREF_PATH_KEYS), path);
     EditorPrefs.SetInt(EditorCommon.GetProjectRelatedEditorPrefsKey(EDITOR_PREF_SIZE_KEYS), size);
     EditorPrefs.SetInt(EditorCommon.GetProjectRelatedEditorPrefsKey(EDITOR_PREF_FILE_TYPE_KEYS), (int)fileType);
 }
Exemplo n.º 13
0
 public void StoreCloudServicePref()
 {
     EditorPrefs.SetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelServer", this.m_ServiceName), this.m_CloudPanelServer);
     EditorPrefs.SetString(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomUrl", this.m_ServiceName), this.m_CloudPanelCustomUrl);
     EditorPrefs.SetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelCustomPort", this.m_ServiceName), this.m_CloudPanelCustomPort);
 }
Exemplo n.º 14
0
	void CreateAssetButtons (float width, ref float distanceFromTop) {
		var shouldShowAll = EditorPrefs.GetBool (APGlobals.ShowAll);
		var shouldShowLabels = EditorPrefs.GetBool (APGlobals.ShowLabels);
		
		int assetIndex = 0;
		int index = -1;
		
		float xCoord = 0;
		float yCoord = 0;
		
		foreach (var assetData in APChoiceSystem.instance.assetList) {
			index++;
			
			if (assetData.tab != APChoiceSystem.instance.getSelectedTab().name && !shouldShowAll) {
				assetIndex++;
				continue;
			}
			
			if(assetData.gameObject == null) { continue; }
			
			var tempObject = GameObject.Instantiate(assetData.gameObject) as GameObject;
			
			Texture2D usedTexture = null;
			if (tempObject.GetComponent<SpriteRenderer> () || 
			    tempObject.GetComponentsInChildren<SpriteRenderer>().Length > 0) {
				
				usedTexture = tempObject.GetComponent<SpriteRenderer> ().sprite.texture;
			} else if (tempObject.GetComponent<MeshFilter> () || 
			           tempObject.GetComponentsInChildren<MeshFilter>().Length > 0) {
				var tempTexture = APIconRenderer.CreateTextureFromCamera(assetData, ref hasMadeAnIconRenderAsset);
				usedTexture = tempTexture; 
			} else if (tempObject.GetComponent<Light> () || 
			           tempObject.GetComponentsInChildren<Light>().Length > 0) {
				usedTexture = lightIcon; 
			} else if (tempObject.GetComponent<AudioSource> () || 
			           tempObject.GetComponentsInChildren<AudioSource>().Length > 0) {
				usedTexture = soundIcon; 
			} else {
				usedTexture = triggerIcon;
			}
			
			DestroyImmediate(tempObject);
			
			var downState = new GUIStyle(GUI.skin.button);
			downState.normal.background = GUI.skin.button.active.background;
			downState.active.background = GUI.skin.button.active.background;
			
			
			var upState =  new GUIStyle(GUI.skin.button);
			var buttonStyle = EditorPrefs.GetInt (APGlobals.SelectedAssetNumber) == index ? downState : upState;
			
			var buttonRect = new Rect ((width / 3.0f) * xCoord, distanceFromTop + (width / 3.0f) * yCoord, (width / 3.0f), (width / 3.0f));
			if (usedTexture && GUI.Button (buttonRect, usedTexture, buttonStyle)) {
				EditorPrefs.SetInt (APGlobals.SelectedAssetNumber, assetIndex);
			}
			
			string keyLabel = assetData.keyCode.ToString();
			if(keyLabel == "None") { keyLabel = "[]"; } 
			else if(keyLabel.Length > 1) { keyLabel = keyLabel.Remove(0,keyLabel.Length - 1); }
			
			if(shouldShowLabels) {
				if(assetData.tab == APChoiceSystem.instance.getSelectedTab().name) {
					CreateHotkeyLabel (buttonRect, keyLabel);
				}
				if(shouldShowAll) {
					CreateTabLabel (assetData, buttonRect);
				}
			}
			
			assetIndex++; xCoord++;
			if (xCoord > 2) { xCoord = 0; yCoord++; }
		}
		
		if (hasMadeAnIconRenderAsset) {
			APIconRenderer.CleanUpRender3DAssets();
		}
	}
Exemplo n.º 15
0
    void OnGUI()
    {
        //Initialize GUIStyles if needed
        if (headerLink == null)
        {
            headerLink           = new GUIStyle();
            headerLink.alignment = TextAnchor.MiddleCenter;
            headerLink.fontStyle = FontStyle.Normal;
            headerLink.fontSize  = 16;

            headerLink.normal.textColor = new Color(0.2f, 0.2f, 0.2f);
            headerLink.margin           = new RectOffset(5, 5, 25, 25);
            headerLink.padding          = new RectOffset(0, 0, 6, 12);

            headerLinkActive = new GUIStyle(headerLink);
            headerLinkActive.normal.background   = headerButtonActive;
            headerLinkActive.onNormal.background = headerButtonActive;
            headerLinkActive.normal.textColor    = Color.white;
        }
        if (headerText == null)
        {
            headerText                  = new GUIStyle((GUIStyle)"ControlLabel");
            headerText.alignment        = TextAnchor.MiddleCenter;
            headerText.fontStyle        = FontStyle.Normal;
            headerText.normal.textColor = new Color(0.2f, 0.2f, 0.2f);
            headerText.margin           = new RectOffset(5, 5, 30, 25);

            headerTextActive = new GUIStyle(headerText);
            headerTextActive.normal.textColor = Color.white;
        }
        if (productTitle == null)
        {
            productTitle           = new GUIStyle();
            productTitle.alignment = TextAnchor.MiddleLeft;
            productTitle.fontStyle = FontStyle.Normal;
            productTitle.fontSize  = 16;
            productTitle.margin    = new RectOffset(0, 0, 15, 0);
            if (EditorGUIUtility.isProSkin)
            {
                productTitle.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
            }
            else
            {
                productTitle.normal.textColor = new Color(0.1f, 0.1f, 0.1f);
            }

            productDescription           = new GUIStyle(headerText);
            productDescription.margin    = new RectOffset(0, 0, 5, 0);
            productDescription.alignment = TextAnchor.MiddleLeft;
            if (EditorGUIUtility.isProSkin)
            {
                productDescription.normal.textColor = new Color(0.7f, 0.7f, 0.7f);
            }
            else
            {
                productDescription.normal.textColor = new Color(0.3f, 0.3f, 0.3f);
            }
        }

        EditorGUI.BeginDisabledGroup(connectionsInProgress > 0);

        GUILayout.BeginHorizontal();
        GUI.DrawTexture(new Rect(0, 0, this.position.width, headerBG.height), headerBG);
        GUILayout.Box(headerLogo, GUIStyle.none);

        if (gotListing)
        {
            GUILayout.Space(-170);
            GUILayout.Box("Products", headerText);

            headerScroll = GUILayout.BeginScrollView(headerScroll, false, false, GUILayout.MaxHeight(headerBG.height + 12));
            GUILayout.Space(0);
            int linkCount = 0;
            GUILayout.BeginHorizontal();
            foreach (string product in headerLinks)
            {
                Rect buttonRect = EditorGUILayout.BeginHorizontal();
                if (productIcons.ContainsKey(product))
                {
                    if (GUILayout.Button(new GUIContent(productIcons[product], product.Replace("_", " ")), (currentFilter == linkCount ? headerLinkActive : headerLink), GUILayout.MaxHeight(75), GUILayout.MaxWidth(70)))
                    {
                        if (currentFilter == linkCount)
                        {
                            currentFilter = -1;
                        }
                        else
                        {
                            currentFilter = linkCount;
                        }
                    }
                }
                else
                {
                    if (GUILayout.Button(new GUIContent(product), (currentFilter == linkCount ? headerLinkActive : headerLink), GUILayout.MaxHeight(50)))
                    {
                        if (currentFilter == linkCount)
                        {
                            currentFilter = -1;
                        }
                        else
                        {
                            currentFilter = linkCount;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
                linkCount++;
                GUILayout.Space(10);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }
        else
        {
            GUILayout.FlexibleSpace();
            if (connectionFailed)
            {
                GUILayout.Box("Connection Failed", headerText);
            }
            else
            {
                GUILayout.Box("Connecting...", headerText);
            }
            GUILayout.Space(30);
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(-86);
        GUILayout.BeginHorizontal();
        GUILayout.Space(220);
        GUILayout.Box("Categories", headerText);
        GUILayout.Space(30);
        foreach (string category in categories)
        {
            Rect buttonRect = EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button(new GUIContent(category), category != currentCategory ? headerText : headerTextActive))
            {
                if (currentCategory == category)
                {
                    currentCategory = null;
                }
                else
                {
                    currentCategory = category;
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.Space(-12);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label("Sort by:");
        int oldSortingMode = sortingMode;

        sortingMode = GUILayout.Toolbar(sortingMode, new string[] { "Name", "Category", "Last Updated" }, EditorStyles.miniButton);
        if (oldSortingMode != sortingMode)
        {
            EditorPrefs.SetInt("RogoDigital_ExtensionsSortingMode", sortingMode);
        }
        GUILayout.Space(5);
        if (GUILayout.Button(sortDirection == 0 ? upArrow : downArrow, EditorStyles.miniButton))
        {
            sortDirection = 1 - sortDirection;
            EditorPrefs.SetInt("RogoDigital_ExtensionsSortDirection", sortDirection);
            itemsAlpha.Sort(SortItemsAlphaNumeric);
            itemsCat.Sort(SortItemsCategory);
            itemsUpdate.Sort(SortItemsLastUpdated);
        }
        GUILayout.FlexibleSpace();
        GUILayout.Space(20);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);

        if (connectionFailed)
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Box("Could not connect to server.", headerText);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Retry"))
            {
                connectionFailed = false;
                ConnectToServer();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
        }
        else if (!gotListing)
        {
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Box("Connecting", headerLink);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
        }
        else
        {
            EditorGUI.BeginDisabledGroup(downloading);
            bodyScroll = GUILayout.BeginScrollView(bodyScroll, false, false);
            foreach (ItemListing listing in lists[sortingMode])
            {
                bool show = false;

                if (currentFilter >= 0)
                {
                    foreach (string product in listing.products)
                    {
                        if (headerLinks[currentFilter] == product)
                        {
                            show = true;
                        }
                    }
                }
                else
                {
                    show = true;
                }

                if (!string.IsNullOrEmpty(currentCategory))
                {
                    if (listing.category != currentCategory)
                    {
                        show = false;
                    }
                }

                if (show)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(20);
                    GUILayout.Box(listing.icon, GUIStyle.none, GUILayout.Width(90), GUILayout.Height(90));

                    GUILayout.Space(30);
                    GUILayout.BeginVertical();
                    //Hack: Prevents random vertical offset.
                    GUILayout.Space(0);
                    GUILayout.Box(new GUIContent(listing.name), productTitle, GUILayout.Height(12));
                    GUILayout.BeginHorizontal();
                    foreach (string product in listing.products)
                    {
                        if (productIcons.ContainsKey(product))
                        {
                            GUILayout.Box(new GUIContent(productIcons[product], product.Replace("_", " ")), productTitle, GUILayout.Height(32), GUILayout.Width(38));
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.Box(listing.description, productDescription);
                    GUILayout.Box("Updated: " + listing.lastUpdatedString, productDescription);
                    GUILayout.EndVertical();
                    GUILayout.FlexibleSpace();
                    GUILayout.BeginVertical();
                    GUILayout.Space(30);
                    if (GUILayout.Button("Download", GUILayout.Height(30), GUILayout.MaxWidth(100)))
                    {
                        downloading = true;
#if UNITY_2018_3_OR_NEWER
                        downloadConnection = UnityWebRequest.Get(baseAddress + listing.url);
                        downloadConnection.SendWebRequest();
#else
                        downloadConnection = new WWW(baseAddress + listing.url);
#endif
                        currentExtension = listing.name;

                        ContinuationManager.Add(() => downloadConnection.isDone, () =>
                        {
                            if (downloading)
                            {
                                downloading = false;
                                if (!string.IsNullOrEmpty(downloadConnection.error))
                                {
                                    Debug.LogError(downloadConnection.error);
                                    ShowNotification(new GUIContent(currentExtension + " - Download Failed"));
                                }
                                else if (downloadConnection.isDone)
                                {
#if UNITY_2018_3_OR_NEWER
                                    File.WriteAllBytes(Application.dataPath + "/" + currentExtension + ".unitypackage", downloadConnection.downloadHandler.data);
#else
                                    File.WriteAllBytes(Application.dataPath + "/" + currentExtension + ".unitypackage", downloadConnection.bytes);
#endif
                                    ShowNotification(new GUIContent(currentExtension + " Downloaded"));
                                    AssetDatabase.ImportPackage(Application.dataPath + "/" + currentExtension + ".unitypackage", true);
                                    File.Delete(Application.dataPath + "/" + currentExtension + ".unitypackage");
                                }
                                else
                                {
                                    ShowNotification(new GUIContent(currentExtension + " Download Cancelled"));
                                }
                            }
                        });
                    }
                    GUILayout.EndVertical();
                    GUILayout.Space(20);
                    GUILayout.EndHorizontal();
                    GUILayout.Space(20);
                }
            }

            GUILayout.Space(40);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Box("More extensions coming soon. To request support for another asset, post in the forum thread, or send us an email.", productTitle);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(10);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Forum Thread"))
            {
                Application.OpenURL("http://forum.unity3d.com/threads/alpha-lipsync-a-phoneme-based-lipsyncing-system-for-unity.309324/");
            }
            if (GUILayout.Button("Email Support"))
            {
                Application.OpenURL("mailto:[email protected]");
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(20);
            GUILayout.EndScrollView();
            EditorGUI.EndDisabledGroup();
            EditorGUI.EndDisabledGroup();

            if (downloading)
            {
#if UNITY_2018_3_OR_NEWER
                float progress = downloadConnection.downloadProgress;
#else
                float progress = downloadConnection.progress;
#endif
                EditorGUI.ProgressBar(new Rect(10, position.height - 30, position.width - 110, 20), progress, "Downloading " + currentExtension + " - " + Mathf.Round(progress * 100).ToString() + "%");
                if (GUI.Button(new Rect(position.width - 90, position.height - 30, 80, 20), "Cancel"))
                {
                    downloading = false;
                }
            }

            if (connectionsInProgress > 0)
            {
                ShowNotification(new GUIContent("Please Wait - Connecting."));
            }
        }
    }
Exemplo n.º 16
0
    public void DrawNoiseParameterGUI(TerrainGeneration script, TerrainInfo info, Dictionary <string, bool> EditorWidgetFoldouts)
    {
        EditorWidgetFoldouts["TerrainGenerationWidget"] = EditorGUILayout.Foldout(EditorWidgetFoldouts["TerrainGenerationWidget"], "TerrainGenerationWidget");
        if (EditorWidgetFoldouts["TerrainGenerationWidget"])
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("DebugPlane coloring");
            SerializedNoiseParameter.TerrainTextureType = (TextureType)EditorGUI.EnumPopup(EditorGUILayout.GetControlRect(), SerializedNoiseParameter.TerrainTextureType);
            GUILayout.EndHorizontal();
            var noiseScale = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Noise Scale", SerializedNoiseParameter.NoiseScale);
            SerializedNoiseParameter.NoiseScale = noiseScale <= 0 ? 0.0001f : noiseScale;
            var baseFrequency = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Base Frequecny", SerializedNoiseParameter.BaseFrequency);
            SerializedNoiseParameter.BaseFrequency = baseFrequency <= 0 ? 0.0001f : baseFrequency;
            var persistance = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Persistance", SerializedNoiseParameter.Persistance);
            SerializedNoiseParameter.Persistance = persistance <= 0 ? 0.0001f : persistance;
            var lacunarity = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Lacunarity", SerializedNoiseParameter.Lacunarity);
            SerializedNoiseParameter.Lacunarity = lacunarity <= 0 ? 0.0001f : lacunarity;
            var octaves = EditorGUI.IntField(EditorGUILayout.GetControlRect(), "Number of octaves", SerializedNoiseParameter.NumberOfOctaves);
            SerializedNoiseParameter.NumberOfOctaves     = octaves <= 0 ? 1 : octaves;
            SerializedNoiseParameter.Seed                = EditorGUI.TextField(EditorGUILayout.GetControlRect(), "Seed", SerializedNoiseParameter.Seed);
            SerializedNoiseParameter.UserOffset          = EditorGUI.Vector2Field(EditorGUILayout.GetControlRect(), "User Offset", SerializedNoiseParameter.UserOffset);
            SerializedNoiseParameter.GlobalNoiseAddition = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Global noise add", SerializedNoiseParameter.GlobalNoiseAddition);
            SerializedNoiseParameter.CustomFunction      = (CustomFunctionType)EditorGUI.EnumPopup(EditorGUILayout.GetControlRect(), SerializedNoiseParameter.CustomFunction);
            if (SerializedNoiseParameter.CustomFunction == CustomFunctionType.kCustom)
            {
                var customExponent = EditorGUI.FloatField(EditorGUILayout.GetControlRect(), "Custom Exponent", SerializedNoiseParameter.CustomExponent);
                SerializedNoiseParameter.CustomExponent = customExponent <= 0 ? 0.0001f : customExponent;
            }
            GUILayout.BeginHorizontal();
            GUILayout.Label("Pick a generation type");
            info.GenerationType = (GenerationType)EditorGUI.EnumPopup(EditorGUILayout.GetControlRect(), info.GenerationType);
            GUILayout.EndHorizontal();

            if (GUI.Button(EditorGUILayout.GetControlRect(), "Paint the terrain!"))
            {
                if (info.GenerationType != GenerationType.kSingleRun)
                {
                    Debug.LogWarningFormat("WARNING: Parameter _GenerationType is {0}, needs to be kSingleRun (can't paint terrain in runtime), changing to single run.", info.GenerationType.ToString());
                    info.GenerationType = GenerationType.kSingleRun;
                }
                AssignSplatMap.DoSplat(info);
            }
            if (GUI.Button(EditorGUILayout.GetControlRect(), "Apply noise parameters!"))
            {
                script.GenerateTerrainOnDemand(true);
            }
            GUILayout.Label("Saved noise presets");
            GUILayout.BeginHorizontal(GUILayout.Width(250));
            var lastIndex = CurrentSelectedIndexNoise;
            CurrentSelectedIndexNoise = EditorGUILayout.Popup(CurrentSelectedIndexNoise, AllNoiseParameterNames, GUILayout.Width(250));
            DeleteFailsafe            = lastIndex != CurrentSelectedIndexNoise ? 0 : DeleteFailsafe;
            if (GUILayout.Button(string.Format("Delete selected preset ({0})", DeleteFailsafe), GUILayout.MaxWidth(200)))
            {
                if (DeleteFailsafe == 2)
                {
                    DeleteFailsafe = 0;
                    SerializationManager.DeleteNoiseParameter(AllNoiseParameterNames[CurrentSelectedIndexNoise]);
                    SerializedNoiseParameters.RemoveAt(CurrentSelectedIndexNoise);
                    TryGeneratingSavedNoiseParameters(info, false);
                }
                else
                {
                    DeleteFailsafe++;
                }
            }
            GUILayout.EndHorizontal();
            if (GUI.Button(EditorGUILayout.GetControlRect(), "Load preset"))
            {
                TryGeneratingSavedNoiseParameters(info, true);
            }
            EditorGUI.LabelField(EditorGUILayout.GetControlRect(), "Terrain parameter serializer, saves the current terrain preset configuration.");
            NoisePresetName = EditorGUI.TextField(EditorGUILayout.GetControlRect(), "Terrain preset name: ", NoisePresetName);
            if (GUI.Button(EditorGUILayout.GetControlRect(), "Save preset"))
            {
                SerializedNoiseParameter.NoiseParameterName = NoisePresetName;
                SerializationManager.SaveNoiseParameters(NoisePresetName, SerializedNoiseParameter);
                TryGeneratingSavedNoiseParameters(info, false);
            }
        }
        EditorGUILayout.Space();
        EditorGUILayout.Space();
        // we do this shit so editor syncs up with runtime, its terrible
        SerializedNoiseParameter.RuntimeErosion = info.RuntimeErosion;
        SerializedNoiseParameter.ErosionType    = info.ErosionType;
        SetCorrectNoiseParams(SerializedNoiseParameter, ref info);
        EditorPrefs.SetInt("ParameterPresetNoiseIdx", CurrentSelectedIndexNoise);
    }
 private void SaveCurrentPage()
 {
     EditorPrefs.SetInt(editorPrefsSavedPage, (int)currentPage);
 }
Exemplo n.º 18
0
        internal void LoadPreferences()
        {
            if (EditorPrefs.GetInt(PreferenceKeys.StoredPreferenceVersion, k_CurrentPreferencesVersion) != k_CurrentPreferencesVersion)
            {
                EditorPrefs.SetInt(PreferenceKeys.StoredPreferenceVersion, k_CurrentPreferencesVersion);
                Preferences.ResetPrefs();
            }

            string snapSettingsJson = EditorPrefs.GetString(PreferenceKeys.SnapSettings);

            m_SnapSettings = new SnapSettings();
            JsonUtility.FromJsonOverwrite(snapSettingsJson, m_SnapSettings);

            m_SnapMethod = (SnapMethod)EditorPrefs.GetInt(PreferenceKeys.SnapMethod, (int)Defaults.SnapMethod);

            m_IncreaseGridSizeShortcut = EditorPrefs.HasKey(PreferenceKeys.IncreaseGridSize)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.IncreaseGridSize)
                                : KeyCode.Equals;
            m_DecreaseGridSizeShortcut = EditorPrefs.HasKey(PreferenceKeys.DecreaseGridSize)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.DecreaseGridSize)
                                : KeyCode.Minus;
            m_NudgePerspectiveBackwardShortcut = EditorPrefs.HasKey(PreferenceKeys.NudgePerspectiveBackward)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.NudgePerspectiveBackward)
                                : KeyCode.LeftBracket;
            m_NudgePerspectiveForwardShortcut = EditorPrefs.HasKey(PreferenceKeys.NudgePerspectiveForward)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.NudgePerspectiveForward)
                                : KeyCode.RightBracket;
            m_ResetGridShortcutModifiers = EditorPrefs.HasKey(PreferenceKeys.ResetGridShortcutModifiers)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.ResetGridShortcutModifiers)
                                : KeyCode.Alpha0;
            m_CyclePerspectiveShortcut = EditorPrefs.HasKey(PreferenceKeys.CyclePerspective)
                                ? (KeyCode)EditorPrefs.GetInt(PreferenceKeys.CyclePerspective)
                                : KeyCode.Backslash;

            m_GridIsLocked = EditorPrefs.GetBool(PreferenceKeys.LockGrid);

            menuOpen = EditorPrefs.GetBool(PreferenceKeys.ProGridsIsExtended, true);

            if (m_GridIsLocked)
            {
                if (EditorPrefs.HasKey(PreferenceKeys.LockedGridPivot))
                {
                    string   piv      = EditorPrefs.GetString(PreferenceKeys.LockedGridPivot);
                    string[] pivsplit = piv.Replace("(", "").Replace(")", "").Split(',');

                    float x, y, z;

                    if (float.TryParse(pivsplit[0], out x) &&
                        float.TryParse(pivsplit[1], out y) &&
                        float.TryParse(pivsplit[2], out z))
                    {
                        m_Pivot.x = x;
                        m_Pivot.y = y;
                        m_Pivot.z = z;
                    }
                }
            }

            FullGridEnabled = EditorPrefs.GetBool(PreferenceKeys.PerspGrid);

            m_RenderPlane    = EditorPrefs.HasKey(PreferenceKeys.GridAxis) ? (Axis)EditorPrefs.GetInt(PreferenceKeys.GridAxis) : Axis.Y;
            m_DrawGrid       = EditorPrefs.GetBool(PreferenceKeys.ShowGrid, Defaults.ShowGrid);
            m_PredictiveGrid = EditorPrefs.GetBool(PreferenceKeys.PredictiveGrid, Defaults.PredictiveGrid);
        }
Exemplo n.º 19
0
    void OnGUI()
    {
        GUILayout.Label("makeing importer", EditorStyles.boldLabel);
        className     = EditorGUILayout.TextField("class name", className);
        sepalateSheet = EditorGUILayout.Toggle("sepalate sheet", sepalateSheet);

        EditorPrefs.SetBool(s_key_prefix + fileName + ".separateSheet", sepalateSheet);

        if (GUILayout.Button("create"))
        {
            EditorPrefs.SetString(s_key_prefix + fileName + ".className", className);
            ExportEntity();
            ExportImporter();

            AssetDatabase.ImportAsset(filePath);
            AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
            Close();
        }

        // selecting sheets

        EditorGUILayout.LabelField("sheet settings");
        EditorGUILayout.BeginVertical("box");
        foreach (ExcelSheetParameter sheet in sheetList)
        {
            GUILayout.BeginHorizontal();
            sheet.isEnable = EditorGUILayout.BeginToggleGroup("enable", sheet.isEnable);
            EditorGUILayout.LabelField(sheet.sheetName);
            EditorGUILayout.EndToggleGroup();
            EditorPrefs.SetBool(s_key_prefix + fileName + ".sheet." + sheet.sheetName, sheet.isEnable);
            GUILayout.EndHorizontal();
        }
        EditorGUILayout.EndVertical();

        // selecting parameters
        EditorGUILayout.LabelField("parameter settings");
        curretScroll = EditorGUILayout.BeginScrollView(curretScroll);
        EditorGUILayout.BeginVertical("box");
        string lastCellName = string.Empty;

        foreach (ExcelRowParameter cell in typeList)
        {
            if (cell.isArray && lastCellName != null && cell.name.Equals(lastCellName))
            {
                continue;
            }

            cell.isEnable = EditorGUILayout.BeginToggleGroup("enable", cell.isEnable);
            if (cell.isArray)
            {
                EditorGUILayout.LabelField("---[array]---");
            }
            GUILayout.BeginHorizontal();
            cell.name = EditorGUILayout.TextField(cell.name);
            cell.type = (ValueType)EditorGUILayout.EnumPopup(cell.type, GUILayout.MaxWidth(100));
            EditorPrefs.SetInt(s_key_prefix + fileName + ".type." + cell.name, (int)cell.type);
            GUILayout.EndHorizontal();

            EditorGUILayout.EndToggleGroup();
            lastCellName = cell.name;
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndScrollView();
    }
Exemplo n.º 20
0
 static void SetState(this MaterialEditor editor, uint value)
 {
     EditorPrefs.SetInt(GetKey(editor), (int)value);
 }
Exemplo n.º 21
0
 public void onAtlasSizeChanged(int width, int height)
 {
     EditorPrefs.SetInt(EDITOR_PREFS_KEY_ATLAS_WIDHT, width);
     EditorPrefs.SetInt(EDITOR_PREFS_KEY_ATLAS_HEIGHT, height);
 }
Exemplo n.º 22
0
 private void OnDestroy()
 {
     EditorPrefs.SetInt("index", entranceProcedureIndex);
 }
Exemplo n.º 23
0
    void DrawField(vlbField field)
    {
        if (field.type == vlbFieldType.Unknown)
        {
            return;
        }

        switch (field.type)
        {
        case vlbFieldType.HzBegin: GUILayout.BeginHorizontal();          break;

        case vlbFieldType.HzEnd: GUILayout.EndHorizontal();            break;

        case vlbFieldType.VtBegin: GUILayout.BeginVertical();            break;

        case vlbFieldType.VtEnd: GUILayout.EndVertical();              break;

        case vlbFieldType.Space: GUILayout.Space((float)field.value);  break;

        case vlbFieldType.FlexibleSpace: GUILayout.FlexibleSpace();            break;

        case vlbFieldType.Int: {
            var val    = (int)field.value;
            var newVal = EditorGUILayout.IntField(field.title, val);
            if (val != newVal)
            {
                EditorPrefs.SetInt(formId + "." + field.varName, newVal);
            }

            field.value = newVal;
        }
        break;

        case vlbFieldType.Bool:
            field.value = EditorGUILayout.ToggleLeft(field.title, (bool)field.value, GUILayout.Width(data.titleWidth));
            break;

        case vlbFieldType.Float:
            field.value = EditorGUILayout.FloatField(field.title, (float)field.value);
            break;

        case vlbFieldType.String:
            field.value = EditorGUILayout.TextField(field.title, (string)field.value);
            break;

        case vlbFieldType.Color:
            field.value = EditorGUILayout.ColorField(field.title, (Color)field.value);
            break;

        case vlbFieldType.Vector2:
            field.value = EditorGUILayout.Vector2Field(field.title, (Vector2)field.value);
            break;

        case vlbFieldType.Vector3:
            field.value = EditorGUILayout.Vector3Field(field.title, (Vector3)field.value);
            break;

        case vlbFieldType.Rect:
            field.value = EditorGUILayout.RectField(field.title, (Rect)field.value);
            break;

        case vlbFieldType.Enum:
            field.value = EditorGUILayout.EnumPopup(field.title, (Enum)field.value);
            break;
        }
    }
Exemplo n.º 24
0
        private void DoLayoutConfigurationOptions()
        {
            int removeIndex = -1;

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.BeginHorizontal();

            int ignitersIndex = GUILayout.Toolbar(this.ignitersIndex, IGNITERS_PLATFORM_NAMES);

            if (ignitersIndex != this.ignitersIndex)
            {
                this.ignitersIndex = ignitersIndex;
                EditorPrefs.SetInt(KEY_IGNITER_INDEX_PREF, this.ignitersIndex);
            }

            if (GUILayout.Button("+", CoreGUIStyles.GetButtonLeft(), GUILayout.Width(30f)))
            {
                this.SelectPlatformMenu();
            }

            EditorGUI.BeginDisabledGroup(this.ignitersIndex == 0);
            if (GUILayout.Button("-", CoreGUIStyles.GetButtonRight(), GUILayout.Width(30f)))
            {
                removeIndex = this.ignitersIndex;
            }

            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel(this.ignitersCache[this.ignitersIndex].name, EditorStyles.miniBoldLabel);
            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Change Trigger", GUILayout.Width(SelectTypePanel.WINDOW_WIDTH)))
            {
                SelectTypePanel selectTypePanel = new SelectTypePanel(this.SelectNewIgniter, "Triggers", typeof(Igniter));
                PopupWindow.Show(this.selectIgniterButtonRect, selectTypePanel);
            }

            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                this.selectIgniterButtonRect = GUILayoutUtility.GetLastRect();
            }

            EditorGUILayout.EndHorizontal();

            if (this.ignitersCache[this.ignitersIndex].serializedObject != null)
            {
                string comment = this.ignitersCache[this.ignitersIndex].comment;
                if (!string.IsNullOrEmpty(comment))
                {
                    EditorGUILayout.HelpBox(comment, MessageType.Info);
                }

                Igniter.PaintEditor(this.ignitersCache[this.ignitersIndex].serializedObject);
            }

            if (this.ignitersCache[this.ignitersIndex].requiresCollider)
            {
                Collider collider = this.trigger.GetComponent <Collider>();
                if (!collider)
                {
                    this.PaintNoCollider();
                }
            }

            EditorGUILayout.EndVertical();

            if (removeIndex > 0)
            {
                UnityEngine.Object obj = this.spIgnitersValues.GetArrayElementAtIndex(removeIndex).objectReferenceValue;
                this.spIgnitersValues.GetArrayElementAtIndex(removeIndex).objectReferenceValue = null;

                this.spIgnitersKeys.DeleteArrayElementAtIndex(removeIndex);
                this.spIgnitersValues.DeleteArrayElementAtIndex(removeIndex);

                if (obj != null)
                {
                    DestroyImmediate(obj, true);
                }

                this.serializedObject.ApplyModifiedProperties();
                this.serializedObject.Update();

                this.updateIgnitersPlatforms = true;
                if (this.ignitersIndex >= this.spIgnitersKeys.arraySize)
                {
                    this.ignitersIndex = this.spIgnitersKeys.arraySize - 1;
                }
            }
        }
Exemplo n.º 25
0
        private void OnDrawAssets()
        {
            Block("Search", () =>
            {
                var nSearchKeyword = EditorGUILayout.TextField("Keyword", _searchKeyword);
                if (nSearchKeyword != _searchKeyword)
                {
                    _searchKeyword = nSearchKeyword;
                    EditorPrefs.SetString(KeyForSearchKey, _searchKeyword);
                    UpdateSearchResults();
                }

                var nSearchSliceKeyword = EditorGUILayout.TextField("Bundle Slice Keyword", _searchSliceKeyword);
                if (nSearchSliceKeyword != _searchSliceKeyword)
                {
                    _searchSliceKeyword = nSearchSliceKeyword;
                    EditorPrefs.SetString(KeyForSearchSliceKey, _searchSliceKeyword);
                    UpdateSearchResults();
                }

                var nShowDefinedOnly = EditorGUILayout.Toggle("Show Defined Only", _showDefinedOnly);
                if (nShowDefinedOnly != _showDefinedOnly)
                {
                    _showDefinedOnly = nShowDefinedOnly;
                    EditorPrefs.SetInt(KeyForShowDefinedOnly, _showDefinedOnly ? 1 : 0);
                    UpdateSearchResults();
                }

                var nShowSelectionOnly = EditorGUILayout.Toggle("Show Selection Only", _showSelectionOnly);
                if (nShowSelectionOnly != _showSelectionOnly)
                {
                    _showSelectionOnly = nShowSelectionOnly;
                    EditorPrefs.SetInt(KeyForShowSelectionOnly, _showSelectionOnly ? 1 : 0);
                    UpdateSearchResults();
                }

                var nShowStreamingAssetsOnly = EditorGUILayout.Toggle("Show StreamingAssets Only", _showStreamingAssetsOnly);
                if (nShowStreamingAssetsOnly != _showStreamingAssetsOnly)
                {
                    _showStreamingAssetsOnly = nShowStreamingAssetsOnly;
                    EditorPrefs.SetInt(KeyForShowStreamingAssetsOnly, _showStreamingAssetsOnly ? 1 : 0);
                    UpdateSearchResults();
                }
            });

            EditorGUILayout.Space();
            Block(string.Format("Results ({0}/{1})", _searchMarks.Count, _searchResults.Count), () =>
            {
                EditorGUILayout.BeginHorizontal();
                var nBatchedSelectMarks = EditorGUILayout.Toggle(_batchedSelectMarks, GUILayout.Width(20f));
                EditorGUILayout.LabelField("Asset Packer", GUILayout.Width(110f));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();

                if (nBatchedSelectMarks != _batchedSelectMarks)
                {
                    _batchedSelectMarks = nBatchedSelectMarks;
                    _searchMarks.Clear();
                    if (_batchedSelectMarks)
                    {
                        for (var i = 0; i < _searchResults.Count; i++)
                        {
                            _searchMarks.Add(_searchResults[i]);
                        }
                    }
                }

                _searchSV = EditorGUILayout.BeginScrollView(_searchSV);

                for (var i = 0; i < _searchResults.Count; i++)
                {
                    var result    = _searchResults[i];
                    var marked    = _searchMarks.Contains(result);
                    var assetGuid = result.assetGuid;

                    EditorGUILayout.BeginHorizontal();
                    var nMarked = EditorGUILayout.Toggle(marked, GUILayout.Width(20f));
                    if (marked) // 批量修改模式
                    {
                        GUI.color = Color.green;
                    }

                    var rBundleInfo  = result.bundleInfo;
                    var rBundleSplit = result.bundleSplit;
                    var rBundleSlice = result.bundleSlice;
                    DrawSingleAssetAttributes(_data, assetGuid, this, marked, () => GotoBundleSlice(_data, rBundleInfo, rBundleSlice));
                    GUI.color = _GUIColor;
                    EditorGUILayout.EndHorizontal();

                    if (nMarked != marked)
                    {
                        if (nMarked)
                        {
                            _searchMarks.Add(result);
                        }
                        else
                        {
                            _searchMarks.Remove(result);
                        }
                    }
                }

                EditorGUILayout.EndScrollView();
            });
            EditorGUILayout.Space();
        }
Exemplo n.º 26
0
 public static void SavePrefInt(string key, int v)
 {
     EditorPrefs.SetInt(key, v);
 }
 private static void SaveID()
 {
     EditorPrefs.SetInt("EditorPlusHistory.curID", currentID);
 }
Exemplo n.º 28
0
        public void drawInspector()
        {
            if (GUIUtils.DrawHeader("Parameters"))
            {
                using (new GUIUtils.GUIContents())
                {
                    bool isUIEnabled = Recorder.Singleton != null && Recorder.Singleton.State == RecorderState.None;
                    using (new GUIUtils.GUIEnabled(isUIEnabled))
                    {
                        using (new GUIUtils.GUIContents())
                        {
                            EditorGUI.BeginChangeCheck();
                            gifCreatorWindow.Parameters.section = (RecorderParameters.Section)EditorGUILayout.EnumPopup("Screen section", gifCreatorWindow.Parameters.section);
                            if (EditorGUI.EndChangeCheck())
                            {
                                updateCustomRectPreview();
                            }

                            EditorGUI.BeginChangeCheck();
                            {
                                switch (gifCreatorWindow.Parameters.section)
                                {
                                case RecorderParameters.Section.Fullscreen:
                                    using (new GUIUtils.GUIEnabled(false))
                                    {
                                        EditorGUILayout.IntField("Position X", (int)gifCreatorWindow.Parameters.getRectSection().x);
                                        EditorGUILayout.IntField("Position Y", (int)gifCreatorWindow.Parameters.getRectSection().y);
                                        EditorGUILayout.IntField("Width", (int)gifCreatorWindow.Parameters.getRectSection().width);
                                        EditorGUILayout.IntField("Height", (int)gifCreatorWindow.Parameters.getRectSection().height);
                                    }
                                    break;

                                case RecorderParameters.Section.CustomRectAbsolute:
                                    gifCreatorWindow.Parameters.absolutePosX   = EditorGUILayout.IntField("Position X", gifCreatorWindow.Parameters.absolutePosX);
                                    gifCreatorWindow.Parameters.absolutePosY   = EditorGUILayout.IntField("Position Y", gifCreatorWindow.Parameters.absolutePosY);
                                    gifCreatorWindow.Parameters.absoluteWidth  = EditorGUILayout.IntField("Width", gifCreatorWindow.Parameters.absoluteWidth);
                                    gifCreatorWindow.Parameters.absoluteHeight = EditorGUILayout.IntField("Height", gifCreatorWindow.Parameters.absoluteHeight);

                                    if (gifCreatorWindow.Parameters.absolutePosX < 0)
                                    {
                                        gifCreatorWindow.Parameters.absolutePosX = 0;
                                    }
                                    if (gifCreatorWindow.Parameters.absolutePosY < 0)
                                    {
                                        gifCreatorWindow.Parameters.absolutePosY = 0;
                                    }
                                    if (gifCreatorWindow.Parameters.absoluteWidth + gifCreatorWindow.Parameters.absolutePosX > gifCreatorWindow.Parameters.getMainGameViewSize().x)
                                    {
                                        gifCreatorWindow.Parameters.absoluteWidth = (int)gifCreatorWindow.Parameters.getMainGameViewSize().x - gifCreatorWindow.Parameters.absolutePosX;
                                    }
                                    if (gifCreatorWindow.Parameters.absoluteHeight + gifCreatorWindow.Parameters.absolutePosY > gifCreatorWindow.Parameters.getMainGameViewSize().y)
                                    {
                                        gifCreatorWindow.Parameters.absoluteHeight = (int)gifCreatorWindow.Parameters.getMainGameViewSize().y - gifCreatorWindow.Parameters.absolutePosY;
                                    }
                                    if (gifCreatorWindow.Parameters.absoluteWidth < 1)
                                    {
                                        gifCreatorWindow.Parameters.absoluteWidth = 1;
                                    }
                                    if (gifCreatorWindow.Parameters.absoluteHeight < 1)
                                    {
                                        gifCreatorWindow.Parameters.absoluteHeight = 1;
                                    }
                                    if (gifCreatorWindow.Parameters.absolutePosX >= gifCreatorWindow.Parameters.getMainGameViewSize().x)
                                    {
                                        gifCreatorWindow.Parameters.absolutePosX = (int)gifCreatorWindow.Parameters.getMainGameViewSize().x - 1;
                                    }
                                    if (gifCreatorWindow.Parameters.absolutePosY >= gifCreatorWindow.Parameters.getMainGameViewSize().y)
                                    {
                                        gifCreatorWindow.Parameters.absolutePosY = (int)gifCreatorWindow.Parameters.getMainGameViewSize().y - 1;
                                    }
                                    break;

                                case RecorderParameters.Section.CustomRectRelative:
                                    gifCreatorWindow.Parameters.relativePosX   = EditorGUILayout.Slider("Position X", gifCreatorWindow.Parameters.relativePosX, 0.0f, 0.99f);
                                    gifCreatorWindow.Parameters.relativePosY   = EditorGUILayout.Slider("Position Y", gifCreatorWindow.Parameters.relativePosY, 0.0f, 0.99f);
                                    gifCreatorWindow.Parameters.relativeWidth  = EditorGUILayout.Slider("Width", gifCreatorWindow.Parameters.relativeWidth, 0.01f, 1.0f);
                                    gifCreatorWindow.Parameters.relativeHeight = EditorGUILayout.Slider("Height", gifCreatorWindow.Parameters.relativeHeight, 0.01f, 1.0f);

                                    if (gifCreatorWindow.Parameters.relativePosX + gifCreatorWindow.Parameters.relativeWidth > 1.0f)
                                    {
                                        gifCreatorWindow.Parameters.relativeWidth = 1.0f - gifCreatorWindow.Parameters.relativePosX;
                                    }

                                    if (gifCreatorWindow.Parameters.relativePosY + gifCreatorWindow.Parameters.relativeHeight > 1.0f)
                                    {
                                        gifCreatorWindow.Parameters.relativeHeight = 1.0f - gifCreatorWindow.Parameters.relativePosY;
                                    }
                                    break;
                                }

                                switch (gifCreatorWindow.Parameters.section)
                                {
                                case RecorderParameters.Section.CustomRectAbsolute:
                                case RecorderParameters.Section.CustomRectRelative:
                                    gifCreatorWindow.Parameters.customRectPreviewColor = EditorGUILayout.ColorField("Custom rect color", gifCreatorWindow.Parameters.customRectPreviewColor);
                                    gifCreatorWindow.Parameters.showCustomRectPreview  = EditorGUILayout.Toggle("Preview on screen", gifCreatorWindow.Parameters.showCustomRectPreview);
                                    break;
                                }
                            }
                            if (EditorGUI.EndChangeCheck())
                            {
                                updateCustomRectPreview();
                            }
                        }

                        EditorGUI.BeginChangeCheck();
                        {
                            gifCreatorWindow.Parameters.framePerSecond = EditorGUILayout.IntSlider(new GUIContent("Frames Per Second", "The number of frames per second the gif will run at."), gifCreatorWindow.Parameters.framePerSecond, 1, 30);
                            gifCreatorWindow.Parameters.duration       = EditorGUILayout.Slider(new GUIContent("Duration", "The amount of time (in seconds) to record."), gifCreatorWindow.Parameters.duration, 0.1f, 30f);
                        }
                        if (EditorGUI.EndChangeCheck())
                        {
                            EditorPrefs.SetInt("gifcreator_fps", gifCreatorWindow.Parameters.framePerSecond);
                            EditorPrefs.SetFloat("gifcreator_duration", gifCreatorWindow.Parameters.duration);
                        }

                        if (gifCreatorWindow.Parameters.repeat < -1)
                        {
                            gifCreatorWindow.Parameters.repeat = -1;
                        }

                        gifCreatorWindow.Parameters.recordWidth = EditorGUILayout.IntField(new GUIContent("Record width", "Even if your screen size is 1280x720 for example. You can specify a different width (640) that will be used to resize each recorded frame. Height is automatically calculated based on the recorded section ratio."), gifCreatorWindow.Parameters.recordWidth);
                        EditorGUILayout.LabelField("Final record dimension", gifCreatorWindow.Parameters.getRecordWidth() + "x" + gifCreatorWindow.Parameters.getRecordHeight());

                        EditorGUILayout.HelpBox("Estimated memory use: " + gifCreatorWindow.Parameters.getEstimatedMemoryUse().ToString("0") + "MB"
                                                + "\n" + gifCreatorWindow.Parameters.getEstimatedMemoryUseDescription(), MessageType.Info);

                        if (gifCreatorWindow.Parameters.recordMode == RecorderParameters.RecordMode.EVERYTHING)
                        {
                            if (gifCreatorWindow.Parameters.getRecordWidth() != gifCreatorWindow.Parameters.getRectSection().width)
                            {
                                EditorGUILayout.HelpBox("Be careful, your record width (" + gifCreatorWindow.Parameters.getRecordWidth() + ") is different than the screen width (" + gifCreatorWindow.Parameters.getRectSection().width + ") you want to record. Gif Creator will resize each recorded frame, each frame, this might result in bad performance and lags during the recording.", MessageType.Warning);
                            }
                        }
                    }
                }
            }
        }
 public void SetDisplayWidth(int columnIndex, int value)
 {
     value = Mathf.Max(value, UI.SplitterStateEx.MinSplitterSize);
     EditorPrefs.SetInt(m_DisplayWidthPrefKeysPerColumn[columnIndex], value);
 }
Exemplo n.º 30
0
        public static void SaveInt(SF_Setting setting, int value)
        {
            string key = KeyOf(setting);

            EditorPrefs.SetInt(key, value);
        }