Ejemplo n.º 1
0
	public override void DrawGUI(Rect position, BuildInfo buildReportToDisplay, AssetDependencies assetDependencies, out bool requestRepaint)
	{
		if (buildReportToDisplay == null)
		{
			requestRepaint = false;
			return;
		}
		
		GUILayout.Space(2); // top padding for scrollbar

		_scrollPos = GUILayout.BeginScrollView(_scrollPos);

		GUILayout.BeginHorizontal();
			GUILayout.Space(10); // extra left padding


			GUILayout.BeginVertical();

			GUILayout.Space(10); // top padding


			// report title
			GUILayout.Label(buildReportToDisplay.SuitableTitle, BuildReportTool.Window.Settings.MAIN_TITLE_STYLE_NAME);





			GUILayout.Space(10);


			// two-column layout
			GUILayout.BeginVertical();
				
				GUILayout.BeginHorizontal();
					// 1st column
					GUILayout.BeginVertical(GUILayout.MaxWidth(350));
						GUILayout.Label(Labels.TIME_OF_BUILD_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
						GUILayout.Label(buildReportToDisplay.GetTimeReadable(), BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);

						GUILayout.Label("Report generation took:", BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
						GUILayout.Label(buildReportToDisplay.ReportGenerationTime.ToString(), BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
						
						if (!string.IsNullOrEmpty(buildReportToDisplay.TotalBuildSize) && !string.IsNullOrEmpty(buildReportToDisplay.BuildFilePath))
						{
							GUILayout.BeginVertical();
							GUILayout.Label(Labels.BUILD_TOTAL_SIZE_LABEL, BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);

							GUILayout.Label(BuildReportTool.Util.GetBuildSizePathDescription(buildReportToDisplay),
								BuildReportTool.Window.Settings.TINY_HELP_STYLE_NAME);

							GUILayout.Label(buildReportToDisplay.TotalBuildSize, BuildReportTool.Window.Settings.BIG_NUMBER_STYLE_NAME);
							GUILayout.EndVertical();
						}

						GUILayout.Space(20);
						
						if (assetDependencies != null)
						{
							if (!string.IsNullOrEmpty(assetDependencies.SavedPath))
							{
								GUILayout.Label("Asset Dependencies file used:",
									BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
								GUILayout.Label(assetDependencies.SavedPath,
									BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
								
								GUILayout.Space(20);
							}
						}

						string emphasisColor = "black";
						if (EditorGUIUtility.isProSkin || BRT_BuildReportWindow.FORCE_USE_DARK_SKIN)
						{
							emphasisColor = "white";
						}

						string largestAssetCategoryLabel = string.Format(
							"<color={0}><size=20><b>{1}</b></size></color> are the largest,\ntaking up <color={0}><size=20><b>{2}%</b></size></color> of the build{3}",
							emphasisColor, buildReportToDisplay.BuildSizes[1].Name, buildReportToDisplay.BuildSizes[1].Percentage.ToString(CultureInfo.InvariantCulture),
							(!buildReportToDisplay.HasStreamingAssets
							? "\n<size=12>(not counting streaming assets)</size>"
							: ""));
						
						GUILayout.Label(largestAssetCategoryLabel, BuildReportTool.Window.Settings.INFO_TEXT_STYLE_NAME);
						GUILayout.Space(20);
					GUILayout.EndVertical();
					
					// 2nd column
					GUILayout.BeginVertical(GUILayout.MaxWidth(250));
						GUILayout.Label("Made for:", BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
						GUILayout.Label(buildReportToDisplay.BuildType, BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);

						GUILayout.Label("Built in:", BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
						GUILayout.Label(buildReportToDisplay.UnityVersionDisplayed, BuildReportTool.Window.Settings.INFO_SUBTITLE_STYLE_NAME);
					GUILayout.EndVertical();

					DrawScenesInBuild(buildReportToDisplay.ScenesInBuild);
					
				GUILayout.EndHorizontal();

				
				GUILayout.BeginHorizontal();
				
					var numberOfTopUsed = buildReportToDisplay.HasUsedAssets ? buildReportToDisplay.UsedAssets.NumberOfTopLargest : 0;
					var numberOfTopUnused = buildReportToDisplay.HasUnusedAssets ? buildReportToDisplay.UnusedAssets.NumberOfTopLargest : 0;
					if (Event.current.type == EventType.Layout)
					{
						_showTopUsed = numberOfTopUsed > 0 && buildReportToDisplay.UsedAssets.TopLargest != null;
						_showTopUnused = numberOfTopUnused > 0 && buildReportToDisplay.UnusedAssets.TopLargest != null;
					}

					// 1st column
					GUILayout.BeginVertical();
					if (_showTopUsed)
					{
						GUILayout.Label(string.Format("Top {0} largest in build:", numberOfTopUsed.ToString()), BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);

						if (!BuildReportTool.Options.AutoResortAssetsWhenUnityEditorRegainsFocus && GUILayout.Button("Refresh", GUILayout.Height(20), GUILayout.MaxWidth(520)))
						{
							buildReportToDisplay.RecategorizeUsedAssets();
							buildReportToDisplay.FlagOkToRefresh();
						}

						DrawAssetList(buildReportToDisplay.UsedAssets, true, buildReportToDisplay, assetDependencies);
					}
					GUILayout.EndVertical();
					
					GUILayout.Space(50);
					
					// 2nd column
					GUILayout.BeginVertical();
					if (_showTopUnused)
					{
						GUILayout.Label(string.Format("Top {0} largest not in build:", numberOfTopUnused.ToString()), BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);
							
						if (!BuildReportTool.Options.AutoResortAssetsWhenUnityEditorRegainsFocus && GUILayout.Button("Refresh", GUILayout.Height(20), GUILayout.MaxWidth(520)))
						{
							buildReportToDisplay.RecategorizeUnusedAssets();
							buildReportToDisplay.FlagOkToRefresh();
						}

						DrawAssetList(buildReportToDisplay.UnusedAssets, false, buildReportToDisplay, assetDependencies);
					}
					GUILayout.EndVertical();
				GUILayout.EndHorizontal();

			GUILayout.EndVertical();


			GUILayout.Space(20);


			GUILayout.EndVertical();

			GUILayout.Space(20); // extra right padding
		GUILayout.EndHorizontal();

		GUILayout.EndScrollView();
		
		// ------------------------------------------------------

		// Continually request repaint, since we need to check the rects
		// generated by the GUILayout (using GUILayoutUtility.GetLastRect())
		// to make the hover checks work. That's because GetLastRect() only
		// works during repaint event.
		//
		// Later checks below can set requestRepaint to false if there's no
		// need to repaint, to help lessen cpu usage.
		requestRepaint = true;
		
		if (Event.current.mousePosition.y >= position.height ||
		    Event.current.mousePosition.y <= 0 ||
		    Event.current.mousePosition.x <= 0 ||
		    Event.current.mousePosition.x >= position.width)
		{
			// mouse is outside the window, no need to repaint, can't show tooltip anyway
			// set requestRepaint to false to help lessen cpu usage
			requestRepaint = false;
		}
		
		var showThumbnailNow = BuildReportTool.Options.ShowTooltipThumbnail &&
		                       _shouldShowThumbnailOnHoveredAsset &&
		                       (_assetUsedEntryHoveredIdx != -1 || _assetUnusedEntryHoveredIdx != -1);

		var zoomInChanged = false;
		if (showThumbnailNow)
		{
			var prevZoomedIn = BRT_BuildReportWindow.ZoomedInThumbnails;

			// if thumbnail is currently showing, we process the inputs
			// (ctrl zooms in on thumbnail, alt toggles alpha blend)
			BRT_BuildReportWindow.ProcessThumbnailControls();

			if (prevZoomedIn != BRT_BuildReportWindow.ZoomedInThumbnails)
			{
				zoomInChanged = true;
			}
		}
		else
		{
			// no thumbnail currently shown. ensure the controls that
			// need to be reset to initial state are reset
			BRT_BuildReportWindow.ResetThumbnailControls();
		}

		if (!zoomInChanged && !Event.current.alt &&
		    !BRT_BuildReportWindow.MouseMovedNow && !BRT_BuildReportWindow.LastMouseMoved)
		{
			// mouse hasn't moved, and no request to zoom-in thumbnail or toggle thumbnail alpha
			// no need to repaint because nothing has changed
			// set requestRepaint to false to help lessen cpu usage
			requestRepaint = false;
		}

		var shouldShowAssetEndUsersTooltipNow = BuildReportTool.Options.ShowAssetPrimaryUsersInTooltipIfAvailable &&
		                                        BRT_BuildReportWindow.ShouldHoveredAssetShowEndUserTooltip(assetDependencies) &&
		                                        (_assetUsedEntryHoveredIdx != -1 || _assetUnusedEntryHoveredIdx != -1);

		if (Event.current.type == EventType.Repaint)
		{
			if (showThumbnailNow && shouldShowAssetEndUsersTooltipNow)
			{
				// draw thumbnail and end users below it
				BRT_BuildReportWindow.DrawThumbnailEndUsersTooltip(position, assetDependencies);
			}
			else if (shouldShowAssetEndUsersTooltipNow)
			{
				// draw only end users in tooltip
				BRT_BuildReportWindow.DrawEndUsersTooltip(position, assetDependencies);
			}
			else if (showThumbnailNow)
			{
				// draw only thumbnail in tooltip
				BRT_BuildReportWindow.DrawThumbnailTooltip(position);
			}
		}
	}
    void ConfigGUI()
    {
        GUILayout.Space(10);
        if (Config.Project == "Enter your Project name (Required)" || Config.Project == "" || Config.PathtoDoxygen == "")
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Save Configuration and Build new DoxyFile", GUILayout.Height(40)))
        {
            MakeNewDoxyFile(Config);
        }
        if (DoxyfileCreateProgress >= 0)
        {
            Rect r = EditorGUILayout.BeginVertical();
            EditorGUI.ProgressBar(r, DoxyfileCreateProgress, CreateProgressString);
            GUILayout.Space(16);
            EditorGUILayout.EndVertical();
        }
        GUI.enabled = true;

        GUILayout.Space(20);
        GUILayout.Label("Set Path to Doxygen Install", EditorStyles.boldLabel);
        GUILayout.Space(5);
        EditorGUILayout.BeginHorizontal();
        Config.PathtoDoxygen = EditorGUILayout.TextField("Doxygen.exe : ", Config.PathtoDoxygen);
        if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
        {
            Config.PathtoDoxygen = EditorUtility.OpenFilePanel("Where is doxygen.exe installed?", "", "");
        }
        EditorGUILayout.EndHorizontal();


        GUILayout.Space(20);
        GUILayout.Label("Provide some details about the project", EditorStyles.boldLabel);
        GUILayout.Space(5);
        Config.Project  = EditorGUILayout.TextField("Project Name: ", Config.Project);
        Config.Synopsis = EditorGUILayout.TextField("Project Brief: ", Config.Synopsis);
        Config.Version  = EditorGUILayout.TextField("Project Version: ", Config.Version);

        GUILayout.Space(15);
        GUILayout.Label("Select Theme", EditorStyles.boldLabel);
        GUILayout.Space(5);
        SelectedTheme = EditorGUILayout.Popup(SelectedTheme, Themes);

        GUILayout.Space(20);
        GUILayout.Label("Setup the Directories", EditorStyles.boldLabel);
        GUILayout.Space(5);
        EditorGUILayout.BeginHorizontal();
        Config.ScriptsDirectory = EditorGUILayout.TextField("Scripts folder: ", Config.ScriptsDirectory);
        if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
        {
            Config.ScriptsDirectory = EditorUtility.OpenFolderPanel("Select your scripts folder", Config.ScriptsDirectory, "");
        }
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(5);
        EditorGUILayout.BeginHorizontal();
        Config.DocDirectory = EditorGUILayout.TextField("Output folder: ", Config.DocDirectory);
        if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
        {
            Config.DocDirectory = EditorUtility.OpenFolderPanel("Select your ouput Docs folder", Config.DocDirectory, "");
        }
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(5);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);
        GUILayout.Space(30);
        GUILayout.Label("By default Doxygen will search through your whole Assets folder for C# script files to document. Then it will output the documentation it generates into a folder called \"Docs\" that is placed in your project folder next to the Assets folder. If you would like to set a specific script or output folder you can do so above. ", EditorStyles.wordWrappedMiniLabel);
        GUILayout.Space(30);
        EditorGUILayout.EndHorizontal();
    }
Ejemplo n.º 3
0
    private void OnGUI()
    {
        Event e = Event.current;



        languageName = EditorGUILayout.TextField(languageName, GUILayout.Height(position.height - 30), GUILayout.Height(textFieldSize));

        if (GUILayout.Button("Add") || (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter))
        {
            //LocalizeWindow.data.languages.Add (languageName, new Dictionary<string, string>());
            //         LocalizeWindow.options.Add(languageName);
            LocalizationManager.AddLang(languageName);
            tool.Repaint();
            this.Close();
        }
    }
        /// <summary>
        /// This displays the graph
        /// </summary>
        public void Display(GUIStyle AreaStyle, int horizontalBorder, int verticalBorder)
        {
            ScrollView = GUILayout.BeginScrollView(ScrollView, false, false);
            GUIStyle BackgroundStyle = new GUIStyle(GUI.skin.box);

            BackgroundStyle.hover = BackgroundStyle.active = BackgroundStyle.normal;

            GUILayout.Space(verticalBorder);
            //Vertical axis and labels

            GUILayout.BeginVertical();
            GUILayout.BeginArea(new Rect(20 + horizontalBorder, 15 + verticalBorder, 30, displayRect.height + 2 * verticalBorder));

            GUIStyle LabelStyle = new GUIStyle(GUI.skin.label);

            LabelStyle.alignment = TextAnchor.UpperCenter;

            GUILayout.Label(topBound, LabelStyle, GUILayout.Height(20), GUILayout.ExpandWidth(true));
            int pixelspace = (int)displayRect.height / 2 - 72;

            GUILayout.Space(pixelspace);
            GUILayout.Label(verticalLabel, LabelStyle, GUILayout.Height(100), GUILayout.ExpandWidth(true));
            GUILayout.Space(pixelspace);
            GUILayout.Label(bottomBound, LabelStyle, GUILayout.Height(20), GUILayout.ExpandWidth(true));

            GUILayout.EndArea();
            GUILayout.EndVertical();


            //Graph itself

            GUILayout.BeginVertical();
            Rect areaRect = new Rect(50 + horizontalBorder, 15 + verticalBorder, displayRect.width + 2 * horizontalBorder, displayRect.height + 2 * verticalBorder);

            GUILayout.BeginArea(areaRect);

            GUI.DrawTexture(displayRect, graph);
            foreach (KeyValuePair <string, ferramGraphLine> pair in allLines)
            {
                GUI.DrawTexture(displayRect, pair.Value.Line());
            }
            GUILayout.EndArea();

            //Horizontal Axis and Labels

            GUILayout.BeginArea(new Rect(50 + horizontalBorder, displayRect.height + verticalBorder + 15, displayRect.width + 2 * horizontalBorder, 30));
            GUILayout.BeginHorizontal(GUILayout.Width(displayRect.width));


            GUILayout.Label(leftBound, LabelStyle, GUILayout.Width(20), GUILayout.ExpandWidth(true));
            pixelspace = (int)displayRect.width / 2 - 102;
            GUILayout.Space(pixelspace);
            GUILayout.Label(horizontalLabel, LabelStyle, GUILayout.Width(160));
            GUILayout.Space(pixelspace);
            GUILayout.Label(rightBound, LabelStyle, GUILayout.Width(20), GUILayout.ExpandWidth(true));

            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            GUILayout.EndVertical();

            GUILayout.BeginVertical();

            //Legend Area

            int movementdownwards = ((int)displayRect.height - allLines.Count * 20) / 2;

            foreach (KeyValuePair <string, ferramGraphLine> pair in allLines)
            {
                if (!pair.Value.displayInLegend)
                {
                    continue;
                }

                GUILayout.BeginArea(new Rect(60 + displayRect.width + 2 * horizontalBorder, 15 + verticalBorder + movementdownwards, 25, 15));
                GUI.DrawTexture(new Rect(1, 1, 25, 15), pair.Value.LegendImage());
                GUILayout.EndArea();
                GUILayout.BeginArea(new Rect(85 + displayRect.width + 2 * horizontalBorder, 15 + verticalBorder + movementdownwards, 35, 15));
                GUILayout.Label(pair.Key, LabelStyle);
                GUILayout.EndArea();
                movementdownwards += 20;
            }
            GUILayout.EndVertical();

            int rightofarea  = (int)displayRect.width + 2 * horizontalBorder + 30;
            int bottomofarea = (int)displayRect.height + 2 * verticalBorder + 30;

            GUILayout.Space(bottomofarea);
            GUILayout.EndScrollView();
        }
Ejemplo n.º 5
0
    void OnGUI()
    {
        windowState = EditorGUILayout.Popup(windowState, modes);
        SerializedObject   serializedObject;
        SerializedProperty targetFileSerlialized;

        switch (windowState)
        {
        case 0:
            EditorGUILayout.BeginVertical();
            scrollPos        = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height));
            serializedObject = new SerializedObject(this);
            SerializedProperty mechdataSerialized = serializedObject.FindProperty("mechData");
            targetFileSerlialized = serializedObject.FindProperty("targetFile");

            EditorGUILayout.PropertyField(mechdataSerialized, true);
            EditorGUILayout.PropertyField(targetFileSerlialized, true);

            serializedObject.ApplyModifiedProperties();

            if (GUILayout.Button("saveData"))
            {
                SaveData();
            }

            if (GUILayout.Button("loadData"))
            {
                LoadData();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            break;

        case 1:
            EditorGUILayout.BeginVertical();
            scrollPos        = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height));
            serializedObject = new SerializedObject(this);
            SerializedProperty componentLoadoutSerialized = serializedObject.FindProperty("componentLoadout");
            targetFileSerlialized = serializedObject.FindProperty("targetFile");

            EditorGUILayout.PropertyField(componentLoadoutSerialized, true);
            EditorGUILayout.PropertyField(targetFileSerlialized, true);

            serializedObject.ApplyModifiedProperties();

            if (GUILayout.Button("saveData"))
            {
                SaveData();
            }

            if (GUILayout.Button("loadData"))
            {
                LoadData();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            break;

        case 2:
            EditorGUILayout.BeginVertical();
            scrollPos        = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height));
            serializedObject = new SerializedObject(this);
            SerializedProperty mechListSerialized = serializedObject.FindProperty("mechArray");
            targetFileSerlialized = serializedObject.FindProperty("targetFile");

            EditorGUILayout.PropertyField(mechListSerialized, true);
            EditorGUILayout.PropertyField(targetFileSerlialized, true);

            serializedObject.ApplyModifiedProperties();

            if (GUILayout.Button("Save Data"))
            {
                SaveData();
            }

            if (GUILayout.Button("Load Data"))
            {
                LoadData();
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            break;
        }
    }
Ejemplo n.º 6
0
    void OnGUI()
    {
        if (richLabelStyle == null)
        {
            richLabelStyle                    = new GUIStyle(GUI.skin.label);
            richLabelStyle.richText           = true;
            richLabelStyle.wordWrap           = true;
            richButtonStyle                   = new GUIStyle(GUI.skin.button);
            richButtonStyle.richText          = true;
            iconButtonStyle                   = new GUIStyle(GUI.skin.button);
            iconButtonStyle.normal.background = null;
            iconButtonStyle.imagePosition     = ImagePosition.ImageOnly;
            iconButtonStyle.fixedWidth        = 96;
            iconButtonStyle.fixedHeight       = 96;
        }

        Rect headerRect = new Rect(0, 0, 530, 207);

        GUI.DrawTexture(headerRect, headerPic, ScaleMode.ScaleAndCrop, false);

        GUILayout.Space(214);

        GUILayout.BeginVertical();
        {
            HR(0, 2);

            // Doc
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("<b>Documentation</b>\n<size=9>Complete manual, examples, tips & tricks</size>", richButtonStyle, GUILayout.MaxWidth(260), GUILayout.Height(36)))
                {
                    Application.OpenURL("http://thomashourdel.com/ssaopro/doc/");
                }

                if (GUILayout.Button("<b>Rate it</b>\n<size=9>Leave a review on the Asset Store</size>", richButtonStyle, GUILayout.Height(36)))
                {
                    Application.OpenURL("com.unity3d.kharma:content/22369");
                }
            }
            GUILayout.EndHorizontal();

            // Contact
            HR(4, 2);

            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("<b>E-mail</b>\n<size=9>[email protected]</size>", richButtonStyle, GUILayout.MaxWidth(172), GUILayout.Height(36)))
                {
                    Application.OpenURL("mailto:[email protected]");
                }

                if (GUILayout.Button("<b>Twitter</b>\n<size=9>@Chman</size>", richButtonStyle, GUILayout.Height(36)))
                {
                    Application.OpenURL("http://twitter.com/Chman");
                }

                if (GUILayout.Button("<b>Support Forum</b>\n<size=9>Unity Community</size>", richButtonStyle, GUILayout.MaxWidth(172), GUILayout.Height(36)))
                {
                    Application.OpenURL("http://forum.unity3d.com/threads/ssao-pro-high-quality-screen-space-ambient-occlusion.274003/");
                }
            }
            GUILayout.EndHorizontal();

            // Changelog
            HR(4, 0);

            changelogScroll = GUILayout.BeginScrollView(changelogScroll);
            GUILayout.Label(changelogText, richLabelStyle);
            GUILayout.EndScrollView();

            // Promo
            HR(0, 0);

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();

                if (GUILayout.Button(iconColorful, iconButtonStyle))
                {
                    Application.OpenURL("com.unity3d.kharma:content/44845");
                }

                if (GUILayout.Button(iconChromatica, iconButtonStyle))
                {
                    Application.OpenURL("com.unity3d.kharma:content/20743");
                }

                if (GUILayout.Button(iconSSAOPro, iconButtonStyle))
                {
                    Application.OpenURL("com.unity3d.kharma:content/22369");
                }

                GUILayout.FlexibleSpace();
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
    }
        /// <summary>
        /// Displays the selection screen for Namespaces.
        /// </summary>
        private void DisplayScope()
        {
            showUsings = RexUIUtils.Toggle(showUsings, _texts["scope_header"]);

            if (showUsings)
            {
                EditorGUILayout.BeginVertical(slimBox);
                {
                    var useWidth = 25;
                    EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    EditorGUILayout.LabelField(_texts["scope_use"], GUILayout.Width(useWidth));
                    EditorGUILayout.LabelField(_texts["scope_namespace"], GUILayout.ExpandWidth(false));
                    EditorGUILayout.EndHorizontal();

                    usingScroll = EditorGUILayout.BeginScrollView(usingScroll, GUILayout.Height(1), GUILayout.MaxHeight(150));
                    {
                        var depth = 0;
                        foreach (var n in RexCompileEngine.Instance.NamespaceInfos)
                        {
                            if (n.Depth > depth)
                            {
                                continue;
                            }
                            if (n.Depth < depth)
                            {
                                depth = n.Depth;
                            }

                            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));
                            {
                                for (int i = 0; i < n.Depth; i++)
                                {
                                    GUILayout.Space(25f);
                                }

                                var prev = n.Selected;
                                n.Selected = GUILayout.Toggle(n.Selected, "", GUILayout.Width(useWidth));

                                if (prev != n.Selected)
                                {
                                    if (prev)
                                    {
                                        RexUsingsHandler.Remove(n.Name);
                                    }
                                    else
                                    {
                                        RexUsingsHandler.Save(n.Name);
                                    }
                                }

                                if (n.HasSubNamespaces)
                                {
                                    EditorGUILayout.LabelField(n.Name);
                                }
                                else if (n.DisplaySubNamespaces = EditorGUILayout.Foldout(n.DisplaySubNamespaces, n.Name))
                                {
                                    depth = n.Depth + 1;
                                }
                                //EditorGUILayout.LabelField(n.Assembly.Location);
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    EditorGUILayout.EndScrollView();
                }
                EditorGUILayout.EndVertical();
            }
        }
Ejemplo n.º 8
0
		private void DrawInit()
		{
			if (mHasConfigFile)
			{
				GUILayout.BeginHorizontal();
				GUILayout.Label("当前版本号", GUILayout.Width(100));
				GUILayout.Label(mPackageVersion.Version, GUILayout.Width(100));
				GUILayout.EndHorizontal();
			}

			GUILayout.BeginHorizontal();
			GUILayout.Label("发布版本号", GUILayout.Width(100));
			mVersionText = GUILayout.TextField(mVersionText, GUILayout.Width(100));
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			GUILayout.Label("类型", GUILayout.Width(100));

			mPackageVersion.Type = (PackageType) EditorGUILayout.EnumPopup(mPackageVersion.Type);

			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			GUILayout.Label("权限", GUILayout.Width(100));

			mPackageVersion.AccessRight = (PackageAccessRight) EditorGUILayout.EnumPopup(mPackageVersion.AccessRight);
			GUILayout.EndHorizontal();

			GUILayout.Label("发布说明:", GUILayout.Width(150));
			mReleaseNote = GUILayout.TextArea(mReleaseNote, GUILayout.Width(250), GUILayout.Height(300));

			if (User.Token.Value.IsNullOrEmpty())
			{
				User.Username.Value = EditorGUIUtils.GUILabelAndTextField("username:"******"password:"******"登录"))
				{
					GetTokenAction.DoGetToken(User.Username.Value, User.Password.Value, token =>
					{
						User.Token.Value = token;
						User.Save();
					});
				}

				if (!inRegisterView && GUILayout.Button("注册"))
				{
					inRegisterView = true;
				}

				if (inRegisterView)
				{
					if (GUILayout.Button("注册"))
					{

					}

					if (GUILayout.Button("返回注册"))
					{
						inRegisterView = false;
					}
				}
			}
			else
			{
				if (GUILayout.Button("注销"))
				{
					User.Token.Value = string.Empty;
					User.Save();
				}
			}

			if (User.Token.Value.IsNotNullAndEmpty() && GUILayout.Button("发布"))
			{
				User.Save();

				if (mReleaseNote.Length < 2)
				{
					ShowErrorMsg("请输入版本修改说明");
					return;
				}

				if (!IsVersionValide(mVersionText))
				{
					ShowErrorMsg("请输入正确的版本号");
					return;
				}

				mPackageVersion.Version = mVersionText;
				mPackageVersion.Readme = new ReleaseItem(mVersionText, mReleaseNote, SystemInfo.deviceName,
					DateTime.Now.ToString("yyyy-MM-dd"));


				mPackageVersion.Save();

				AssetDatabase.Refresh();

				GotoPacking();
			}
		}
