UnityEngine.GUILayout.EndHorizontal()

Here are the examples of the csharp api UnityEngine.GUILayout.EndHorizontal() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

906 Examples 7

19 View Source File : UIPopupListInspector.cs
License : MIT License
Project Creator : mamoniem

void DrawAtlas()
	{
		if (NGUIEditorTools.DrawHeader("Atlas"))
		{
			NGUIEditorTools.BeginContents();

			GUILayout.BeginHorizontal();
			{
				if (NGUIEditorTools.DrawPrefixButton("Atlas"))
					ComponentSelector.Show<UIAtlas>(OnSelectAtlas);
				NGUIEditorTools.DrawProperty("", serializedObject, "atlas");
			}
			GUILayout.EndHorizontal();

			NGUIEditorTools.DrawPaddedSpriteField("Background", mList.atlas, mList.backgroundSprite, OnBackground);
			NGUIEditorTools.DrawPaddedSpriteField("Highlight", mList.atlas, mList.highlightSprite, OnHighlight);

			EditorGUILayout.Space();

			NGUIEditorTools.DrawProperty("Background", serializedObject, "backgroundColor");
			NGUIEditorTools.DrawProperty("Highlight", serializedObject, "highlightColor");
			NGUIEditorTools.DrawProperty("Animated", serializedObject, "isAnimated");
			NGUIEditorTools.EndContents();
		}
	}

19 View Source File : UIPopupListInspector.cs
License : MIT License
Project Creator : mamoniem

void DrawFont ()
	{
		if (NGUIEditorTools.DrawHeader("Font"))
		{
			NGUIEditorTools.BeginContents();

			SerializedProperty ttf = null;

			GUILayout.BeginHorizontal();
			{
				if (NGUIEditorTools.DrawPrefixButton("Font"))
				{
					if (mType == FontType.Bitmap)
					{
						ComponentSelector.Show<UIFont>(OnBitmapFont);
					}
					else
					{
						ComponentSelector.Show<Font>(OnDynamicFont, new string[] { ".ttf", ".otf"});
					}
				}

#if DYNAMIC_FONT
				GUI.changed = false;
				mType = (FontType)EditorGUILayout.EnumPopup(mType, GUILayout.Width(62f));

				if (GUI.changed)
				{
					GUI.changed = false;

					if (mType == FontType.Bitmap)
					{
						serializedObject.FindProperty("trueTypeFont").objectReferenceValue = null;
					}
					else
					{
						serializedObject.FindProperty("bitmapFont").objectReferenceValue = null;
					}
				}
#else
				mType = FontType.Bitmap;
#endif

				if (mType == FontType.Bitmap)
				{
					NGUIEditorTools.DrawProperty("", serializedObject, "bitmapFont", GUILayout.MinWidth(40f));
				}
				else
				{
					ttf = NGUIEditorTools.DrawProperty("", serializedObject, "trueTypeFont", GUILayout.MinWidth(40f));
				}
			}
			GUILayout.EndHorizontal();

			if (ttf != null && ttf.objectReferenceValue != null)
			{
				GUILayout.BeginHorizontal();
				{
					EditorGUI.BeginDisabledGroup(ttf.hasMultipleDifferentValues);
					NGUIEditorTools.DrawProperty("Font Size", serializedObject, "fontSize", GUILayout.Width(142f));
					NGUIEditorTools.DrawProperty("", serializedObject, "fontStyle", GUILayout.MinWidth(40f));
					NGUIEditorTools.DrawPadding();
					EditorGUI.EndDisabledGroup();
				}
				GUILayout.EndHorizontal();
			}
			else NGUIEditorTools.DrawProperty("Font Size", serializedObject, "fontSize", GUILayout.Width(142f));

			NGUIEditorTools.DrawProperty("Text Color", serializedObject, "textColor");

			GUILayout.BeginHorizontal();
			NGUIEditorTools.SetLabelWidth(66f);
			EditorGUILayout.PrefixLabel("Padding");
			NGUIEditorTools.SetLabelWidth(14f);
			NGUIEditorTools.DrawProperty("X", serializedObject, "padding.x", GUILayout.MinWidth(30f));
			NGUIEditorTools.DrawProperty("Y", serializedObject, "padding.y", GUILayout.MinWidth(30f));
			NGUIEditorTools.DrawPadding();
			NGUIEditorTools.SetLabelWidth(80f);
			GUILayout.EndHorizontal();

			NGUIEditorTools.EndContents();
		}
	}

19 View Source File : UIPrefabTool.cs
License : MIT License
Project Creator : mamoniem

void OnGUI ()
	{
		Event currentEvent = Event.current;
		EventType type = currentEvent.type;

		int x = cellPadding, y = cellPadding;
		int width = Screen.width - cellPadding;
		int spacingX = cellSize + cellPadding;
		int spacingY = spacingX;
		if (mMode == Mode.DetailedMode) spacingY += 32;

		GameObject dragged = draggedObject;
		bool isDragging = (dragged != null);
		int indexUnderMouse = GetCellUnderMouse(spacingX, spacingY);
		Item selection = isDragging ? FindItem(dragged) : null;
		string searchFilter = NGUISettings.searchField;

		int newTab = mTab;

		GUILayout.BeginHorizontal();
		if (GUILayout.Toggle(newTab == 0, "1", "ButtonLeft")) newTab = 0;
		if (GUILayout.Toggle(newTab == 1, "2", "ButtonMid")) newTab = 1;
		if (GUILayout.Toggle(newTab == 2, "3", "ButtonMid")) newTab = 2;
		if (GUILayout.Toggle(newTab == 3, "4", "ButtonMid")) newTab = 3;
		if (GUILayout.Toggle(newTab == 4, "5", "ButtonRight")) newTab = 4;
		GUILayout.EndHorizontal();

		if (mTab != newTab)
		{
			Save();
			mTab = newTab;
			mReset = true;
			NGUISettings.SetInt("NGUI Prefab Tab", mTab);
			Load();
		}

		if (mReset && type == EventType.Repaint)
		{
			mReset = false;
			foreach (Item item in mItems) GeneratePreview(item, null);
			RectivateLights();
		}

		// Search field
		GUILayout.BeginHorizontal();
		{
			string after = EditorGUILayout.TextField("", searchFilter, "SearchTextField", GUILayout.Width(Screen.width - 20f));

			if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
			{
				after = "";
				GUIUtility.keyboardControl = 0;
			}

			if (searchFilter != after)
			{
				NGUISettings.searchField = after;
				searchFilter = after;
			}
		}
		GUILayout.EndHorizontal();

		bool eligibleToDrag = (currentEvent.mousePosition.y < Screen.height - 40);

		if (type == EventType.MouseDown)
		{
			mMouseIsInside = true;
		}
		else if (type == EventType.MouseDrag)
		{
			mMouseIsInside = true;

			if (indexUnderMouse != -1 && eligibleToDrag)
			{
				// Drag operation begins
				if (draggedObjectIsOurs) DragAndDrop.StartDrag("Prefab Tool");
				currentEvent.Use();
			}
		}
		else if (type == EventType.MouseUp)
		{
			DragAndDrop.PrepareStartDrag();
			mMouseIsInside = false;
			Repaint();
		}
		else if (type == EventType.DragUpdated)
		{
			// Something dragged into the window
			mMouseIsInside = true;
			UpdateVisual();
			currentEvent.Use();
		}
		else if (type == EventType.DragPerform)
		{
			// We've dropped a new object into the window
			if (dragged != null)
			{
				if (selection != null)
				{
					DestroyTexture(selection);
					mItems.Remove(selection);
				}

				AddItem(dragged, indexUnderMouse);
				draggedObject = null;
			}
			mMouseIsInside = false;
			currentEvent.Use();
		}
		else if (type == EventType.DragExited || type == EventType.Ignore)
		{
			mMouseIsInside = false;
		}

		// If the mouse is not inside the window, clear the selection and dragged object
		if (!mMouseIsInside)
		{
			selection = null;
			dragged = null;
		}

		// Create a list of indices, inserting an entry of '-1' underneath the dragged object
		BetterList<int> indices = new BetterList<int>();

		for (int i = 0; i < mItems.size; )
		{
			if (dragged != null && indices.size == indexUnderMouse)
				indices.Add(-1);

			if (mItems[i] != selection)
			{
				if (string.IsNullOrEmpty(searchFilter) ||
					mItems[i].prefab.name.IndexOf(searchFilter, System.StringComparison.CurrentCultureIgnoreCase) != -1)
						indices.Add(i);
			}
			++i;
		}

		// There must always be '-1' (Add/Move slot) present
		if (!indices.Contains(-1)) indices.Add(-1);

		// We want to start dragging something from within the window
		if (eligibleToDrag && type == EventType.MouseDown && indexUnderMouse > -1)
		{
			GUIUtility.keyboardControl = 0;

			if (currentEvent.button == 0 && indexUnderMouse < indices.size)
			{
				int index = indices[indexUnderMouse];

				if (index != -1 && index < mItems.size)
				{
					selection = mItems[index];
					draggedObject = selection.prefab;
					dragged = selection.prefab;
					currentEvent.Use();
				}
			}
		}
		//else if (type == EventType.MouseUp && currentEvent.button == 1 && indexUnderMouse > mItems.size)
		//{
		//    NGUIContextMenu.AddItem("Reset", false, RemoveItem, index);
		//    NGUIContextMenu.Show();
		//}

		// Draw the scroll view with prefabs
		mPos = GUILayout.BeginScrollView(mPos);
		{
			Color normal = new Color(1f, 1f, 1f, 0.5f);

			for (int i = 0; i < indices.size; ++i)
			{
				int index = indices[i];
				Item ent = (index != -1) ? mItems[index] : selection;

				if (ent != null && ent.prefab == null)
				{
					mItems.RemoveAt(index);
					continue;
				}

				Rect rect = new Rect(x, y, cellSize, cellSize);
				Rect inner = rect;
				inner.xMin += 2f;
				inner.xMax -= 2f;
				inner.yMin += 2f;
				inner.yMax -= 2f;
				rect.yMax -= 1f; // Button seems to be mis-shaped. It's height is larger than its width by a single pixel.

				if (!isDragging && (mMode == Mode.CompactMode || (ent == null || ent.tex != null)))
					mContent.tooltip = (ent != null) ? ent.prefab.name : "Click to add";
				else mContent.tooltip = "";

				//if (ent == selection)
				{
					GUI.color = normal;
					NGUIEditorTools.DrawTiledTexture(inner, NGUIEditorTools.backdropTexture);
				}

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

				if (GUI.Button(rect, mContent, "Button"))
				{
					if (ent == null || currentEvent.button == 0)
					{
						string path = EditorUtility.OpenFilePanel("Add a prefab", NGUISettings.currentPath, "prefab");

						if (!string.IsNullOrEmpty(path))
						{
							NGUISettings.currentPath = System.IO.Path.GetDirectoryName(path);
							Item newEnt = CreateItemByPath(path);

							if (newEnt != null)
							{
								mItems.Add(newEnt);
								Save();
							}
						}
					}
					else if (currentEvent.button == 1)
					{
						NGUIContextMenu.AddItem("Delete", false, RemoveItem, index);
						NGUIContextMenu.Show();
					}
				}

				string caption = (ent == null) ? "" : ent.prefab.name.Replace("Control - ", "");

				if (ent != null)
				{
					if (ent.tex != null)
					{
						GUI.DrawTexture(inner, ent.tex);
					}
					else if (mMode != Mode.DetailedMode)
					{
						GUI.Label(inner, caption, mStyle);
						caption = "";
					}
				}
				else GUI.Label(inner, "Add", mStyle);

				if (mMode == Mode.DetailedMode)
				{
					GUI.backgroundColor = new Color(1f, 1f, 1f, 0.5f);
					GUI.contentColor = new Color(1f, 1f, 1f, 0.7f);
					GUI.Label(new Rect(rect.x, rect.y + rect.height, rect.width, 32f), caption, "ProgressBarBack");
					GUI.contentColor = Color.white;
					GUI.backgroundColor = Color.white;
				}

				x += spacingX;

				if (x + spacingX > width)
				{
					y += spacingY;
					x = cellPadding;
				}
			}
			GUILayout.Space(y);
		}
		GUILayout.EndScrollView();

		// Mode
		Mode modeAfter = (Mode)EditorGUILayout.EnumPopup(mMode);

		if (modeAfter != mMode)
		{
			mMode = modeAfter;
			mReset = true;
			NGUISettings.SetEnum("NGUI Prefab Mode", mMode);
		}
	}

19 View Source File : UIRootEditor.cs
License : MIT License
Project Creator : mamoniem

public override void OnInspectorGUI ()
	{
		serializedObject.Update();
		NGUIEditorTools.SetLabelWidth(110f);

		SerializedProperty sp = NGUIEditorTools.DrawProperty("Scaling Style", serializedObject, "scalingStyle");

		UIRoot.Scaling scaling = (UIRoot.Scaling)sp.intValue;

		if (scaling == UIRoot.Scaling.Flexible)
		{
			NGUIEditorTools.DrawProperty("Minimum Height", serializedObject, "minimumHeight");
			NGUIEditorTools.DrawProperty("Maximum Height", serializedObject, "maximumHeight");
			NGUIEditorTools.DrawProperty("Shrink Portrait UI", serializedObject, "shrinkPortraitUI");
			NGUIEditorTools.DrawProperty("Adjust by DPI", serializedObject, "adjustByDPI");

			EditorGUILayout.HelpBox("Also known as the 'Pixel-Perfect' mode, this setting makes NGUI's virtual pixels match the screen. This means that your UI will look smaller on high resolution devices and bigger on lower resolution devices, but it will always be as crisp as it can be." +
				"\n\nIdeal usage: PC games with a modular user interface that takes advantage of widget anchoring.", MessageType.Info);
		}
		else
		{
			GUILayout.BeginHorizontal();
			NGUIEditorTools.DrawProperty("Content Width", serializedObject, "manualWidth", GUILayout.Width(160f));
			NGUIEditorTools.SetLabelWidth(26f);
			bool fitWidth = NGUIEditorTools.DrawProperty("Fit", serializedObject, "fitWidth").boolValue;
			NGUIEditorTools.SetLabelWidth(110f);
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			NGUIEditorTools.DrawProperty("Content Height", serializedObject, "manualHeight", GUILayout.Width(160f));
			NGUIEditorTools.SetLabelWidth(26f);
			bool fitHeight = NGUIEditorTools.DrawProperty("Fit", serializedObject, "fitHeight").boolValue;
			NGUIEditorTools.SetLabelWidth(110f);
			GUILayout.EndHorizontal();

			if (fitHeight)
			{
				if (fitWidth)
				{
					EditorGUILayout.HelpBox("Whatever you create within the content frame (blue outline) will always be visible, regardless of the screen's aspect ratio." +
						"\n\nThink of it as choosing the 'Fit' desktop background style.", MessageType.Info);
				}
				else
				{
					EditorGUILayout.HelpBox("This setting will keep your UI look the same on all screen sizes relative to the height of the screen." +
						"\n\nYou will still be able to see more or less on the left and right sides of the screen as the aspect ratio changes.", MessageType.Info);
				}
			}
			else if (fitWidth)
			{
				EditorGUILayout.HelpBox("This setting will keep your UI look the same on all screen sizes relative to the width of the screen." +
					"\n\nYou will still be able to see more or less on the top and bottom sides sides of the screen as the aspect ratio changes.", MessageType.Info);
			}
			else
			{
				EditorGUILayout.HelpBox("Your UI within the content frame (blue outline) will always fill the screen, and edges will be cropped based on the aspect ratio." +
					"\n\nThink of it as choosing the 'Fill' desktop background style.", MessageType.Info);
			}
		}

		serializedObject.ApplyModifiedProperties();
	}

19 View Source File : UIScrollViewEditor.cs
License : MIT License
Project Creator : mamoniem

public override void OnInspectorGUI ()
	{
		NGUIEditorTools.SetLabelWidth(130f);

		GUILayout.Space(3f);
		serializedObject.Update();

		SerializedProperty sppv = serializedObject.FindProperty("contentPivot");
		UIWidget.Pivot before = (UIWidget.Pivot)sppv.intValue;

		NGUIEditorTools.DrawProperty("Content Origin", sppv, false);

		SerializedProperty sp = NGUIEditorTools.DrawProperty("Movement", serializedObject, "movement");

		if (((UIScrollView.Movement)sp.intValue) == UIScrollView.Movement.Custom)
		{
			NGUIEditorTools.SetLabelWidth(20f);

			GUILayout.BeginHorizontal();
			GUILayout.Space(114f);
			NGUIEditorTools.DrawProperty("X", serializedObject, "customMovement.x", GUILayout.MinWidth(20f));
			NGUIEditorTools.DrawProperty("Y", serializedObject, "customMovement.y", GUILayout.MinWidth(20f));
			GUILayout.EndHorizontal();
		}

		NGUIEditorTools.SetLabelWidth(130f);

		NGUIEditorTools.DrawProperty("Drag Effect", serializedObject, "dragEffect");
		NGUIEditorTools.DrawProperty("Scroll Wheel Factor", serializedObject, "scrollWheelFactor");
		NGUIEditorTools.DrawProperty("Momentum Amount", serializedObject, "momentumAmount");

		NGUIEditorTools.DrawProperty("Restrict Within Panel", serializedObject, "restrictWithinPanel");
		NGUIEditorTools.DrawProperty("Cancel Drag If Fits", serializedObject, "disableDragIfFits");
		NGUIEditorTools.DrawProperty("Smooth Drag Start", serializedObject, "smoothDragStart");
		NGUIEditorTools.DrawProperty("IOS Drag Emulation", serializedObject, "iOSDragEmulation");

		NGUIEditorTools.SetLabelWidth(100f);

		if (NGUIEditorTools.DrawHeader("Scroll Bars"))
		{
			NGUIEditorTools.BeginContents();
			NGUIEditorTools.DrawProperty("Horizontal", serializedObject, "horizontalScrollBar");
			NGUIEditorTools.DrawProperty("Vertical", serializedObject, "verticalScrollBar");
			NGUIEditorTools.DrawProperty("Show Condition", serializedObject, "showScrollBars");
			NGUIEditorTools.EndContents();
		}
		serializedObject.ApplyModifiedProperties();

		if (before != (UIWidget.Pivot)sppv.intValue)
		{
			(target as UIScrollView).ResetPosition();
		}
	}

19 View Source File : UISpriteInspector.cs
License : MIT License
Project Creator : mamoniem

protected override bool ShouldDrawProperties ()
	{
		GUILayout.BeginHorizontal();
		if (NGUIEditorTools.DrawPrefixButton("Atlas"))
			ComponentSelector.Show<UIAtlas>(OnSelectAtlas);
		SerializedProperty atlas = NGUIEditorTools.DrawProperty("", serializedObject, "mAtlas", GUILayout.MinWidth(20f));
		
		if (GUILayout.Button("Edit", GUILayout.Width(40f)))
		{
			if (atlas != null)
			{
				UIAtlas atl = atlas.objectReferenceValue as UIAtlas;
				NGUISettings.atlas = atl;
				NGUIEditorTools.Select(atl.gameObject);
			}
		}
		GUILayout.EndHorizontal();

		SerializedProperty sp = serializedObject.FindProperty("mSpriteName");
		NGUIEditorTools.DrawAdvancedSpriteField(atlas.objectReferenceValue as UIAtlas, sp.stringValue, SelectSprite, false);
		return true;
	}

19 View Source File : UIWidgetInspector.cs
License : MIT License
Project Creator : mamoniem

static public void DrawInspectorProperties (SerializedObject so, UIWidget w, bool drawColor)
	{
		if (drawColor)
		{
			DrawColor(so, w);
			GUILayout.Space(3f);
		}

		PrefabType type = PrefabUtility.GetPrefabType(w.gameObject);

		if (NGUIEditorTools.DrawHeader("Widget"))
		{
			NGUIEditorTools.BeginContents();
			if (NGUISettings.minimalisticLook) NGUIEditorTools.SetLabelWidth(70f);

			DrawPivot(so, w);
			DrawDepth(so, w, type == PrefabType.Prefab);
			DrawDimensions(so, w, type == PrefabType.Prefab);
			if (NGUISettings.minimalisticLook) NGUIEditorTools.SetLabelWidth(70f);

			SerializedProperty ratio = so.FindProperty("aspectRatio");
			SerializedProperty aspect = so.FindProperty("keepAspectRatio");

			GUILayout.BeginHorizontal();
			{
				if (!aspect.hasMultipleDifferentValues && aspect.intValue == 0)
				{
					EditorGUI.BeginDisabledGroup(true);
					NGUIEditorTools.DrawProperty("Aspect", ratio, false, GUILayout.Width(130f));
					EditorGUI.EndDisabledGroup();
				}
				else NGUIEditorTools.DrawProperty("Aspect", ratio, false, GUILayout.Width(130f));

				NGUIEditorTools.DrawProperty("", aspect, false, GUILayout.MinWidth(20f));
			}
			GUILayout.EndHorizontal();

			if (so.isEditingMultipleObjects || w.hasBoxCollider)
			{
				GUILayout.BeginHorizontal();
				{
					NGUIEditorTools.DrawProperty("Collider", so, "autoResizeBoxCollider", GUILayout.Width(100f));
					GUILayout.Label("auto-adjust to match");
				}
				GUILayout.EndHorizontal();
			}
			NGUIEditorTools.EndContents();
		}
	}

19 View Source File : UIWidgetInspector.cs
License : MIT License
Project Creator : mamoniem

static void DrawDimensions (SerializedObject so, UIWidget w, bool isPrefab)
	{
		GUILayout.BeginHorizontal();
		{
			bool freezeSize = so.isEditingMultipleObjects;

			UILabel lbl = w as UILabel;

			if (!freezeSize && lbl) freezeSize = (lbl.overflowMethod == UILabel.Overflow.ResizeFreely);

			if (freezeSize)
			{
				EditorGUI.BeginDisabledGroup(true);
				NGUIEditorTools.DrawProperty("Size", so, "mWidth", GUILayout.MinWidth(100f));
				EditorGUI.EndDisabledGroup();
			}
			else
			{
				GUI.changed = false;
				int val = EditorGUILayout.IntField("Size", w.width, GUILayout.MinWidth(100f));

				if (GUI.changed)
				{
					NGUIEditorTools.RegisterUndo("Dimensions Change", w);
					w.width = val;
				}
			}

			if (!freezeSize && lbl)
			{
				UILabel.Overflow ov = lbl.overflowMethod;
				freezeSize = (ov == UILabel.Overflow.ResizeFreely || ov == UILabel.Overflow.ResizeHeight);
			}

			NGUIEditorTools.SetLabelWidth(12f);

			if (freezeSize)
			{
				EditorGUI.BeginDisabledGroup(true);
				NGUIEditorTools.DrawProperty("x", so, "mHeight", GUILayout.MinWidth(30f));
				EditorGUI.EndDisabledGroup();
			}
			else
			{
				GUI.changed = false;
				int val = EditorGUILayout.IntField("x", w.height, GUILayout.MinWidth(30f));

				if (GUI.changed)
				{
					NGUIEditorTools.RegisterUndo("Dimensions Change", w);
					w.height = val;
				}
			}

			NGUIEditorTools.SetLabelWidth(80f);

			if (isPrefab)
			{
				GUILayout.Space(70f);
			}
			else
			{
				EditorGUI.BeginDisabledGroup(so.isEditingMultipleObjects);

				if (GUILayout.Button("Snap", GUILayout.Width(60f)))
				{
					foreach (GameObject go in Selection.gameObjects)
					{
						UIWidget pw = go.GetComponent<UIWidget>();

						if (pw != null)
						{
							NGUIEditorTools.RegisterUndo("Snap Dimensions", pw);
							NGUIEditorTools.RegisterUndo("Snap Dimensions", pw.transform);
							pw.MakePixelPerfect();
						}
					}
				}
				EditorGUI.EndDisabledGroup();
			}
		}
		GUILayout.EndHorizontal();
	}

19 View Source File : UIWidgetInspector.cs
License : MIT License
Project Creator : mamoniem

static void DrawDepth (SerializedObject so, UIWidget w, bool isPrefab)
	{
		if (isPrefab) return;

		GUILayout.Space(2f);
		GUILayout.BeginHorizontal();
		{
			EditorGUILayout.PrefixLabel("Depth");

			if (GUILayout.Button("Back", GUILayout.MinWidth(46f)))
			{
				foreach (GameObject go in Selection.gameObjects)
				{
					UIWidget pw = go.GetComponent<UIWidget>();
					if (pw != null) pw.depth = w.depth - 1;
				}
			}

			NGUIEditorTools.DrawProperty("", so, "mDepth", GUILayout.MinWidth(20f));

			if (GUILayout.Button("Forward", GUILayout.MinWidth(60f)))
			{
				foreach (GameObject go in Selection.gameObjects)
				{
					UIWidget pw = go.GetComponent<UIWidget>();
					if (pw != null) pw.depth = w.depth + 1;
				}
			}
		}
		GUILayout.EndHorizontal();

		int matchingDepths = 1;

		UIPanel p = w.panel;

		if (p != null)
		{
			for (int i = 0, imax = p.widgets.Count; i < imax; ++i)
			{
				UIWidget pw = p.widgets[i];
				if (pw != w && pw.depth == w.depth)
					++matchingDepths;
			}
		}

		if (matchingDepths > 1)
		{
			EditorGUILayout.HelpBox(matchingDepths + " widgets are sharing the depth value of " + w.depth, MessageType.Info);
		}
	}

19 View Source File : UIWidgetInspector.cs
License : MIT License
Project Creator : mamoniem

static void DrawPivot (SerializedObject so, UIWidget w)
	{
		SerializedProperty pv = so.FindProperty("mPivot");

		if (pv.hasMultipleDifferentValues)
		{
			// TODO: Doing this doesn't keep the widget's position where it was. Another approach is needed.
			NGUIEditorTools.DrawProperty("Pivot", so, "mPivot");
		}
		else
		{
			// Pivot point -- the new, more visual style
			GUILayout.BeginHorizontal();
			GUILayout.Label("Pivot", GUILayout.Width(NGUISettings.minimalisticLook ? 66f : 76f));
			Toggle(w, "\u25C4", "ButtonLeft", UIWidget.Pivot.Left, true);
			Toggle(w, "\u25AC", "ButtonMid", UIWidget.Pivot.Center, true);
			Toggle(w, "\u25BA", "ButtonRight", UIWidget.Pivot.Right, true);
			Toggle(w, "\u25B2", "ButtonLeft", UIWidget.Pivot.Top, false);
			Toggle(w, "\u258C", "ButtonMid", UIWidget.Pivot.Center, false);
			Toggle(w, "\u25BC", "ButtonRight", UIWidget.Pivot.Bottom, false);

			GUILayout.EndHorizontal();
			pv.enumValueIndex = (int)w.pivot;
		}
	}

19 View Source File : UIWidgetInspector.cs
License : MIT License
Project Creator : mamoniem

protected override void OnDrawFinalProperties ()
	{
		if (mAnchorType == AnchorType.Advanced || !mWidget.isAncreplacedd) return;

		SerializedProperty sp = serializedObject.FindProperty("leftAnchor.target");

		if (!IsRect(sp))
		{
			GUILayout.Space(3f);
			GUILayout.BeginHorizontal();
			GUILayout.Space(6f);
			NGUIEditorTools.DrawProperty("", serializedObject, "hideIfOffScreen", GUILayout.Width(18f));
			GUILayout.Label("Hide if off-screen", GUILayout.MinWidth(20f));
			GUILayout.EndHorizontal();
		}
	}

19 View Source File : UIWrapContentEditor.cs
License : MIT License
Project Creator : mamoniem

public override void OnInspectorGUI ()
	{
		GUILayout.Space(6f);
		NGUIEditorTools.SetLabelWidth(90f);

		string fieldName = "Item Size";
		string error = null;
		UIScrollView sv = null;

		if (!serializedObject.isEditingMultipleObjects)
		{
			UIWrapContent list = target as UIWrapContent;
			sv = NGUITools.FindInParents<UIScrollView>(list.gameObject);

			if (sv == null)
			{
				error = "UIWrappedList needs a Scroll View on its parent in order to work properly";
			}
			else if (sv.movement == UIScrollView.Movement.Horizontal) fieldName = "Item Width";
			else if (sv.movement == UIScrollView.Movement.Vertical) fieldName = "Item Height";
			else
			{
				error = "Scroll View needs to be using Horizontal or Vertical movement";
			}
		}

		serializedObject.Update();
		GUILayout.BeginHorizontal();
		NGUIEditorTools.DrawProperty(fieldName, serializedObject, "itemSize", GUILayout.Width(130f));
		GUILayout.Label("pixels");
		GUILayout.EndHorizontal();

		GUILayout.BeginHorizontal();
		SerializedProperty sp1 = NGUIEditorTools.DrawProperty("Range Limit", serializedObject, "minIndex", GUILayout.Width(130f));
		NGUIEditorTools.SetLabelWidth(20f);
		SerializedProperty sp2 = NGUIEditorTools.DrawProperty("to", serializedObject, "maxIndex", GUILayout.Width(60f));
		NGUIEditorTools.SetLabelWidth(90f);
		if (sp1.intValue == sp2.intValue) GUILayout.Label("unlimited");
		GUILayout.EndHorizontal();

		NGUIEditorTools.DrawProperty("Cull Content", serializedObject, "cullContent");

		if (!string.IsNullOrEmpty(error))
		{
			EditorGUILayout.HelpBox(error, MessageType.Error);
			if (sv != null && GUILayout.Button("Select the Scroll View"))
				Selection.activeGameObject = sv.gameObject;
		}

		serializedObject.ApplyModifiedProperties();

		if (sp1.intValue != sp2.intValue)
		{
			if ((target as UIWrapContent).GetComponent<UICenterOnChild>() != null)
			{
				EditorGUILayout.HelpBox("Limiting indices doesn't play well with UICenterOnChild. You should either not limit the indices, or not use UICenterOnChild.", MessageType.Warning);
			}
		}
	}

19 View Source File : UIPanelTool.cs
License : MIT License
Project Creator : mamoniem

bool DrawRow (Entry ent, UIPanel selected, bool isChecked)
	{
		bool retVal = false;
		string panelName, layer, depth, widgetCount, drawCalls, clipping, triangles;

		if (ent != null)
		{
			panelName = ent.panel.name;
			layer = LayerMask.LayerToName(ent.panel.gameObject.layer);
			depth = ent.panel.depth.ToString();
			widgetCount = ent.widgets.Count.ToString();
			drawCalls = ent.panel.drawCalls.Count.ToString();
			clipping = (ent.panel.clipping != UIDrawCall.Clipping.None) ? "Yes" : "";

			int triangeCount = 0;
			foreach (var dc in ent.panel.drawCalls)
				triangeCount += dc.triangles;

			triangles = triangeCount.ToString();
		}
		else
		{
			panelName = "Panel's Name";
			layer = "Layer";
			depth = "DP";
			widgetCount = "WG";
			drawCalls = "DC";
			clipping = "Clip";
			triangles = "Tris";
		}

		if (ent != null) GUILayout.Space(-1f);

		if (ent != null)
		{
			GUI.backgroundColor = ent.panel == selected ? Color.white : new Color(0.8f, 0.8f, 0.8f);
			GUILayout.BeginHorizontal("AS TextArea", GUILayout.MinHeight(20f));
			GUI.backgroundColor = Color.white;
		}
		else
		{
			GUILayout.BeginHorizontal();
		}

		GUI.contentColor = (ent == null || ent.isEnabled) ? Color.white : new Color(0.7f, 0.7f, 0.7f);
		if (isChecked != EditorGUILayout.Toggle(isChecked, GUILayout.Width(20f))) retVal = true;

		GUILayout.Label(depth, GUILayout.Width(30f));

		if (GUILayout.Button(panelName, EditorStyles.label, GUILayout.MinWidth(100f)))
		{
			if (ent != null)
			{
				Selection.activeGameObject = ent.panel.gameObject;
				EditorUtility.SetDirty(ent.panel.gameObject);
			}
		}

		GUILayout.Label(layer, GUILayout.Width(ent == null ? 65f : 70f));
		GUILayout.Label(widgetCount, GUILayout.Width(30f));
		GUILayout.Label(drawCalls, GUILayout.Width(30f));
		GUILayout.Label(clipping, GUILayout.Width(30f));
		GUILayout.Label(triangles, GUILayout.Width(30f));

		if (ent == null)
		{
			GUILayout.Label("Stc", GUILayout.Width(24f));
		}
		else
		{
			bool val = ent.panel.widgetsAreStatic;

			if (val != EditorGUILayout.Toggle(val, GUILayout.Width(20f)))
			{
				ent.panel.widgetsAreStatic = !val;
				EditorUtility.SetDirty(ent.panel.gameObject);
#if !UNITY_3_5
				if (NGUITransformInspector.instance != null)
					NGUITransformInspector.instance.Repaint();
#endif
			}
		}
		GUI.contentColor = Color.white;
		GUILayout.EndHorizontal();
		return retVal;
	}

19 View Source File : UIProgressBarEditor.cs
License : MIT License
Project Creator : mamoniem

public override void OnInspectorGUI ()
	{
		NGUIEditorTools.SetLabelWidth(80f);

		serializedObject.Update();

		GUILayout.Space(3f);

		DrawLegacyFields();

		GUILayout.BeginHorizontal();
		SerializedProperty sp = NGUIEditorTools.DrawProperty("Steps", serializedObject, "numberOfSteps", GUILayout.Width(110f));
		if (sp.intValue == 0) GUILayout.Label("= unlimited");
		GUILayout.EndHorizontal();

		OnDrawExtraFields();

		if (NGUIEditorTools.DrawHeader("Appearance", "Appearance", false, true))
		{
			NGUIEditorTools.BeginContents(true);
			NGUIEditorTools.DrawProperty("Foreground", serializedObject, "mFG");
			NGUIEditorTools.DrawProperty("Background", serializedObject, "mBG");
			NGUIEditorTools.DrawProperty("Thumb", serializedObject, "thumb");

			GUILayout.BeginHorizontal();
			NGUIEditorTools.DrawProperty("Direction", serializedObject, "mFill");
			NGUIEditorTools.DrawPadding();
			GUILayout.EndHorizontal();

			OnDrawAppearance();
			NGUIEditorTools.EndContents();
		}

		UIProgressBar sb = target as UIProgressBar;
		NGUIEditorTools.DrawEvents("On Value Change", sb, sb.onChange);
		serializedObject.ApplyModifiedProperties();
	}

19 View Source File : UIRectEditor.cs
License : MIT License
Project Creator : mamoniem