Ejemplo n.º 9
0
        public GenericPeekListDrawer(
            PeekEditorWindow peekWindow,
            string iconList,
            string listDescription,
            bool calculateExtent,
            string foldStateKey,
            bool canReorder,

            SerializedProperty list,
            SerializedProperty listPath,
            SerializedProperty sceneLinked,

            string iconBookMark,
            string iconHoverBookMark,
            string toolTipBookMark,
            float height,

            UnityAction <int> onBookMarkClic,
            UnityAction <int> onSelectItem,
            UnityAction <int> onInfoItem,
            UnityAction <int> onInfoForceItem,
            UnityAction <int> onPinItem,
            UnityAction <int> onRemoveItem,
            UnityAction onClear)
        {
            _peekWindow = peekWindow;

            _iconList                = iconList;
            _listDescription         = listDescription;
            _calculateExtent         = calculateExtent;
            _foldStateKey            = foldStateKey;
            _dragSettings.CanReorder = canReorder;
            _heightLine              = height;
            _margin                  = ExtGUIStyles.MicroButtonLeftCenter.margin.top + ExtGUIStyles.MicroButtonLeftCenter.margin.bottom;
            _sceneButton             = new GUIStyle(ExtGUIStyles.MicroButtonScene);
            _sceneButton.fixedHeight = _heightLine - MARGIN_SCENE_BUTTON * 2;

            ListToDisplay     = list;
            ListToDisplayPath = listPath;
            SceneLinkedPath   = sceneLinked;
            OnBookMarkClic    = onBookMarkClic;
            OnSelectItem      = onSelectItem;
            OnInfoItem        = onInfoItem;
            OnInfoForceItem   = onInfoForceItem;
            OnPinItem         = onPinItem;
            OnRemoveItem      = onRemoveItem;
            OnClear           = onClear;

            BookMarkButtonOptions = new ButtonImageWithHoverOptions(
                iconBookMark,
                iconHoverBookMark,
                ExtGUIStyles.MicroButtonLeftCenter,
                toolTipBookMark,
                _heightLine,
                GUILayout.ExpandWidth(false), GUILayout.MaxWidth(30), GUILayout.Height(_heightLine));

            CalculateWidthExtentOptions = new CalculateWidthExtentOptions(
                0.2f,
                10,
                AnimationCurve.EaseInOut(0f, 0f, 1f, 1f));
        }