public void DrawAnchorTransform ()
	{
		if (NGUIEditorTools.DrawHeader("Anchors"))
		{
			NGUIEditorTools.BeginContents();
			NGUIEditorTools.SetLabelWidth(NGUISettings.minimalisticLook ? 69f : 62f);

			EditorGUI.BeginDisabledGroup(!((target as UIRect).canBeAncreplacedd));
			GUILayout.BeginHorizontal();
			AnchorType type = (AnchorType)EditorGUILayout.EnumPopup("Type", mAnchorType);
			NGUIEditorTools.DrawPadding();
			GUILayout.EndHorizontal();

			SerializedProperty[] tg = new SerializedProperty[4];
			for (int i = 0; i < 4; ++i) tg[i] = serializedObject.FindProperty(FieldName[i] + ".target");

			if (mAnchorType == AnchorType.None && type != AnchorType.None)
			{
				if (type == AnchorType.Unified)
				{
					if (mTarget[0] == null && mTarget[1] == null && mTarget[2] == null && mTarget[3] == null)
					{
						UIRect rect = target as UIRect;
						UIRect parent = NGUITools.FindInParents<UIRect>(rect.cachedTransform.parent);

						if (parent != null)
							for (int i = 0; i < 4; ++i)
								mTarget[i] = parent.cachedTransform;
					}
				}

				for (int i = 0; i < 4; ++i)
				{
					tg[i].objectReferenceValue = mTarget[i];
					mTarget[i] = null;
				}
				UpdateAnchors(true);
			}

			if (type != AnchorType.None)
			{
				NGUIEditorTools.DrawPaddedProperty("Execute", serializedObject, "updateAnchors");
			}

			if (type == AnchorType.Advanced)
			{
				DrawAnchor(0, true);
				DrawAnchor(1, true);
				DrawAnchor(2, true);
				DrawAnchor(3, true);
			}
			else if (type == AnchorType.Unified)
			{
				DrawSingleAnchorSelection();

				DrawAnchor(0, false);
				DrawAnchor(1, false);
				DrawAnchor(2, false);
				DrawAnchor(3, false);
			}
			else if (type == AnchorType.None && mAnchorType != type)
			{
				// Save values to make it easy to "go back"
				for (int i = 0; i < 4; ++i)
				{
					mTarget[i] = tg[i].objectReferenceValue as Transform;
					tg[i].objectReferenceValue = null;
				}

				serializedObject.FindProperty("leftAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("bottomAnchor.relative").floatValue = 0f;
				serializedObject.FindProperty("rightAnchor.relative").floatValue = 1f;
				serializedObject.FindProperty("topAnchor.relative").floatValue = 1f;
			}

			mAnchorType = type;
			OnDrawFinalProperties();
			EditorGUI.EndDisabledGroup();
			NGUIEditorTools.EndContents();
		}
	}

19 View Source File : UIRectEditor.cs
License : MIT License
Project Creator : mamoniem

protected void DrawAnchor (int index, bool targetSelection)
	{
		//if (targetSelection) GUILayout.Space(3f);

		//NGUIEditorTools.SetLabelWidth(16f);
		GUILayout.BeginHorizontal();
		GUILayout.Label(PrefixName[index], GUILayout.Width(NGUISettings.minimalisticLook ? 65f : 56f));

		UIRect myRect = serializedObject.targetObject as UIRect;
		string name = FieldName[index];

		SerializedProperty tar = serializedObject.FindProperty(name + ".target");
		SerializedProperty rel = serializedObject.FindProperty(name + ".relative");
		SerializedProperty abs = serializedObject.FindProperty(name + ".absolute");

		if (targetSelection)
		{
			Object before = tar.objectReferenceValue;
			NGUIEditorTools.DrawProperty("", tar, false, GUILayout.MinWidth(20f));
			Object after = tar.objectReferenceValue;

			if (after != null || tar.hasMultipleDifferentValues)
			{
				if (before != after && after != null)
					UpdateAnchor(index, true);
			}

			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal();
			GUILayout.Label(" ", GUILayout.Width(NGUISettings.minimalisticLook ? 65f : 56f));
		}

		UIRect targetRect = GetRect(tar);
		Camera targetCam = GetCamera(tar);
		float relative = rel.floatValue;
		bool isCommon = (targetRect == null && targetCam == null) || IsCommon(relative);
		int previousOrigin = 1;

		if (targetRect != null || targetCam != null)
		{
			if (mCustom[index] || !isCommon) previousOrigin = 3;
			else if (relative == 0f) previousOrigin = 0;
			else if (relative == 1f) previousOrigin = 2;
		}

		// Draw the origin selection list
		EditorGUI.BeginDisabledGroup(targetRect == null && targetCam == null);
		int newOrigin = IsHorizontal[index] ?
			EditorGUILayout.Popup(previousOrigin, HorizontalList) :
			EditorGUILayout.Popup(previousOrigin, VerticalList);
		EditorGUI.EndDisabledGroup();

		// "Set to Current" choice
		if (newOrigin == 4)
		{
			newOrigin = 3;

			Vector3[] sides = targetRect.GetSides(myRect.cachedTransform);

			float f0, f1;

			if (IsHorizontal[index])
			{
				f0 = sides[0].x;
				f1 = sides[2].x;
			}
			else
			{
				f0 = sides[3].y;
				f1 = sides[1].y;
			}

			// Final position after both relative and absolute values are taken into consideration
			float final = Mathf.Floor(0.5f + Mathf.Lerp(0f, f1 - f0, rel.floatValue) + abs.intValue);

			rel.floatValue = final / (f1 - f0);
			abs.intValue = 0;

			serializedObject.ApplyModifiedProperties();
			serializedObject.Update();
		}

		mCustom[index] = (newOrigin == 3);

		// If the origin changes
		if (newOrigin != 3 && previousOrigin != newOrigin)
		{
			// Desired relative value
			if (newOrigin == 0) relative = 0f;
			else if (newOrigin == 2) relative = 1f;
			else relative = 0.5f;

			Vector3[] sides = (targetRect != null) ?
				targetRect.GetSides(myRect.cachedTransform) :
				targetCam.GetSides(myRect.cachedTransform);

			// Calculate the current position based from the bottom-left
			float f0, f1;

			if (IsHorizontal[index])
			{
				f0 = sides[0].x;
				f1 = sides[2].x;
			}
			else
			{
				f0 = sides[3].y;
				f1 = sides[1].y;
			}

			// Final position after both relative and absolute values are taken into consideration
			float final = Mathf.Floor(0.5f + Mathf.Lerp(f0, f1, rel.floatValue) + abs.intValue);

			rel.floatValue = relative;
			abs.intValue = Mathf.FloorToInt(final + 0.5f - Mathf.Lerp(f0, f1, relative));

			serializedObject.ApplyModifiedProperties();
			serializedObject.Update();
		}

		if (mCustom[index])
		{
			// Draw the relative value
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal();
			GUILayout.Space(64f);

			relative = rel.floatValue;
			bool isOutside01 = relative < 0f || relative > 1f;

			// Horizontal slider for relative values, for convenience
			EditorGUI.BeginDisabledGroup(isOutside01);
			{
				GUILayout.Space(10f);
				float val = GUILayout.HorizontalSlider(relative, 0f, 1f);

				NGUIEditorTools.DrawProperty("", rel, false, GUILayout.Width(40f));

				if (!isOutside01 && val != relative)
				{
					Vector3[] sides = (targetRect != null) ?
						targetRect.GetSides(myRect.cachedTransform) :
						targetCam.GetSides(myRect.cachedTransform);

					// Calculate the current position based from the bottom-left
					float f0, f1;

					if (IsHorizontal[index])
					{
						f0 = sides[0].x;
						f1 = sides[2].x;
					}
					else
					{
						f0 = sides[3].y;
						f1 = sides[1].y;
					}

					float size = (f1 - f0);
					int intVal = Mathf.FloorToInt(val * size + 0.5f);
					//intVal = ((intVal >> 1) << 1);
					rel.floatValue = (size > 0f) ? intVal / size : 0.5f;
				}
			}
			EditorGUI.EndDisabledGroup();
		}

		// Draw the absolute value
		NGUIEditorTools.SetLabelWidth(16f);
		NGUIEditorTools.DrawProperty("+", abs, false, GUILayout.Width(60f));
		
		GUILayout.EndHorizontal();
		NGUIEditorTools.SetLabelWidth(NGUISettings.minimalisticLook ? 69f : 62f);
	}

19 View Source File : UIToggleInspector.cs
License : MIT License
Project Creator : mamoniem

public override void OnInspectorGUI ()
	{
		serializedObject.Update();

		NGUIEditorTools.SetLabelWidth(100f);
		UIToggle toggle = target as UIToggle;

		GUILayout.Space(6f);
		GUI.changed = false;

		GUILayout.BeginHorizontal();
		SerializedProperty sp = NGUIEditorTools.DrawProperty("Group", serializedObject, "group", GUILayout.Width(120f));
		GUILayout.Label(" - zero means 'none'");
		GUILayout.EndHorizontal();

		EditorGUI.BeginDisabledGroup(sp.intValue == 0);
		NGUIEditorTools.DrawProperty("  State of 'None'", serializedObject, "optionCanBeNone");
		EditorGUI.EndDisabledGroup();

		NGUIEditorTools.DrawProperty("Starting State", serializedObject, "startsActive");
		NGUIEditorTools.SetLabelWidth(80f);

		if (NGUIEditorTools.DrawMinimalisticHeader("State Transition"))
		{
			NGUIEditorTools.BeginContents(true);
			NGUIEditorTools.DrawProperty("Sprite", serializedObject, "activeSprite");
			NGUIEditorTools.DrawProperty("Animation", serializedObject, "activeAnimation");

			if (serializedObject.isEditingMultipleObjects)
			{
				NGUIEditorTools.DrawProperty("Instant", serializedObject, "instantTween");
			}
			else
			{
				GUI.changed = false;
				Transition tr = toggle.instantTween ? Transition.Instant : Transition.Smooth;
				GUILayout.BeginHorizontal();
				tr = (Transition)EditorGUILayout.EnumPopup("Transition", tr);
				NGUIEditorTools.DrawPadding();
				GUILayout.EndHorizontal();

				if (GUI.changed)
				{
					NGUIEditorTools.RegisterUndo("Toggle Change", toggle);
					toggle.instantTween = (tr == Transition.Instant);
					NGUITools.SetDirty(toggle);
				}
			}
			NGUIEditorTools.EndContents();
		}

		NGUIEditorTools.DrawEvents("On Value Change", toggle, toggle.onChange);
		serializedObject.ApplyModifiedProperties();
	}

19 View Source File : UITweenerEditor.cs
License : MIT License
Project Creator : mamoniem

protected void DrawCommonProperties ()
	{
		UITweener tw = target as UITweener;

		if (NGUIEditorTools.DrawHeader("Tweener"))
		{
			NGUIEditorTools.BeginContents();
			NGUIEditorTools.SetLabelWidth(110f);

			GUI.changed = false;

			UITweener.Style style = (UITweener.Style)EditorGUILayout.EnumPopup("Play Style", tw.style);
			AnimationCurve curve = EditorGUILayout.CurveField("Animation Curve", tw.animationCurve, GUILayout.Width(170f), GUILayout.Height(62f));
			//UITweener.Method method = (UITweener.Method)EditorGUILayout.EnumPopup("Play Method", tw.method);

			GUILayout.BeginHorizontal();
			float dur = EditorGUILayout.FloatField("Duration", tw.duration, GUILayout.Width(170f));
			GUILayout.Label("seconds");
			GUILayout.EndHorizontal();

			GUILayout.BeginHorizontal();
			float del = EditorGUILayout.FloatField("Start Delay", tw.delay, GUILayout.Width(170f));
			GUILayout.Label("seconds");
			GUILayout.EndHorizontal();

			int tg = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(170f));
			bool ts = EditorGUILayout.Toggle("Ignore TimeScale", tw.ignoreTimeScale);

			if (GUI.changed)
			{
				NGUIEditorTools.RegisterUndo("Tween Change", tw);
				tw.animationCurve = curve;
				//tw.method = method;
				tw.style = style;
				tw.ignoreTimeScale = ts;
				tw.tweenGroup = tg;
				tw.duration = dur;
				tw.delay = del;
				NGUITools.SetDirty(tw);
			}
			NGUIEditorTools.EndContents();
		}

		NGUIEditorTools.SetLabelWidth(80f);
		NGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished);
	}

19 View Source File : KKABMX_AdvancedGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : ManlyMarco

private void DrawHeader()
        {
            void AddNewBone(string boneName)
            {
                if (string.IsNullOrEmpty(boneName)) return;

                _addedBones.Add(boneName);

                if (_currentBoneController.GetModifier(boneName) != null)
                {
                    KKABMX_Core.Logger.LogMessage($"Bone {boneName} is already added.");
                }
                else
                {
                    var newMod = new BoneModifier(boneName);
                    _currentBoneController.AddModifier(newMod);
                    if (newMod.BoneTransform == null)
                    {
                        KKABMX_Core.Logger.LogMessage($"Failed to add bone {boneName}, make sure the name is correct.");
                        _currentBoneController.Modifiers.Remove(newMod);
                    }
                    else
                    {
                        KKABMX_Core.Logger.LogMessage($"Added bone {boneName} successfully. Modify it to make it save.");
                    }
                }
            }

            GUILayout.BeginHorizontal(UnityEngine.GUI.skin.box);
            {
                GUILayout.Label("Search:", GUILayout.ExpandWidth(false));

                UnityEngine.GUI.SetNextControlName(SearchControlName);
                SearchFieldValue = GUILayout.TextField(SearchFieldValue, _gloExpand);

                if (SearchControlName.Equals(UnityEngine.GUI.GetNameOfFocusedControl(), StringComparison.Ordinal))
                {
                    var currentEvent = Event.current;
                    if (currentEvent.isKey && (currentEvent.keyCode == KeyCode.Return || currentEvent.keyCode == KeyCode.KeypadEnter))
                    {
                        currentEvent.Use();
                        AddNewBone(SearchFieldValue);
                    }
                }

                if (string.IsNullOrEmpty(SearchFieldValue))
                    UnityEngine.GUI.enabled = false;
                if (GUILayout.Button("Add new", GUILayout.ExpandWidth(false)))
                {
                    AddNewBone(SearchFieldValue);
                    UnityEngine.GUI.FocusControl(SearchControlName);
                }
                UnityEngine.GUI.enabled = true;

                if (GUILayout.Button("Revert", GUILayout.ExpandWidth(false))) _currentBoneController.RevertChanges();

                _onlyShowAdditional = GUILayout.Toggle(_onlyShowAdditional, "Only new", GUILayout.ExpandWidth(false));

#if !AI
                _onlyShowCoords = GUILayout.Toggle(_onlyShowCoords, "Only per coordinate", GUILayout.ExpandWidth(false));
#endif

                GUILayout.Space(6);

                GUILayout.Label("Increment:", GUILayout.ExpandWidth(false));

                float RoundToPowerOf10(float value) => Mathf.Pow(10, Mathf.Round(Mathf.Log10(value)));

                float.TryParse(GUILayout.TextField(_incrementSize.ToString(CultureInfo.InvariantCulture), _gsInput, _gloTextfieldWidth, _gloHeight), out _incrementSize);
                if (GUILayout.Button("-", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) _incrementSize = RoundToPowerOf10(_incrementSize * 0.1f);
                if (GUILayout.Button("+", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) _incrementSize = RoundToPowerOf10(_incrementSize * 10f);

                GUILayout.Space(4);
                if (GUILayout.Button("X", GUILayout.ExpandWidth(false))) enabled = false;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(UnityEngine.GUI.skin.box);
            {
                _suggestionScrollPosition = GUILayout.BeginScrollView(_suggestionScrollPosition, true, false, _gloSuggestionsStyle);
                {
                    GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
                    {
                        const int singleItemWidth = 120;
                        var lefreplacedemCount = Mathf.FloorToInt(_suggestionScrollPosition.x / singleItemWidth);
                        GUILayout.Space(lefreplacedemCount * singleItemWidth);

                        var shownItemCount = Mathf.CeilToInt(_windowRect.width / singleItemWidth) + 1; // Add one more to account for spaces between buttons
                        foreach (var boneResult in _boneSuggestions.Skip(lefreplacedemCount).Take(shownItemCount))
                        {
                            if (GUILayout.Button(boneResult, _gsButtonReset, GUILayout.Width(singleItemWidth), _gloHeight))
                            {
                                if (_currentBoneController.GetModifier(boneResult) == null)
                                    AddNewBone(boneResult);

                                UnityEngine.GUI.FocusControl(SearchControlName);
                            }
                        }

                        var righreplacedemCount = Mathf.Max(0, _boneSuggestions.Count - (lefreplacedemCount + shownItemCount));
                        GUILayout.Space(righreplacedemCount * singleItemWidth);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawEnviroControls(CheatToolsWindow cheatToolsWindow)
        {
            var weatherSim = _map.Simulator;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Weather: " + weatherSim.Weather, GUILayout.Width(120));

                if (weatherSim.Weather == Weather.Clear) GUI.enabled = false;
                if (GUILayout.Button("Clear")) weatherSim.RefreshWeather(Weather.Clear, true);
                GUI.enabled = true;

                if (GUILayout.Button("Next")) weatherSim.RefreshWeather(weatherSim.Weather.Next(), true);
            }
            GUILayout.EndHorizontal();

            if (weatherSim.EnvironmentProfile != null)
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label($"Temperature: {weatherSim.TemperatureValue:F0}C", GUILayout.Width(120));
                    weatherSim.TemperatureValue = GUILayout.HorizontalSlider(weatherSim.TemperatureValue,
                        weatherSim.EnvironmentProfile.TemperatureBorder.MinDegree,
                        weatherSim.EnvironmentProfile.TemperatureBorder.MaxDegree);
                }
                GUILayout.EndHorizontal();
            }

            if (weatherSim.EnviroSky != null && weatherSim.EnviroSky.GameTime != null)
            {
                GUILayout.BeginHorizontal();
                {
                    var gameTime = weatherSim.EnviroSky.GameTime;
                    //var dt = DateTime.MinValue.AddHours(gameTime.Hours).AddMinutes(gameTime.Minutes).AddSeconds(gameTime.Seconds);
                    GUILayout.Label("Game time:", GUILayout.Width(120));
                    var timeText = _gameTimeText ?? $"{gameTime.Hours:00}:{gameTime.Minutes:00}:{gameTime.Seconds:00}";
                    var newTimeText = GUILayout.TextField(timeText, GUILayout.ExpandWidth(true));
                    if (timeText != newTimeText)
                    {
                        try
                        {
                            var parts = newTimeText.Split(':');
                            weatherSim.EnviroSky.SetTime(gameTime.Years, gameTime.Days, int.Parse(parts[0]), int.Parse(parts[1]), int.Parse(parts[2]));
                            _gameTimeText = null;
                        }
                        catch
                        {
                            // Let user keep editing if the parsing fails
                            _gameTimeText = newTimeText;
                        }
                    }
                }
                GUILayout.EndHorizontal();
            }
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawHSceneCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("H scene controls");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Male Gauge: " + _hScene.feel_m.ToString("F2"), GUILayout.Width(150));
                _hScene.feel_m = GUILayout.HorizontalSlider(_hScene.feel_m, 0, 1);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Female Gauge: " + _hScene.feel_f.ToString("F2"), GUILayout.Width(150));
                _hScene.feel_f = GUILayout.HorizontalSlider(_hScene.feel_f, 0, 1);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Pain Gauge: " + _hScene.feelPain.ToString("F2"), GUILayout.Width(150));
                _hScene.feelPain = GUILayout.HorizontalSlider(_hScene.feelPain, 0, 1);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Open HScene Flags in inspector"))
                cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawSingleGirlCheats(Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                GUILayout.Label("Selected heroine name: " + (GetHeroineName(currentAdvGirl)));
                GUILayout.Space(6);

                if (currentAdvGirl.chaCtrl != null && currentAdvGirl.chaCtrl.fileGameInfo2 != null)
                {
                    var anyChanges = false;
                    var gi2 = currentAdvGirl.gameinfo2;

                    void DrawSingleStateBtn(ChaFileDefine.State state)
                    {
                        if (GUILayout.Button(state.ToString()))
                        {
                            gi2.nowState = state; gi2.calcState = state; gi2.nowDrawState = state;
                            gi2.Favor = state == ChaFileDefine.State.Favor ? 100 : Mathf.Min(gi2.Favor, 90);
                            gi2.Enjoyment = state == ChaFileDefine.State.Enjoyment ? 100 : Mathf.Min(gi2.Enjoyment, 90);
                            gi2.Aversion = state == ChaFileDefine.State.Aversion ? 100 : Mathf.Min(gi2.Aversion, 90);
                            gi2.Slavery = state == ChaFileDefine.State.Slavery ? 100 : Mathf.Min(gi2.Slavery, 90);
                            gi2.Broken = state == ChaFileDefine.State.Broken ? 100 : Mathf.Min(gi2.Broken, 90);
                            gi2.Dependence = state == ChaFileDefine.State.Dependence ? 100 : Mathf.Min(gi2.Dependence, 90);
                            anyChanges = true;
                        }
                    }
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Current state: " + gi2.nowState);
                        GUILayout.FlexibleSpace();
                        DrawSingleStateBtn(ChaFileDefine.State.Blank);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        DrawSingleStateBtn(ChaFileDefine.State.Favor);
                        DrawSingleStateBtn(ChaFileDefine.State.Enjoyment);
                        DrawSingleStateBtn(ChaFileDefine.State.Aversion);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        DrawSingleStateBtn(ChaFileDefine.State.Slavery);
                        DrawSingleStateBtn(ChaFileDefine.State.Broken);
                        DrawSingleStateBtn(ChaFileDefine.State.Dependence);
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.Space(6);

                    GUILayout.Label("Statistics:");

                    void ShowSingleSlider(string name, Action<int> set, Func<int> get)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            var status = get();
                            GUILayout.Label(name + ": " + status, GUILayout.Width(120));
                            var newStatus = Mathf.RoundToInt(GUILayout.HorizontalSlider(status, 0, 100));
                            if (newStatus != status)
                            {
                                set(newStatus);
                                anyChanges = true;
                            }
                        }
                        GUILayout.EndHorizontal();
                    }
                    void ShowSingleTextfield(string name, Action<int> set, Func<int> get)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(name + ": ", GUILayout.Width(120));
                            GUI.changed = false;
                            var status = get();
                            var textField = GUILayout.TextField(status.ToString());
                            if (GUI.changed && int.TryParse(textField, out var newStatus) && newStatus != status)
                            {
                                set(newStatus);
                                anyChanges = true;
                            }

                            GUI.changed = false;
                        }
                        GUILayout.EndHorizontal();
                    }

                    ShowSingleSlider(nameof(gi2.Favor), i => gi2.Favor = i, () => gi2.Favor);
                    ShowSingleSlider(nameof(gi2.Enjoyment), i => gi2.Enjoyment = i, () => gi2.Enjoyment);
                    ShowSingleSlider(nameof(gi2.Aversion), i => gi2.Aversion = i, () => gi2.Aversion);
                    ShowSingleSlider(nameof(gi2.Slavery), i => gi2.Slavery = i, () => gi2.Slavery);
                    ShowSingleSlider(nameof(gi2.Broken), i => gi2.Broken = i, () => gi2.Broken);
                    ShowSingleSlider(nameof(gi2.Dependence), i => gi2.Dependence = i, () => gi2.Dependence);
                    ShowSingleSlider(nameof(gi2.Dirty), i => gi2.Dirty = i, () => gi2.Dirty);
                    ShowSingleSlider(nameof(gi2.Tiredness), i => gi2.Tiredness = i, () => gi2.Tiredness);
                    ShowSingleSlider(nameof(gi2.Toilet), i => gi2.Toilet = i, () => gi2.Toilet);
                    ShowSingleSlider(nameof(gi2.Libido), i => gi2.Libido = i, () => gi2.Libido);

                    ShowSingleTextfield(nameof(gi2.hCount), i => { gi2.hCount = i; if (i == 0) gi2.firstHFlag = true; }, () => gi2.hCount);

                    if (anyChanges)
                        _onGirlStatsChanged(_currentVisibleGirl);

                    if (GUILayout.Button("View more stats and flags"))
                        cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(gi2, "Heroine " + GetHeroineName(currentAdvGirl)), true);
                }

                GUILayout.Space(6);

                if (GUILayout.Button("Navigate to Heroine's GameObject"))
                {
                    if (currentAdvGirl.transform != null)
                        cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
                    else
                        CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body replacedigned");
                }

                if (GUILayout.Button("Open Heroine in inspector"))
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + GetHeroineName(currentAdvGirl)), true);

                if (GUILayout.Button("Inspect extended data"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.chaFile), "ExtData for " + currentAdvGirl.Name), true);
                }
            }
            GUILayout.EndVertical();
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("Player stats");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("STR: " + Game.Player.physical, GUILayout.Width(60));
                Game.Player.physical = (int)GUILayout.HorizontalSlider(Game.Player.physical, 0, 100);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("INT: " + Game.Player.intellect, GUILayout.Width(60));
                    Game.Player.intellect = (int)GUILayout.HorizontalSlider(Game.Player.intellect, 0, 100);
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("H: " + Game.Player.hentai, GUILayout.Width(60));
                    Game.Player.hentai = (int)GUILayout.HorizontalSlider(Game.Player.hentai, 0, 100);
                }
                GUILayout.EndHorizontal();

                var cycle = Object.FindObjectsOfType<Cycle>().FirstOrDefault();
                if (cycle != null)
                {
                    if (cycle.timerVisible)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label("Time: " + cycle.timer.ToString("N1"), GUILayout.Width(65));
                            var newVal = GUILayout.HorizontalSlider(cycle.timer, 0, Cycle.TIME_LIMIT);
                            if (Math.Abs(newVal - cycle.timer) > 0.09)
                            {
                                cycle._timer = newVal;
                            }
                        }
                        GUILayout.EndHorizontal();
                    }

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Day of the week: " + cycle.nowWeek);
                        if (GUILayout.Button("Next"))
                            cycle.Change(cycle.nowWeek.Next());
                    }
                    GUILayout.EndHorizontal();
                }
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Player Name: ", GUILayout.ExpandWidth(false));
                Game.Player.parameter.lastname = GUILayout.TextField(Game.Player.parameter.lastname);
                Game.Player.parameter.firstname = GUILayout.TextField(Game.Player.parameter.firstname);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Add 100 Koikatsu points"))
            {
                Game.saveData.totalKoikatsuPoint += 100;
                Game.saveData.player.koikatsuPoint += 100;
            }

            if (GUILayout.Button("Stop shame reactions in bathrooms"))
            {
                var actionMap = Object.FindObjectOfType<ActionMap>();
                if (actionMap != null)
                {
                    foreach (var param in actionMap.infoDic.Values)
                    {
                        if (param.isWarning)
                        {
                            param.isWarning = false;
                            CheatToolsPlugin.Logger.Log(LogLevel.Message, "Disabling shame reactions on map: " + param.MapName);
                        }
                    }
                }
            }

            GUI.changed = false;
            var playerIsNoticeable = _playerEnterExitTrigger == null || _playerEnterExitTrigger.enabled;
            playerIsNoticeable = !GUILayout.Toggle(!playerIsNoticeable, "Make player unnoticeable");
            if (GUI.changed)
            {
                var actionMap = Object.FindObjectOfType<ActionScene>();
                if (actionMap != null)
                {
                    _playerEnterExitTrigger = actionMap.Player.noticeArea;
                    _playerEnterExitTrigger.enabled = playerIsNoticeable;
                }
            }

            NoclipFeature.NoclipMode = GUILayout.Toggle(NoclipFeature.NoclipMode, "Enable player noclip");

            if (GUILayout.Button("Open player data in inspector"))
            {
                cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(Game.saveData.player, "Player data"), true);
            }

            GUILayout.BeginVertical(GUI.skin.box);
            {
                var currentPrayer = Game.saveData.prayedResult;
                var prayerIndex = Array.IndexOf(_prayerIds, currentPrayer);
                var prayerName = prayerIndex >= 0 ? _prayerNames[prayerIndex] : "Unknown";

                GUILayout.Label("Prayer bonus: " + prayerName);

                GUI.changed = false;
                var result = GUILayout.SelectionGrid(prayerIndex, _prayerNames, 1);
                if (GUI.changed)
                    Game.saveData.prayedResult = _prayerIds[result];
            }
            GUILayout.EndVertical();
        }

19 View Source File : KKABMX_AdvancedGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : ManlyMarco

private void DrawWindowContents(int id)
        {
            GUILayout.BeginVertical();
            {
                DrawHeader();

                _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true, _gloExpand);
                {
                    foreach (var mod in _visibleModifiers)
                    {
                        GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
                        {
                            var currentCoordinate = CoordinateType.Unknown;
                            var modData = mod.GetModifier(currentCoordinate);

                            BoneModifierData linkedModData = null;

                            GUILayout.BeginHorizontal(_gloExpand);
                            {
                                GUILayout.TextField(mod.BoneName, _gsLabel);

                                GUILayout.FlexibleSpace();

                                if (GUILayout.Button("X", _gsButtonReset, _gloSmallButtonWidth))
                                    _currentBoneController.RemoveModifier(mod);

                                var counterBoneName = GetCounterBoneName(mod);
                                if (counterBoneName != null)
                                {
                                    var currLink = _symmetryBones.Contains(mod.BoneName);
                                    var link = GUILayout.Toggle(currLink, "Link R/L bones");

                                    if (currLink != link)
                                    {
                                        if (link)
                                        {
                                            _symmetryBones.Add(mod.BoneName);
                                            _symmetryBones.Add(counterBoneName);
                                        }
                                        else
                                        {
                                            _symmetryBones.Remove(mod.BoneName);
                                            _symmetryBones.Remove(counterBoneName);
                                        }
                                    }

                                    if (link)
                                    {
                                        var linkedBone = _currentBoneController.GetModifier(counterBoneName);
                                        if (linkedBone == null)
                                        {
                                            linkedBone = new BoneModifier(counterBoneName);
                                            _currentBoneController.AddModifier(linkedBone);
                                            if (linkedBone.BoneTransform == null)
                                            {
                                                KKABMX_Core.Logger.LogMessage($"Failed to add bone {counterBoneName}, make sure the name is correct.");
                                                _currentBoneController.Modifiers.Remove(linkedBone);
                                                linkedBone = null;
                                                _symmetryBones.Remove(mod.BoneName);
                                                _symmetryBones.Remove(counterBoneName);
                                            }
                                        }

                                        if (linkedBone != null) linkedModData = linkedBone.GetModifier(currentCoordinate);
                                    }
                                }

                                //if (GUILayout.Toggle(mod.IsCoordinateSpecific(), "Per coordinate", GUILayout.ExpandWidth(false)))
                                //    mod.MakeCoordinateSpecific();
                                //else
                                //    mod.MakeNonCoordinateSpecific();

                                GUILayout.Space(8);

                                // Length slider
                                var lengthModifier = modData.LengthModifier;
                                UnityEngine.GUI.changed = false;

                                GUILayout.Label("Length:", GUILayout.ExpandWidth(false));

                                DrawSingleSlider(null, ref lengthModifier, -2, 2);

                                if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) lengthModifier = 1;

                                if (UnityEngine.GUI.changed)
                                {
                                    modData.LengthModifier = lengthModifier;
                                    if (linkedModData != null) linkedModData.LengthModifier = lengthModifier;
                                }
                            }
                            GUILayout.EndHorizontal();

                            GUILayout.BeginHorizontal(_gloExpand);
                            {
                                // Scale sliders
                                var scale = modData.ScaleModifier;
                                UnityEngine.GUI.changed = false;

                                GUILayout.Label("Scale", _gloExpand);

                                DrawSingleSlider("X:", ref scale.x, 0, 2);
                                DrawSingleSlider("Y:", ref scale.y, 0, 2);
                                DrawSingleSlider("Z:", ref scale.z, 0, 2);

                                if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) scale = Vector3.one;

                                if (UnityEngine.GUI.changed)
                                {
                                    modData.ScaleModifier = scale;
                                    if (linkedModData != null) linkedModData.ScaleModifier = scale;
                                }
                            }
                            GUILayout.EndHorizontal();

                            if (!KKABMX_Core.NoRotationBones.Contains(mod.BoneName))
                            {
                                GUILayout.BeginHorizontal(_gloExpand);
                                {
                                    // Position sliders
                                    var position = modData.PositionModifier;
                                    UnityEngine.GUI.changed = false;

                                    GUILayout.Label("Offset", _gloExpand);

                                    DrawSingleSlider("X:", ref position.x, -1, 1);
                                    DrawSingleSlider("Y:", ref position.y, -1, 1);
                                    DrawSingleSlider("Z:", ref position.z, -1, 1);

                                    if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) position = Vector3.zero;

                                    if (UnityEngine.GUI.changed)
                                    {
                                        modData.PositionModifier = position;
                                        if (linkedModData != null) linkedModData.PositionModifier = new Vector3(position.x * -1, position.y, position.z);
                                    }
                                }
                                GUILayout.EndHorizontal();

                                GUILayout.BeginHorizontal(_gloExpand);
                                {
                                    // Rotation sliders
                                    var rotation = modData.RotationModifier;
                                    UnityEngine.GUI.changed = false;

                                    GUILayout.Label("Tilt", _gloExpand);

                                    DrawSingleSlider("X:", ref rotation.x, -180, 180);
                                    DrawSingleSlider("Y:", ref rotation.y, -180, 180);
                                    DrawSingleSlider("Z:", ref rotation.z, -180, 180);

                                    if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) rotation = Vector3.zero;

                                    if (UnityEngine.GUI.changed)
                                    {
                                        modData.RotationModifier = rotation;
                                        if (linkedModData != null) linkedModData.RotationModifier = new Vector3(rotation.x, rotation.y * -1, rotation.z * -1);
                                    }
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                        GUILayout.EndVertical();
                    }

                    if (_visibleModifiers.Count == 0)
                    {
                        GUILayout.Label(_currentBoneController.Modifiers.Count == 0
                            ? "No bone modifiers to show. You can add new modifiers by using the search box above, or by using the yellow in-game sliders in maker."
                            : "No bone modifiers were found. Change your search parameters or add a new bone above.");
                    }

                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();

            UnityEngine.GUI.DragWindow();
        }

19 View Source File : KKABMX_AdvancedGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : ManlyMarco