Ejemplo n.º 10
0
    }//!FiltresAndSorting



    Rect GetRect(float leftWidth, float height, EditorWindow window, int divider)
    {
      return EditorGUILayout.GetControlRect( GUILayout.Width( Math.Min( (window.position.width - leftWidth - 10 - 40) / divider, 700 / divider ) ), GUILayout.Height( height ) );
    }
Ejemplo n.º 11
0
    void DrawPresets(ISupportedPostComponent component)
    {
      var zoom = (int)Mathf.Clamp(Params.zoomFactor +1,1,3);
      int cellHeight = (int)((125 + 16) / ((zoom - 1)/2f + 1));
      int CAPTUREHeight = (int)((125 ) / ((zoom - 1)/2f + 1));
      var WIN_HEIGHT = position.height - (40 + 20 + 24 + 20 );


      var sortNotInverse = ((int)Params.sortInverse & (1 << (int)Params.sortMode)) == 0;
      var targetArray = default_gradients;
      switch ((int)Params.sortMode)
      {
        case 0: targetArray = sortNotInverse ? default_gradients : inverse_default_gradients; break;
        case 1: targetArray = sortNotInverse ? bright_gradients : inverse_bright_gradients; break;
        case 2: targetArray = sortNotInverse ? hue_gradients : inverse_hue_gradients; break;
        case 3: targetArray = sortNotInverse ? compareToFirst_gradients : inverse_compareToFirst_gradients; break;
      }//sort type

      var l = component.LutTexture;
      int selectIndex = -1;
      int filteredSelectIndex = -1;
      var __i  = -1;
      var __M  = -1;
      for (__i = 0 ; __i < targetArray.Count ; __i++)
      {
        if (!SeartchValidate( targetArray[__i].name )) continue;
        if (Params.showFav == 1 && !favorites.ContainsKey( targetArray[__i].name )) continue;
        __M++;
        if (selectIndex == -1 && l == targetArray[__i].gradientTexture)
        {
          filteredSelectIndex = __M;
          selectIndex = __i;
        }
      }

      // var XXX = Math.Min(3 * zoom, Math.Max(1, M + 1));
      var XXX = 3 * zoom;
      int displaingCount = Mathf.CeilToInt(WIN_HEIGHT / cellHeight + 1) * XXX;

      var scrollX = Params.presetScrollX;
      var scrollY = Params.presetScrollY;
      if (Params.showFav == 1)
      {
        scrollX = Params.favScrollX;
        scrollY = Params.favScrollY;
      }

      if (mayResetScroll)
      {
        mayResetScroll = false;
        if (filteredSelectIndex != -1)
        {
          var fixedcellHeight = cellHeight;
          //(float)Params.presetScrollY + " " + filteredSelectIndex / XXX * cellHeight + " " + WIN_HEIGHT + " " + (filteredSelectIndex / XXX * cellHeight +
          //Debug.Log( fixedcellHeight > Params.presetScrollY + WIN_HEIGHT );
          if (filteredSelectIndex / XXX * fixedcellHeight < scrollY) scrollY.Set( filteredSelectIndex / XXX * fixedcellHeight );
          else if (filteredSelectIndex / XXX * fixedcellHeight + fixedcellHeight > scrollY + WIN_HEIGHT) scrollY.Set( filteredSelectIndex / XXX * fixedcellHeight + fixedcellHeight - WIN_HEIGHT );
        }
      }//frame scroll


      Params.scroll.x = scrollX;
      Params.scroll.y = scrollY;
      Params.scroll = GUILayout.BeginScrollView( Params.scroll );
      scrollX.Set( Params.scroll.x );
      scrollY.Set( Params.scroll.y );



      GUILayout.BeginVertical();
      var height = Mathf.Ceil( gradients.Length / (float)XXX);
      int wasRender = 0;
      int __FirstRenderInc = -1;
      bool needRepaint = false;

      var newCheck = component.GetHashString();
      if (Params.AutoRefresh == 1 && !string.Equals( newCheck, oldCheck, StringComparison.Ordinal ))
      {
        oldCheck = newCheck;
        ClearImages( false );
        currentWindow.Repaint();

      }//refrest if changed



      __i = -1;
      Rect line = new Rect();
      bool renderTexture = false;
      bool newLine = false;

      if (__M == -1)
      {
        if (Params.showFav == 1) GUILayout.Label( "No Favorite Elements", Params.Label );
        else GUILayout.Label( "No elements '" + (string)Params.filtres + "' found", Params.Label );
      }
      else
      {
        line = EditorGUILayout.GetControlRect( GUILayout.Height( (__M / XXX + 1) * cellHeight ) );
        line.height = cellHeight;
        line.y -= line.height;
        int __renderInc = -1;

        for (int y = 0 ; y < height ; y++)
        {
          newLine = true;


          for (int x = 0 ; x < XXX ; x++)
          {
            __i++;
            //var i = x + y * XXX;
            if (__i >= targetArray.Count) break;

            if (!SeartchValidate( targetArray[__i].name ))
            {
              x--;
              continue;
            }
            if (Params.showFav == 1 && !favorites.ContainsKey( targetArray[__i].name ))
            {
              x--;
              continue;
            }

            if (newLine)
            {
              newLine = false;
              //line = EditorGUILayout.GetControlRect( GUILayout.Height( cellHeight ) );
              line.y += line.height;
              renderTexture = line.y + line.height >= Params.scroll.y && line.y - line.height <= Params.scroll.y + WIN_HEIGHT;
            }



            var rect = line;
            rect.width = line.width / XXX;
            rect.x = rect.width * x;

            if (!renderTexture) continue;
            __renderInc++;

            if (__FirstRenderInc == -1) __FirstRenderInc = __renderInc;

            if (renderedScreen.Length != targetArray.Count)
            {
              System.Array.Resize( ref renderedScreen, targetArray.Count );
              ClearImages( false );
              currentWindow.Repaint();
            }

            if (renderedIndex < __FirstRenderInc) renderedIndex = __FirstRenderInc;

            /* if (Params.showFav == 1)
               Debug.Log( (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME) + " " + (renderedIndex % displaingCount) + " " + __renderInc + " " + __FirstRenderInc );*/

            if (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME && renderedIndex % displaingCount == (__renderInc - __FirstRenderInc))
            {
              if ((int)rect.width - 10 > 0 && !renderedDoubleCheck[__i])
              {
                renderedIndex++;

                component.CameraPredrawAction(); // PRE

                //memory
                var oldLutEnable = component.LutEnable;
                var oldLutTexture = component.LutTexture;
                var oldAmount = component.LutAmount;
                //change
                component.LutEnable = true;
                component.LutTexture = (targetArray[__i]).gradientTexture;
                component.LutAmount = (1);

                var oldAnti = component.AntiAliasEnable;
                component.AntiAliasEnable = false;
                //draw
                if (renderedScreen[__i]) DestroyImmediate( renderedScreen[__i], true );
                renderedDoubleCheck[__i] = renderedScreen[__i] = TakeScreen( Camera.main, (int)rect.width - 10, CAPTUREHeight );
                component.AntiAliasEnable = oldAnti;

                //restore
                component.LutEnable = oldLutEnable;
                component.LutTexture = (oldLutTexture);
                component.LutAmount = (oldAmount);

                component.CameraPostDrawAction(); // POST

                wasRender++;
              }
            }

            var screen =  renderedScreen[__i];

            if (!renderedDoubleCheck[__i]) needRepaint = true;

            if (DrawCell( rect, screen, targetArray[__i].name, selectIndex == __i, component ))
            {
              WasElementsChanged = true;
              component.CREATE_UNDO( "set " + targetArray[__i].name );
              component.LutTexture = (targetArray[__i].gradientTexture);
              if (!component.LutEnable) component.LutAmount = (1);
              component.LutEnable = true;
              component.SET_DIRTY();
              UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
            }
          }
        }
      }


      GUILayout.EndVertical();


      if (wasRender < (Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME)
      {
        // renderedIndex = firstI;
        renderedIndex += (int)(Params.zoomFactor + 1) * IMAGE_RENDER_PER_FRAME - wasRender;
        //needRepaint = true;
      }
      if (needRepaint)
      {
        Repaint();
      }
      GUILayout.EndScrollView();
    }//!DrawPresets
Ejemplo n.º 12
0
    void OnGUI()
    {
      if (!SceneManager.GetActiveScene().IsValid()) return;

      if (!currentWindow)
      {
        currentWindow = Resources.FindObjectsOfTypeAll( Params.WindowType ).FirstOrDefault() as EditorWindow;
        if (currentWindow) ResetWindow();
      }
      if (!currentWindow) return;

      if (SceneManager.GetActiveScene().GetHashCode() != EditorPrefs.GetInt( "EModules/" + Params.TITLE + "/Scene", -1 )) ResetWindow();

      if (Params.Label == null)
      {
        Params.Label = new GUIStyle( GUI.skin.label );
        Params.Label.fontSize = 14;
        Params.Label.fontStyle = FontStyle.Bold;

        Params.Button = new GUIStyle( GUI.skin.button );
        // Button.fontSize = 14;
        var t = new Texture2D(1,1,TextureFormat.ARGB32,false,true);
        t.hideFlags = HideFlags.DontSave;
        t.SetPixel( 0, 0, new Color( 0, 0.1f, 0.4f, 0.3f ) );
        t.Apply();
        Params.Button.normal.background = null;
        Params.Button.hover.background = null;
        Params.Button.focused.background = null;
        Params.Button.active.background = t;
      }


      if (!Camera.main)
      {
        GUILayout.Label( "No Camera", Params.Label );
        return;
      }

      ISupportedPostComponent currentComponent = null;
      MonoBehaviour c1 = null;
      MonoBehaviour c2 = null;
      if (Params.PostProcessingBehaviourType != null)
        c1 = Camera.main.GetComponent( Params.PostProcessingBehaviourType ) as MonoBehaviour;
      if (Params.AmplifyBaseType != null)
        c2 = Camera.main.GetComponent( Params.AmplifyBaseType ) as MonoBehaviour;

      if (c1 && c1.enabled) currentComponent = postPresets_UnityPostGUI;
      else if (c2 && c2.enabled) currentComponent = postPresets_AmplifyPostGUI;
      else if (c1) currentComponent = postPresets_UnityPostGUI;
      else if (c2) currentComponent = postPresets_AmplifyPostGUI;
      else if (Params.PostProcessingBehaviourType != null) currentComponent = postPresets_UnityPostGUI;
      else if (Params.AmplifyBaseType != null) currentComponent = postPresets_AmplifyPostGUI;


      if (currentComponent == null)
      {
        GUILayout.Label( "Unity PostProcessing or AmplifyColor not imported", Params.Label );
        if (GUILayout.Button( "Download Unity 'Post Processing Stack'", GUILayout.Height( 40 ) ))
        {
          Application.OpenURL( "https://www.assetstore.unity3d.com/#!/content/83912" );
        }
        if (GUILayout.Button( "Download 'Amplify Color'", GUILayout.Height( 40 ) ))
        {
          Application.OpenURL( " https://www.assetstore.unity3d.com/en/#!/content/1894" );
        }
        return;
      }


      // Left column ////
      GUILayout.BeginHorizontal();
      var leftwidth =  Mathf.Clamp( position.width / 3f, 200, 350 );

      GUILayout.BeginVertical( GUILayout.Width( leftwidth ) );
      GUILayout.Label( "Camera: " + Camera.main.name, Params.Label );
      if (GUI.Button( GUILayoutUtility.GetLastRect(), "", Params.Button )) Selection.objects = new[] { Camera.main.gameObject };
      EditorGUIUtility.AddCursorRect( GUILayoutUtility.GetLastRect(), MouseCursor.Link );


      if (currentComponent.MonoComponent == null)
      {
        if (GUILayout.Button( "Add " + currentComponent.MonoComponentType + " Script", GUILayout.Height( 200 ) ))
        {
          Undo.RecordObject( Camera.main.gameObject, "Add " + currentComponent.MonoComponentType + " Script" );
          Camera.main.gameObject.AddComponent( currentComponent.MonoComponentType );
          EditorUtility.SetDirty( Camera.main.gameObject );
        }
        return;
      }

      if (!currentComponent.MonoComponent.enabled)
      {
        GUILayout.Label( currentComponent.MonoComponent.GetType().Name + " Component Disabled", Params.Label );
        if (GUILayout.Button( "Enable " + currentComponent.MonoComponent.GetType().Name + " Component", GUILayout.Height( 200 ) ))
        {
          Undo.RecordObject( currentComponent.MonoComponent, "Enable " + currentComponent.MonoComponent.GetType().Name + " Component" );
          currentComponent.MonoComponent.enabled = true;
          EditorUtility.SetDirty( currentComponent.MonoComponent );
          UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
        }
        return;
      }

      if (widthCheck == null) widthCheck = position.width;
      if (widthCheck.Value != position.width)
      {
        widthCheck = position.width;
        ClearImages( false );
        currentWindow.Repaint();
      }

      //! *** POSTPROCESSING COMPONENT GUI *** //
      currentComponent.LeftSideGUI( this, leftwidth );
      //! *** POSTPROCESSING COMPONENT GUI *** //

      if (GUILayout.Button( "http://emodules.me/", Params.Button )) Application.OpenURL( "http://emodules.me/" );
      EditorGUIUtility.AddCursorRect( GUILayoutUtility.GetLastRect(), MouseCursor.Link );

      GUILayout.EndVertical();
      // Left column

      GUILayout.Space( 10 );

      leftwidth += 20;

      //! PRESETS GRID GUI
      if (currentComponent.IsValid)
      {
        GUILayout.BeginVertical();
        ////////////////////////
        currentComponent.TopFastButtonsGUI( this, leftwidth );
        ////////////////////////
        FiltresAndSorting( this, leftwidth );
        ////////////////////////
        DrawPresets( currentComponent );
        ////////////////////////
        GUILayout.EndVertical();
      }
      //! PRESETS GRID GUI

      GUILayout.EndHorizontal();



    }//!OnGUI
Ejemplo n.º 13
0
        /// <summary>
        /// Instance Editor window
        /// </summary>
        /// <param name="windowID"></param>
        void GroupEditorWindow(int windowID)
        {
            UpdateVectors();

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", UIMain.DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Group Editor", UIMain.DeadButton, GUILayout.Height(21));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", UIMain.DeadButtonRed, GUILayout.Height(21)))
                {
                    //KerbalKonstructs.instance.saveObjects();
                    //KerbalKonstructs.instance.deselectObject(true, true);
                    this.Close();
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, UIMain.BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button(selectedGroup.Group, GUILayout.Height(23)))
            {
                showNameField = true;
                newGroupName  = selectedGroup.Group;
            }
            GUILayout.EndHorizontal();

            if (showNameField)
            {
                GUILayout.Label("Enter new Name: ");

                newGroupName = GUILayout.TextField(newGroupName, 15, GUILayout.Width(150));

                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("OK", GUILayout.Height(23)))
                    {
                        selectedGroup.RenameGroup(newGroupName);
                        showNameField = false;
                    }
                    if (GUILayout.Button("Cancel", GUILayout.Height(23)))
                    {
                        showNameField = false;
                    }
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();
                if (!foldedIn)
                {
                    GUILayout.Label("Increment");
                    increment = float.Parse(GUILayout.TextField(increment.ToString(), 5, GUILayout.Width(48)));

                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("0.001", GUILayout.Height(18)))
                    {
                        increment = 0.001f;
                    }
                    if (GUILayout.Button("0.01", GUILayout.Height(18)))
                    {
                        increment = 0.01f;
                    }
                    if (GUILayout.Button("0.1", GUILayout.Height(18)))
                    {
                        increment = 0.1f;
                    }
                    if (GUILayout.Button("1", GUILayout.Height(18)))
                    {
                        increment = 1f;
                    }
                    if (GUILayout.Button("10", GUILayout.Height(18)))
                    {
                        increment = 10f;
                    }
                    if (GUILayout.Button("25", GUILayout.Height(16)))
                    {
                        increment = 25f;
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                }
                else
                {
                    GUILayout.Label("i");
                    increment = float.Parse(GUILayout.TextField(increment.ToString(), 3, GUILayout.Width(25)));

                    if (GUILayout.Button("0.1", GUILayout.Height(23)))
                    {
                        increment = 0.1f;
                    }
                    if (GUILayout.Button("1", GUILayout.Height(23)))
                    {
                        increment = 1f;
                    }
                    if (GUILayout.Button("10", GUILayout.Height(23)))
                    {
                        increment = 10f;
                    }
                }
            }
            GUILayout.EndHorizontal();

            //
            // Set reference butons
            //
            GUILayout.BeginHorizontal();
            GUILayout.Label("Reference System: ");
            GUILayout.FlexibleSpace();
            GUI.enabled = (referenceSystem == Space.World);

            if (GUILayout.Button(new GUIContent(UIMain.iconCubes, "Model"), GUILayout.Height(23), GUILayout.Width(23)))
            {
                referenceSystem = Space.Self;
                UpdateVectors();
            }

            GUI.enabled = (referenceSystem == Space.Self);
            if (GUILayout.Button(new GUIContent(UIMain.iconWorld, "World"), GUILayout.Height(23), GUILayout.Width(23)))
            {
                referenceSystem = Space.World;
                UpdateVectors();
            }
            GUI.enabled = true;

            GUILayout.Label(referenceSystem.ToString());

            GUILayout.EndHorizontal();
            float fTempWidth = 80f;

            //
            // Position editing
            //
            GUILayout.BeginHorizontal();

            if (referenceSystem == Space.Self)
            {
                GUILayout.Label("Back / Forward:");
                GUILayout.FlexibleSpace();

                if (foldedIn)
                {
                    fTempWidth = 40f;
                }

                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    SetTransform(Vector3.back * increment);
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    SetTransform(Vector3.forward * increment);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Left / Right:");
                GUILayout.FlexibleSpace();
                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    SetTransform(Vector3.left * increment);
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    SetTransform(Vector3.right * increment);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
            }
            else
            {
                GUILayout.Label("West / East :");
                GUILayout.FlexibleSpace();

                if (foldedIn)
                {
                    fTempWidth = 40f;
                }

                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    Setlatlng(0d, -increment);
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    Setlatlng(0d, increment);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("South / North:");
                GUILayout.FlexibleSpace();
                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    Setlatlng(-increment, 0d);
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    Setlatlng(increment, 0d);
                }
            }

            GUILayout.EndHorizontal();

            GUI.enabled = true;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Lat: ");
                GUILayout.FlexibleSpace();
                refLat = GUILayout.TextField(refLat, 10, GUILayout.Width(fTempWidth));

                GUILayout.Label("  Lng: ");
                GUILayout.FlexibleSpace();
                refLng = GUILayout.TextField(refLng, 10, GUILayout.Width(fTempWidth));
            }
            GUILayout.EndHorizontal();

            //
            // Altitude editing
            //
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Alt.");
                GUILayout.FlexibleSpace();
                selectedGroup.RadiusOffset = float.Parse(GUILayout.TextField(selectedGroup.RadiusOffset.ToString(), 25, GUILayout.Width(fTempWidth)));
                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    selectedGroup.RadiusOffset -= increment;
                    ApplySettings();
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(21)) || GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(21)))
                {
                    selectedGroup.RadiusOffset += increment;
                    ApplySettings();
                }
            }
            GUILayout.EndHorizontal();


            GUI.enabled = true;

            GUILayout.Space(5);



            //
            // Rotation
            //
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Rotation:");
                GUILayout.FlexibleSpace();
                headingStr = GUILayout.TextField(headingStr, 9, GUILayout.Width(fTempWidth));

                if (GUILayout.RepeatButton("<<", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    SetRotation(-increment);
                }
                if (GUILayout.Button("<", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    SetRotation(-increment);
                }
                if (GUILayout.Button(">", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    SetRotation(increment);
                }
                if (GUILayout.RepeatButton(">>", GUILayout.Width(30), GUILayout.Height(23)))
                {
                    SetRotation(increment);
                }
            }
            GUILayout.EndHorizontal();


            GUILayout.Space(1);

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("SeaLevel as Reference:");
                GUILayout.FlexibleSpace();
                selectedGroup.SeaLevelAsReference = GUILayout.Toggle(selectedGroup.SeaLevelAsReference, "", GUILayout.Width(140), GUILayout.Height(23));
            }
            GUILayout.EndHorizontal();

            GUILayout.Box(tHorizontalSep, UIMain.BoxNoBorder, GUILayout.Height(4));



            GUILayout.Space(2);
            GUILayout.Space(5);



            GUI.enabled = true;



            GUI.enabled = true;
            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = true;
                if (GUILayout.Button("Save&Close", GUILayout.Width(110), GUILayout.Height(23)))
                {
                    selectedGroup.Save();
                    this.Close();
                }
                GUI.enabled = true;
                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Destroy Group", GUILayout.Height(21)))
                {
                    DeleteGroupCenter();
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(15);

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, UIMain.BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            if (GUI.tooltip != "")
            {
                var labelSize = GUI.skin.GetStyle("Label").CalcSize(new GUIContent(GUI.tooltip));
                GUI.Box(new Rect(Event.current.mousePosition.x - (25 + (labelSize.x / 2)), Event.current.mousePosition.y - 40, labelSize.x + 10, labelSize.y + 5), GUI.tooltip);
            }

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
Ejemplo n.º 14
0
	void DrawScenesInBuild(BuildReportTool.BuildInfo.SceneInBuild[] scenesInBuild)
	{
		if (scenesInBuild == null || scenesInBuild.Length == 0)
		{
			//Debug.LogError("no top ten largest");
			return;
		}

		bool useAlt = true;

		GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
		GUILayout.Label("Scenes in Build:", BuildReportTool.Window.Settings.INFO_TITLE_STYLE_NAME);

		var prevColor = GUI.contentColor;
		
		//GUILayout.BeginHorizontal();
			// 1st column: name
			GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
			var usedIdx = -1;
			for (int n = 0; n < scenesInBuild.Length; ++n)
			{
				if (scenesInBuild[n].Enabled)
				{
					++usedIdx;
				}
				
				string styleToUse = useAlt ? BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME : BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME;
				string iconStyleToUse = useAlt ? BuildReportTool.Window.Settings.LIST_ICON_ALT_STYLE_NAME : BuildReportTool.Window.Settings.LIST_ICON_STYLE_NAME;

				
				Texture icon = AssetDatabase.GetCachedIcon(scenesInBuild[n].Path);

				GUILayout.BeginHorizontal(styleToUse, GUILayout.ExpandWidth(true));

				// enabled status
				//GUILayout.Toggle(scenesInBuild[n].Enabled, string.Empty, GUILayout.Width(20), GUILayout.Height(30));
				
				// icon
				if (icon == null)
				{
					//GUILayout.Space(22);
					GUILayout.Label(string.Empty, iconStyleToUse, GUILayout.Width(28), GUILayout.Height(30));
				}
				else
				{
					if (!scenesInBuild[n].Enabled)
					{
						GUI.contentColor = new Color(1.0f,1.0f,1.0f, 0.4f);
					}
					GUILayout.Button(icon, iconStyleToUse, GUILayout.Width(28), GUILayout.Height(30));
					if (!scenesInBuild[n].Enabled)
					{
						GUI.contentColor = prevColor;
					}
				}


				// scene index
				if (scenesInBuild[n].Enabled)
				{
					if (GUILayout.Button(usedIdx.ToString(), styleToUse, GUILayout.Width(20), GUILayout.Height(30)))
					{
						Utility.PingAssetInProject(scenesInBuild[n].Path);
					}
				}
				else
				{
					GUILayout.Label(string.Empty, iconStyleToUse, GUILayout.Width(20), GUILayout.Height(30));
				}

				// path
				string prettyName;
				if (scenesInBuild[n].Enabled)
				{
					prettyName = string.Format("<color=#{0}>{1}/</color><b>{2}</b>",
						BuildReportTool.Window.Screen.AssetList.GetPathColor(false),
						System.IO.Path.GetDirectoryName(scenesInBuild[n].Path),
						System.IO.Path.GetFileName(scenesInBuild[n].Path));
				}
				else
				{
					prettyName = string.Format("<color=#{0}>{1}/<b>{2}</b></color>",
						BuildReportTool.Window.Screen.AssetList.GetPathColor(false),
						System.IO.Path.GetDirectoryName(scenesInBuild[n].Path),
						System.IO.Path.GetFileName(scenesInBuild[n].Path));
				}

				if (GUILayout.Button(prettyName, styleToUse, GUILayout.MinWidth(100), GUILayout.Height(30), GUILayout.ExpandWidth(true)))
				{
					Utility.PingAssetInProject(scenesInBuild[n].Path);
				}
				GUILayout.EndHorizontal();

				useAlt = !useAlt;
			}
			GUILayout.EndVertical();

			
			GUILayout.FlexibleSpace();
		//GUILayout.EndHorizontal();
		GUILayout.Space(5); // bottom padding
		GUILayout.EndVertical();
	}
Ejemplo n.º 15
0
    void OnGUI()
    {
        GUI.enabled = BrowserUtility.guiEnabled;

        if (!initGUIStyle)
        {
            InitializeStyle();

            LoadSettings();
        }

        scrollPosition1 = GUILayout.BeginScrollView(scrollPosition1, false, false, GUI.skin.horizontalScrollbar, blankScrollbar, GUILayout.Height(110));

        #region Main button row
        GUILayout.BeginHorizontal();

        DisplayButtons();

        GUILayout.EndHorizontal();
        #endregion

        GUILayout.Space(12);
        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(3));

        #region Repository location, initialization
        GUILayout.BeginHorizontal();
        if (!string.IsNullOrEmpty(BrowserUtility.repositoryLocation))
        {
            GUILayout.Label(versionControlTypeLogo);

            GUILayout.Space(10);

            GUILayout.Label(BrowserUtility.repositoryShortName);



            GUILayout.FlexibleSpace();

            /* TODO: Put this in the settings window
             *
             * if (viewMode != BrowserViewMode.ArtistMode)
             * {
             *      if (GUILayout.Button("Reinitialize"))
             *              BrowserUtility.OnButton_Init(this);
             * }
             */

            var vm = (BrowserViewMode)EditorGUILayout.EnumPopup(viewMode);

            if (vm != viewMode)
            {
                viewMode = vm;
                EditorPrefs.SetInt("UnityVersionControl.BrowserViewMode", (int)viewMode);
            }
        }
        else
        {
            GUI.color = Color.red;
            GUILayout.Label("No project repository found!");
            GUI.color = Color.white;

            GUILayout.FlexibleSpace();

            // Todo, make initialization UI prettier
            if (GUILayout.Button("Initialize"))
            {
                BrowserUtility.OnButton_Init(this);
            }

            var vm = (BrowserViewMode)EditorGUILayout.EnumPopup(viewMode);

            if (vm != viewMode)
            {
                viewMode = vm;
                EditorPrefs.SetInt("UnityVersionControl.BrowserViewMode", (int)viewMode);
            }
        }

        GUILayout.EndHorizontal();
        #endregion


        GUILayout.EndScrollView();


        mainScrollPosition = GUILayout.BeginScrollView(mainScrollPosition);

        GUILayout.BeginHorizontal();
        if (viewMode != BrowserViewMode.ArtistMode && showDiff)
        {
            GUILayout.BeginVertical(GUILayout.Width(horizontalResizeWidget1 - 3));
        }
        else
        {
            GUILayout.BeginVertical();
        }

        #region First scroll area - Staged files (git)
        if (VersionControl.versionControlType == VersionControlType.Git && viewMode != BrowserViewMode.ArtistMode && showStagedFiles)
        {
            GUILayout.BeginVertical(GUILayout.Height(verticalResizeWidget1 - 3));

            GUILayout.BeginHorizontal();
            GUILayout.Label("Staged files", EditorStyles.toolbarButton);
            stagedFilesFilter = (FileState)EditorGUILayout.EnumMaskField(stagedFilesFilter, EditorStyles.toolbarPopup, GUILayout.Width(100));

            GUILayout.EndHorizontal();

            scrollPosition2 = GUILayout.BeginScrollView(scrollPosition2, false, false);
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUI.backgroundColor *= .5f;
            GUILayout.Label("State", EditorStyles.toolbarButton, GUILayout.Width(80));
            GUILayout.Label("File", EditorStyles.toolbarButton, GUILayout.Width(300));
            GUILayout.Label("Path", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
            GUI.backgroundColor = Color.white;
            GUILayout.EndHorizontal();

            filteredStagedFiles.Clear();
            filteredStagedFiles.AddRange(BrowserUtility.stagedFiles.Values);

            FilterFileList(filteredStagedFiles, true);

            for (int i = 0; i < filteredStagedFiles.Count; i++)
            {
                DisplayFile(filteredStagedFiles[i], i, true, filteredStagedFiles);
            }

            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }
        #endregion

        #region Resize widget
        if (VersionControl.versionControlType == VersionControlType.Git && viewMode != BrowserViewMode.ArtistMode && showStagedFiles)
        {
            Rect r    = new Rect(position.x, position.y - 220, position.width, position.height);
            bool drag = GUIHelpers.ResizeWidget(drag1, ref verticalResizeWidget1, 60, position.height - 180, 6, true, r, this);

            if (drag != drag1)
            {
                drag1 = drag;
                EditorPrefs.SetFloat("UnityVersionControl.VWidget1", verticalResizeWidget1);
            }
        }
        #endregion

        #region Second scroll area - Working tree
        if (VersionControl.versionControlType == VersionControlType.Git && viewMode != BrowserViewMode.ArtistMode && showStagedFiles)
        {
            GUILayout.BeginVertical(GUILayout.Height(position.height - 126 - verticalResizeWidget1 - 3));
        }

        GUILayout.BeginHorizontal();
        GUILayout.Label("Working tree", EditorStyles.toolbarButton);
        workingTreeFilter = (FileState)EditorGUILayout.EnumMaskField(workingTreeFilter, EditorStyles.toolbarPopup, GUILayout.Width(100));
        GUILayout.EndHorizontal();

        scrollPosition3 = GUILayout.BeginScrollView(scrollPosition3, false, false);
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        GUI.backgroundColor *= .5f;
        GUILayout.Label("State", EditorStyles.toolbarButton, GUILayout.Width(80));
        if (viewMode != BrowserViewMode.ArtistMode)
        {
            GUILayout.Label("File", EditorStyles.toolbarButton, GUILayout.Width(300));
        }
        GUILayout.Label("Path", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
        GUI.backgroundColor = Color.white;
        GUILayout.EndHorizontal();

        filteredWorkingTree.Clear();
        filteredWorkingTree.AddRange(BrowserUtility.workingTree.Values);

        FilterFileList(filteredWorkingTree, false);

        for (int i = 0; i < filteredWorkingTree.Count; i++)
        {
            DisplayFile(filteredWorkingTree[i], i, false, filteredWorkingTree);
        }

        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        if (VersionControl.versionControlType == VersionControlType.Git && viewMode != BrowserViewMode.ArtistMode && showStagedFiles)
        {
            GUILayout.EndVertical();
        }
        #endregion

        GUILayout.EndVertical();

        #region Resize widget
        if (viewMode != BrowserViewMode.ArtistMode && showDiff)
        {
            bool drag = GUIHelpers.ResizeWidget(drag2, ref horizontalResizeWidget1, 80, position.width - 80, 4, false, position, this);

            if (drag != drag2)
            {
                drag2 = drag;
                EditorPrefs.SetFloat("UnityVersionControl.HWidget1", horizontalResizeWidget1);
            }
        }
        #endregion

        #region 3rd scroll area - Diff
        if (viewMode != BrowserViewMode.ArtistMode && showDiff)
        {
            GUILayout.BeginVertical(GUILayout.Width(position.width - horizontalResizeWidget1));

            GUILayout.BeginHorizontal();
            GUILayout.Label("Diff", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            scrollPosition4 = GUILayout.BeginScrollView(scrollPosition4, false, false);
            EditorGUILayout.SelectableLabel(BrowserUtility.diffString, GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            GUILayout.EndVertical();
        }
        #endregion

        GUILayout.EndHorizontal();

        GUILayout.EndScrollView();

        #region Status bar
        DisplayStatusBar();
        #endregion

        GUI.enabled = BrowserUtility.guiEnabled;

        if (BrowserUtility.guiEnabled)
        {
            BrowserUtility.ProcessKeyboardEvents(ref lastSelectedIndex, filteredStagedFiles, filteredWorkingTree);
        }
    }
Ejemplo n.º 16
0
        private void DisplayOneItem(Object toDisplay, string nameInListPath, int index, float width, bool disable)
        {
            if (toDisplay == null && string.IsNullOrEmpty(nameInListPath))
            {
                return;
            }

            if (toDisplay == null && !UnityEssentialsPreferences.GetBool(UnityEssentialsPreferences.SHOW_GAMEOBJECTS_FROM_OTHER_SCENE, true))
            {
                return;
            }

            GUI.color = (PeekSerializeObject.LastSelectedObject == toDisplay && toDisplay != null) ? Color.green : Color.white;

            EditorGUI.BeginDisabledGroup(disable);
            {
                using (HorizontalScope horizontalScope = new HorizontalScope(GUILayout.Width(width), GUILayout.Height(_heightLine)))
                {
                    float widthExtent = CalculateWidthExtentOptions.CalculateWidthExtent(width, index, ListToDisplay.arraySize);
                    float widthButtonWithoutExtent = CalculateWidthExtentOptions.CalculateButtonWidthWithoutExtent(widthExtent, _heightLine, _margin);

                    if (_calculateExtent)
                    {
                        GUILayout.Label("", GUILayout.Width(widthExtent), GUILayout.Height(_heightLine));
                    }
                    //display bookmark button
                    bool clicOnBookMark = BookMarkButtonOptions.ButtonImageWithHover(WIDTH_BUTTON_HOVER, toDisplay != null, _heightLine);
                    if (clicOnBookMark)
                    {
                        OnBookMarkClic?.Invoke(index);
                        return;
                    }
                    //display main logo
                    DisplayLogoByTypeOfObject(toDisplay, _heightLine);
                    if (!disable && !_dragSettings.IsDragging)
                    {
                        Rect logoContent = GUILayoutUtility.GetLastRect();
                        if (logoContent.Contains(Event.current.mousePosition))
                        {
                            EditorGUIUtility.AddCursorRect(logoContent, MouseCursor.MoveArrow);
                            if (Event.current.type == EventType.MouseDown)
                            {
                                _listToDisplayCopy = ListToDisplay.ToObjectList();
                                _dragSettings.StartDragging(index, logoContent);
                                Event.current.Use();
                            }
                        }
                    }
                    //display main button
                    EditorGUI.BeginDisabledGroup(toDisplay == null);
                    {
                        string nameObjectToSelect;
                        if (toDisplay == null)
                        {
                            nameObjectToSelect = !string.IsNullOrEmpty(nameInListPath) ? ObjectNames.NicifyVariableName(nameInListPath) : " --- not found --- ";
                        }
                        else
                        {
                            nameObjectToSelect = ObjectNames.NicifyVariableName(toDisplay.name);
                        }


                        GUIContent buttonSelectContent = ShortenNameIfNeeded(nameObjectToSelect, width, widthButtonWithoutExtent);
                        buttonSelectContent.tooltip = "Clic to select, Right clic to Pin only";
                        if (GUILayout.Button(buttonSelectContent, BookMarkButtonOptions.GuiStyle, GUILayout.ExpandWidth(true), GUILayout.Height(_heightLine)))
                        {
                            if (Event.current.button == 0)
                            {
                                OnSelectItem?.Invoke(index);
                            }
                            else
                            {
                                OnPinItem?.Invoke(index);
                            }
                            return;
                        }
                    }
                    EditorGUI.EndDisabledGroup();

                    //display special scene buttons
                    if (toDisplay == null && OnInfoItem != null)
                    {
                        bool selectScene = false;
                        bool goToScene   = false;

                        DisplaySpecialSceneSettings(ref selectScene, ref goToScene);
                        if (goToScene)
                        {
                            OnInfoForceItem?.Invoke(index);
                            return;
                        }
                        else if (selectScene)
                        {
                            OnInfoItem?.Invoke(index);
                            return;
                        }
                    }

                    //display delete button
                    GUIContent buttonDeletContent = EditorGUIUtility.IconContent(DELETE_ICON);
                    buttonDeletContent.tooltip = "Remove from list";
                    if (GUILayout.Button(buttonDeletContent, BookMarkButtonOptions.GuiStyle, GUILayout.ExpandWidth(false), GUILayout.MaxWidth(WIDTH_BUTTON_HOVER), GUILayout.Height(_heightLine)) &&
                        Event.current.button == 0)
                    {
                        OnRemoveItem?.Invoke(index);
                        return;
                    }
                    if (_calculateExtent)
                    {
                        GUILayout.Label("", GUILayout.Width(widthExtent), GUILayout.Height(_heightLine));
                    }
                }
            }
            EditorGUI.EndDisabledGroup();
        }
Ejemplo n.º 17
0
    void DisplayButtons()
    {
        if (viewMode == BrowserViewMode.ArtistMode)
        {
            GUILayout.FlexibleSpace();
        }

        if (GUILayout.Button("Commit", versionControlSkin.GetStyle("Buttons_Main_Commit"), GUILayout.Width(64), GUILayout.Height(64)))
        {
            BrowserUtility.OnButton_Commit(this);
        }

        if (viewMode != BrowserViewMode.ArtistMode)
        {
            GUI.enabled = false;
            GUI.color  *= .75f;

            if (GUILayout.Button("Checkout", versionControlSkin.GetStyle("Buttons_Main_Checkout"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Checkout(this);
            }

            GUI.color   = Color.white;
            GUI.enabled = BrowserUtility.guiEnabled;
        }

        if (GUILayout.Button("Reset", versionControlSkin.GetStyle("Buttons_Main_Reset"), GUILayout.Width(64), GUILayout.Height(64)))
        {
            BrowserUtility.OnButton_Reset(this);
        }

        if (viewMode != BrowserViewMode.ArtistMode)
        {
            GUI.enabled = false;
            GUI.color  *= .75f;

            if (GUILayout.Button("Stash", versionControlSkin.GetStyle("Buttons_Main_Stash"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                Debug.Log("not implemented");
            }

            GUI.color   = Color.white;
            GUI.enabled = BrowserUtility.guiEnabled;

            GUI.enabled = BrowserUtility.guiEnabled && BrowserUtility.workingTreeSelected;

            if (GUILayout.Button("Add", versionControlSkin.GetStyle("Buttons_Main_Add"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Add(this);
            }

            GUI.enabled = BrowserUtility.guiEnabled && BrowserUtility.anyFileSelected;

            if (GUILayout.Button("Remove", versionControlSkin.GetStyle("Buttons_Main_Remove"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Remove(this);
            }

            GUI.enabled = BrowserUtility.guiEnabled;

            if (GUILayout.Button("Fetch", versionControlSkin.GetStyle("Buttons_Main_Fetch"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Fetch(this);
            }
        }

        if (GUILayout.Button("Pull", versionControlSkin.GetStyle("Buttons_Main_Pull"), GUILayout.Width(64), GUILayout.Height(64)))
        {
            BrowserUtility.OnButton_Pull(this);
        }

        if (GUILayout.Button("Push", versionControlSkin.GetStyle("Buttons_Main_Push"), GUILayout.Width(64), GUILayout.Height(64)))
        {
            BrowserUtility.OnButton_Push(this);
        }

        if (viewMode != BrowserViewMode.ArtistMode)
        {
            if (GUILayout.Button("Branch", versionControlSkin.GetStyle("Buttons_Main_Branch"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Branch(this);
            }

            GUI.enabled = false;
            GUI.color  *= .75f;

            if (GUILayout.Button("Merge", versionControlSkin.GetStyle("Buttons_Main_Merge"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Merge(this);
            }

            if (GUILayout.Button("Tag", versionControlSkin.GetStyle("Buttons_Main_Tag"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Tag(this);
            }

            GUI.color   = Color.white;
            GUI.enabled = BrowserUtility.guiEnabled;
        }

        GUILayout.FlexibleSpace();

        if (viewMode != BrowserViewMode.ArtistMode)
        {
            if (GUILayout.Button("Settings", versionControlSkin.GetStyle("Buttons_Main_Settings"), GUILayout.Width(64), GUILayout.Height(64)))
            {
                BrowserUtility.OnButton_Settings(this);
            }
        }
    }
Ejemplo n.º 18
0
 private void DisplayEmptyCellItem(float width)
 {
     using (ExtGUILayout.HorizontalScope(new Color(0, 0, 0, 0.2f), GUILayout.Width(width), GUILayout.Height(_heightLine + _margin * 2)))
     {
         GUILayout.Label("", GUILayout.Height(_heightLine + (_margin - EditorGUIUtility.singleLineHeight)));
     }
 }
Ejemplo n.º 19
0
 private static void DisplayLine()
 {
     GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) });
     //EditorGUILayout.Separator();
 }
        public static void CraftConstructionInterface(StaticObject selectedFacility)
        {
            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background  = null;
            DeadButton.hover.background   = null;
            DeadButton.active.background  = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor   = Color.white;
            DeadButton.hover.textColor    = Color.white;
            DeadButton.active.textColor   = Color.white;
            DeadButton.focused.textColor  = Color.white;
            DeadButton.fontSize           = 14;
            DeadButton.fontStyle          = FontStyle.Bold;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background  = null;
            DeadButtonRed.hover.background   = null;
            DeadButtonRed.active.background  = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor   = Color.red;
            DeadButtonRed.hover.textColor    = Color.yellow;
            DeadButtonRed.active.textColor   = Color.red;
            DeadButtonRed.focused.textColor  = Color.red;
            DeadButtonRed.fontSize           = 12;
            DeadButtonRed.fontStyle          = FontStyle.Bold;

            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor  = Color.white;

            Yellowtext = new GUIStyle(GUI.skin.box);
            Yellowtext.normal.textColor  = Color.yellow;
            Yellowtext.normal.background = null;

            LabelInfo = new GUIStyle(GUI.skin.label);
            LabelInfo.normal.background = null;
            LabelInfo.normal.textColor  = Color.white;
            LabelInfo.fontSize          = 13;
            LabelInfo.fontStyle         = FontStyle.Bold;
            LabelInfo.padding.left      = 3;
            LabelInfo.padding.top       = 0;
            LabelInfo.padding.bottom    = 0;

            ButtonSmallText           = new GUIStyle(GUI.skin.button);
            ButtonSmallText.fontSize  = 12;
            ButtonSmallText.fontStyle = FontStyle.Normal;

            string sProducing = (string)selectedFacility.getSetting("Producing");

            if (sProducing == null || sProducing == "")
            {
                sProducing = "None";
                selectedFacility.setSetting("Producing", "None");
                PersistenceUtils.saveStaticPersistence(selectedFacility);
            }

            if (GUILayout.Button("Construct a Craft", ButtonSmallText, GUILayout.Height(20)))
            {
                if (sProducing != "None")
                {
                    MiscUtils.HUDMessage("Only one craft can be constructed at a time.", 10,
                                         3);
                }
            }

            GUILayout.Space(3);
            if (sProducing == "None")
            {
                GUILayout.Label("No craft currently under construction in this facility.", LabelInfo);
            }
            else
            {
                GUILayout.Label("Craft Under Construction: ", LabelInfo);

                // TO DO List of craft
                GUILayout.Label("Cost of Construction: X Funds / X Materials", LabelInfo);
                GUILayout.Label("Total Construction Time: X hours", LabelInfo);
                GUILayout.Label("Time to Completion: X hours", LabelInfo);
                if (GUILayout.Button("Assign a Kerbonaut Engineer", ButtonSmallText, GUILayout.Height(20)))
                {
                }
            }

            if (GUILayout.Button("Upgrade Production", ButtonSmallText, GUILayout.Height(20)))
            {
            }

            float fAvailableMaterials;

            fAvailableMaterials = (float)selectedFacility.getSetting("PrOreCurrent");

            GUILayout.Space(3);
            GUILayout.Label("Available Materials (Processed Ore): " + fAvailableMaterials.ToString("#0.0"), LabelInfo);
        }
Ejemplo n.º 21
0
        public void Draw() {
            if (skin == null) {
                skin = Resources.Load("GUISkins/editorSkin", typeof(GUISkin)) as GUISkin;
            }

            var allRect = EditorGUILayout.BeginVertical();

            bool toggleColor = false;
            Color baseColor = GUI.color;

            GUILayout.Label(label);
            position = EditorGUILayout.BeginScrollView(
                position, false, true, GUILayout.Height(height));

            float y = 0;

            foreach (var item in items) {
                var itemRect = EditorGUILayout.BeginHorizontal();

                if (scrollToItem == item && Event.current.type == EventType.Repaint) {
                    if (y - position.y < 0) { // item above
                        position.y = y;
                    } else if (y - position.y + itemRect.height + 2 >= allRect.height) { // item below ( + 2 - hack)
                        position.y = y - (allRect.height - itemRect.height * 2);
                    }

                    scrollToItem = null;
                }

                if (selectionEnabled) {
                    if (Event.current.type == EventType.MouseDown && Event.current.button == 0) {
                        if (itemRect.Contains(Event.current.mousePosition)) {
                            if (Event.current.shift) {
                                SelectRange(selectedItem, item);
                            } else {
                                selectedItem = item;

                                var currentClickTime = GetTimeMillis();

                                if (currentClickTime - lastClickTime <= 250 && lastClickedItem == selectedItem) {
                                    if (doubleClickCallback != null) {
                                        doubleClickCallback(lastClickedItem);
                                    }
                                    lastClickTime = 0;
                                    lastClickedItem = null;
                                } else {
                                    lastClickTime = currentClickTime;
                                    lastClickedItem = selectedItem;
                                }
                            }
                            
                        }
                    }
                }

                // component value based on skin
                float c = EditorGUIUtility.isProSkin ? 0 : 1;

                GUI.color = toggleColor ? Color.clear : new Color(c, c, c, 0.2f);
                toggleColor = !toggleColor;
                if (item.selected) {
                    GUI.color = toggleColor ? new Color(c, c, c, 0.4f) : new Color(c, c, c, 0.6f);
                }

                GUI.Box(itemRect, "", skin.box);
                GUI.color = baseColor;

                EditorGUILayout.BeginVertical();
                item.OnGUI();
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();

                y += itemRect.height;
            }

            if (items.Count == 0) {
                GUILayout.Label(emptyListMessage);
            }

            GUILayout.FlexibleSpace();

            if (spaceAfter != 0) {
                GUILayout.Space(spaceAfter);
            }

            EditorGUILayout.EndScrollView();

            GUI.color = baseColor;

            EditorGUILayout.EndVertical();

            Event evt = Event.current;
            switch (evt.type) {
                case EventType.MouseDrag:
                case EventType.DragUpdated:
                case EventType.DragPerform:
                    if (!allRect.Contains(evt.mousePosition)) {
                        break;
                    }

                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

                    if (evt.type == EventType.DragPerform) {
                        DragAndDrop.AcceptDrag();

                        foreach (Object draggedObject in DragAndDrop.objectReferences) {
                            if (acceptDropTypes.Contains(draggedObject.GetType())) {
                                AcceptDrag(items.Count, draggedObject);
                            }
                        }
                    }
                    break;
            }
        }
Ejemplo n.º 22
0
        public void drawGUI()
        {
            GUI.skin = HighLogic.Skin;

            if (coreSettings.show)
            {
                coreSettings.Pos = GUILayout.Window(coreSettings.WINDOW_ID, coreSettings.Pos, coreSettings.GUI, "RemoteTech Settings", GUILayout.Width(500), GUILayout.Height(385));
                return;
            }

            RTGlobals.coreList.drawGUI();



            if (settings.show && settings.module != null)
            {
                DishSettingPos = GUILayout.Window(settings.WINDOW_ID, DishSettingPos, settings.SettingsGUI, settings.descript, GUILayout.Width(350), GUILayout.Height(600));
            }
        }
Ejemplo n.º 23
0
    /// <summary>
    /// Draw the UI for this tool.
    /// </summary>

    void OnGUI()
    {
        if (mLastAtlas != NGUISettings.atlas)
        {
            mLastAtlas = NGUISettings.atlas;
        }

        // jwu NGUI - prevents ReferenceAtlas from being able to accept changes to real Atlases
        if (NGUISettings.atlas != null &&
            (NGUISettings.atlas.replacement != null || NGUISettings.atlas.name.EndsWith("RefAtlas")))
        {
            Debug.LogError(NGUISettings.atlas.name + " is a Reference Atlas. Add assets to normal atlases only.");
            NGUISettings.atlas = null;
        }

        bool update  = false;
        bool replace = false;

        NGUIEditorTools.SetLabelWidth(84f);
        GUILayout.Space(3f);

        NGUIEditorTools.DrawHeader("Input", true);
        NGUIEditorTools.BeginContents(false);

        GUILayout.BeginHorizontal();
        {
            ComponentSelector.Draw <UIAtlas>("Atlas", NGUISettings.atlas, OnSelectAtlas, true, GUILayout.MinWidth(80f));

            EditorGUI.BeginDisabledGroup(NGUISettings.atlas == null);
            if (GUILayout.Button("New", GUILayout.Width(40f)))
            {
                NGUISettings.atlas = null;
            }
            EditorGUI.EndDisabledGroup();
        }
        GUILayout.EndHorizontal();

        List <Texture> textures = GetSelectedTextures();

        if (NGUISettings.atlas != null)
        {
            Material mat = NGUISettings.atlas.spriteMaterial;
            Texture  tex = NGUISettings.atlas.texture;

            // Material information
            GUILayout.BeginHorizontal();
            {
                if (mat != null)
                {
                    if (GUILayout.Button("Material", GUILayout.Width(76f)))
                    {
                        Selection.activeObject = mat;
                    }
                    GUILayout.Label(" " + mat.name);
                }
                else
                {
                    GUI.color = Color.grey;
                    GUILayout.Button("Material", GUILayout.Width(76f));
                    GUI.color = Color.white;
                    GUILayout.Label(" N/A");
                }
            }
            GUILayout.EndHorizontal();

            // Texture atlas information
            GUILayout.BeginHorizontal();
            {
                if (tex != null)
                {
                    if (GUILayout.Button("Texture", GUILayout.Width(76f)))
                    {
                        Selection.activeObject = tex;
                    }
                    GUILayout.Label(" " + tex.width + "x" + tex.height);
                }
                else
                {
                    GUI.color = Color.grey;
                    GUILayout.Button("Texture", GUILayout.Width(76f));
                    GUI.color = Color.white;
                    GUILayout.Label(" N/A");
                }
            }
            GUILayout.EndHorizontal();
        }

        GUILayout.BeginHorizontal();
        NGUISettings.atlasPadding = Mathf.Clamp(EditorGUILayout.IntField("Padding", NGUISettings.atlasPadding, GUILayout.Width(100f)), 0, 8);
        GUILayout.Label((NGUISettings.atlasPadding == 1 ? "pixel" : "pixels") + " between sprites");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        NGUISettings.atlasTrimming = EditorGUILayout.Toggle("Trim Alpha", NGUISettings.atlasTrimming, GUILayout.Width(100f));
        GUILayout.Label("Remove empty space");
        GUILayout.EndHorizontal();

        bool fixedShader = false;

        if (NGUISettings.atlas != null)
        {
            Material mat = NGUISettings.atlas.spriteMaterial;

            if (mat != null)
            {
                Shader shader = mat.shader;

                if (shader != null)
                {
                    if (shader.name == "Unlit/Transparent Colored")
                    {
                        NGUISettings.atlasPMA = false;
                        fixedShader           = true;
                    }
                    else if (shader.name == "Unlit/Premultiplied Colored")
                    {
                        NGUISettings.atlasPMA = true;
                        fixedShader           = true;
                    }
                }
            }
        }

        if (!fixedShader)
        {
            GUILayout.BeginHorizontal();
            NGUISettings.atlasPMA = EditorGUILayout.Toggle("PMA Shader", NGUISettings.atlasPMA, GUILayout.Width(100f));
            GUILayout.Label("Pre-multiplied alpha", GUILayout.MinWidth(70f));
            GUILayout.EndHorizontal();
        }

        //GUILayout.BeginHorizontal();
        //NGUISettings.keepPadding = EditorGUILayout.Toggle("Keep Padding", NGUISettings.keepPadding, GUILayout.Width(100f));
        //GUILayout.Label("or replace with trimmed pixels", GUILayout.MinWidth(70f));
        //GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        NGUISettings.unityPacking = EditorGUILayout.Toggle("Unity Packer", NGUISettings.unityPacking, GUILayout.Width(100f));
        GUILayout.Label("or custom packer", GUILayout.MinWidth(70f));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        NGUISettings.trueColorAtlas = EditorGUILayout.Toggle("Truecolor", NGUISettings.trueColorAtlas, GUILayout.Width(100f));
        GUILayout.Label("force ARGB32 textures", GUILayout.MinWidth(70f));
        GUILayout.EndHorizontal();

        if (!NGUISettings.unityPacking)
        {
            GUILayout.BeginHorizontal();
            NGUISettings.forceSquareAtlas = EditorGUILayout.Toggle("Force Square", NGUISettings.forceSquareAtlas, GUILayout.Width(100f));
            GUILayout.Label("if on, forces a square atlas texture", GUILayout.MinWidth(70f));
            GUILayout.EndHorizontal();
        }

#if UNITY_IPHONE || UNITY_ANDROID
        GUILayout.BeginHorizontal();
        NGUISettings.allow4096 = EditorGUILayout.Toggle("4096x4096", NGUISettings.allow4096, GUILayout.Width(100f));
        GUILayout.Label("if off, limit atlases to 2048x2048");
        GUILayout.EndHorizontal();
#endif
        NGUIEditorTools.EndContents();

        if (NGUISettings.atlas != null)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);

            if (textures.Count > 0)
            {
                update = GUILayout.Button("Add/Update");
            }
            else if (GUILayout.Button("View Sprites"))
            {
                SpriteSelector.ShowSelected();
            }

            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
        }
        else
        {
            EditorGUILayout.HelpBox("You can create a new atlas by selecting one or more textures in the Project View window, then clicking \"Create\".", MessageType.Info);

            EditorGUI.BeginDisabledGroup(textures.Count == 0);
            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            bool create = GUILayout.Button("Create");
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();

            if (create)
            {
                string path = EditorUtility.SaveFilePanelInProject("Save As",
                                                                   "New Atlas.prefab", "prefab", "Save atlas as...", NGUISettings.currentPath);

                if (!string.IsNullOrEmpty(path))
                {
                    NGUISettings.currentPath = System.IO.Path.GetDirectoryName(path);
                    GameObject go      = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
                    string     matPath = path.Replace(".prefab", ".mat");
                    replace = true;

                    // Try to load the material
                    Material mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;

                    // If the material doesn't exist, create it
                    if (mat == null)
                    {
                        Shader shader = Shader.Find(NGUISettings.atlasPMA ? "Unlit/Premultiplied Colored" : "Unlit/Transparent Colored");
                        mat = new Material(shader);

                        // Save the material
                        AssetDatabase.CreateAsset(mat, matPath);
                        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

                        // Load the material so it's usable
                        mat = AssetDatabase.LoadAssetAtPath(matPath, typeof(Material)) as Material;
                    }

                    // Create a new prefab for the atlas
                    Object prefab = (go != null) ? go : PrefabUtility.CreateEmptyPrefab(path);

                    // Create a new game object for the atlas
                    string atlasName = path.Replace(".prefab", "");
                    atlasName = atlasName.Substring(path.LastIndexOfAny(new char[] { '/', '\\' }) + 1);
                    go        = new GameObject(atlasName);
                    go.AddComponent <UIAtlas>().spriteMaterial = mat;

                    // Update the prefab
                    PrefabUtility.ReplacePrefab(go, prefab);
                    DestroyImmediate(go);
                    AssetDatabase.SaveAssets();
                    AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);

                    // Select the atlas
                    go = AssetDatabase.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
                    NGUISettings.atlas         = go.GetComponent <UIAtlas>();
                    Selection.activeGameObject = go;
                }
            }
        }


        string selection = null;
        Dictionary <string, int> spriteList = GetSpriteList(textures);

        if (spriteList.Count > 0)
        {
            NGUIEditorTools.DrawHeader("Sprites", true);
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(3f);
                GUILayout.BeginVertical();

                mScroll = GUILayout.BeginScrollView(mScroll);

                bool delete = false;
                int  index  = 0;
                foreach (KeyValuePair <string, int> iter in spriteList)
                {
                    ++index;

                    GUILayout.Space(-1f);
                    bool highlight = (UIAtlasInspector.instance != null) && (NGUISettings.selectedSprite == iter.Key);
                    GUI.backgroundColor = highlight ? Color.white : new Color(0.8f, 0.8f, 0.8f);
                    GUILayout.BeginHorizontal(textArea, GUILayout.MinHeight(20f));
                    GUI.backgroundColor = Color.white;
                    GUILayout.Label(index.ToString(), GUILayout.Width(24f));

                    if (GUILayout.Button(iter.Key, "OL TextField", GUILayout.Height(20f)))
                    {
                        selection = iter.Key;
                    }

                    if (iter.Value == 2)
                    {
                        GUI.color = Color.green;
                        GUILayout.Label("Add", GUILayout.Width(27f));
                        GUI.color = Color.white;
                    }
                    else if (iter.Value == 1)
                    {
                        GUI.color = Color.cyan;
                        GUILayout.Label("Update", GUILayout.Width(45f));
                        GUI.color = Color.white;
                    }
                    else
                    {
                        if (mDelNames.Contains(iter.Key))
                        {
                            GUI.backgroundColor = Color.red;

                            if (GUILayout.Button("Delete", GUILayout.Width(60f)))
                            {
                                delete = true;
                            }
                            GUI.backgroundColor = Color.green;
                            if (GUILayout.Button("X", GUILayout.Width(22f)))
                            {
                                mDelNames.Remove(iter.Key);
                                delete = false;
                            }
                            GUI.backgroundColor = Color.white;
                        }
                        else
                        {
                            // If we have not yet selected a sprite for deletion, show a small "X" button
                            if (GUILayout.Button("X", GUILayout.Width(22f)))
                            {
                                mDelNames.Add(iter.Key);
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
                GUILayout.Space(3f);
                GUILayout.EndHorizontal();

                // If this sprite was marked for deletion, remove it from the atlas
                if (delete)
                {
                    List <SpriteEntry> sprites = new List <SpriteEntry>();
                    ExtractSprites(NGUISettings.atlas, sprites);

                    for (int i = sprites.Count; i > 0;)
                    {
                        SpriteEntry ent = sprites[--i];
                        if (mDelNames.Contains(ent.name))
                        {
                            sprites.RemoveAt(i);
                        }
                    }
                    UpdateAtlas(NGUISettings.atlas, sprites);
                    mDelNames.Clear();
                    NGUIEditorTools.RepaintSprites();
                }
                else if (update)
                {
                    UpdateAtlas(textures, true);
                }
                else if (replace)
                {
                    UpdateAtlas(textures, false);
                }

                if (NGUISettings.atlas != null && !string.IsNullOrEmpty(selection))
                {
                    NGUIEditorTools.SelectSprite(selection);
                }
                else if (update || replace)
                {
                    NGUIEditorTools.UpgradeTexturesToSprites(NGUISettings.atlas);
                    NGUIEditorTools.RepaintSprites();
                }
            }
        }

        if (NGUISettings.atlas != null && textures.Count == 0)
        {
            EditorGUILayout.HelpBox("You can reveal more options by selecting one or more textures in the Project View window.", MessageType.Info);
        }

        // Uncomment this line if you want to be able to force-sort the atlas
        //if (NGUISettings.atlas != null && GUILayout.Button("Sort Alphabetically")) NGUISettings.atlas.SortAlphabetically();
    }
Ejemplo n.º 24
0
        /// <summary>
        /// 一键导出
        /// </summary>
        public void OnGUI_OneKeyExprot()
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Label("注:上面按钮操作,会默认生成到StreamingAssets", GUILayout.Width(500), GUILayout.Height(30));
                //isGenWindowsAssets=GUILayout.Toggle(isGenWindowsAssets, "生成Windows资源");
                isGenAndroidAssets = GUILayout.Toggle(isGenAndroidAssets, "生成Android资源(Windows共用)");
                isGenIosAssets     = GUILayout.Toggle(isGenIosAssets, "生成Ios资源");

                //
                GUILayout.Label("导出地址:" + exportPath, GUILayout.Width(500));
                //
                if (GUILayout.Button("一键导出", GUILayout.Width(350), GUILayout.Height(30)))
                {
                    if (isBuilding)
                    {
                        return;
                    }
                    isBuilding = true;

                    //选择目录
                    exportPath = EditorUtility.OpenFolderPanel("选择导出目录", exportPath, "");
                    if (string.IsNullOrEmpty(exportPath))
                    {
                        return;
                    }


                    //生成android资源
                    if (isGenAndroidAssets)
                    {
                        GenAllAssets(exportPath, RuntimePlatform.Android, BuildTarget.Android);
                    }

                    //生成ios资源
                    if (isGenIosAssets)
                    {
                        GenAllAssets(exportPath, RuntimePlatform.IPhonePlayer, BuildTarget.iOS);
                    }

                    EditorUtility.DisplayDialog("提示", "资源导出完成", "OK");

                    isBuilding = false;
                }

                //
                if (GUILayout.Button("热更资源转hash(生成服务器配置)", GUILayout.Width(350), GUILayout.Height(30)))
                {
                    //选择目录
                    exportPath = EditorUtility.OpenFolderPanel("选择导出目录", exportPath, "");
                    if (string.IsNullOrEmpty(exportPath))
                    {
                        return;
                    }

                    //自动转hash
                    AssetUploadToServer.Assets2Hash(exportPath, "");
                }
            }
            GUILayout.EndVertical();
        }
    private void OnGUI()
    {
        scrollView = GUILayout.BeginScrollView(scrollView, GUILayout.Width(position.width), GUILayout.Height(position.height));
        EditorGUILayout.LabelField("示例1:BeginChangeCheck()和EndChangeCheck()的使用");

        /*
         *   知识点一:
         *   ToggleLeft
         */
        EditorGUI.BeginChangeCheck();
        toogle1 = EditorGUILayout.ToggleLeft("ToggleLeft:改变则会在控制台上Debug出语句(Toggle Left)", toogle1);
        toogle2 = EditorGUILayout.Toggle("Toggle:改变则会在控制台上Debug出语句(Toggle)", toogle2);
        if (EditorGUI.EndChangeCheck())
        {
            Debug.Log("Toggle状态发生了改变");
        }



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例2:BeginDisabledGroup()和EndDisabledGroup()的使用");
        Display();
        EditorGUILayout.Space();
        EditorGUI.BeginDisabledGroup(true);
        Display();
        EditorGUI.EndDisabledGroup();


        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例3:GUI的FadeGroup动画");
        bool on = animFloat.value == 1;

        if (GUILayout.Button(on?"Close":"Open", GUILayout.Width(64)))
        {
            animFloat.target = on ? 0.0001f : 1;
            animFloat.speed  = 5f;

            var env = new UnityEvent();
            env.AddListener(() => Repaint());
            animFloat.valueChanged = env;
        }
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.BeginFadeGroup(animFloat.value);
        DisplayForExampleThree();
        EditorGUILayout.EndFadeGroup();
        DisplayForExampleThree();
        EditorGUILayout.EndHorizontal();



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例4:ObjectField的使用");
        DisplayForExampleFour();



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例5:EditorGUI.MultiFloatField的使用:绘制多个浮点值编辑字段");
        //DisplayForFive();



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例6:EditorGUI.indentLevel的使用:缩进管理");
        DisplayForSix();


        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例7:EditorGUI.Knob的使用:圆形Slider");
        DisplayForSeven();



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例8:自定义Scope的使用");
        DisplayForEight();



        EditorGUILayout.Space(SpaceLength);
        EditorGUILayout.LabelField("示例9:切换按钮样式");
        DisplayForNight();


        GUILayout.EndScrollView();
    }
Ejemplo n.º 26
0
        static void AttachmentField <T>(Object owner, T attachment) where T : class, IGameObject, IAttachment, IFloatValue, new()
        {
            const int cellSize   = 44;
            const int fudgeWidth = 175;
            const int border     = 2;

            Transform      _transform   = attachment.gameObject.transform;
            SpriteRenderer _sprr        = attachment.gameObject.GetComponent <SpriteRenderer>();
            float          _fDepthFudge = attachment.FloatValue;
            int            IndentLevel  = attachment.IndentLevel;

            Color borderColor = Selection.activeObject == _transform.gameObject
                ? CustomEditorGUI.Color_LightYellow : Color.gray;

            Rect rect              = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(GUILayout.Height(cellSize + border * 2)));
            Rect rect_inside       = new Rect(rect.xMin + border, rect.yMin + border, rect.width - border * 2, rect.height - border * 2);
            Rect rect_preview      = new Rect(rect_inside.xMin, rect_inside.yMin, cellSize, rect_inside.height);
            Rect rect_info_name    = new Rect(rect_preview.xMax, rect_inside.yMin, rect_inside.width - cellSize - fudgeWidth, rect_inside.height * 0.5f);
            Rect rect_Fudge        = new Rect(rect_info_name.xMax, rect_inside.yMin, fudgeWidth, rect_inside.height * 0.5f - border);
            Rect rect_info_Sub     = new Rect(rect_info_name.xMin, rect_info_name.yMin + cellSize * 0.5f, rect_info_name.width, rect_inside.height - rect_info_name.height);
            Rect rect_select_reset = new Rect(rect_inside.xMax - cellSize * 3.1f, rect_info_Sub.yMin, cellSize * 1.5f, rect_info_Sub.height);
            Rect rect_select_go    = new Rect(rect_inside.xMax - cellSize * 1.5f, rect_info_Sub.yMin, cellSize * 1.5f, rect_info_Sub.height);

            CustomEditorGUI.DrawBordereddRect(rect, borderColor, rect_inside, Color.clear);
            if (_sprr != null)
            {
                CustomEditorGUI.DrawSprite(rect_preview, _sprr.sprite, Color.white, false, false);
            }
            else
            {
                EditorGUI.LabelField(rect_preview, "Trans\nform\nNode");
            }

            int iLv = EditorGUI.indentLevel;

            EditorGUI.indentLevel = 0;
            EditorGUI.LabelField(rect_info_name, _transform.name, EditorStyles.boldLabel);

            float _fNewDepthFudge = CustomEditorGUI.FloatSlider(rect_Fudge, "Depth", _fDepthFudge, -1f, 1f);


            // 서브 인포 출력
            //using (new EditorGUILayout.HorizontalScope())
            {
                float            _fMinSize = Mathf.Min(rect_info_Sub.width, rect_info_Sub.height);
                SpriteRenderer[] _sprrList = _transform.GetComponentsInChildren <SpriteRenderer>();

                for (int i = 0; i < _sprrList.Length; ++i)
                {
                    if (_sprrList[i].sprite != null && _sprrList[i] != _sprr)
                    {
                        Rect _rt = EditorGUI.IndentedRect(rect_info_Sub);
                        _rt.width           = _rt.height = _fMinSize;
                        rect_info_Sub.xMin += _fMinSize;
                        CustomEditorGUI.DrawSprite(_rt, _sprrList[i].sprite, _sprrList[i].color, true, true);
                    }
                }
            }
            using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightMagenta))
            {
                if (GUI.Button(rect_select_reset, "Depth 0"))
                {
                    _fNewDepthFudge = 0;
                }
            }

            using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightYellow))
            {
                if (GUI.Button(rect_select_go, "Select"))
                {
                    Selection.activeGameObject = _transform.gameObject;
                }
            }

            if (_fNewDepthFudge != _fDepthFudge)
            {
                Vector2 _tileAngle = IsoMap.IsNull ? new Vector2(_sprr.transform.localEulerAngles.x, _sprr.transform.localEulerAngles.y) : IsoMap.instance.TileAngle;
                Undo.RecordObject(_transform, "Transform : LocalOffset");
                _transform.position = _transform.position - IsoMap.vDepthFudge(_fDepthFudge, _tileAngle) + IsoMap.vDepthFudge(_fNewDepthFudge, _tileAngle);

                Undo.RecordObject(owner, "DepthFudge changed");
                attachment.FloatValue = _fNewDepthFudge;
            }

            EditorGUI.indentLevel = iLv;
        }
    void GenerateGUI()
    {
        if (DoxyFileExists)
        {
            //UnityEngine.Debug.Log(DoxyoutputProgress);
            GUILayout.Space(10);
            if (!DocsGenerated)
            {
                GUI.enabled = false;
            }
            if (GUILayout.Button("Browse Documentation", GUILayout.Height(40)))
            {
                Application.OpenURL("File://" + Config.DocDirectory + "/html/annotated.html");
            }
            GUI.enabled = true;

            if (DoxygenOutput == null)
            {
                if (GUILayout.Button("Run Doxygen", GUILayout.Height(40)))
                {
                    DocsGenerated = false;
                    RunDoxygen();
                }

                if (DocsGenerated && DoxygenLog != null)
                {
                    if (GUILayout.Button("View Doxygen Log", EditorStyles.toolbarDropDown))
                    {
                        ViewLog = !ViewLog;
                    }
                    if (ViewLog)
                    {
                        scroll = EditorGUILayout.BeginScrollView(scroll, GUILayout.ExpandHeight(true));
                        foreach (string logitem in DoxygenLog)
                        {
                            EditorGUILayout.SelectableLabel(logitem, EditorStyles.miniLabel, GUILayout.ExpandWidth(true));
                        }
                        EditorGUILayout.EndScrollView();
                    }
                }
            }
            else
            {
                if (DoxygenOutput.isStarted() && !DoxygenOutput.isFinished())
                {
                    string currentline = DoxygenOutput.ReadLine();
                    DoxyoutputProgress = DoxyoutputProgress + 0.1f;
                    if (DoxyoutputProgress >= 0.9f)
                    {
                        DoxyoutputProgress = 0.75f;
                    }
                    Rect r = EditorGUILayout.BeginVertical();
                    EditorGUI.ProgressBar(r, DoxyoutputProgress, currentline);
                    GUILayout.Space(40);
                    EditorGUILayout.EndVertical();
                }
                if (DoxygenOutput.isFinished())
                {
                    if (Event.current.type == EventType.Repaint)
                    {
                        /*
                         * If you look at what SetTheme is doing, I know, it seems a little scary to be
                         * calling file moving operations from inside a an OnGUI call like this. And
                         * maybe it would be a better choice to call SetTheme and update these other vars
                         * from inside of the OnDoxygenFinished callback. But since the callback is static
                         * that would require a little bit of messy singleton instance checking to make sure
                         * the call back was calling into the right functions. I did try to do it that way
                         * but for some reason the file operations failed every time. I'm not sure why.
                         * This is what I was getting from the debugger:
                         *
                         * Error in file: C:/BuildAgent/work/842f9551727e852/Runtime/Mono/MonoManager.cpp at line 2212
                         * UnityEditor.FileUtil:DeleteFileOrDirectory(String)
                         * UnityEditor.FileUtil:ReplaceFile(String, String) (at C:\BuildAgent\work\842f9557127e852\Editor\MonoGenerated\Editor\FileUtil.cs:42)
                         *
                         * Doing them here seems to work every time and the Repaint event check ensures that they will only be done once.
                         */
                        SetTheme(SelectedTheme);
                        DoxygenLog         = DoxygenOutput.ReadFullLog();
                        DoxyoutputProgress = -1.0f;
                        DoxygenOutput      = null;
                        DocsGenerated      = true;
                        EditorPrefs.SetBool(UnityProjectID + "DocsGenerated", DocsGenerated);
                    }
                }
            }
        }
        else
        {
            GUIStyle ErrorLabel = new GUIStyle(EditorStyles.largeLabel);
            ErrorLabel.alignment = TextAnchor.MiddleCenter;
            GUILayout.Space(20);
            GUI.contentColor = Color.red;
            GUILayout.Label("You must set the path to your Doxygen install and \nbuild a new Doxyfile before you can generate documentation", ErrorLabel);
        }
    }
Ejemplo n.º 28
0
        public static void ColliderControlHelperGUI(Object[] objects)
        {
            SubColliderHelper[] _cols = objects.Where(r => r is SubColliderHelper).Cast <SubColliderHelper>().ToArray();

            bool bHasBC       = _cols.All(r => r.GetComponent <BoxCollider>() != null);
            bool isNotIsoTile = _cols.All(r => r.GetComponent <IsoTile>() == null);

            if (isNotIsoTile)
            {
                Util.CustomEditorGUI.NewParagraph("[Object Selector]");
                Util.CustomEditorGUI.ComSelector <IsoTile>(Selection.activeGameObject.GetComponentInParent <IsoTile>(), "GO IsoTile");
                var _iso2Ds = Selection.activeGameObject.GetComponentsInChildren <Iso2DObject>();
                foreach (var one in _iso2Ds)
                {
                    Util.CustomEditorGUI.ComSelector <Iso2DObject>(one, "GO Iso2D");
                }
                CustomEditorGUI.DrawSeperator();
            }

            if (bHasBC || isNotIsoTile)
            {
                NewParagraph("[Collider Control]");
                float fRayCastHeight = 10f;
                if (bHasBC && GUILayout.Button(string.Format("Drop to the floor collider[Max({0:0.0})]", fRayCastHeight)))
                {
                    foreach (var _col in _cols)
                    {
                        if (_col.BC != null)
                        {
                            float fDropHeight = _col.BC.DropToFloor(_col.gameObject, fRayCastHeight);
                            if (fDropHeight > 0)
                            {
                                Debug.Log(string.Format("{0} fell {1} high.", _col.gameObject.name, fDropHeight));
                            }
                            else if (fDropHeight < 0)
                            {
                                Debug.Log(string.Format("{0} went up to {1} height because there is no floor within {2} range.",
                                                        _col.gameObject.name, -fDropHeight, fRayCastHeight));
                            }
                            else
                            {
                                Debug.Log(string.Format("There is no floor within {0} height.", fRayCastHeight));
                            }
                        }
                    }
                }
                if (isNotIsoTile && GUILayout.Button(string.Format("Change Parent to the nearest tile.", fRayCastHeight)))
                {
                    foreach (var _col in _cols)
                    {
                        _col.ReParent(0.5f);
                    }
                }
                if (isNotIsoTile && GUILayout.Button("Sync Light to Tile."))
                {
                    foreach (var _col in _cols)
                    {
                        var _tile = _col.GetComponentInParent <IsoTile>();
                        _tile.SyncIsoLight(_col.gameObject);
                    }
                }
                CustomEditorGUI.DrawSeperator();
            }

            if (isNotIsoTile && (bFoldout_ColliderControlGUI = !NewParagraphWithHideToggle("[Etc Control]", "Hide", !bFoldout_ColliderControlGUI)))
            {
                List <Iso2DObject> Iso2Ds = new List <Iso2DObject>();
                foreach (var _col in _cols)
                {
                    Iso2Ds.AddRange(_col.GetComponentsInChildren <Iso2DObject>());
                }
                if (Iso2Ds.Count > 0)
                {
                    Iso2Ds = Iso2Ds.Distinct().ToList();
                    GUILayoutOption heightLayout = GUILayout.Height(EditorGUIUtility.singleLineHeight * 3);
                    Iso2Ds.ForEach(r => Iso2DDrawer.Drawer(EditorGUILayout.GetControlRect(heightLayout), r.gameObject));
                }
            }
        }
        ///An editor for BBParameter type to let user choose either a constant value or link to a Blackboard Variable.
        public static BBParameter ParameterField(GUIContent content, BBParameter bbParam, bool blackboardOnly = false, object[] attributes = null)
        {
            if (bbParam == null)
            {
                EditorGUILayout.LabelField(content, new GUIContent("BBParameter is null"));
                return(null);
            }

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();

            //Direct assignement
            if (!blackboardOnly && !bbParam.useBlackboard)
            {
                GUILayout.BeginVertical();
                var internalField = bbParam.GetType().RTGetField("_value");
                bbParam.value = EditorUtils.ReflectedFieldInspector(content, bbParam.value, bbParam.varType, internalField, bbParam, attributes);
                GUILayout.EndVertical();

                //Dropdown variable selection
            }
            else
            {
                GUI.color = new Color(0.9f, 0.9f, 1f, 1f);
                var varNames = new List <string>();

                //Local
                if (bbParam.bb != null)
                {
                    varNames.AddRange(bbParam.bb.GetVariableNames(bbParam.varType));
                }

                //Seperator
                varNames.Add("/");

                //Globals
                foreach (var globalBB in GlobalBlackboard.allGlobals)
                {
                    var globalVars = globalBB.GetVariableNames(bbParam.varType);
                    if (globalVars.Length == 0)
                    {
                        varNames.Add(globalBB.name + "/");
                    }
                    for (var i = 0; i < globalVars.Length; i++)
                    {
                        globalVars[i] = globalBB.name + "/" + globalVars[i];
                    }
                    varNames.AddRange(globalVars);
                }

                //Dynamic
                varNames.Add("(DynamicVar)");

                //New
                if (bbParam.bb != null)
                {
                    varNames.Add("(Create New)");
                }

                var isDynamic = !string.IsNullOrEmpty(bbParam.name) && !varNames.Contains(bbParam.name);
                if (!isDynamic)
                {
                    bbParam.name = EditorUtils.StringPopup(content, bbParam.name, varNames, false, true);

                    if (bbParam.name == "(DynamicVar)")
                    {
                        bbParam.name = "_";
                    }

                    if (bbParam.bb != null && bbParam.name == "(Create New)")
                    {
                        if (bbParam.bb.AddVariable(content.text, bbParam.varType) != null)
                        {
                            bbParam.name = content.text;
                        }
                        else
                        {
                            bbParam.name = null;
                        }
                    }
                }
                else
                {
                    bbParam.name        = EditorGUILayout.DelayedTextField(content.text + " (" + bbParam.varType.FriendlyName() + ")", bbParam.name);
                    GUI.backgroundColor = new Color(1, 1, 1, 0.2f);
                    if (bbParam.bb != null && GUILayout.Button(new GUIContent("+", "Promote To Variable"), GUILayout.Width(20), GUILayout.Height(14)))
                    {
                        bbParam.PromoteToVariable(bbParam.bb);
                    }
                }
            }


            GUI.color           = Color.white;
            GUI.backgroundColor = Color.white;

            if (!blackboardOnly)
            {
                bbParam.useBlackboard = EditorGUILayout.Toggle(bbParam.useBlackboard, EditorStyles.radioButton, GUILayout.Width(18));
            }

            GUILayout.EndHorizontal();

            string info = null;

            if (bbParam.useBlackboard)
            {
                if (bbParam.bb == null)
                {
                    info = "<i>No current Blackboard reference</i>";
                }
                else
                if (bbParam.isNone)
                {
                    info = "Select a '" + bbParam.varType.FriendlyName() + "' Assignable Blackboard Variable";
                }
                else
                if (bbParam.varRef != null && bbParam.varType != bbParam.refType)
                {
                    var setPossible = bbParam.varRef.CanConvertFrom(bbParam.varType);
                    info = string.Format("AutoConvert: ({0} ➲ {1}){2}", bbParam.refType.FriendlyName(), bbParam.varType.FriendlyName(), setPossible? "" : " [GET ONLY]");
                }
            }

            if (info != null)
            {
                GUI.backgroundColor = new Color(0.8f, 0.8f, 1f, 0.5f);
                GUI.color           = new Color(1f, 1f, 1f, 0.5f);
                GUILayout.BeginVertical("textfield");
                GUILayout.Label(info, GUILayout.Width(0), GUILayout.ExpandWidth(true));
                GUILayout.EndVertical();
                GUILayout.Space(2);
            }

            GUILayout.EndVertical();
            GUI.backgroundColor = Color.white;
            GUI.color           = Color.white;
            return(bbParam);
        }
Ejemplo n.º 30
0
	void DrawAssetList(BuildReportTool.AssetList assetList, bool usedAssets, BuildInfo buildReportToDisplay, AssetDependencies assetDependencies)
	{
		if (assetList == null || assetList.TopLargest == null)
		{
			//Debug.LogError("no top ten largest");
			return;
		}

		BuildReportTool.SizePart[] assetsToShow = assetList.TopLargest;
		
		if (assetsToShow == null)
		{
			//Debug.LogError("no top ten largest");
			return;
		}

		bool useAlt = true;

		var newEntryHoveredIdx = -1;
		BuildReportTool.SizePart newEntryHovered = null;
		Rect newEntryHoveredRect = new Rect();
		Rect iconRect = new Rect();
		var hoveringOverIcon = false;
		//var hoveringOverLabel = false;

		GUILayout.BeginHorizontal();

			// 1st column: name
			GUILayout.BeginVertical();
			for (int n = 0; n < assetsToShow.Length; ++n)
			{
				BuildReportTool.SizePart b = assetsToShow[n];

				string styleToUse = useAlt ? BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME : BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME;
				string iconStyleToUse = useAlt ? BuildReportTool.Window.Settings.LIST_ICON_ALT_STYLE_NAME : BuildReportTool.Window.Settings.LIST_ICON_STYLE_NAME;

				Texture icon = AssetDatabase.GetCachedIcon(b.Name);

				GUILayout.BeginHorizontal();
				if (icon == null)
				{
					// no icon, just add space so it aligns with the other entries
					GUILayout.Label(string.Empty, iconStyleToUse, GUILayout.Width(28), GUILayout.Height(30));
				}
				else
				{
					GUILayout.Button(icon, iconStyleToUse, GUILayout.Width(28), GUILayout.Height(30));
				}

				if (Event.current.type == EventType.Repaint)
				{
					iconRect = GUILayoutUtility.GetLastRect();

					// if mouse is hovering over asset entry's icon (not the label)
					// draw a border on the asset icon
					if (iconRect.Contains(Event.current.mousePosition))
					{
						hoveringOverIcon = true;
						newEntryHoveredIdx = n;
						newEntryHovered = b;
						newEntryHoveredRect = iconRect;

						GUI.Box(iconRect, icon, "IconHovered");
					}
				}
				
				string prettyName = string.Format(" {0}. {1}", (n + 1).ToString(), System.IO.Path.GetFileName(b.Name));
				if (GUILayout.Button(prettyName, styleToUse, GUILayout.MinWidth(100), GUILayout.MaxWidth(400), GUILayout.Height(30)))
				{
					Utility.PingAssetInProject(b.Name);
				}

				if (newEntryHoveredIdx == -1 && Event.current.type == EventType.Repaint)
				{
					var labelRect = GUILayoutUtility.GetLastRect();

					// if mouse is hovering over asset entry's label
					// draw a border on the asset icon
					if (labelRect.Contains(Event.current.mousePosition))
					{
						//hoveringOverLabel = true;
						newEntryHoveredIdx = n;
						newEntryHovered = b;
						newEntryHoveredRect = labelRect;

						GUI.Box(iconRect, icon, "IconHovered");
					}
				}
				
				GUILayout.EndHorizontal();

				useAlt = !useAlt;
			}
			GUILayout.EndVertical();


			if (Event.current.type == EventType.Repaint)
			{
				if (usedAssets)
				{
					_assetUsedEntryHoveredIdx = newEntryHoveredIdx;
				}
				else
				{
					_assetUnusedEntryHoveredIdx = newEntryHoveredIdx;
				}
				
				if (newEntryHoveredIdx != -1)
				{
					string hoveredAssetPath = newEntryHovered != null ? newEntryHovered.Name : null;
					
					// ----------------
					// update what is considered the hovered asset, for use later on
					// when the tooltip will be drawn
					BRT_BuildReportWindow.UpdateHoveredAsset(hoveredAssetPath, newEntryHoveredRect,
						usedAssets, buildReportToDisplay, assetDependencies);

					// ----------------
					// if mouse is hovering over the correct area, we signify that
					// the tooltip thumbnail should be drawn
					if (BuildReportTool.Options.ShowTooltipThumbnail &&
					    (BuildReportTool.Options.ShowThumbnailOnHoverLabelToo || hoveringOverIcon) &&
					    BRT_BuildReportWindow.GetAssetPreview(hoveredAssetPath) != null)
					{
						_shouldShowThumbnailOnHoveredAsset = true;
					}
					else
					{
						_shouldShowThumbnailOnHoveredAsset = false;
					}
				}
			}

			// 2nd column: size

			var useRawSize = (usedAssets && !BuildReportTool.Options.ShowImportedSizeForUsedAssets) || !usedAssets;

			useAlt = true;
			GUILayout.BeginVertical();
			for (int n = 0; n < assetsToShow.Length; ++n)
			{
				BuildReportTool.SizePart b = assetsToShow[n];

				string styleToUse = useAlt ? BuildReportTool.Window.Settings.LIST_NORMAL_ALT_STYLE_NAME : BuildReportTool.Window.Settings.LIST_NORMAL_STYLE_NAME;

				GUILayout.Label(useRawSize ? b.RawSize : b.ImportedSize, styleToUse, GUILayout.MaxWidth(100), GUILayout.Height(30));

				useAlt = !useAlt;
			}
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
	}