private void DrawSingleModifier(BoneModifier mod)
        {
            var anyChanged = UnityEngine.GUI.changed;

            GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
            {
#if KK || KKS
                var currentCoordinate = (ChaFileDefine.CoordinateType)_currentBoneController.ChaControl.fileStatus.coordinateType;
#elif EC
                var currentCoordinate = KoikatsuCharaFile.ChaFileDefine.CoordinateType.School01;
#elif AI || HS2
                var currentCoordinate = CoordinateType.Unknown;
#endif
                var modData = mod.GetModifier(currentCoordinate);

                BoneModifierData linkedModData = null;

                GUILayout.BeginHorizontal(_gloExpand);
                {
                    GUILayout.TextField(mod.BoneName, _gsLabel);

                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("X", _gsButtonReset, _gloSmallButtonWidth))
                        _currentBoneController.RemoveModifier(mod);

                    var counterBoneName = GetCounterBoneName(mod);
                    if (counterBoneName != null)
                    {
                        var currLink = _symmetryBones.Contains(mod.BoneName);
                        var link = GUILayout.Toggle(currLink, "Link R/L bones");

                        if (currLink != link)
                        {
                            if (link)
                            {
                                _symmetryBones.Add(mod.BoneName);
                                _symmetryBones.Add(counterBoneName);
                            }
                            else
                            {
                                _symmetryBones.Remove(mod.BoneName);
                                _symmetryBones.Remove(counterBoneName);
                            }
                        }

                        if (link)
                        {
                            var linkedBone = _currentBoneController.GetModifier(counterBoneName);
                            if (linkedBone == null)
                            {
                                linkedBone = new BoneModifier(counterBoneName);
                                _currentBoneController.AddModifier(linkedBone);
                                if (linkedBone.BoneTransform == null)
                                {
                                    KKABMX_Core.Logger.LogMessage($"Failed to add bone {counterBoneName}, make sure the name is correct.");
                                    _currentBoneController.Modifiers.Remove(linkedBone);
                                    linkedBone = null;
                                    _symmetryBones.Remove(mod.BoneName);
                                    _symmetryBones.Remove(counterBoneName);
                                }
                            }

                            if (linkedBone != null) linkedModData = linkedBone.GetModifier(currentCoordinate);
                        }
                    }

#if !EC && !AI && !HS2
                    if (GUILayout.Toggle(mod.IsCoordinateSpecific(), "Per coordinate", GUILayout.ExpandWidth(false)))
                        mod.MakeCoordinateSpecific(_currentBoneController.ChaFileControl.coordinate.Length);
                    else
                        mod.MakeNonCoordinateSpecific();
#endif

                    GUILayout.Space(8);

                    // Length slider
                    var lengthModifier = modData.LengthModifier;
                    UnityEngine.GUI.changed = false;

                    GUILayout.Label("Length:", GUILayout.ExpandWidth(false));

                    DrawSingleSlider(null, ref lengthModifier, -2, 2);

                    if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) lengthModifier = 1;

                    if (UnityEngine.GUI.changed)
                    {
                        modData.LengthModifier = lengthModifier;
                        if (linkedModData != null) linkedModData.LengthModifier = lengthModifier;
                        anyChanged = true;
                    }
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(_gloExpand);
                {
                    // Scale sliders
                    var scale = modData.ScaleModifier;
                    UnityEngine.GUI.changed = false;

                    GUILayout.Label("Scale", _gloExpand);

                    DrawSingleSlider("X:", ref scale.x, 0, 2);
                    DrawSingleSlider("Y:", ref scale.y, 0, 2);
                    DrawSingleSlider("Z:", ref scale.z, 0, 2);

                    if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) scale = Vector3.one;

                    if (UnityEngine.GUI.changed)
                    {
                        modData.ScaleModifier = scale;
                        if (linkedModData != null) linkedModData.ScaleModifier = scale;
                        anyChanged = true;
                    }
                }
                GUILayout.EndHorizontal();

                if (!KKABMX_Core.NoRotationBones.Contains(mod.BoneName))
                {
                    GUILayout.BeginHorizontal(_gloExpand);
                    {
                        // Position sliders
                        var position = modData.PositionModifier;
                        UnityEngine.GUI.changed = false;

                        GUILayout.Label("Offset", _gloExpand);

                        DrawSingleSlider("X:", ref position.x, -1, 1);
                        DrawSingleSlider("Y:", ref position.y, -1, 1);
                        DrawSingleSlider("Z:", ref position.z, -1, 1);

                        if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) position = Vector3.zero;

                        if (UnityEngine.GUI.changed)
                        {
                            modData.PositionModifier = position;
                            if (linkedModData != null) linkedModData.PositionModifier = new Vector3(position.x * -1, position.y, position.z);
                            anyChanged = true;
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(_gloExpand);
                    {
                        // Rotation sliders
                        var rotation = modData.RotationModifier;
                        UnityEngine.GUI.changed = false;

                        GUILayout.Label("Tilt", _gloExpand);

                        DrawSingleSlider("X:", ref rotation.x, -180, 180);
                        DrawSingleSlider("Y:", ref rotation.y, -180, 180);
                        DrawSingleSlider("Z:", ref rotation.z, -180, 180);

                        if (GUILayout.Button("0", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) rotation = Vector3.zero;

                        if (UnityEngine.GUI.changed)
                        {
                            modData.RotationModifier = rotation;
                            if (linkedModData != null) linkedModData.RotationModifier = new Vector3(rotation.x, rotation.y * -1, rotation.z * -1);
                            anyChanged = true;
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndVertical();

            if (anyChanged) UnityEngine.GUI.changed = true;
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("General / Player");
            var playerData = _map.Player.PlayerData;

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Fishing skill lvl: " + playerData.FishingSkill.Level, GUILayout.Width(150));
                if (GUILayout.Button("+500 exp")) playerData.FishingSkill.AddExperience(500);
            }
            GUILayout.EndHorizontal();

            if (_resources != null)
            {
                var mp = _resources.MerchantProfile;
                if (mp != null)
                {
                    GUILayout.BeginHorizontal();
                    {
                        var shanLvl = mp.SpendMoneyBorder.Count(x => playerData.SpendMoney >= x) + 1;
                        GUILayout.Label("Shan heart lvl: " + shanLvl, GUILayout.Width(150));
                        if (GUILayout.Button("1")) playerData.SpendMoney = 0;
                        if (GUILayout.Button("2")) playerData.SpendMoney = mp.SpendMoneyBorder[0];
                        if (GUILayout.Button("3")) playerData.SpendMoney = mp.SpendMoneyBorder[1];
                    }
                    GUILayout.EndHorizontal();
                }
            }

            FishingHackHooks.Enabled = GUILayout.Toggle(FishingHackHooks.Enabled, "Enable instant fishing");
            UnlockCraftingHooks.Enabled = GUILayout.Toggle(UnlockCraftingHooks.Enabled, "Enable free crafting");
            NoclipFeature.NoclipMode = GUILayout.Toggle(NoclipFeature.NoclipMode, "Enable player noclip");

            CheatToolsPlugin.BuildAnywhere.Value = GUILayout.Toggle(CheatToolsPlugin.BuildAnywhere.Value, "Allow building anywhere");
            CheatToolsPlugin.BuildOverlap.Value = GUILayout.Toggle(CheatToolsPlugin.BuildOverlap.Value, "Allow building items to overlap");

            if (_resources != null)
            {
                var dp = _resources.DefinePack;
                if (dp != null)
                {
                    GUILayout.BeginVertical(GUI.skin.box);
                    {
                        GUILayout.Label("Warning: These can't be turned off!");
                        if (dp.MapDefines.ItemSlotMax >= 99999 && playerData.InventorySlotMax >= 99999)
                            GUI.enabled = false;
                        if (GUILayout.Button("Unlimited inventory slots"))
                        {
                            dp.MapDefines._itemSlotMax = 99999;
                            dp.MapDefines._itemStackUpperLimit = 99999;
                            playerData.InventorySlotMax = 99999;
                        }
                        GUI.enabled = true;

                        if (playerData.ItemList.Count == 0)
                            GUI.enabled = false;
                        if (GUILayout.Button("Clear player inventory"))
                        {
                            playerData.ItemList.Clear();
                            //MapUIContainer.AddNotify();
                            CheatToolsPlugin.Logger.LogMessage("Your inventory has been cleared.");
                        }
                        GUI.enabled = true;

                        GUILayout.BeginHorizontal();
                        {
                            var add1 = GUILayout.Button("Get +1 of all items");
                            var add99 = GUILayout.Button("+99");
                            if (add1 || add99)
                            {
                                if (_resources.GameInfo != null)
                                {
                                    var addAmount = add1 ? 1 : 99;
                                    foreach (var category in _resources.GameInfo.GereplacedemCategories())
                                    {
                                        foreach (var stuffItemInfo in _resources.GameInfo.GereplacedemTable(category).Values)
                                        {
                                            var it = playerData.ItemList.Find(item => item.CategoryID == stuffItemInfo.CategoryID && item.ID == stuffItemInfo.ID);
                                            if (it != null) it.Count += addAmount;
                                            else playerData.ItemList.Add(new StuffItem(stuffItemInfo.CategoryID, stuffItemInfo.ID, addAmount));
                                        }
                                    }

                                    CheatToolsPlugin.Logger.LogMessage(addAmount + " of all items have been added to your inventory");
                                }
                            }
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndVertical();
                }
            }

            if (GUILayout.Button("Navigate to Player's GameObject"))
            {
                if (_map.Player.transform != null)
                    cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(_map.Player.transform);
                else
                    CheatToolsPlugin.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message,
                        "Player has no body replacedigned");
            }

            if (GUILayout.Button("Open Player in inspector"))
                cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_map.Player, "Player"), true);
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawHSceneCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("H scene controls");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Male Gauge: " + _hScene.feel_m.ToString("F2"), GUILayout.Width(150));
                _hScene.feel_m = GUILayout.HorizontalSlider(_hScene.feel_m, 0, 1);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Female Gauge: " + _hScene.feel_f.ToString("F2"), GUILayout.Width(150));
                _hScene.feel_f = GUILayout.HorizontalSlider(_hScene.feel_f, 0, 1);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Open HScene Flags in inspector"))
                cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_hScene, "HSceneFlagCtrl"), true);
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawHSceneCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("H scene controls");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Male Gauge: " + _hFlag.gaugeMale.ToString("N1"), GUILayout.Width(150));
                _hFlag.gaugeMale = GUILayout.HorizontalSlider(_hFlag.gaugeMale, 0, 100);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Female Gauge: " + _hFlag.gaugeFemale.ToString("N1"), GUILayout.Width(150));
                _hFlag.gaugeFemale = GUILayout.HorizontalSlider(_hFlag.gaugeFemale, 0, 100);
            }

            GUILayout.EndHorizontal();

            if (_hSprite != null)
            {
                if (GUILayout.Button("Force quit H scene"))
                {
                    Utils.Sound.Play(SystemSE.cancel);
                    _hSprite.flags.click = HFlag.ClickKind.end;
                    _hSprite.flags.isHSceneEnd = true;
                    _hSprite.flags.numEnd = 0;
                }
            }
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.BeginVertical();
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Selected girl name: ");
                    GUILayout.Label(currentAdvGirl.Name);
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Relationship level: ");
                    GUILayout.Label(_relationNames[currentAdvGirl.relation]);
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Favor: " + currentAdvGirl.favor, GUILayout.Width(70));
                    currentAdvGirl.favor = (int)GUILayout.HorizontalSlider(currentAdvGirl.favor, 0, currentAdvGirl.isGirlfriend ? 150 : 100);
                }
                GUILayout.EndHorizontal();

                currentAdvGirl.isFriend = GUILayout.Toggle(currentAdvGirl.isFriend, "Is a friend");
                currentAdvGirl.isGirlfriend = GUILayout.Toggle(currentAdvGirl.isGirlfriend, "Is a girlfriend");

                currentAdvGirl.confessed = GUILayout.Toggle(currentAdvGirl.confessed, "Confessed");
                currentAdvGirl.isLunch = GUILayout.Toggle(currentAdvGirl.isLunch, "Had first lunch");
                currentAdvGirl.isDayH = GUILayout.Toggle(currentAdvGirl.isDayH, "Had H today (won't visit)");

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Desire to visit: ", GUILayout.ExpandWidth(false));
                    GUI.changed = false;
                    var newCount = GUILayout.TextField(currentAdvGirl.visitDesire.ToString(), GUILayout.ExpandWidth(true));
                    if (GUI.changed && int.TryParse(newCount, out var newCountInt))
                        currentAdvGirl.visitDesire = Mathf.Max(newCountInt, 0);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(8);

                if (GUILayout.Button("Reset conversation time"))
                    currentAdvGirl.talkTime = currentAdvGirl.talkTimeMax;

                if (ActionScene.instance != null && currentAdvGirl.transform != null && GUILayout.Button("Follow me"))
                {
                    var npc = currentAdvGirl.transform.GetComponent<NPC>();
                    if (npc) ActionScene.instance.Player.ChaserSet(npc);
                    else CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Could not make heroine follow - NPC component not found");
                }

                if (ActionScene.initialized && ActionScene.instance != null)
                {
                    var actCtrl = ActionScene.instance.actCtrl;

                    var sortedDesires = Enum.GetValues(typeof(DesireEng)).Cast<DesireEng>()
                        .Select(i => new { id = i, value = actCtrl.GetDesire((int)i, currentAdvGirl) })
                        .Where(x => x.value > 5)
                        .OrderByDescending(x => x.value)
                        .Take(8);

                    var any = false;
                    foreach (var desire in sortedDesires)
                    {
                        if (!any)
                        {
                            GUILayout.Label("Desires (and their strengths):\n");
                            any = true;
                        }
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label((int)desire.id + " " + desire.id);
                            GUILayout.FlexibleSpace();
                            GUILayout.Label(desire.value + "%");
                            if (GUILayout.Button("X", GUILayout.ExpandWidth(false)))
                                actCtrl.SetDesire((int)desire.id, currentAdvGirl, 0);
                        }
                        GUILayout.EndHorizontal();
                    }
                    if (!any) GUILayout.Label("Has no desires");

                    if (GUILayout.Button("Clear all desires"))
                    {
                        for (int i = 0; i < 31; i++) actCtrl.SetDesire(i, currentAdvGirl, 0);
                    }

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Set desire ", GUILayout.ExpandWidth(false));
                        _setdesireId = GUILayout.TextField(_setdesireId ?? "");
                        GUILayout.Label(" to value ", GUILayout.ExpandWidth(false));
                        _setdesireValue = GUILayout.TextField(_setdesireValue ?? "");
                        if (GUILayout.Button("OK", GUILayout.ExpandWidth(false)))
                        {
                            try
                            {
                                actCtrl.SetDesire((int)Enum.Parse(typeof(DesireEng), _setdesireId), currentAdvGirl, int.Parse(_setdesireValue));
                            }
                            catch (Exception e)
                            {
                                CheatToolsPlugin.Logger.LogMessage("Invalid desire ID (0-30) or value (0-100) - " + e.Message);
                            }
                        }
                    }
                    GUILayout.EndHorizontal();

                    var wantsMast = actCtrl.GetDesire(4, currentAdvGirl) > 80;
                    if (!wantsMast)
                    {
                        if (GUILayout.Button("Make desire to replaced"))
                            actCtrl.SetDesire(4, currentAdvGirl, 100);
                    }

                    var wantsLes = actCtrl.GetDesire(26, currentAdvGirl) > 80;
                    if (!wantsLes)
                    {
                        if (GUILayout.Button("Make desire to lesbian"))
                        {
                            actCtrl.SetDesire(26, currentAdvGirl, 100);
                            actCtrl.SetDesire(27, currentAdvGirl, 100);
                        }
                    }
                }

                GUILayout.Space(8);

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Lewd: " + currentAdvGirl.lewdness, GUILayout.Width(70));
                    currentAdvGirl.lewdness = (int)GUILayout.HorizontalSlider(currentAdvGirl.lewdness, 0, 100);
                }
                GUILayout.EndHorizontal();

                // 危険日 is risky, 安全日 is safe. Only change when user clicks to avoid messing with the value unnecessarily
                GUI.changed = false;
                var isDangerousDay = GUILayout.Toggle(HFlag.GetMenstruation(currentAdvGirl.MenstruationDay) == HFlag.MenstruationType.危険日, "Is on a risky day");
                if (GUI.changed)
                    HFlag.SetMenstruation(currentAdvGirl, isDangerousDay ? HFlag.MenstruationType.危険日 : HFlag.MenstruationType.安全日);

                currentAdvGirl.isVirgin = GUILayout.Toggle(currentAdvGirl.isVirgin, "isVirgin");
                currentAdvGirl.isreplacedVirgin = GUILayout.Toggle(currentAdvGirl.isreplacedVirgin, "isreplacedVirgin");

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Sex count: ", GUILayout.ExpandWidth(false));
                    GUI.changed = false;
                    var newCount = GUILayout.TextField(currentAdvGirl.hCount.ToString(), GUILayout.ExpandWidth(true));
                    if (GUI.changed && int.TryParse(newCount, out var newCountInt))
                        currentAdvGirl.hCount = Mathf.Max(newCountInt, 0);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(4);

                GUILayout.Label("Sex experience: " + GetHExpText(currentAdvGirl));
                GUILayout.Label("Set to: (changes multiple stats)");
                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Virgin"))
                        MakeVirgin(currentAdvGirl);
                    if (GUILayout.Button("Inexp"))
                        MakeInexperienced(currentAdvGirl);
                    if (GUILayout.Button("Exp"))
                        MakeExperienced(currentAdvGirl);
                    if (GUILayout.Button("replaced"))
                        Makereplaced(currentAdvGirl);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(4);

                GUILayout.Label("Set all touch experience");
                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("0%"))
                        SetGirlHExp(currentAdvGirl, 0f);
                    if (GUILayout.Button("50%"))
                        SetGirlHExp(currentAdvGirl, 50f);
                    if (GUILayout.Button("100%"))
                        SetGirlHExp(currentAdvGirl, 100f);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(4);

                currentAdvGirl.denial.kiss = GUILayout.Toggle(currentAdvGirl.denial.kiss, "Won't refuse kiss");
                currentAdvGirl.denial.mreplacedage = GUILayout.Toggle(currentAdvGirl.denial.mreplacedage, "Won't refuse strong mreplacedage");
                currentAdvGirl.denial.replaced = GUILayout.Toggle(currentAdvGirl.denial.replaced, "Won't refuse replaced");
                currentAdvGirl.denial.aibu = GUILayout.Toggle(currentAdvGirl.denial.aibu, "Won't refuse vibrator");
                currentAdvGirl.denial.notCondom = GUILayout.Toggle(currentAdvGirl.denial.notCondom, "Insert w/o condom OK");

                GUILayout.Space(4);

                if (GUILayout.Button("Navigate to heroine's GameObject"))
                {
                    if (currentAdvGirl.transform != null)
                        cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
                    else
                        CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body replacedigned");
                }

                if (GUILayout.Button("Open Heroine in inspector"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
                }

                if (GUILayout.Button("Inspect extended data"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
                }
            }
            GUILayout.EndVertical();
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawHeroineCheats(SaveData.Heroine currentAdvGirl, CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.BeginVertical();
            {
                GUILayout.Label("Selected girl name: " + currentAdvGirl.Name);

                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Favor: " + currentAdvGirl.favor, GUILayout.Width(60));
                        currentAdvGirl.favor = (int)GUILayout.HorizontalSlider(currentAdvGirl.favor, 0, 100);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Lewd: " + currentAdvGirl.lewdness, GUILayout.Width(60));
                        currentAdvGirl.lewdness = (int)GUILayout.HorizontalSlider(currentAdvGirl.lewdness, 0, 100);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Anger: " + currentAdvGirl.anger, GUILayout.Width(60));
                        currentAdvGirl.anger = (int)GUILayout.HorizontalSlider(currentAdvGirl.anger, 0, 100);
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Intimacy: " + currentAdvGirl.intimacy, GUILayout.Width(60));
                        currentAdvGirl.intimacy = (int)GUILayout.HorizontalSlider(currentAdvGirl.intimacy, 0, 100);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();

                GUILayout.Space(4);

                GUILayout.Label("Sex experience: " + GetHExpText(currentAdvGirl));
                GUILayout.Label("Set to: (changes multiple stats)");
                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("Virgin"))
                        MakeVirgin(currentAdvGirl);
                    if (GUILayout.Button("Inexp"))
                        MakeInexperienced(currentAdvGirl);
                    if (GUILayout.Button("Exp"))
                        MakeExperienced(currentAdvGirl);
                    if (GUILayout.Button("replaced"))
                        Makereplaced(currentAdvGirl);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(4);

                GUILayout.Label("Set all touch experience");
                GUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("0%"))
                        SetGirlHExp(currentAdvGirl, 0f);
                    if (GUILayout.Button("50%"))
                        SetGirlHExp(currentAdvGirl, 50f);
                    if (GUILayout.Button("100%"))
                        SetGirlHExp(currentAdvGirl, 100f);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(8);

                if (GUILayout.Button("Reset conversation time"))
                    currentAdvGirl.talkTime = currentAdvGirl.talkTimeMax;

                var actCtrl = _gameMgr?.actScene?.actCtrl;
                if (actCtrl != null)
                {
                    var sortedDesires = Enum.GetValues(typeof(DesireEng)).Cast<DesireEng>()
                        .Select(i => new { id = i, value = actCtrl.GetDesire((int)i, currentAdvGirl) })
                        .Where(x => x.value > 5)
                        .OrderByDescending(x => x.value)
                        .Take(8);

                    var any = false;
                    foreach (var desire in sortedDesires)
                    {
                        if (!any)
                        {
                            GUILayout.Label("Desires (and their strengths):\n");
                            any = true;
                        }
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label((int)desire.id + " " + desire.id);
                            GUILayout.FlexibleSpace();
                            GUILayout.Label(desire.value + "%");
                            if (GUILayout.Button("X", GUILayout.ExpandWidth(false)))
                                actCtrl.SetDesire((int)desire.id, currentAdvGirl, 0);
                        }
                        GUILayout.EndHorizontal();
                    }
                    if (!any) GUILayout.Label("Has no desires");

                    if (GUILayout.Button("Clear all desires"))
                    {
                        for (int i = 0; i < 31; i++) actCtrl.SetDesire(i, currentAdvGirl, 0);
                    }

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Set desire ", GUILayout.ExpandWidth(false));
                        _setdesireId = GUILayout.TextField(_setdesireId ?? "");
                        GUILayout.Label(" to value ", GUILayout.ExpandWidth(false));
                        _setdesireValue = GUILayout.TextField(_setdesireValue ?? "");
                        if (GUILayout.Button("OK", GUILayout.ExpandWidth(false)))
                        {
                            try
                            {
                                actCtrl.SetDesire((int)Enum.Parse(typeof(DesireEng), _setdesireId), currentAdvGirl, int.Parse(_setdesireValue));
                            }
                            catch (Exception e)
                            {
                                CheatToolsPlugin.Logger.LogMessage("Invalid desire ID (0-30) or value (0-100) - " + e.Message);
                            }
                        }
                    }
                    GUILayout.EndHorizontal();

                    var wantsMast = actCtrl.GetDesire(4, currentAdvGirl) > 80;
                    if (!wantsMast)
                    {
                        if (GUILayout.Button("Make desire to replaced"))
                            actCtrl.SetDesire(4, currentAdvGirl, 100);
                    }

                    var wantsLes = actCtrl.GetDesire(26, currentAdvGirl) > 80;
                    if (!wantsLes)
                    {
                        if (GUILayout.Button("Make desire to lesbian"))
                        {
                            actCtrl.SetDesire(26, currentAdvGirl, 100);
                            actCtrl.SetDesire(27, currentAdvGirl, 100);
                        }
                    }
                }

                GUILayout.Space(8);

                // 危険日 is risky, 安全日 is safe. Only change when user clicks to avoid messing with the value unnecessarily
                GUI.changed = false;
                var isDangerousDay = GUILayout.Toggle(HFlag.GetMenstruation(currentAdvGirl.MenstruationDay) == HFlag.MenstruationType.危険日, "Is on a risky day");
                if (GUI.changed)
                    HFlag.SetMenstruation(currentAdvGirl, isDangerousDay ? HFlag.MenstruationType.危険日 : HFlag.MenstruationType.安全日);

                currentAdvGirl.isVirgin = GUILayout.Toggle(currentAdvGirl.isVirgin, "isVirgin");
                currentAdvGirl.isreplacedVirgin = GUILayout.Toggle(currentAdvGirl.isreplacedVirgin, "isreplacedVirgin");

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Sex count: ", GUILayout.ExpandWidth(false));
                    GUI.changed = false;
                    var newCount = GUILayout.TextField(currentAdvGirl.hCount.ToString(), GUILayout.ExpandWidth(true));
                    if (GUI.changed && int.TryParse(newCount, out var newCountInt))
                        currentAdvGirl.hCount = Mathf.Max(newCountInt, 0);
                }
                GUILayout.EndHorizontal();

                currentAdvGirl.isAnger = GUILayout.Toggle(currentAdvGirl.isAnger, "Is angry");
                currentAdvGirl.isDate = GUILayout.Toggle(currentAdvGirl.isDate, "Date promised");
                //currentAdvGirl.isFirstGirlfriend = GUILayout.Toggle(currentAdvGirl.isFirstGirlfriend, "isFirstGirlfriend");

                GUI.changed = false;
                var newVal = GUILayout.Toggle(currentAdvGirl.talkEvent.Contains(0) || currentAdvGirl.talkEvent.Contains(1), "Had first meeting");
                if (GUI.changed)
                {
                    if (newVal)
                    {
                        currentAdvGirl.talkEvent.Add(0);
                        currentAdvGirl.talkEvent.Add(1);
                    }
                    else
                    {
                        currentAdvGirl.talkEvent.Remove(0);
                        currentAdvGirl.talkEvent.Remove(1);
                    }
                }

                GUI.changed = false;
                newVal = GUILayout.Toggle(currentAdvGirl.talkEvent.Contains(2), "Is a friend");
                if (GUI.changed)
                {
                    if (newVal)
                    {
                        currentAdvGirl.talkEvent.Add(2);
                    }
                    else
                    {
                        currentAdvGirl.talkEvent.Remove(2);
                    }
                }

                currentAdvGirl.isGirlfriend = GUILayout.Toggle(currentAdvGirl.isGirlfriend, "Is a girlfriend");
                currentAdvGirl.isStaff = GUILayout.Toggle(currentAdvGirl.isStaff, "Is a club member");

                currentAdvGirl.denial.kiss = GUILayout.Toggle(currentAdvGirl.denial.kiss, "Won't refuse kiss");
                currentAdvGirl.denial.mreplacedage = GUILayout.Toggle(currentAdvGirl.denial.mreplacedage, "Won't refuse strong mreplacedage");
                currentAdvGirl.denial.replaced = GUILayout.Toggle(currentAdvGirl.denial.replaced, "Won't refuse replaced");
                currentAdvGirl.denial.aibu = GUILayout.Toggle(currentAdvGirl.denial.aibu, "Won't refuse vibrator");
                currentAdvGirl.denial.notCondom = GUILayout.Toggle(currentAdvGirl.denial.notCondom, "Insert w/o condom OK");

                if (_gameMgr?.actScene != null && currentAdvGirl.transform != null && GUILayout.Button("Follow me"))
                {
                    var npc = currentAdvGirl.transform.GetComponent<NPC>();
                    if (npc) _gameMgr.actScene.Player.ChaserSet(npc);
                    else CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Could not make heroine follow - NPC component not found");
                }

                if (GUILayout.Button("Navigate to heroine's GameObject"))
                {
                    if (currentAdvGirl.transform != null)
                        cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
                    else
                        CheatToolsPlugin.Logger.Log(LogLevel.Warning | LogLevel.Message, "Heroine has no body replacedigned");
                }

                if (GUILayout.Button("Open Heroine in inspector"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Heroine " + currentAdvGirl.Name), true);
                }

                if (GUILayout.Button("Inspect extended data"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.charFile), "ExtData for " + currentAdvGirl.Name), true);
                }
            }
            GUILayout.EndVertical();
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawPlayerCheats(CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.Label("Player stats");

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("STR: " + _gameMgr.Player.physical, GUILayout.Width(60));
                _gameMgr.Player.physical = (int)GUILayout.HorizontalSlider(_gameMgr.Player.physical, 0, 100);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("INT: " + _gameMgr.Player.intellect, GUILayout.Width(60));
                    _gameMgr.Player.intellect = (int)GUILayout.HorizontalSlider(_gameMgr.Player.intellect, 0, 100);
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("H: " + _gameMgr.Player.hentai, GUILayout.Width(60));
                    _gameMgr.Player.hentai = (int)GUILayout.HorizontalSlider(_gameMgr.Player.hentai, 0, 100);
                }
                GUILayout.EndHorizontal();

                var cycle = Object.FindObjectsOfType<Cycle>().FirstOrDefault();
                if (cycle != null)
                {
                    if (cycle.timerVisible)
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label("Time: " + cycle.timer.ToString("N1"), GUILayout.Width(65));
                            var newVal = GUILayout.HorizontalSlider(cycle.timer, 0, Cycle.TIME_LIMIT);
                            if (Math.Abs(newVal - cycle.timer) > 0.09)
                            {
                                typeof(Cycle)
                                    .GetField("_timer", BindingFlags.Instance | BindingFlags.NonPublic)
                                    ?.SetValue(cycle, newVal);
                            }
                        }
                        GUILayout.EndHorizontal();
                    }

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Day of the week: " + cycle.nowWeek);
                        if (GUILayout.Button("Next"))
                            cycle.Change(cycle.nowWeek.Next());
                    }
                    GUILayout.EndHorizontal();
                }
            }

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Academy Name: ", GUILayout.ExpandWidth(false));
                _gameMgr.saveData.accademyName =
                    GUILayout.TextField(_gameMgr.saveData.accademyName, GUILayout.ExpandWidth(true));
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Player Name: ", GUILayout.ExpandWidth(false));
                _gameMgr.Player.parameter.lastname = GUILayout.TextField(_gameMgr.Player.parameter.lastname);
                _gameMgr.Player.parameter.firstname = GUILayout.TextField(_gameMgr.Player.parameter.firstname);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("Add 10000 club points (+1 level)"))
                _gameMgr.saveData.clubReport.comAdd += 10000;

            if (GUILayout.Button("Stop shame reactions in bathrooms"))
            {
                var actionMap = Object.FindObjectOfType<ActionMap>();
                if (actionMap != null)
                {
                    foreach (var param in actionMap.infoDic.Values)
                    {
                        if (param.isWarning)
                        {
                            param.isWarning = false;
                            CheatToolsPlugin.Logger.Log(LogLevel.Message,
                                "Disabling shame reactions on map: " + param.MapName);
                        }
                    }
                }
            }

            GUI.changed = false;
            var playerIsNoticeable = _playerEnterExitTrigger == null || _playerEnterExitTrigger.enabled;
            playerIsNoticeable = !GUILayout.Toggle(!playerIsNoticeable, "Make player unnoticeable");
            if (GUI.changed)
            {
                var actionMap = Object.FindObjectOfType<ActionScene>();
                if (actionMap != null)
                {
                    _playerEnterExitTrigger = actionMap.Player.noticeArea;
                    _playerEnterExitTrigger.enabled = playerIsNoticeable;
                }
            }

            NoclipFeature.NoclipMode = GUILayout.Toggle(NoclipFeature.NoclipMode, "Enable player noclip");

            if (GUILayout.Button("Open player data in inspector"))
            {
                cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(_gameMgr.saveData.player, "Player data"), true);
            }
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DrawTimeControls(CheatToolsWindow window)
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label("Speed", GUILayout.ExpandWidth(false));
                GUILayout.Label((int)Math.Round(Time.timeScale * 100) + "%", GUILayout.Width(35));
                Time.timeScale = GUILayout.HorizontalSlider(Time.timeScale, 0, 5, GUILayout.ExpandWidth(true));
                if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false))) Time.timeScale = 1;
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : FolderTreeView.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DisplayObjectTreeHelper(DirectoryTree dir, int indent, ref int itemsDrawn)
        {
            var dirFullName = dir.FullName;
            var subDirs = dir.SubDirs;

            if (indent == 0 && subDirs.Count == 0)
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.Label(@"You can organize your files into folders and use this window to browse them.");
                    GUILayout.Space(5);
                    GUILayout.Label($@"Folders placed inside your {DefaultPath.Substring(_topmostPath.Length)} folder will appear on this list.");
                }
                GUILayout.EndVertical();
                return;
            }

            var isSearching = !string.IsNullOrEmpty(_searchString);
            if (!isSearching || dirFullName.IndexOf(_searchString, DefaultPath.Length, StringComparison.OrdinalIgnoreCase) >= 0)
            {
                var drawnItemTotalHeight = itemsDrawn * _itemHeight;

                if (_scrollTreeToSelected ||
                    _itemHeight == 0 || _scrollviewHeight == 0 ||
                    // Only draw items that are visible at current scroll position
                    drawnItemTotalHeight >= _treeScrollPosition.y - _itemHeight &&
                    drawnItemTotalHeight <= _treeScrollPosition.y + _scrollviewHeight + _itemHeight)
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(indent * 20f);

                        var c = GUI.color;
                        if (dirFullName == CurrentFolder)
                        {
                            GUI.color = Color.cyan;
                            if (_scrollTreeToSelected && Event.current.type == EventType.Repaint)
                            {
                                _scrollTreeToSelected = false;
                                _treeScrollPosition.y = Mathf.Max(0, drawnItemTotalHeight - (_scrollviewHeight - _itemHeight) / 2);
                            }
                        }

                        GUILayout.BeginHorizontal();
                        {

                            if (subDirs.Count > 0)
                            {
                                if (GUILayout.Toggle(_openedObjects.Contains(dirFullName), "", GUILayout.ExpandWidth(false)))
                                    _openedObjects.Add(dirFullName);
                                else
                                    _openedObjects.Remove(dirFullName);
                            }
                            else
                            {
                                GUILayout.Space(20f);
                            }

                            if (NonTranslatedButton(dir.Name, GUI.skin.label, GUILayout.ExpandWidth(true), GUILayout.MinWidth(100)))
                            {

                                if (string.Equals(CurrentFolder, dirFullName, StringComparison.OrdinalIgnoreCase))
                                {
                                    if (_openedObjects.Contains(dirFullName) == false)
                                        _openedObjects.Add(dirFullName);
                                    else
                                        _openedObjects.Remove(dirFullName);
                                }

                                CurrentFolder = dirFullName;

                            }
                        }
                        GUILayout.EndHorizontal();

                        GUI.color = c;
                    }
                    GUILayout.EndHorizontal();

                    if (_itemHeight == 0 && Event.current.type == EventType.Repaint)
                        _itemHeight = (int)GUILayoutUtility.GetLastRect().height;
                }
                else
                {
                    GUILayout.Space(_itemHeight);
                }

                itemsDrawn++;
            }

            if (isSearching || _openedObjects.Contains(dirFullName))
            {
                foreach (var subDir in subDirs)
                    DisplayObjectTreeHelper(subDir, indent + 1, ref itemsDrawn);
            }
        }

19 View Source File : SceneFolders.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void TreeWindow(int id)
        {
            GUILayout.BeginHorizontal();
            {
                _folderTreeView.DrawDirectoryTree();

                GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(200));
                {
                    if (GUILayout.Button("Refresh scene thumbnails"))
                    {
                        _folderTreeView?.ResetTreeCache();
                        OnFolderChanged();
                    }

                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Open current folder in explorer"))
                        Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
                    if (GUILayout.Button("Open screenshot folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(AI_BrowserFolders.UserDataPath, "cap"));
                    if (GUILayout.Button("Open character folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(AI_BrowserFolders.UserDataPath, "chara"));
                    if (GUILayout.Button("Open main game folder in explorer"))
                        Utils.OpenDirInExplorer(Paths.GameRootPath);
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : KKABMX_AdvancedGUI.cs
License : GNU Lesser General Public License v3.0
Project Creator : ManlyMarco

private void DrawHeader()
        {
            void AddNewBone(string boneName)
            {
                if (string.IsNullOrEmpty(boneName)) return;

                _addedBones.Add(boneName);

                if (_currentBoneController.GetModifier(boneName) != null)
                {
                    KKABMX_Core.Logger.LogMessage($"Bone {boneName} is already added.");
                }
                else
                {
                    var newMod = new BoneModifier(boneName);
                    _currentBoneController.AddModifier(newMod);
                    if (newMod.BoneTransform == null)
                    {
                        KKABMX_Core.Logger.LogMessage($"Failed to add bone {boneName}, make sure the name is correct.");
                        _currentBoneController.Modifiers.Remove(newMod);
                    }
                    else
                    {
                        KKABMX_Core.Logger.LogMessage($"Added bone {boneName} successfully. Modify it to make it save.");
                    }
                }
            }

            GUILayout.BeginHorizontal(UnityEngine.GUI.skin.box);
            {
                GUILayout.Label("Search:", GUILayout.ExpandWidth(false));

                UnityEngine.GUI.SetNextControlName(SearchControlName);
                SearchFieldValue = GUILayout.TextField(SearchFieldValue, _gloExpand);

                if (SearchControlName.Equals(UnityEngine.GUI.GetNameOfFocusedControl(), StringComparison.Ordinal))
                {
                    var currentEvent = Event.current;
                    if (currentEvent.isKey && (currentEvent.keyCode == KeyCode.Return || currentEvent.keyCode == KeyCode.KeypadEnter))
                    {
                        currentEvent.Use();
                        AddNewBone(SearchFieldValue);
                    }
                }

                if (string.IsNullOrEmpty(SearchFieldValue))
                    UnityEngine.GUI.enabled = false;
                if (GUILayout.Button("Add new", GUILayout.ExpandWidth(false)))
                {
                    AddNewBone(SearchFieldValue);
                    UnityEngine.GUI.FocusControl(SearchControlName);
                }
                UnityEngine.GUI.enabled = true;

                if (GUILayout.Button("Revert", GUILayout.ExpandWidth(false))) _currentBoneController.RevertChanges();

                _onlyShowAdditional = GUILayout.Toggle(_onlyShowAdditional, "Only show added bones", GUILayout.ExpandWidth(false));

                GUILayout.Space(6);

                GUILayout.Label("Increment:", GUILayout.ExpandWidth(false));

                float RoundToPowerOf10(float value) => Mathf.Pow(10, Mathf.Round(Mathf.Log10(value)));

                float.TryParse(GUILayout.TextField(_incrementSize.ToString(CultureInfo.InvariantCulture), _gsInput, _gloTextfieldWidth, _gloHeight), out _incrementSize);
                if (GUILayout.Button("-", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) _incrementSize = RoundToPowerOf10(_incrementSize * 0.1f);
                if (GUILayout.Button("+", _gsButtonReset, _gloSmallButtonWidth, _gloHeight)) _incrementSize = RoundToPowerOf10(_incrementSize * 10f);

                GUILayout.Space(4);
                if (GUILayout.Button("X", GUILayout.ExpandWidth(false))) enabled = false;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(UnityEngine.GUI.skin.box);
            {
                _suggestionScrollPosition = GUILayout.BeginScrollView(_suggestionScrollPosition, true, false, _gloSuggestionsStyle);
                {
                    GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
                    {
                        const int singleItemWidth = 120;
                        var lefreplacedemCount = Mathf.FloorToInt(_suggestionScrollPosition.x / singleItemWidth);
                        GUILayout.Space(lefreplacedemCount * singleItemWidth);

                        var shownItemCount = Mathf.CeilToInt(_windowRect.width / singleItemWidth) + 1; // Add one more to account for spaces between buttons
                        foreach (var boneResult in _boneSuggestions.Skip(lefreplacedemCount).Take(shownItemCount))
                        {
                            if (GUILayout.Button(boneResult, _gsButtonReset, GUILayout.Width(singleItemWidth), _gloHeight))
                            {
                                if (_currentBoneController.GetModifier(boneResult) == null)
                                    AddNewBone(boneResult);

                                UnityEngine.GUI.FocusControl(SearchControlName);
                            }
                        }

                        var righreplacedemCount = Mathf.Max(0, _boneSuggestions.Count - (lefreplacedemCount + shownItemCount));
                        GUILayout.Space(righreplacedemCount * singleItemWidth);
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : CheatToolsWindow.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawSingleGirlCheats(AgentActor currentAdvGirl, CheatToolsWindow cheatToolsWindow)
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                GUILayout.Label("Selected heroine name: " + (currentAdvGirl.CharaName ?? currentAdvGirl.name));
                GUILayout.Space(6);

                if (currentAdvGirl.ChaControl != null && currentAdvGirl.ChaControl.fileGameInfo != null)
                {
                    GUILayout.Label("Status");

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label($"Love phase: {currentAdvGirl.ChaControl.fileGameInfo.phase + 1} / 4");
                        if (GUILayout.Button("-1")) currentAdvGirl.SetPhase(Mathf.Max(0, currentAdvGirl.ChaControl.fileGameInfo.phase - 1));
                        if (GUILayout.Button("+1")) currentAdvGirl.SetPhase(Mathf.Min(3, currentAdvGirl.ChaControl.fileGameInfo.phase + 1));
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        var sickness = AIProject.Definitions.Sickness.TagTable.FirstOrDefault(x => x.Value == currentAdvGirl.AgentData.SickState.ID).Key;
                        GUILayout.Label($"Sickness: {sickness ?? "None"}", GUILayout.ExpandWidth(true));
                        if (GUILayout.Button("Heal", GUILayout.ExpandWidth(false)) && currentAdvGirl.AgentData.SickState.ID > -1)
                        {
                            currentAdvGirl.HealSickBySleep();
                            currentAdvGirl.AgentData.SickState.OverwritableID = -1;
                            currentAdvGirl.AgentData.WeaknessMotivation = 0;
                        }
                    }
                    GUILayout.EndHorizontal();

                    foreach (Status.Type statusValue in Enum.GetValues(typeof(Status.Type)))
                    {
                        if (currentAdvGirl.AgentData.StatsTable.ContainsKey((int)statusValue))
                        {
                            GUILayout.BeginHorizontal();
                            {
                                var status = Mathf.RoundToInt(currentAdvGirl.AgentData.StatsTable[(int)statusValue]);
                                GUILayout.Label(statusValue + ": " + status, GUILayout.Width(120));
                                var newStatus = Mathf.RoundToInt(GUILayout.HorizontalSlider(status, 0, (int)statusValue == 5 ? 150 : 100));
                                if (newStatus != status)
                                    currentAdvGirl.AgentData.StatsTable[(int)statusValue] = newStatus;
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                    GUILayout.Space(6);

                    GUILayout.Label("Flavor skills");
                    foreach (FlavorSkill.Type typeValue in Enum.GetValues(typeof(FlavorSkill.Type)))
                    {
                        if (currentAdvGirl.ChaControl.fileGameInfo.flavorState.ContainsKey((int)typeValue))
                        {
                            GUILayout.BeginHorizontal();
                            {
                                GUILayout.Label(typeValue + ": ", GUILayout.Width(120));
                                GUI.changed = false;
                                var flavorSkill = currentAdvGirl.GetFlavorSkill(typeValue);
                                var textField = GUILayout.TextField(flavorSkill.ToString());
                                if (GUI.changed && int.TryParse(textField, out var newSkill) && newSkill != flavorSkill)
                                    currentAdvGirl.SetFlavorSkill(typeValue, newSkill);
                                GUI.changed = false;
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                    GUILayout.Space(6);
                }

                if (currentAdvGirl.AgentData.TalkMotivation >= currentAdvGirl.AgentData.StatsTable[5])
                    GUI.enabled = false;
                if (GUILayout.Button("Reset talk time"))
                {
                    currentAdvGirl.AgentData.TalkMotivation = currentAdvGirl.AgentData.StatsTable[5];
                    currentAdvGirl.AgentData.WeaknessMotivation = 0;
                }
                GUI.enabled = true;

                GUILayout.Space(6);

                if (GUILayout.Button("Navigate to Actor's GameObject"))
                {
                    if (currentAdvGirl.transform != null)
                        cheatToolsWindow.Editor.TreeViewer.SelectAndShowObject(currentAdvGirl.transform);
                    else
                        CheatToolsPlugin.Logger.Log(BepInEx.Logging.LogLevel.Warning | BepInEx.Logging.LogLevel.Message, "Actor has no body replacedigned");
                }

                if (GUILayout.Button("Open Actor in inspector"))
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(currentAdvGirl, "Actor " + currentAdvGirl.CharaName), true);

                if (GUILayout.Button("Inspect extended data"))
                {
                    cheatToolsWindow.Editor.Inspector.Push(new InstanceStackEntry(ExtensibleSaveFormat.ExtendedSave.GetAllExtendedData(currentAdvGirl.ChaControl?.chaFile), "ExtData for " + currentAdvGirl.CharaName), true);
                }
            }
            GUILayout.EndVertical();
        }

19 View Source File : SceneFolders.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void TreeWindow(int id)
        {
            GUILayout.BeginHorizontal();
            {
                _folderTreeView.DrawDirectoryTree();

                GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(200));
                {
                    if (GUILayout.Button("Refresh scene thumbnails"))
                    {
                        _folderTreeView?.ResetTreeCache();
                        OnFolderChanged();
                    }

                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Open current folder in explorer"))
                        Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
                    if (GUILayout.Button("Open screenshot folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
                    if (GUILayout.Button("Open character folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "chara"));
                    if (GUILayout.Button("Open main game folder in explorer"))
                        Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : ClubInterface.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawColumns()
        {
            var selectedHeroine = _crestableHeroines[_selHeroine];
            var selectedController = selectedHeroine.Controller;

            GUILayout.BeginHorizontal();
            {
                // Left column ----------------------------------------------------------------------------------------
                GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(_charaListWidth), GUILayout.ExpandHeight(true));
                if (_crestableHeroines.Count == 0)
                {
                    GUILayout.FlexibleSpace();
                    var alig = GUI.skin.label.alignment;
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    GUILayout.Label("Only present club memebers can be given a crest.\n\nInvite some new members and try again!");
                    GUI.skin.label.alignment = alig;
                    GUILayout.FlexibleSpace();
                }
                else
                {
                    _scrollPos1 = GUILayout.BeginScrollView(_scrollPos1, false, true, GUILayout.ExpandWidth(true),
                        GUILayout.ExpandHeight(true));
                    {
                        if (_singleItemSize > 0)
                        {
                            for (int i = 0; i < _crestableHeroines.Count;)
                            {
                                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
                                for (int r = 0; r < _rowCount && i < _crestableHeroines.Count; i++, r++)
                                {
                                    var heroine = _crestableHeroines[i];
                                    var style = _selHeroine == i ? _btnStyleSelected : _btnStyleDeselected;
                                    GUILayout.BeginVertical(style, GUILayout.Width(_singleItemSize), GUILayout.ExpandHeight(false));
                                    {
                                        GUILayout.Label(heroine.GetFaceTex());
                                        GUILayout.Label(heroine.HeroineName);
                                        GUILayout.Label(heroine.GetCrestName());
                                    }
                                    GUILayout.EndVertical();

                                    // bug This will pick up elements even if they are scrolled outside of the scrollview.
                                    // This is mitigated by making the scrollview take whole left side, but beware when reordering.
                                    // Getting scrollview rect and checking if mouse is inside of it didn't work properly because it was offset for some reason.
                                    if (ClickedInsideLastElement())
                                    {
                                        _selHeroine = i;
                                        _selCrest = _crestlist.GetIndex(heroine.Controller.CurrentCrest);
                                    }
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                    }
                    GUILayout.EndScrollView();

                    //if (Event.current.type == EventType.repaint)
                    //{
                    //    _scrollRect = GUILayoutUtility.GetLastRect();
                    //    //Console.WriteLine("scrl " + _scrollRect.ToString());
                    //}
                }

                GUILayout.EndVertical();

                // Right column ----------------------------------------------------------------------------------------
                GUILayout.BeginVertical(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                {
                    GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true));
                    {
                        GUILayout.Label("Your club's love research includes giving other club members lewd crests. " +
                                        "Crests can have many different effects, but members don't know about them to avoid bias.");
                        GUILayout.Label("If you don't see a character, make sure they are club members. " +
                                        "Effects are applied immediately or on next period. " +
                                        "After a crest is removed effects are reverted but memories remain.");
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical(GUI.skin.box, GUILayout.Height(160), GUILayout.ExpandWidth(true));
                    {
                        _scrollPos2 = GUILayout.BeginScrollView(_scrollPos2, false, true, GUILayout.ExpandWidth(true));
                        {
                            _selCrest = GUILayout.SelectionGrid(_selCrest, _crestlist.GetInterfaceNames(), 3, _btnStyleDeselected, GUILayout.ExpandWidth(true));
                            if (GUI.changed)
                            {
                                selectedController.CurrentCrest = _crestlist.GetType(_selCrest);
                                GUI.changed = false;
                            }
                        }
                        GUILayout.EndScrollView();
                        ShowOnlyImplemented = GUILayout.Toggle(ShowOnlyImplemented, "Show only crests with gameplay effects");
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true));
                    {
                        GUILayout.Label("Currently selected heroine: " + selectedHeroine.HeroineName);
                        var currentCrest = _crestlist.GetInfo(_selCrest);
                        GUILayout.Label("Currently selected crest: " + (currentCrest?.Name ?? "None"));
                        if (currentCrest != null)
                        {
                            GUILayout.Label("Description: " + currentCrest.Description);
                            selectedController.HideCrestGraphic = GUILayout.Toggle(selectedController.HideCrestGraphic, "Hide crest graphic (effect is still applied)");
                            GUILayout.FlexibleSpace();
                            GUILayout.Label(currentCrest.Implemented
                                ? "Gameplay will be changed roughly as described."
                                : "Only for looks and lore, it won't change gameplay.");
                        }
                        else
                        {
                            GUILayout.Label("No crest selected. Choose a crest on the left see its description and give it to the selected character.");
                        }
                    }
                    GUILayout.EndVertical();

                    if (GUILayout.Button("Close this window", GUILayout.ExpandWidth(true)))
                        ShowWindow = false;
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : FolderTreeView.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

public void DrawDirectoryTree()
        {

            ExpandToCurrentFolder();

            GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
            {
                _treeScrollPosition = GUILayout.BeginScrollView(_treeScrollPosition, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                {
                    var itemsDrawn = 0;
                    DisplayObjectTreeHelper(DefaultPathTree, 0, ref itemsDrawn);
                }
                GUILayout.EndScrollView();

                if (_scrollviewHeight == 0 && Event.current.type == EventType.Repaint)
                    _scrollviewHeight = (int)GUILayoutUtility.GetLastRect().height;

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Search: ", GUILayout.ExpandWidth(false));
                    _searchString = GUILayout.TextField(_searchString).Replace('\\', '/');
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();


            try
            {
                StartMonitoringFiles();
            }
            catch (InvalidOperationException)
            {
                // stop monitoring and trigger refresh
                StopMonitoringFiles();
                ResetTreeCache();
            }
        }

19 View Source File : GizmoDrawer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

public static void DisplayControls()
        {
            if (!UnityFeatureHelper.SupportsVectrosity) return;

            GUILayout.BeginHorizontal(GUI.skin.box);
            {
                GUILayout.Label("Gizmos");
                GUILayout.FlexibleSpace();
                ShowGizmos = GUILayout.Toggle(ShowGizmos, "Show selection");
                ShowGizmosOutsideEditor = GUILayout.Toggle(ShowGizmosOutsideEditor, "When closed");
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : Inspector.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void InspectorWindow(int id)
        {
            try
            {
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(true));
                        {
                            GUILayout.Label("Filter:", GUILayout.ExpandWidth(false));

                            GUI.SetNextControlName(SearchBoxName);
                            SearchString = GUILayout.TextField(SearchString, GUILayout.ExpandWidth(true));

                            if (_focusSearchBox)
                            {
                                GUI.FocusWindow(id);
                                GUI.FocusControl(SearchBoxName);
                                _focusSearchBox = false;
                            }

                            GUILayout.Label("Find:", GUILayout.ExpandWidth(false));
                            foreach (var obj in new[]
                            {
                                new KeyValuePair<object, string>(
                                    EditorUtilities.GetInstanceClreplacedScanner().OrderBy(x => x.Name()), "Instances"),
                                new KeyValuePair<object, string>(EditorUtilities.GetComponentScanner().OrderBy(x => x.Name()),
                                    "Components"),
                                new KeyValuePair<object, string>(
                                    EditorUtilities.GetMonoBehaviourScanner().OrderBy(x => x.Name()), "MonoBehaviours"),
                                new KeyValuePair<object, string>(EditorUtilities.GetTransformScanner().OrderBy(x => x.Name()),
                                    "Transforms")
                                //                            new KeyValuePair<object, string>(GetTypeScanner(CurrentTab.InspectorStack.Peek().GetType()).OrderBy(x=>x.Name()), CurrentTab.InspectorStack.Peek().GetType().ToString()+"s"),
                            })
                            {
                                if (obj.Key == null) continue;
                                if (GUILayout.Button(obj.Value, GUILayout.ExpandWidth(false)))
                                    Push(new InstanceStackEntry(obj.Key, obj.Value), true);
                            }
                        }
                        GUILayout.EndHorizontal();

                        GUILayout.Space(6);

                        GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.Width(160));
                        {
                            if (GUILayout.Button("Help"))
                                Push(InspectorHelpObject.Create(), true);
                            if (GUILayout.Button("Close"))
                                Show = false;
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndHorizontal();

                    var currentTab = GetCurrentTab();
                    var defaultGuiColor = GUI.color;
                    if (_tabs.Count >= 2)
                    {
                        _tabScrollPos = GUILayout.BeginScrollView(_tabScrollPos, false, false,
                            GUI.skin.horizontalScrollbar, GUIStyle.none, GUIStyle.none); //, GUILayout.Height(46)
                        {
                            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false));
                            for (var index = 0; index < _tabs.Count; index++)
                            {
                                var tab = _tabs[index];

                                if (currentTab == tab)
                                    GUI.color = Color.cyan;

                                if (GUILayout.Button($"Tab {index + 1}: {LimitStringLengthForPreview(tab?.CurrentStackItem?.Name, 18)}", GUILayout.ExpandWidth(false)))
                                {
                                    if (IsContextClick())
                                        RemoveTab(tab);
                                    else
                                        _currentTab = tab;

                                    GUI.color = defaultGuiColor;
                                    break;
                                }

                                GUI.color = defaultGuiColor;
                            }

                            GUILayout.FlexibleSpace();
                            GUI.color = new Color(1, 1, 1, 0.6f);
                            if (GUILayout.Button("Close all"))
                            {
                                _tabs.Clear();
                                _currentTab = null;
                            }
                            GUI.color = defaultGuiColor;

                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndScrollView();
                    }

                    if (currentTab != null)
                    {
                        currentTab.InspectorStackScrollPos = GUILayout.BeginScrollView(currentTab.InspectorStackScrollPos, false, false,
                            GUI.skin.horizontalScrollbar, GUIStyle.none, GUIStyle.none); //, GUILayout.Height(46)
                        {
                            GUILayout.BeginHorizontal(GUI.skin.box, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false));
                            var stackEntries = currentTab.InspectorStack.Reverse().ToArray();
                            for (var i = 0; i < stackEntries.Length; i++)
                            {
                                var item = stackEntries[i];

                                if (i + 1 == stackEntries.Length)
                                    GUI.color = Color.cyan;

                                if (GUILayout.Button(LimitStringLengthForPreview(item.Name, 90), GUILayout.ExpandWidth(false)))
                                {
                                    currentTab.PopUntil(item);
                                    GUI.color = defaultGuiColor;
                                    return;
                                }

                                if (i + 1 < stackEntries.Length)
                                    GUILayout.Label(">", GUILayout.ExpandWidth(false));

                                GUI.color = defaultGuiColor;
                            }
                            GUILayout.EndHorizontal();
                        }
                        GUILayout.EndScrollView();

                        GUILayout.BeginVertical(GUI.skin.box);
                        {
                            GUILayout.BeginHorizontal();
                            {
                                GUILayout.Space(1);
                                GUILayout.Label("Value/return type", GUI.skin.box, _inspectorTypeWidth);
                                GUILayout.Space(2);
                                GUILayout.Label("Member name", GUI.skin.box, _inspectorNameWidth);
                                GUILayout.Space(1);
                                GUILayout.Label("Value", GUI.skin.box, GUILayout.ExpandWidth(true));
                            }
                            GUILayout.EndHorizontal();

                            DrawContentScrollView(currentTab);
                        }
                        GUILayout.EndVertical();
                    }
                    else
                    {
                        GUILayout.Label("Nothing to show. Click on objects in the scene browser to open them in a new tab.");
                        GUILayout.Label("Tip: You can right click on a member inside inspector to open in a new tab, and on a tab to close it.");
                        GUILayout.FlexibleSpace();
                    }
                }
                GUILayout.EndVertical();
            }
            catch (Exception ex)
            {
                RuntimeUnityEditorCore.Logger.Log(LogLevel.Error, "[Inspector] GUI crash: " + ex);
                //CurrentTab?.Pop();
            }

            VariableFieldDrawer.DrawCurrentDropdown();

            _inspectorWindowRect = IMGUIUtils.DragOrResize(id, _inspectorWindowRect);
        }

19 View Source File : SceneFolders.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void TreeWindow(int id)
        {
            GUILayout.BeginHorizontal();
            {
                _folderTreeView.DrawDirectoryTree();

                GUILayout.BeginVertical(GUI.skin.box, GUILayout.Width(200));
                {
                    if (GUILayout.Button("Refresh scene thumbnails"))
                    {
                        _folderTreeView.ResetTreeCache();
                        OnFolderChanged();
                    }

                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Open current folder in explorer"))
                        Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
                    if (GUILayout.Button("Open screenshot folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
                    if (GUILayout.Button("Open character folder in explorer"))
                        Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "chara"));
                    if (GUILayout.Button("Open main game folder in explorer"))
                        Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : Inspector.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DrawSingleContentEntry(ICacheEntry entry)
        {
            GUILayout.BeginHorizontal(_inspectorRecordHeight);
            {
                try
                {
                    GUILayout.Label(entry.TypeName(), _inspectorTypeWidth);

                    var value = entry.GetValue();

                    if (entry.CanEnterValue() || value is Exception)
                        DrawVariableNameEnterButton(entry);
                    else
                        GUILayout.TextArea(entry.Name(), GUI.skin.label, _inspectorNameWidth);

                    VariableFieldDrawer.DrawSettingValue(entry, value);

                    if (DnSpyHelper.IsAvailable && GUILayout.Button("^", _dnSpyButtonOptions))
                        DnSpyHelper.OpenInDnSpy(entry);
                }
                catch (Exception ex)
                {
                    RuntimeUnityEditorCore.Logger.Log(LogLevel.Error, $"Failed to draw setting {entry?.Name()} - {ex.Message}");
                    GUILayout.TextArea(ex.Message, GUI.skin.label, GUILayout.ExpandWidth(true));
                }
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : VariableFieldDrawer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private static void DrawFlagsField(ICacheEntry setting, IList enumValues, object fieldValue)
        {
            var currentValue = Convert.ToInt64(fieldValue);
            var allValues = enumValues.Cast<Enum>().Select(x => new { name = x.ToString(), val = Convert.ToInt64(x) }).ToArray();

            // Vertically stack Horizontal groups of the options to deal with the options taking more width than is available in the window
            GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
            {
                for (var index = 0; index < allValues.Length;)
                {
                    GUILayout.BeginHorizontal();
                    {
                        var currentWidth = 0;
                        for (; index < allValues.Length; index++)
                        {
                            var value = allValues[index];

                            // Skip the 0 / none enum value, just uncheck everything to get 0
                            if (value.val != 0)
                            {
                                // Make sure this horizontal group doesn't extend over window width, if it does then start a new horiz group below
                                var textDimension = (int)GUI.skin.toggle.CalcSize(new GUIContent(value.name)).x;
                                currentWidth += textDimension;
                                if (currentWidth > 370)
                                    break;

                                GUI.changed = false;
                                var newVal = GUILayout.Toggle((currentValue & value.val) == value.val, value.name,
                                    GUILayout.ExpandWidth(false));
                                if (GUI.changed)
                                {
                                    var newValue = newVal ? currentValue | value.val : currentValue & ~value.val;
                                    setting.SetValue(Enum.ToObject(setting.Type(), newValue));
                                }
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                GUI.changed = false;
            }
            GUILayout.EndVertical();
            // Make sure the reset button is properly spaced
            GUILayout.FlexibleSpace();
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DisplayObjectTreeHelper(GameObject go, int indent, ref int currentCount)
        {
            currentCount++;

            var needsHeightMeasure = _singleObjectTreeItemHeight == 0;

            var isVisible = currentCount * _singleObjectTreeItemHeight >= _treeScrollPosition.y &&
                            (currentCount - 1) * _singleObjectTreeItemHeight <= _treeScrollPosition.y + _objectTreeHeight;

            if (isVisible || needsHeightMeasure || _scrollTreeToSelected)
            {
                var c = GUI.color;
                if (SelectedTransform == go.transform)
                {
                    GUI.color = Color.cyan;
                    if (_scrollTreeToSelected && Event.current.type == EventType.Repaint)
                        _scrollTarget = (int)(GUILayoutUtility.GetLastRect().y - 250);
                }
                else if (!go.activeSelf)
                {
                    GUI.color = new Color(1, 1, 1, 0.6f);
                }

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(indent * 20f);

                    GUILayout.BeginHorizontal();
                    {
                        if (go.transform.childCount != 0)
                        {
                            if (GUILayout.Toggle(_openedObjects.Contains(go), "", GUILayout.ExpandWidth(false)))
                                _openedObjects.Add(go);
                            else
                                _openedObjects.Remove(go);
                        }
                        else
                        {
                            GUILayout.Space(20f);
                        }

                        if (GUILayout.Button(go.name, GUI.skin.label, GUILayout.ExpandWidth(true), GUILayout.MinWidth(200)))
                        {
                            if (SelectedTransform == go.transform)
                            {
                                // Toggle on/off
                                if (!_openedObjects.Add(go))
                                    _openedObjects.Remove(go);
                            }
                            else
                            {
                                SelectedTransform = go.transform;
                            }
                        }

                        GUI.color = c;
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndHorizontal();

                if (needsHeightMeasure && Event.current.type == EventType.repaint)
                    _singleObjectTreeItemHeight = Mathf.CeilToInt(GUILayoutUtility.GetLastRect().height);
            }
            else
            {
                GUILayout.Space(_singleObjectTreeItemHeight);
            }

            if (_openedObjects.Contains(go))
            {
                for (var i = 0; i < go.transform.childCount; ++i)
                    DisplayObjectTreeHelper(go.transform.GetChild(i).gameObject, indent + 1, ref currentCount);
            }
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void WindowFunc(int id)
        {
            GUILayout.BeginVertical();
            {
                DisplayObjectTree();

                DisplayControls();

                DisplayObjectProperties();
            }
            GUILayout.EndHorizontal();

            _windowRect = IMGUIUtils.DragOrResize(id, _windowRect);
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DisplayControls()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.BeginHorizontal(GUI.skin.box);
                {
                    GUILayout.Label("Time", GUILayout.ExpandWidth(false));

                    if (GUILayout.Button(">", GUILayout.ExpandWidth(false)))
                        Time.timeScale = 1;
                    if (GUILayout.Button("||", GUILayout.ExpandWidth(false)))
                        Time.timeScale = 0;

                    if (float.TryParse(GUILayout.TextField(Time.timeScale.ToString("F2", CultureInfo.InvariantCulture), _drawVector3FieldWidth), NumberStyles.Any, CultureInfo.InvariantCulture, out var newVal))
                        Time.timeScale = newVal;
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal(GUI.skin.box);
                {
                    if (SelectedTransform == null) GUI.enabled = false;
                    if (GUILayout.Button("Dump", GUILayout.ExpandWidth(false)))
                        SceneDumper.DumpObjects(SelectedTransform.gameObject);
                    GUI.enabled = true;

                    if (GUILayout.Button("Log", GUILayout.ExpandWidth(false)))
                        UnityFeatureHelper.OpenLog();

                    GUILayout.FlexibleSpace();

                    if (RuntimeUnityEditorCore.Instance.Repl != null)
                        RuntimeUnityEditorCore.Instance.ShowRepl = GUILayout.Toggle(RuntimeUnityEditorCore.Instance.ShowRepl, "REPL");

                    _wireframe = GUILayout.Toggle(_wireframe, "Wireframe");
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            {
                GUI.changed = false;
                var n = GUILayout.Toggle(Application.runInBackground, "Run in bg");
                if (GUI.changed) Application.runInBackground = n;

                RuntimeUnityEditorCore.Instance.EnableMouseInspect = GUILayout.Toggle(RuntimeUnityEditorCore.Instance.EnableMouseInspect, "Mouse inspect");

                replacedetBundleManagerHelper.DrawButtonIfAvailable();
            }
            GUILayout.EndHorizontal();

            GizmoDrawer.DisplayControls();
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DisplayObjectProperties()
        {
            _propertiesScrollPosition = GUILayout.BeginScrollView(_propertiesScrollPosition, GUI.skin.box);
            {
                if (SelectedTransform == null)
                {
                    GUILayout.Label("No object selected");
                }
                else
                {
                    DrawTransformControls();

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label("Search components ", GUILayout.ExpandWidth(false));

                        _searchTextComponents = GUILayout.TextField(_searchTextComponents, GUILayout.ExpandWidth(true));

                        if (GUILayout.Button("Clear", GUILayout.ExpandWidth(false)))
                            _searchTextComponents = string.Empty;
                    }
                    GUILayout.EndHorizontal();

                    foreach (var component in SelectedTransform.GetComponents<Component>())
                    {
                        if (component == null)
                            continue;

                        if (!string.IsNullOrEmpty(_searchTextComponents) && !GameObjectSearcher.SearchInComponent(_searchTextComponents, component, false))
                            continue;

                        DrawSingleComponent(component);
                    }
                }
            }
            GUILayout.EndScrollView();
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DrawTransformControls()
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                var fullTransfromPath = SelectedTransform.GetFullTransfromPath();

                GUILayout.TextArea(fullTransfromPath, GUI.skin.label);

                GUILayout.BeginHorizontal();
                {
                    var selectedGameObject = SelectedTransform.gameObject;
                    GUILayout.Label($"Layer {selectedGameObject.layer} ({LayerMask.LayerToName(selectedGameObject.layer)})");

                    GUILayout.Space(8);

                    GUILayout.Toggle(selectedGameObject.isStatic, "isStatic");

                    selectedGameObject.SetActive(GUILayout.Toggle(selectedGameObject.activeSelf, "Active", GUILayout.ExpandWidth(false)));

                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Inspect"))
                        OnInspectorOpen(new InstanceStackEntry(selectedGameObject, selectedGameObject.name));

                    if (GUILayout.Button("X"))
                        Object.Destroy(selectedGameObject);
                }
                GUILayout.EndHorizontal();

                DrawVector3(nameof(Transform.position), vector3 => SelectedTransform.position = vector3, () => SelectedTransform.position, -5, 5);
                DrawVector3(nameof(Transform.localPosition), vector3 => SelectedTransform.localPosition = vector3, () => SelectedTransform.localPosition, -5, 5);
                DrawVector3(nameof(Transform.localScale), vector3 => SelectedTransform.localScale = vector3, () => SelectedTransform.localScale, 0.00001f, 5);
                DrawVector3(nameof(Transform.eulerAngles), vector3 => SelectedTransform.eulerAngles = vector3, () => SelectedTransform.eulerAngles, 0, 360);
                DrawVector3("localEuler", vector3 => SelectedTransform.localEulerAngles = vector3, () => SelectedTransform.localEulerAngles, 0, 360);
            }
            GUILayout.EndVertical();
        }

19 View Source File : ObjectTreeViewer.cs
License : GNU General Public License v3.0
Project Creator : ManlyMarco

private void DrawVector3(string name, Action<Vector3> set, Func<Vector3> get, float minVal, float maxVal)
        {
            var v3 = get();
            var v3New = v3;

            GUI.changed = false;
            GUILayout.BeginHorizontal();
            {
                GUILayout.Label(name, GUILayout.ExpandWidth(true), _drawVector3FieldHeight);
                v3New.x = GUILayout.HorizontalSlider(v3.x, minVal, maxVal, _drawVector3SliderWidth, _drawVector3SliderHeight);
                float.TryParse(GUILayout.TextField(v3New.x.ToString("F2", CultureInfo.InvariantCulture), _drawVector3FieldWidth, _drawVector3FieldHeight), NumberStyles.Any, CultureInfo.InvariantCulture, out v3New.x);
                v3New.y = GUILayout.HorizontalSlider(v3.y, minVal, maxVal, _drawVector3SliderWidth, _drawVector3SliderHeight);
                float.TryParse(GUILayout.TextField(v3New.y.ToString("F2", CultureInfo.InvariantCulture), _drawVector3FieldWidth, _drawVector3FieldHeight), NumberStyles.Any, CultureInfo.InvariantCulture, out v3New.y);
                v3New.z = GUILayout.HorizontalSlider(v3.z, minVal, maxVal, _drawVector3SliderWidth, _drawVector3SliderHeight);
                float.TryParse(GUILayout.TextField(v3New.z.ToString("F2", CultureInfo.InvariantCulture), _drawVector3FieldWidth, _drawVector3FieldHeight), NumberStyles.Any, CultureInfo.InvariantCulture, out v3New.z);
            }
            GUILayout.EndHorizontal();

            if (GUI.changed && v3 != v3New) set(v3New);
        }

See More Examples