Here are the examples of the csharp api UnityEngine.GUILayout.ExpandHeight(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
91 Examples
19
Source : LuaConsole.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI()
{
if (!initedStyle)
{
GUIStyle entryInfoTyle = "CN EntryInfo";
textAreaStyle.richText = true;
textAreaStyle.normal.textColor = entryInfoTyle.normal.textColor;
initedStyle = true;
}
string[] statehints = new string[LuaState.statemap.Count];
LuaState[] states = new LuaState[LuaState.statemap.Count];
int n = 0;
foreach(var k in LuaState.statemap.Values) {
states[n] = k;
statehints[n++] = k.Name;
}
stateIndex = EditorGUILayout.Popup(stateIndex,statehints);
LuaState l = null;
if (stateIndex >= 0 && stateIndex <states.Length)
l = states[stateIndex];
if (current != null && current != l)
{
current.logDelegate -= AddLog;
current.errorDelegate -= AddError;
}
if(current!=l && l!=null) {
l.logDelegate += AddLog;
l.errorDelegate += AddError;
current = l;
}
//Output Text Area
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width), GUILayout.ExpandHeight(true));
EditorGUILayout.TextArea(outputText, textAreaStyle, GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
//Filter Option Toggles
GUILayout.BeginHorizontal();
bool oldToggleLog = toggleLog;
bool oldToggleErr = toggleErr;
toggleLog = GUILayout.Toggle(oldToggleLog, "log", GUILayout.ExpandWidth(false));
toggleErr = GUILayout.Toggle(oldToggleErr, "error", GUILayout.ExpandWidth(false));
//Filter Input Field
GUILayout.Space(10f);
GUILayout.Label("filter:", GUILayout.ExpandWidth(false));
string oldFilterPattern = filterText;
filterText = GUILayout.TextField(oldFilterPattern, GUILayout.Width(200f));
//Menu Buttons
if (GUILayout.Button("clear", GUILayout.ExpandWidth(false)))
{
recordList.Clear();
ConsoleFlush();
}
GUILayout.EndHorizontal();
if (toggleLog != oldToggleLog || toggleErr != oldToggleErr || filterText != oldFilterPattern)
{
ConsoleFlush();
}
if (Event.current.type == EventType.Repaint)
{
inputAreaPosY = GUILayoutUtility.GetLastRect().yMax;
}
//Drag Spliter
ResizeScrollView();
//Input Area
GUI.SetNextControlName("Input");
inputText = EditorGUILayout.TextField(inputText, GUILayout.Height(inputAreaHeight));
if (Event.current.isKey && Event.current.type == EventType.KeyUp)
{
bool refresh = false;
if (Event.current.keyCode == KeyCode.Return)
{
if (inputText != "")
{
if (history.Count == 0 || history[history.Count - 1] != inputText)
{
history.Add(inputText);
}
AddLog(inputText);
DoCommand(inputText);
inputText = "";
refresh = true;
historyIndex = history.Count;
}
}
else if (Event.current.keyCode == KeyCode.UpArrow)
{
if (history.Count > 0)
{
historyIndex = historyIndex - 1;
if (historyIndex < 0)
{
historyIndex = 0;
}
else
{
inputText = history[historyIndex];
refresh = true;
}
}
}
else if (Event.current.keyCode == KeyCode.DownArrow)
{
if (history.Count > 0)
{
historyIndex = historyIndex + 1;
if (historyIndex > history.Count - 1)
{
historyIndex = history.Count - 1;
}
else
{
inputText = history[historyIndex];
refresh = true;
}
}
}
if (refresh)
{
Repaint();
EditorGUIUtility.editingTextField = false;
GUI.FocusControl("Input");
}
}
}
19
Source : BlendshapePrinter.cs
with GNU General Public License v3.0
from ARPOISE
with GNU General Public License v3.0
from ARPOISE
void OnGUI()
{
if (shapeEnabled) {
string blendshapes = "";
string shapeNames = "";
string valueNames = "";
foreach(KeyValuePair<string,float> kvp in currentBlendShapes) {
blendshapes += " [";
blendshapes += kvp.Key.ToString ();
blendshapes += ":";
blendshapes += kvp.Value.ToString ();
blendshapes += "]\n";
shapeNames += "\"";
shapeNames += kvp.Key.ToString ();
shapeNames += "\",\n";
valueNames += kvp.Value.ToString ();
valueNames += "\n";
}
GUILayout.BeginHorizontal (GUILayout.ExpandHeight(true));
GUILayout.Box (blendshapes);
GUILayout.EndHorizontal ();
Debug.Log (shapeNames);
Debug.Log (valueNames);
}
}
19
Source : TMP_PackageUtilities.cs
with MIT License
from ashishgopalhattimare
with MIT License
from ashishgopalhattimare
void OnGUI()
{
GUILayout.BeginVertical();
{
// Scan project files and resources
GUILayout.BeginVertical(EditorStyles.helpBox);
{
GUILayout.Label("Scan Project Files", EditorStyles.boldLabel);
GUILayout.Label("Press the <i>Scan Project Files</i> button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro.", TMP_UIStyleManager.label);
GUILayout.Space(10f);
GUILayout.Label("Project folder to be scanned. Example \"replacedets/TextMesh Pro\"");
m_ProjectFolderToScan = EditorGUILayout.TextField("Folder Path: replacedets/", m_ProjectFolderToScan);
GUILayout.Space(5f);
GUI.enabled = m_IsAlreadyScanningProject == false ? true : false;
if (GUILayout.Button("Scan Project Files"))
{
m_CancelScanProcess = false;
// Make sure replacedet Serialization mode is set to ForceText and Version Control mode to Visible Meta Files.
if (CheckProjectSerializationAndSourceControlModes() == true)
{
EditorCoroutine.StartCoroutine(ScanProjectFiles());
}
else
{
EditorUtility.DisplayDialog("Project Settings Change Required", "In menu options \"Edit - Project Settings - Editor\", please change replacedet Serialization Mode to ForceText and Source Control Mode to Visible Meta Files.", "OK", string.Empty);
}
}
GUI.enabled = true;
// Display progress bar
Rect rect = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true));
EditorGUI.ProgressBar(rect, m_ProgressPercentage, "Scan Progress (" + m_ScanningCurrentFileIndex + "/" + m_ScanningTotalFiles + ")");
// Display cancel button and name of file currently being scanned.
if (m_IsAlreadyScanningProject)
{
Rect cancelRect = new Rect(rect.width - 20, rect.y + 2, 20, 16);
if (GUI.Button(cancelRect, "X"))
{
m_CancelScanProcess = true;
}
GUILayout.Label("Scanning: " + m_ScanningCurrentFileName);
}
else
GUILayout.Label(string.Empty);
GUILayout.Space(5);
// Creation Feedback
GUILayout.BeginVertical(TMP_UIStyleManager.textAreaBoxWindow, GUILayout.ExpandHeight(true));
{
m_ProjectScanResultScrollPosition = EditorGUILayout.BeginScrollView(m_ProjectScanResultScrollPosition, GUILayout.ExpandHeight(true));
EditorGUILayout.LabelField(m_ProjectScanResults, TMP_UIStyleManager.label);
EditorGUILayout.EndScrollView();
}
GUILayout.EndVertical();
GUILayout.Space(5f);
}
GUILayout.EndVertical();
// Scan project files and resources
GUILayout.BeginVertical(EditorStyles.helpBox);
{
GUILayout.Label("Save Modified Project Files", EditorStyles.boldLabel);
GUILayout.Label("Pressing the <i>Save Modified Project Files</i> button will update the files in the <i>Project Scan Results</i> listed above. <color=#FFFF80>Please make sure that you have created a backup of your project first</color> as these file modifications are permanent and cannot be undone.", TMP_UIStyleManager.label);
GUILayout.Space(5f);
GUI.enabled = m_IsAlreadyScanningProject == false && m_ModifiedreplacedetList.Count > 0 ? true : false;
if (GUILayout.Button("Save Modified Project Files"))
{
UpdateProjectFiles();
}
GUILayout.Space(10f);
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.Space(5f);
}
19
Source : Q_InventoryItemEditorWindow.cs
with GNU Affero General Public License v3.0
from AugustToko
with GNU Affero General Public License v3.0
from AugustToko
private void OnGUI()
{
using (var h = new EditorGUILayout.HorizontalScope())
{
using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos))
{
scrollPos = scrollView.scrollPosition;
GUILayout.Label("Item Editor", labelStyle);
GUILayout.Space(20);
m_ObjectType = (ObjectType) EditorGUILayout.EnumPopup("Object Creating Type", m_ObjectType);
GUILayout.Space(10);
if (inventoryItemList != null)
{
GUILayout.BeginHorizontal();
GUILayout.Space(10);
if (GUILayout.Button("Prev", GUILayout.ExpandWidth(false)))
{
ClearReorderableList();
if (viewIndex > 1)
viewIndex--;
else if (viewIndex == 1)
viewIndex = inventoryItemList.itemList.Count;
InitializeReorderableList();
}
GUILayout.Space(5);
if (GUILayout.Button("Next", GUILayout.ExpandWidth(false)))
{
ClearReorderableList();
if (viewIndex < inventoryItemList.itemList.Count)
{
viewIndex++;
}
else if (viewIndex == inventoryItemList.itemList.Count)
{
viewIndex = 1;
}
InitializeReorderableList();
}
GUILayout.Space(180);
if (GUILayout.Button("Add Item", GUILayout.ExpandWidth(false)))
{
AddItem();
}
if (inventoryItemList.itemList.Count > 0)
{
if (GUILayout.Button("Delete Item", GUILayout.ExpandWidth(false)))
{
DeleteItem(viewIndex - 1);
}
}
GUILayout.EndHorizontal();
//...........
if (inventoryItemList.itemList == null)
Debug.Log("Dont have item");
if (inventoryItemList.itemList.Count > 0)
{
GUILayout.Label("Normal Settings", tipLabelStyle);
GUILayout.BeginHorizontal();
viewIndex = Mathf.Clamp(
EditorGUILayout.IntField("Current Item", viewIndex, GUILayout.ExpandWidth(false)), 1,
inventoryItemList.itemList.Count);
EditorGUILayout.LabelField(
"of " + inventoryItemList.itemList.Count.ToString() + " items", "",
GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(10);
//下面是各种物品数据的显示
//ID
GUILayout.Label("Item ID: " +
inventoryItemList.itemList[viewIndex - 1].ID.ToString());
//Name
EditorGUI.BeginChangeCheck();
inventoryItemList.itemList[viewIndex - 1].itemName =
EditorGUILayout.DelayedTextField("Item Name",
inventoryItemList.itemList[viewIndex - 1].itemName as string);
if (EditorGUI.EndChangeCheck())
{
replacedetDatabase.Renamereplacedet(
EditorPrefs.GetString("DatabasePath") + "/Items/" +
inventoryItemList.itemList[viewIndex - 1].m_object.name + ".prefab",
inventoryItemList.itemList[viewIndex - 1].itemName);
replacedetDatabase.Renamereplacedet(
EditorPrefs.GetString("DatabasePath") + "/Items/ItemScriptObjects/" +
inventoryItemList.itemList[viewIndex - 1].name + ".replacedet",
inventoryItemList.itemList[viewIndex - 1].itemName);
replacedetDatabase.Savereplacedets();
}
GUILayout.Space(5);
//Description
GUILayout.Label("Item Description");
GUILayout.Space(5);
scrollPos2 = EditorGUILayout.BeginScrollView(scrollPos2, GUILayout.Height(100));
inventoryItemList.itemList[viewIndex - 1].description = EditorGUILayout.TextArea(
inventoryItemList.itemList[viewIndex - 1].description, GUILayout.ExpandHeight(true));
EditorGUILayout.EndScrollView();
GUILayout.Space(5);
//icon
EditorGUI.BeginChangeCheck();
inventoryItemList.itemList[viewIndex - 1].icon = EditorGUILayout.ObjectField("Item Icon",
inventoryItemList.itemList[viewIndex - 1].icon, typeof(Sprite), false) as Sprite;
if (EditorGUI.EndChangeCheck())
{
if (inventoryItemList.itemList[viewIndex - 1].m_object && inventoryItemList
.itemList[viewIndex - 1].m_object.GetComponent<SpriteRenderer>())
{
inventoryItemList.itemList[viewIndex - 1].m_object.GetComponent<SpriteRenderer>()
.sprite = inventoryItemList.itemList[viewIndex - 1].icon;
RefreshEditorProjectWindow();
}
}
//gameobject
inventoryItemList.itemList[viewIndex - 1].m_object =
EditorGUILayout.ObjectField("Item Object",
inventoryItemList.itemList[viewIndex - 1].m_object, typeof(GameObject),
false) as GameObject;
GUILayout.Space(10);
GUILayout.BeginHorizontal();
inventoryItemList.itemList[viewIndex - 1].isStackable = EditorGUILayout.Toggle(
"Is Stackable", inventoryItemList.itemList[viewIndex - 1].isStackable,
GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
GUILayout.Space(5);
if (inventoryItemList.itemList[viewIndex - 1].isStackable)
{
inventoryItemList.itemList[viewIndex - 1].maxStackNumber = Mathf.Clamp(
(int) EditorGUILayout.IntField("maxStackNumber",
inventoryItemList.itemList[viewIndex - 1].maxStackNumber), 1, 999);
GUILayout.Space(10);
}
inventoryItemList.itemList[viewIndex - 1].rarity =
(Rarity) EditorGUILayout.EnumPopup("Item Rarity",
inventoryItemList.itemList[viewIndex - 1].rarity);
GUILayout.Space(10);
inventoryItemList.itemList[viewIndex - 1].variety =
(Variety) EditorGUILayout.EnumPopup("Item Variety",
inventoryItemList.itemList[viewIndex - 1].variety);
if (inventoryItemList.itemList[viewIndex - 1].variety == Variety.Consumable)
{
GUILayout.Space(10);
GUILayout.Label("Consumable Settings", tipLabelStyle);
inventoryItemList.itemList[viewIndex - 1].coolDown = Mathf.Clamp(
(float) EditorGUILayout.FloatField("Cool Down",
inventoryItemList.itemList[viewIndex - 1].coolDown), 0, 99999999);
//
if (m_ConsumbleList != null && m_ConsumbleSerializedObject != null)
{
m_ConsumbleSerializedObject.ApplyModifiedProperties();
m_ConsumbleSerializedObject.Update();
m_ConsumbleList.DoLayoutList();
m_ConsumbleSerializedObject.ApplyModifiedProperties();
}
}
else if (inventoryItemList.itemList[viewIndex - 1].variety == Variety.Equipment)
{
GUILayout.Space(10);
GUILayout.Label("Equipment Settings", tipLabelStyle);
inventoryItemList.itemList[viewIndex - 1].equipmentPart =
(EquipmentPart) EditorGUILayout.EnumPopup("Equipment Part",
inventoryItemList.itemList[viewIndex - 1].equipmentPart);
//
if (m_EquipmentList != null && m_EquipmentSerializedObject != null)
{
m_EquipmentSerializedObject.ApplyModifiedProperties();
m_EquipmentSerializedObject.Update();
m_EquipmentList.DoLayoutList();
m_EquipmentSerializedObject.ApplyModifiedProperties();
}
}
GUILayout.Space(10);
if (inventoryItemList.itemList[viewIndex - 1].variety == Variety.Equipment ||
inventoryItemList.itemList[viewIndex - 1].variety == Variety.Consumable)
{
inventoryItemList.itemList[viewIndex - 1].clipOnUse =
EditorGUILayout.ObjectField("Clip",
inventoryItemList.itemList[viewIndex - 1].clipOnUse, typeof(AudioClip),
false) as AudioClip;
if (inventoryItemList.itemList[viewIndex - 1].clipOnUse)
{
inventoryItemList.itemList[viewIndex - 1].playClipTimes =
Mathf.Clamp(
(int) EditorGUILayout.IntField("Clip Play Times",
inventoryItemList.itemList[viewIndex - 1].playClipTimes), 1, 99);
}
}
GUILayout.Space(20);
GUILayout.Label("Price Settings", tipLabelStyle);
GUILayout.Space(10);
GUILayout.Label("Buy Price");
GUILayout.Space(5);
if (m_BuyPriceList != null && m_BuySerializedObject != null)
{
m_BuySerializedObject.ApplyModifiedProperties();
m_BuySerializedObject.Update();
m_BuyPriceList.DoLayoutList();
m_BuySerializedObject.ApplyModifiedProperties();
}
GUILayout.Label("Sell Price");
GUILayout.Space(5);
if (m_SellPriceList != null && m_SellSerializedObject != null)
{
m_SellSerializedObject.ApplyModifiedProperties();
m_SellSerializedObject.Update();
m_SellPriceList.DoLayoutList();
m_SellSerializedObject.ApplyModifiedProperties();
}
GUILayout.Space(10);
GUILayout.Space(20);
}
else
{
GUILayout.Space(50);
GUILayout.Label("This Inventory List is Empty.", normalCenterStyle);
}
}
}
}
if (GUI.changed)
{
EditorUtility.SetDirty(inventoryItemList);
if (viewIndex > 0)
EditorUtility.SetDirty(inventoryItemList.itemList[viewIndex - 1]);
}
//window.Repaint();
}
19
Source : PlayModeTestListGUI.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
public override void PrintHeadPanel()
{
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
base.PrintHeadPanel();
if (GUILayout.Button("Run all in player (" + EditorUserBuildSettings.activeBuildTarget + ")", EditorStyles.toolbarButton))
{
RunTestsInPlayer();
}
EditorGUILayout.EndHorizontal();
DrawFilters();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
EditorGUILayout.EndHorizontal();
}
19
Source : TestListGUIBase.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
public virtual void RenderTestList()
{
if (m_TestListTree == null)
{
GUILayout.Label("Loading...");
return;
}
m_TestListScroll = EditorGUILayout.BeginScrollView(m_TestListScroll,
GUILayout.ExpandWidth(true),
GUILayout.MaxWidth(2000));
if (m_TestListTree.data.root == null || m_TestListTree.data.rowCount == 0 || (!m_TestListTree.isSearching && !m_TestListTree.data.Gereplacedem(0).hasChildren))
{
if (m_TestRunnerUIFilter.IsFiltering)
{
if (GUILayout.Button("Clear filters"))
{
m_TestRunnerUIFilter.Clear();
m_TestListTree.ReloadData();
m_Window.Repaint();
}
}
RenderNoTestsInfo();
}
else
{
var treeRect = EditorGUILayout.GetControlRect(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
var treeViewKeyboardControlId = GUIUtility.GetControlID(FocusType.Keyboard);
m_TestListTree.OnGUI(treeRect, treeViewKeyboardControlId);
}
EditorGUILayout.EndScrollView();
}
19
Source : TestListGUIBase.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
public void RenderDetails()
{
m_TestInfoScroll = EditorGUILayout.BeginScrollView(m_TestInfoScroll);
var resultTextSize = TestRunnerWindow.Styles.info.CalcSize(new GUIContent(m_ResultText));
EditorGUILayout.SelectableLabel(m_ResultText, TestRunnerWindow.Styles.info,
GUILayout.ExpandHeight(true),
GUILayout.ExpandWidth(true),
GUILayout.MinWidth(resultTextSize.x),
GUILayout.MinHeight(resultTextSize.y));
EditorGUILayout.EndScrollView();
}
19
Source : TMP_PackageUtilities.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void OnGUI()
{
GUILayout.BeginVertical();
{
// Scan project files and resources
GUILayout.BeginVertical(EditorStyles.helpBox);
{
GUILayout.Label("Scan Project Files", EditorStyles.boldLabel);
GUILayout.Label("Press the <i>Scan Project Files</i> button to begin scanning your project for files & resources that were created with a previous version of TextMesh Pro.", TMP_UIStyleManager.label);
GUILayout.Space(10f);
GUILayout.Label("Project folder to be scanned. Example \"replacedets/TextMesh Pro\"");
m_ProjectFolderToScan = EditorGUILayout.TextField("Folder Path: replacedets/", m_ProjectFolderToScan);
GUILayout.Space(5f);
GUI.enabled = m_IsAlreadyScanningProject == false ? true : false;
if (GUILayout.Button("Scan Project Files"))
{
m_CancelScanProcess = false;
// Make sure replacedet Serialization mode is set to ForceText and Version Control mode to Visible Meta Files.
if (CheckProjectSerializationAndSourceControlModes() == true)
{
m_ProjectPath = Path.GetFullPath("replacedets/..");
TMP_EditorCoroutine.StartCoroutine(ScanProjectFiles());
}
else
{
EditorUtility.DisplayDialog("Project Settings Change Required", "In menu options \"Edit - Project Settings - Editor\", please change replacedet Serialization Mode to ForceText and Source Control Mode to Visible Meta Files.", "OK", string.Empty);
}
}
GUI.enabled = true;
// Display progress bar
Rect rect = GUILayoutUtility.GetRect(0f, 20f, GUILayout.ExpandWidth(true));
EditorGUI.ProgressBar(rect, m_ProgressPercentage, "Scan Progress (" + m_ScanningCurrentFileIndex + "/" + m_ScanningTotalFiles + ")");
// Display cancel button and name of file currently being scanned.
if (m_IsAlreadyScanningProject)
{
Rect cancelRect = new Rect(rect.width - 20, rect.y + 2, 20, 16);
if (GUI.Button(cancelRect, "X"))
{
m_CancelScanProcess = true;
}
GUILayout.Label(k_ProjectScanLabelPrefix + m_ScanningCurrentFileName, TMP_UIStyleManager.label);
}
else
GUILayout.Label(string.Empty);
GUILayout.Space(5);
// Creation Feedback
GUILayout.BeginVertical(TMP_UIStyleManager.textAreaBoxWindow, GUILayout.ExpandHeight(true));
{
m_ProjectScanResultScrollPosition = EditorGUILayout.BeginScrollView(m_ProjectScanResultScrollPosition, GUILayout.ExpandHeight(true));
EditorGUILayout.LabelField(m_ProjectScanResults, TMP_UIStyleManager.label);
EditorGUILayout.EndScrollView();
}
GUILayout.EndVertical();
GUILayout.Space(5f);
}
GUILayout.EndVertical();
// Scan project files and resources
GUILayout.BeginVertical(EditorStyles.helpBox);
{
GUILayout.Label("Save Modified Project Files", EditorStyles.boldLabel);
GUILayout.Label("Pressing the <i>Save Modified Project Files</i> button will update the files in the <i>Project Scan Results</i> listed above. <color=#FFFF80>Please make sure that you have created a backup of your project first</color> as these file modifications are permanent and cannot be undone.", TMP_UIStyleManager.label);
GUILayout.Space(5f);
GUI.enabled = m_IsAlreadyScanningProject == false && m_ModifiedreplacedetList.Count > 0 ? true : false;
if (GUILayout.Button("Save Modified Project Files"))
{
UpdateProjectFiles();
}
GUILayout.Space(10f);
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.Space(5f);
}
19
Source : GUIInterface.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void OnGUI()
{
GUI.skin = skin;
GUI.Box(new Rect(0, 0, Screen.width, 30), "");
if (GUI.Button(new Rect(0, 0, 140, 30), LogoButton))
{
Application.OpenURL("https://github.com/BelkinAndrey/OPENTadpole");
}
GUI.Label(new Rect(150, 5, 170, 30), ">> ConnectomTadpole <<");
if (GUI.Button(new Rect(325, 0, 115, 30), " SimWorldTadpole"))
{
Application.LoadLevel(1);
}
if (GUI.Button(new Rect(Screen.width - 30, 0, 30, 30), CloseButton))
{
Application.Quit();
}
if (GUI.Button(new Rect(Screen.width - 60, 0, 30, 30), FullButton))
{
if (!Screen.fullScreen)
{
W = Screen.width;
H = Screen.height;
Screen.fullScreen = true;
Screen.SetResolution(resolutions[resolutions.Length - 1].width, resolutions[resolutions.Length - 1].height, true);
}
else
{
Screen.fullScreen = false;
Screen.SetResolution(W, H, false);
}
}
GetComponent<SaveOpen>().PathFile = GUI.TextField(new Rect(Screen.width - 260, 5, 180, 20), GetComponent<SaveOpen>().PathFile);
if (GUI.Button(new Rect(Screen.width - 80, 0, 20, 30), DownButton))
{
pilot = !pilot;
}
if (GUI.Button(new Rect(Screen.width - 350, 0, 30, 30), ClearButton))
{
PlayerPrefs.SetString("Path", "");
PlayerPrefs.SetFloat("StartZoom", 3200);
PlayerPrefs.SetFloat("CamX", 0);
PlayerPrefs.SetFloat("CamY", -1840);
PlayerPrefs.SetFloat("CamZ", -100);
Application.LoadLevel(0);
}
if (GUI.Button(new Rect(Screen.width - 320, 0, 30, 30), OpenButton))
{
GetComponent<SaveOpen>().Open();
}
if (GUI.Button(new Rect(Screen.width - 290, 0, 30, 30), SaveButton))
{
GetComponent<SaveOpen>().Save();
}
if (pilot)
{
Rect RectPilot = new Rect(Screen.width - 260, 35, 200, 200);
OnRect = RectPilot.Contains(Event.current.mousePosition);
GUILayout.BeginArea(RectPilot, GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
string[] dir = Directory.GetFiles(Application.dataPath + "/Data/", "*.tad");
foreach (string value in dir)
{
GUILayout.BeginHorizontal();
string v = value.Remove(value.Length - 4).Remove(0, Application.dataPath.Length + 6);
if (GUILayout.Button(v))
{
GameObject C = GameObject.Find("Camera");
PlayerPrefs.SetFloat("StartZoom", C.GetComponent<Camera>().orthographicSize);
PlayerPrefs.SetFloat("CamX", C.transform.position.x);
PlayerPrefs.SetFloat("CamY", C.transform.position.y);
PlayerPrefs.SetFloat("CamZ", C.transform.position.z);
PlayerPrefs.SetString("Path", v);
Application.LoadLevel(0);
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
19
Source : GUIInterfaceWorld.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void OnGUI()
{
GUI.skin = skin;
GUI.Box(new Rect(0, 0, Screen.width, 30), "");
if (GUI.Button(new Rect(0, 0, 140, 30), LogoButton))
{
Application.OpenURL("https://github.com/BelkinAndrey/OPENTadpole");
}
GUI.Label(new Rect(150, 5, 170, 30), ">> SimWorldTadpole <<");
if (GUI.Button(new Rect(325, 0, 125, 30), " ConnectomTadpole"))
{
Application.LoadLevel(0);
}
if (GUI.Button(new Rect(Screen.width - 30, 0, 30, 30), CloseButton))
{
Application.Quit();
}
if (GUI.Button(new Rect(Screen.width - 60, 0, 30, 30), FullButton))
{
if (!Screen.fullScreen)
{
W = Screen.width;
H = Screen.height;
Screen.fullScreen = true;
Screen.SetResolution(resolutions[resolutions.Length - 1].width, resolutions[resolutions.Length - 1].height, true);
}
else
{
Screen.fullScreen = false;
Screen.SetResolution(W, H, false);
}
}
GetComponent<LoadBrain>().PathFile = GUI.TextField(new Rect(Screen.width - 260, 5, 180, 20), GetComponent<LoadBrain>().PathFile);
if (GUI.Button(new Rect(Screen.width - 80, 0, 20, 30), DownButton))
{
pilot = !pilot;
}
if (GUI.Button(new Rect(Screen.width - 320, 0, 30, 30), ReStartButton))
{
Application.LoadLevel(1);
}
if (GUI.Button(new Rect(Screen.width - 290, 0, 30, 30), OpenButton))
{
GetComponent<LoadBrain>().Open();
}
if (pilot)
{
Rect RectPilot = new Rect(Screen.width - 260, 35, 200, 200);
OnRect = RectPilot.Contains(Event.current.mousePosition);
GUILayout.BeginArea(RectPilot, GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
string[] dir = Directory.GetFiles(Application.dataPath + "/Data/", "*.tad");
foreach (string value in dir)
{
GUILayout.BeginHorizontal();
string v = value.Remove(value.Length - 4).Remove(0, Application.dataPath.Length + 6);
if (GUILayout.Button(v))
{
PlayerPrefs.SetString("Path", v);
Application.LoadLevel(1);
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
19
Source : GUIEditNeuron.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void DoMyWindow(int windowID)
{
if (GUI.Button(new Rect(160, 2, 18, 18), "x"))
{
EnableWindows = false;
MouseWindowsExit.Invoke();
}
if (GetComponent<SelectionNeuron>().SelectorNeuronOne != null)
{
GUILayout.BeginArea(new Rect(2, 20, 174, 408));
inventoryScroll = GUILayout.BeginScrollView(inventoryScroll, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
EditNeuron = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron;
GUILayout.Label("ID Neuron: " + EditNeuron.IDNeuron.ToString("000000000"));
GUILayout.Label("Type index: " + EditNeuron.Type);
switch (EditNeuron.Type)
{
case 0:
SimpleSummer(EditNeuron);
break;
case 1:
SimpleSummer(EditNeuron);
ModulMod(EditNeuron);
break;
case 2:
SummerdIN(EditNeuron);
break;
default:
break;
}
GUILayout.EndScrollView();
GUILayout.EndArea();
if (GUI.Button(new Rect(2, 428, 88, 20), "Cancel"))
{
EnableWindows = false;
MouseWindowsExit.Invoke();
}
if (GUI.Button(new Rect(91, 428, 88, 20), "Ok"))
{
switch (EditNeuron.Type)
{
case 0:
SimpleSummerOk(EditNeuron);
break;
case 1:
SimpleSummerOk(EditNeuron);
ModulModOk(EditNeuron);
break;
case 2:
SummerdINOk(EditNeuron);
break;
default:
break;
}
}
}
else EditNeuron = null;
GUI.DragWindow();
}
19
Source : GUIWindowEditSynapse.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void DoMyWindow(int windowID)
{
if (GUI.Button(new Rect(408, 2, 18, 18), "x"))
{
EnableWindows = false;
if (GizmaSynapse != null) GizmaSynapse.SetActive(false);
MouseWindowsExit.Invoke();
}
if (GetComponent<SelectionNeuron>().SelectorNeuronOne != null)
{
intButtonPrePost = GUI.SelectionGrid(new Rect(5, 20, 200, 20), intButtonPrePost, ButtonSPrePost, ButtonSPrePost.Length);
GUILayout.BeginArea(new Rect(5, 42, 200, 203), GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
if (intButtonPrePost == 0)
{
List<Synapse> hit = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron.PreSynapses;
for (int i = 0; i < hit.Count; i++)
{
string ButtonName = "" + (i + 1) + ". #" + hit[i].parentNeuron.IDNeuron.ToString("000000") + " >> #" + hit[i].targetNeuron.IDNeuron.ToString("000000");
GUILayout.BeginHorizontal();
if (GUILayout.Button(ButtonName))
{
ButtonOn(hit[i]);
}
GUILayout.EndHorizontal();
}
}
if (intButtonPrePost == 1)
{
List<Synapse> hit = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron.PostSynapses;
for (int i = 0; i < hit.Count; i++)
{
string ButtonName = "" + (i + 1) + ". #" + hit[i].parentNeuron.IDNeuron.ToString("000000") + " >> #" + hit[i].targetNeuron.IDNeuron.ToString("000000");
GUILayout.BeginHorizontal();
if (GUILayout.Button(ButtonName))
{
ButtonOn(hit[i]);
}
GUILayout.EndHorizontal();
}
}
GUILayout.EndScrollView();
GUILayout.EndArea();
if (EditSynanse != null)
{
GUI.Label(new Rect(210, 40, 100, 20), "Type");
EditSynanse.TypeSynapse = GUI.SelectionGrid(new Rect(310, 40, 100, 20), EditSynanse.TypeSynapse, ButtonTypeS, ButtonTypeS.Length);
GUI.Label(new Rect(210, 65, 100, 20), "Force");
forceS = GUI.TextField(new Rect(310, 65, 100, 20), forceS);
GUI.Label(new Rect(210, 90, 100, 20), "Delay");
delayS = GUI.TextField(new Rect(310, 90, 100, 20), delayS);
// GUI.Label(new Rect(210, 115, 100, 20), "descriptor");
// descriptorS = GUI.TextField(new Rect(310, 115, 100, 20), descriptorS);
// GUI.Label(new Rect(210, 140, 100, 20), "Freeze");
// EditSynanse.Freeze = GUI.Toggle(new Rect(310, 140, 100, 20), EditSynanse.Freeze, "");
GUI.Label(new Rect(210, 165, 200, 20), "Distanse = " + distanse.ToString("0.00"));
if (GUI.Button(new Rect(260, 190, 110, 20), "Delete Synapse")) DeleteSynapse();
if (GUI.Button(new Rect(210, 220, 100, 20), "Close"))
{
EnableWindows = false;
if (GizmaSynapse != null) GizmaSynapse.SetActive(false);
MouseWindowsExit.Invoke();
}
if (GUI.Button(new Rect(315, 220, 100, 20), "OK"))
{
float tryFloat;
if (float.TryParse(forceS, out tryFloat)) EditSynanse.Force = tryFloat;
int tryInt;
if (int.TryParse(delayS, out tryInt)) EditSynanse.Delay = tryInt;
if (int.TryParse(descriptorS, out tryInt)) EditSynanse.descriptor = tryInt;
}
}
else GUI.Label(new Rect(210, 20, 200, 20), "Not select synapse");
}
GUI.DragWindow();
}
19
Source : StartScreen.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public void OnGUI()
{
if( !m_infoDownloaded )
{
m_infoDownloaded = true;
// get affiliate links
StartBackgroundTask( StartRequest( PackageRefURL, ( www ) =>
{
var pack = PackageRef.CreateFromJSON( www.downloadHandler.text );
if( pack != null )
{
m_packageRef = pack;
Repaint();
}
} ) );
// get banner information and texture
StartBackgroundTask( StartRequest( BannerInfoURL, ( www ) =>
{
BannerInfo info = BannerInfo.CreateFromJSON( www.downloadHandler.text );
if( info != null && !string.IsNullOrEmpty( info.ImageUrl ) )
{
StartBackgroundTask( StartTextureRequest( info.ImageUrl, ( www2 ) =>
{
Texture2D texture = DownloadHandlerTexture.GetContent( www2 );
if( texture != null )
m_newsImage = texture;
} ) );
}
if( info != null && info.Version >= m_bannerInfo.Version )
{
m_bannerInfo = info;
}
// improve this later
int major = m_bannerInfo.Version / 100;
int minor = ( m_bannerInfo.Version / 10 ) - major * 10;
int release = m_bannerInfo.Version - major * 100 - minor * 10;
m_newVersion = major + "." + minor + "." + release;
Repaint();
} ) );
}
if( m_buttonStyle == null )
{
m_buttonStyle = new GUIStyle( GUI.skin.button );
m_buttonStyle.alignment = TextAnchor.MiddleLeft;
}
if( m_labelStyle == null )
{
m_labelStyle = new GUIStyle( "BoldLabel" );
m_labelStyle.margin = new RectOffset( 4, 4, 4, 4 );
m_labelStyle.padding = new RectOffset( 2, 2, 2, 2 );
m_labelStyle.fontSize = 13;
}
if( m_linkStyle == null )
{
var inv = replacedetDatabase.LoadreplacedetAtPath<Texture2D>( replacedetDatabase.GUIDToreplacedetPath( "1004d06b4b28f5943abdf2313a22790a" ) ); // find a better solution for transparent buttons
m_linkStyle = new GUIStyle();
m_linkStyle.normal.textColor = new Color( 0.2980392f, 0.4901961f, 1f );
m_linkStyle.hover.textColor = Color.white;
m_linkStyle.active.textColor = Color.grey;
m_linkStyle.margin.top = 3;
m_linkStyle.margin.bottom = 2;
m_linkStyle.hover.background = inv;
m_linkStyle.active.background = inv;
}
EditorGUILayout.BeginHorizontal( GUIStyle.none, GUILayout.ExpandWidth( true ) );
{
// left column
EditorGUILayout.BeginVertical( GUILayout.Width( 175 ) );
{
GUILayout.Label( Resourcesreplacedle, m_labelStyle );
if( GUILayout.Button( WikiButton, m_buttonStyle ) )
Application.OpenURL( WikiURL );
GUILayout.Space( 10 );
GUILayout.Label( "Amplify Products", m_labelStyle );
if( m_packageRef.Links != null )
{
var webIcon = EditorGUIUtility.IconContent( "BuildSettings.Web.Small" ).image;
for( int i = 0; i < m_packageRef.Links.Length; i++ )
{
var gc = new GUIContent( " " + m_packageRef.Links[ i ].replacedle, webIcon );
if( GUILayout.Button( gc, m_buttonStyle ) )
Application.OpenURL( m_packageRef.Links[ i ].Url + RefID );
}
}
GUILayout.Label( "* Affiliate Links", "minilabel" );
}
EditorGUILayout.EndVertical();
// right column
EditorGUILayout.BeginVertical( GUILayout.Width( 650 - 175 - 9 ), GUILayout.ExpandHeight( true ) );
{
GUILayout.Label( Communityreplacedle, m_labelStyle );
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
{
if( GUILayout.Button( DiscordButton, GUILayout.ExpandWidth( true ) ) )
{
Application.OpenURL( DiscordURL );
}
if( GUILayout.Button( ForumButton, GUILayout.ExpandWidth( true ) ) )
{
Application.OpenURL( ForumURL );
}
}
EditorGUILayout.EndHorizontal();
GUILayout.Label( Updatereplacedle, m_labelStyle );
if( m_newsImage != null )
{
var gc = new GUIContent( m_newsImage );
int width = 650 - 175 - 9 - 8;
width = Mathf.Min( m_newsImage.width, width );
int height = m_newsImage.height;
height = (int)( ( width + 8 ) * ( (float)m_newsImage.height / (float)m_newsImage.width ) );
Rect buttonRect = EditorGUILayout.GetControlRect( false, height );
EditorGUIUtility.AddCursorRect( buttonRect, MouseCursor.Link );
if( GUI.Button( buttonRect, gc, m_linkStyle ) )
{
Application.OpenURL( m_bannerInfo.LinkUrl );
}
}
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition, GUILayout.ExpandHeight( true ), GUILayout.ExpandWidth( true ) );
GUILayout.Label( m_bannerInfo.NewsText, "WordWrappedMiniLabel", GUILayout.ExpandHeight( true ) );
GUILayout.EndScrollView();
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
{
EditorGUILayout.BeginVertical();
GUILayout.Label( replacedleSTR, m_labelStyle );
GUILayout.Label( "Installed Version: " + VersionInfo.StaticToString() );
if( m_bannerInfo.Version > VersionInfo.FullNumber )
{
var cache = GUI.color;
GUI.color = Color.red;
GUILayout.Label( "New version available: " + m_newVersion, "BoldLabel" );
GUI.color = cache;
}
else
{
var cache = GUI.color;
GUI.color = Color.green;
GUILayout.Label( "You are using the latest version", "BoldLabel" );
GUI.color = cache;
}
EditorGUILayout.BeginHorizontal();
GUILayout.Label( "Download links:" );
if( GUILayout.Button( "Amplify", m_linkStyle ) )
Application.OpenURL( SiteURL );
GUILayout.Label( "-" );
if( GUILayout.Button( "replacedet Store", m_linkStyle ) )
Application.OpenURL( StoreURL );
EditorGUILayout.EndHorizontal();
GUILayout.Space( 7 );
EditorGUILayout.EndVertical();
GUILayout.FlexibleSpace();
EditorGUILayout.BeginVertical();
GUILayout.Space( 7 );
GUILayout.Label( Icon );
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal( "ProjectBrowserBottomBarBg", GUILayout.ExpandWidth( true ), GUILayout.Height( 22 ) );
{
GUILayout.FlexibleSpace();
EditorGUI.BeginChangeCheck();
var cache = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 100;
m_startup = EditorGUILayout.ToggleLeft( "Show At Startup", m_startup, GUILayout.Width( 120 ) );
EditorGUIUtility.labelWidth = cache;
if( EditorGUI.EndChangeCheck() )
{
EditorPrefs.SetBool( Preferences.PrefStartUp, m_startup );
}
}
EditorGUILayout.EndHorizontal();
// Find a better way to update link buttons without repainting the window
Repaint();
}
19
Source : UI+Wrappers.cs
with MIT License
from cabarius
with MIT License
from cabarius
public static GUILayoutOption ExpandHeight(bool v) => GL.ExpandHeight(v);
19
Source : UI+Wrappers.cs
with MIT License
from cabarius
with MIT License
from cabarius
public static GUILayoutOption AutoHeight() => GL.ExpandHeight(false);
19
Source : SettingsBinderBuilder.cs
with GNU General Public License v2.0
from Caeden117
with GNU General Public License v2.0
from Caeden117
public override void OnInspectorGUI()
{
try
{
settingsBinder.BindedSettingSearchType =
(SettingsBinder.SettingsType)EditorGUILayout.EnumPopup("Binded Settings Search Type",
settingsBinder.BindedSettingSearchType);
var fieldInfos = Settings.GetAllFieldInfos();
var potentialOptions = fieldInfos.Keys.ToList();
if (settingsBinder.BindedSettingSearchType != SettingsBinder.SettingsType.All)
{
potentialOptions = potentialOptions.Where(x =>
fieldInfos[x].Name.ToUpperInvariant()
.Contains(settingsBinder.BindedSettingSearchType.ToString()))
.ToList();
}
potentialOptions.Insert(0, "None");
potentialOptions = potentialOptions.OrderBy(x => x).ToList();
if (potentialOptions.IndexOf(settingsBinder.BindedSetting) == -1) settingsBinder.BindedSetting = "None";
settingsBinder.BindedSetting = potentialOptions[
EditorGUILayout.Popup(
"Binded Setting",
potentialOptions.IndexOf(settingsBinder.BindedSetting),
potentialOptions.ToArray(),
GUILayout.MinHeight(0), GUILayout.MinWidth(0),
GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))];
settingsBinder.PopupEditorWarning =
EditorGUILayout.Toggle("Show Editor Restart Warning", settingsBinder.PopupEditorWarning);
if (settingsBinder.BindedSetting != "None")
{
EditorGUILayout.TextField("Binded Setting Type",
fieldInfos[settingsBinder.BindedSetting]?.Name ?? "None");
}
else
{
EditorGUILayout.TextField("Binded Setting Type", "None");
}
base.OnInspectorGUI();
if (GUI.changed) EditorUtility.SetDirty(settingsBinder);
}
catch (Exception e)
{
EditorGUILayout.HelpBox($"Erorr while loading custom editor:\n{e}", MessageType.Error);
base.OnInspectorGUI();
}
}
19
Source : PlayModeTestListGUI.cs
with Creative Commons Zero v1.0 Universal
from Colanderp
with Creative Commons Zero v1.0 Universal
from Colanderp
public override void PrintHeadPanel()
{
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
base.PrintHeadPanel();
if (GUILayout.Button("Run all in player (" + EditorUserBuildSettings.activeBuildTarget + ")", EditorStyles.toolbarButton))
{
RunTestsInPlayer(null);
}
EditorGUILayout.EndHorizontal();
DrawFilters();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
EditorGUILayout.EndHorizontal();
}
19
Source : Yodo1AdIntegrationManagerWindow.cs
with MIT License
from Crazy-Marvin
with MIT License
from Crazy-Marvin
private void DrawNetworkDetailRow(Yodo1ConflictData network)
{
string action;
if (network.name.Equals("FireBase"))
{
action = "Solution";
}
else
{
action = "Remove";
}
GUILayout.Space(4);
using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false)))
{
GUILayout.Space(5);
EditorGUILayout.LabelField(new GUIContent(network.name), headerLabelStyle, networkWidthOption);
GUILayout.Space(3);
GUILayout.FlexibleSpace();
if (GUILayout.Button(new GUIContent(action), fieldWidth))
{
EditorUtility.DisplayProgressBar("Integration Manager", "Removing " + network.name + "...", 0.5f);
if (network.name.Equals("FireBase"))
{
Application.OpenURL(doreplacedentationFireBaseLink);
}
else if (network.name.Equals("Admob"))
{
Yodo1AdBuildCheck.RemoveAdmobAds();
RemoveFromList(network);
replacedetDatabase.Refresh();
}
else if (network.name.Equals("UnityAds"))
{
Yodo1AdBuildCheck.RemoveUnityAds();
}
else if (network.name.Equals("Facebook"))
{
Yodo1AdBuildCheck.RemoveFacebookCoreKit();
RemoveFromList(network);
replacedetDatabase.Refresh();
}
else
{
}
//if(!network.name.Equals("UnityAds")) // refresh replacedet. unityads no need
//{
//replacedetDatabase.Refresh();
//}
EditorUtility.ClearProgressBar();
}
}
foreach (string path in network.paths)
{
GUILayout.BeginHorizontal();
GUILayout.Space(20);
using (new EditorGUILayout.VerticalScope("box"))
{
GUILayout.Space(2);
DrawTextLabel(path, networkWidthOption);
}
GUILayout.EndHorizontal();
}
}
19
Source : MessagePipeDiagnosticsInfoWindow.cs
with MIT License
from Cysharp
with MIT License
from Cysharp
void RenderTable()
{
if (tableListStyle == null)
{
tableListStyle = new GUIStyle("CN Box");
tableListStyle.margin.top = 0;
tableListStyle.padding.left = 3;
}
EditorGUILayout.BeginVertical(tableListStyle, EmptyLayoutOption);
this.tableScroll = EditorGUILayout.BeginScrollView(this.tableScroll, new GUILayoutOption[]
{
GUILayout.ExpandWidth(true),
GUILayout.MaxWidth(2000f)
});
var controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[]
{
GUILayout.ExpandHeight(true),
GUILayout.ExpandWidth(true)
});
treeView?.OnGUI(controlRect);
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
}
19
Source : MessagePipeDiagnosticsInfoWindow.cs
with MIT License
from Cysharp
with MIT License
from Cysharp
void RenderDetailsPanel()
{
if (detailsStyle == null)
{
detailsStyle = new GUIStyle("CN Message");
detailsStyle.wordWrap = false;
detailsStyle.stretchHeight = true;
detailsStyle.margin.right = 15;
}
string message = "";
var selected = treeView.state.selectedIDs;
if (selected.Count > 0)
{
var first = selected[0];
var item = treeView.CurrentBindingItems.FirstOrDefault(x => x.id == first) as MessagePipeDiagnosticsInfoTreeViewItem;
if (item != null)
{
var now = DateTimeOffset.UtcNow;
message = string.Join(Splitter, item.StackTraces
.Select(x =>
"Subscribe at " + x.Timestamp.ToLocalTime().ToString("HH:mm:ss.ff") // + ", Elapsed: " + (now - x.Timestamp).TotalSeconds.ToString("00.00")
+ Environment.NewLine
+ (x.formattedStackTrace ?? (x.formattedStackTrace = x.StackTrace.CleanupAsyncStackTrace()))));
}
}
detailsScroll = EditorGUILayout.BeginScrollView(this.detailsScroll, EmptyLayoutOption);
var vector = detailsStyle.CalcSize(new GUIContent(message));
EditorGUILayout.SelectableLabel(message, detailsStyle, new GUILayoutOption[]
{
GUILayout.ExpandHeight(true),
GUILayout.ExpandWidth(true),
GUILayout.MinWidth(vector.x),
GUILayout.MinHeight(vector.y)
});
EditorGUILayout.EndScrollView();
}
19
Source : UniTaskTrackerWindow.cs
with MIT License
from Cysharp
with MIT License
from Cysharp
void RenderDetailsPanel()
{
if (detailsStyle == null)
{
detailsStyle = new GUIStyle("CN Message");
detailsStyle.wordWrap = false;
detailsStyle.stretchHeight = true;
detailsStyle.margin.right = 15;
}
string message = "";
var selected = treeView.state.selectedIDs;
if (selected.Count > 0)
{
var first = selected[0];
var item = treeView.CurrentBindingItems.FirstOrDefault(x => x.id == first) as UniTaskTrackerViewItem;
if (item != null)
{
message = item.Position;
}
}
detailsScroll = EditorGUILayout.BeginScrollView(this.detailsScroll, EmptyLayoutOption);
var vector = detailsStyle.CalcSize(new GUIContent(message));
EditorGUILayout.SelectableLabel(message, detailsStyle, new GUILayoutOption[]
{
GUILayout.ExpandHeight(true),
GUILayout.ExpandWidth(true),
GUILayout.MinWidth(vector.x),
GUILayout.MinHeight(vector.y)
});
EditorGUILayout.EndScrollView();
}
19
Source : PlayModeTestListGUI.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public override void PrintHeadPanel()
{
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
base.PrintHeadPanel();
PlayerMenuItem[] menuItems;
if (EditorUserBuildSettings.installInBuildFolder)
{
menuItems = new []
{
// Note: We select here buildOnly = false, so build location dialog won't show up
// The player won't actually be ran when using together with EditorUserBuildSettings.installInBuildFolder
new PlayerMenuItem()
{
name = new GUIContent("Install All Tests In Build Folder"), buildOnly = false, filterSelectedTestsOnly = false
},
new PlayerMenuItem()
{
name = new GUIContent("Install Selected Tests In Build Folder"), buildOnly = false, filterSelectedTestsOnly = true
}
};
}
else
{
menuItems = new []
{
new PlayerMenuItem()
{
name = new GUIContent("Run All Tests"), buildOnly = false, filterSelectedTestsOnly = false
},
new PlayerMenuItem()
{
name = new GUIContent("Run Selected Tests"), buildOnly = false, filterSelectedTestsOnly = true
},
new PlayerMenuItem()
{
name = new GUIContent($"{GetBuildText()} All Tests"), buildOnly = true, filterSelectedTestsOnly = false
},
new PlayerMenuItem()
{
name = new GUIContent($"{GetBuildText()} Selected Tests"), buildOnly = true, filterSelectedTestsOnly = true
},
};
}
m_SelectedOption = Math.Min(m_SelectedOption, menuItems.Length - 1);
var selectedMenuItem = menuItems[m_SelectedOption];
if (GUILayout.Button(
new GUIContent($"{selectedMenuItem.name.text} ({EditorUserBuildSettings.activeBuildTarget})"),
EditorStyles.toolbarButton))
{
ExecuteAction(selectedMenuItem);
}
if (GUILayout.Button(GUIContent.none, EditorStyles.toolbarDropDown))
{
Vector2 mousePos = Event.current.mousePosition;
EditorUtility.DisplayCustomMenu(new Rect(mousePos.x, mousePos.y, 0, 0),
menuItems.Select(m => m.name).ToArray(),
-1,
(object userData, string[] options, int selected) => m_SelectedOption = selected,
menuItems);
}
EditorGUILayout.EndHorizontal();
DrawFilters();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
EditorGUILayout.EndHorizontal();
}
19
Source : TMPro_FontAssetCreatorWindow.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
void DrawPreview()
{
Rect pixelRect;
if (position.width > position.height && position.width > k_TwoColumnControlsWidth)
{
float minSide = Mathf.Min(position.height - 15f, position.width - k_TwoColumnControlsWidth);
EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.MaxWidth(minSide));
pixelRect = GUILayoutUtility.GetRect(minSide, minSide, GUILayout.ExpandHeight(false), GUILayout.ExpandWidth(false));
}
else
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
pixelRect = GUILayoutUtility.GetAspectRect(1f);
}
if (m_FontAtlasTexture != null)
{
EditorGUI.DrawTextureAlpha(pixelRect, m_FontAtlasTexture, ScaleMode.StretchToFill);
}
else if (m_SavedFontAtlas != null)
{
EditorGUI.DrawTextureAlpha(pixelRect, m_SavedFontAtlas, ScaleMode.StretchToFill);
}
EditorGUILayout.EndVertical();
}
19
Source : Styling.cs
with GNU Lesser General Public License v3.0
from Egomotion
with GNU Lesser General Public License v3.0
from Egomotion
public bool SquareIconButton(Texture2D tex, string tooltip, float size = 20.0f)
{
return GUILayout.Button(new GUIContent(tex, tooltip), GUILayout.Width(size), GUILayout.ExpandWidth(false), GUILayout.Height(size), GUILayout.ExpandHeight(false));
}
19
Source : Styling.cs
with GNU Lesser General Public License v3.0
from Egomotion
with GNU Lesser General Public License v3.0
from Egomotion
public bool RefreshButton(string tooltip)
{
var tex = _textures.Refresh;
if (tex)
{
float size = 20.0f;
return GUILayout.Button(new GUIContent(tex, tooltip), IconButton(), GUILayout.Width(size), GUILayout.ExpandWidth(false), GUILayout.Height(size), GUILayout.ExpandHeight(false));
}
else
{
return GUILayout.Button(new GUIContent("Refresh", tooltip), GUILayout.MaxWidth(60));
}
}
19
Source : Styling.cs
with GNU Lesser General Public License v3.0
from Egomotion
with GNU Lesser General Public License v3.0
from Egomotion
public bool SquareButton(string label, string tooltip, float size = 20.0f)
{
return GUILayout.Button(new GUIContent(label, tooltip), GUILayout.Width(size), GUILayout.ExpandWidth(false), GUILayout.Height(size), GUILayout.ExpandHeight(false));
}
19
Source : Styling.cs
with GNU Lesser General Public License v3.0
from Egomotion
with GNU Lesser General Public License v3.0
from Egomotion
public bool EditButton(string tooltip)
{
var tex = _textures.Edit;
if (tex)
{
float size = 20.0f;
return GUILayout.Button(new GUIContent(tex, tooltip), IconButton(), GUILayout.Width(size), GUILayout.ExpandWidth(false), GUILayout.Height(size), GUILayout.ExpandHeight(false));
}
else
{
return GUILayout.Button(new GUIContent("edit", tooltip), GUILayout.Width(34), GUILayout.ExpandWidth(false));
}
}
19
Source : Styling.cs
with GNU Lesser General Public License v3.0
from Egomotion
with GNU Lesser General Public License v3.0
from Egomotion
public void WarningIcon(string tooltip)
{
float size = 20.0f;
GUILayout.Label(new GUIContent(_textures.Warning, tooltip), GUILayout.Width(size), GUILayout.ExpandWidth(false), GUILayout.Height(size), GUILayout.ExpandHeight(false));
}
19
Source : BuildEditor.cs
with MIT License
from focus-creative-games
with MIT License
from focus-creative-games
private void OnGUI()
{
EditorGUILayout.LabelField("打包平台:");
this.platformType = (PlatformType)EditorGUILayout.EnumPopup(platformType);
this.clearFolder = EditorGUILayout.Toggle("清理资源文件夹: ", clearFolder);
this.isBuildExe = EditorGUILayout.Toggle("是否打包EXE: ", this.isBuildExe);
this.isContainAB = EditorGUILayout.Toggle("是否同将资源打进EXE: ", this.isContainAB);
this.buildType = (BuildType)EditorGUILayout.EnumPopup("BuildType: ", this.buildType);
EditorGUILayout.LabelField("BuildreplacedetBundleOptions(可多选):");
this.buildreplacedetBundleOptions = (BuildreplacedetBundleOptions)EditorGUILayout.EnumFlagsField(this.buildreplacedetBundleOptions);
switch (buildType)
{
case BuildType.Development:
this.buildOptions = BuildOptions.Development | BuildOptions.AutoRunPlayer | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging;
break;
case BuildType.Release:
this.buildOptions = BuildOptions.None;
break;
}
GUILayout.Space(5);
if (GUILayout.Button("开始打包", GUILayout.ExpandHeight(true)))
{
if (this.platformType == PlatformType.None)
{
ShowNotification(new GUIContent("请选择打包平台!"));
return;
}
if (platformType != activePlatform)
{
switch (EditorUtility.DisplayDialogComplex("警告!", $"当前目标平台为{activePlatform}, 如果切换到{platformType}, 可能需要较长加载时间", "切换", "取消", "不切换"))
{
case 0:
activePlatform = platformType;
break;
case 1:
return;
case 2:
platformType = activePlatform;
break;
}
}
BuildHelper.Build(this.platformType, this.buildreplacedetBundleOptions, this.buildOptions, this.isBuildExe, this.isContainAB, this.clearFolder);
}
GUILayout.Space(5);
}
19
Source : ChangesView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
private void DoCommitGUI()
{
GUILayout.BeginHorizontal();
{
GUILayout.Space(Styles.CommitAreaPadding);
GUILayout.BeginVertical(GUILayout.Height(
Mathf.Clamp(Position.height * Styles.CommitAreaDefaultRatio,
Styles.CommitAreaMinHeight,
Styles.CommitAreaMaxHeight))
);
{
GUILayout.Space(Styles.CommitAreaPadding);
GUILayout.Label(SummaryLabel);
commitMessage = EditorGUILayout.TextField(commitMessage, Styles.TextFieldStyle);
GUILayout.Space(Styles.CommitAreaPadding * 2);
GUILayout.Label(DescriptionLabel);
commitBody = EditorGUILayout.TextArea(commitBody, Styles.CommitDescriptionFieldStyle, GUILayout.ExpandHeight(true));
GUILayout.Space(Styles.CommitAreaPadding);
// Disable committing when already committing or if we don't have all the data needed
//Debug.LogFormat("IsBusy:{0} string.IsNullOrEmpty(commitMessage): {1} treeChanges.GetCheckedFiles().Any(): {2}",
// IsBusy, string.IsNullOrEmpty(commitMessage), treeChanges.GetCheckedFiles().Any());
EditorGUI.BeginDisabledGroup(IsBusy || string.IsNullOrEmpty(commitMessage) || !treeChanges.GetCheckedFiles().Any());
{
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button(String.Format(CommitButton, currentBranch), Styles.CommitButtonStyle))
{
GUI.FocusControl(null);
Commit();
}
}
GUILayout.EndHorizontal();
}
EditorGUI.EndDisabledGroup();
GUILayout.Space(Styles.CommitAreaPadding);
}
GUILayout.EndVertical();
GUILayout.Space(Styles.CommitAreaPadding);
}
GUILayout.EndHorizontal();
}
19
Source : StereoControllerEditor.cs
with MIT License
from harshitjuneja
with MIT License
from harshitjuneja
public override void OnInspectorGUI() {
DrawDefaultInspector();
GUILayout.BeginHorizontal(GUILayout.ExpandHeight(false));
GUILayout.FlexibleSpace();
if (GUILayout.Button(updateButton, GUILayout.ExpandWidth(false))) {
var controller = (StereoController)target;
DoUpdateStereoCameras(controller.gameObject);
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
19
Source : BhapticsVRCEditorInspector.cs
with Apache License 2.0
from HerpDerpinstine
with Apache License 2.0
from HerpDerpinstine
void OnSceneGUI()
{
if (script == null)
{
return;
}
if (!script.enabled)
return;
if (script.anim == null)
{
return;
}
if (script.anim.avatar == null)
{
return;
}
if (script.avatarDescriptor == null)
{
return;
}
if (Event.current != null && Event.current.type == EventType.Layout)
{
HandleUtility.AddDefaultControl(0);
}
Handles.BeginGUI();
GUIStyle windowStyle = new GUIStyle("Window");
windowStyle.margin.left = 15;
GUILayout.BeginVertical("Bhaptics VRC Editor", windowStyle, GUILayout.Width(300), GUILayout.MaxHeight(10), GUILayout.ExpandHeight(true));
GUILayout.BeginHorizontal();
GUIStyle topMarginStyle = new GUIStyle(GUI.skin.label);
topMarginStyle.margin.top = 0;
GUILayout.Label("Device Type", topMarginStyle, GUILayout.Width(80));
GUILayout.BeginVertical();
script.selectedDeviceType = (BhapticsDeviceType)EditorGUILayout.EnumPopup(string.Empty, script.selectedDeviceType, GUILayout.ExpandWidth(true), GUILayout.MinWidth(10));
GUILayout.EndVertical();
script.selectedDevice = script.deviceGameObjects[(int)script.selectedDeviceType] == null ? null : script.deviceGameObjects[(int)script.selectedDeviceType].transform;
if (script.selectedDevice != null)
{
GUIStyle selectButtonStyle = new GUIStyle(GUI.skin.button);
selectButtonStyle.margin.top = 0;
if (GUILayout.Button("Select", selectButtonStyle, GUILayout.Width(50)))
{
Selection.activeGameObject = script.selectedDevice.gameObject;
}
}
GUILayout.EndHorizontal();
if (script.selectedDevice == null)
{
GUILayout.Space(10);
script.symmetry = false;
GUIStyle addButtonStyle = new GUIStyle(GUI.skin.button);
addButtonStyle.richText = true;
if (GUILayout.Button("<color=green>Add</color> " + script.selectedDeviceType + " Object", addButtonStyle, GUILayout.Height(30)))
{
script.AddDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=green>Add </color>" + script.selectedDeviceType.ToString() + " Object");
return;
}
}
else
{
GUILayout.Space(2);
if (previousGameObject != script.selectedDevice)
{
previousGameObject = script.selectedDevice;
Camera[] cams = script.selectedDevice.GetComponentsInChildren<Camera>(true);
foreach (Camera cam in cams)
if (cam.gameObject.name.ToLowerInvariant().Contains("dummy"))
{
IsVisualized = cam.gameObject.active;
break;
}
}
GUILayout.BeginHorizontal();
GUILayout.Label("Visible Mode", GUILayout.Width(80));
GUIStyle visualButtonStyle = new GUIStyle(GUI.skin.button);
visualButtonStyle.margin.top = 1;
if (GUILayout.Button(IsVisualized ? "Visualized" : "Hidden", visualButtonStyle, GUILayout.Width(100), GUILayout.Height(18)))
{
IsVisualized = !IsVisualized;
MeshRenderer[] render = script.selectedDevice.GetComponentsInChildren<MeshRenderer>(true);
foreach (MeshRenderer renderer in render)
if (renderer.gameObject == script.selectedDevice.gameObject)
renderer.enabled = IsVisualized;
else
renderer.gameObject.SetActive(IsVisualized);
SkinnedMeshRenderer[] render2 = script.selectedDevice.GetComponentsInChildren<SkinnedMeshRenderer>(true);
foreach (SkinnedMeshRenderer renderer in render2)
if (renderer.gameObject == script.selectedDevice.gameObject)
renderer.enabled = IsVisualized;
else
renderer.gameObject.SetActive(IsVisualized);
Camera[] cams = script.selectedDevice.GetComponentsInChildren<Camera>(true);
foreach (Camera cam in cams)
if (cam.gameObject.name.ToLowerInvariant().Contains("dummy"))
cam.gameObject.SetActive(IsVisualized);
string visual = "<color=green>Visualized</color>";
string hide = "<color=red>Hidden</color>";
Debug.Log($"BhapticsVRCEditor / Change Visible Mode {(!IsVisualized ? visual : hide)} -> {(IsVisualized ? visual : hide)}");
return;
}
GUILayout.EndHorizontal();
var isLeft = script.selectedDevice.name.Contains("Left");
var isRight = script.selectedDevice.name.Contains("Right");
if (isLeft || isRight)
{
GUILayout.BeginHorizontal();
GUILayout.Label("Symmetry", GUILayout.Width(80));
script.symmetry = EditorGUILayout.Toggle(script.symmetry);
GUILayout.EndHorizontal();
if (script.symmetry)
{
if (isLeft)
{
script.symmetryDevice = script.FindDeviceObject(script.selectedDevice.name.Replace("Left", "Right"));
}
else if (isRight)
{
script.symmetryDevice = script.FindDeviceObject(script.selectedDevice.name.Replace("Right", "Left"));
}
if (script.symmetryDevice == null)
{
EditorGUILayout.HelpBox("Symmetry object is not found! Create one.", MessageType.Error);
}
}
else
{
script.symmetryDevice = null;
}
}
else
{
script.symmetryDevice = null;
}
GUILayout.BeginHorizontal();
GUILayout.Label("Edit Mode", GUILayout.Width(80));
GUILayout.BeginVertical();
GUIStyle boldStyle = new GUIStyle(GUI.skin.label);
boldStyle.fontStyle = FontStyle.Bold;
GUIStyle tooltipStyle = new GUIStyle(GUI.skin.label);
tooltipStyle.richText = true;
tooltipStyle.padding.top = -3;
if (Tools.current == Tool.Move)
{
GUILayout.Label("Position", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = </size><b>[W]</b><size=9> E R</size>", tooltipStyle);
}
else if (Tools.current == Tool.Rotate)
{
GUILayout.Label("Rotation", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = W </size><b>[E]</b><size=9> R</size>", tooltipStyle);
}
else if (Tools.current == Tool.Scale)
{
GUILayout.Label("Scale", boldStyle, GUILayout.Width(60));
GUILayout.Label("<size=9>*shortcut = W E </size><b>[R]</b>", tooltipStyle);
}
else
{
GUILayout.Label("Etc");
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.Label("Position", GUILayout.Width(80));
script.selectedDevice.localPosition = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localPosition), GUILayout.Width(200));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Rotation", GUILayout.Width(80));
script.selectedDevice.localEulerAngles = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localEulerAngles), GUILayout.Width(200));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Scale", GUILayout.Width(80));
script.selectedDevice.localScale = EditorGUILayout.Vector3Field("", script.RoundVector3(script.selectedDevice.localScale), GUILayout.Width(200));
var cameras = script.selectedDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < cameras.Length; ++i)
FixCameraScaling(cameras[i]);
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUIStyle deleteButtonStyle = new GUIStyle(GUI.skin.button);
deleteButtonStyle.richText = true;
if (GUILayout.Button("<color=red>Delete</color> " + script.selectedDeviceType + " Object [Del]", deleteButtonStyle, GUILayout.Height(30)))
{
Undo.DestroyObjectImmediate(script.selectedDevice.gameObject);
Debug.Log("BhapticsVRCEditor / <color=red>Delete </color>" + script.selectedDeviceType.ToString() + " Object");
return;
}
}
GUILayout.Space(2);
GUILayout.EndVertical();
Handles.EndGUI();
Color buttonColor = new Color(0.9f, 0.9f, 0.3f);
Color defaultColor = new Color(0.6f, 0.6f, 0.6f);
Handles.color = buttonColor;
for (int i = 0; i < script.deviceGameObjects.Length; ++i)
{
if (script.deviceGameObjects[i] == null)
{
continue;
}
if (script.selectedDevice != null && script.selectedDevice == script.deviceGameObjects[i].transform)
{
continue;
}
var buttonSize = HandleUtility.GetHandleSize(script.deviceGameObjects[i].transform.position) / 10f;
if (Handles.Button(script.deviceGameObjects[i].transform.position, Quaternion.idenreplacedy, buttonSize, buttonSize, Handles.DotHandleCap))
{
script.selectedDeviceType = (BhapticsDeviceType)i;
return;
}
}
Handles.color = defaultColor;
if (script.selectedDevice != null)
{
try
{
if (Tools.current == Tool.Move)
{
Handles.CubeHandleCap(0, script.selectedDevice.position, Quaternion.idenreplacedy, HandleUtility.GetHandleSize(script.selectedDevice.position) / 7f, EventType.Repaint);
script.selectedDevice.position = Handles.PositionHandle(script.selectedDevice.position, script.selectedDevice.rotation);
}
else if (Tools.current == Tool.Rotate)
{
script.selectedDevice.rotation = Handles.RotationHandle(script.selectedDevice.rotation, script.selectedDevice.position);
}
else if (Tools.current == Tool.Scale)
{
script.selectedDevice.localScale = Handles.ScaleHandle(script.selectedDevice.localScale, script.selectedDevice.position, script.selectedDevice.rotation,
HandleUtility.GetHandleSize(script.selectedDevice.position));
var cameras = script.selectedDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < cameras.Length; ++i)
FixCameraScaling(cameras[i]);
}
}
catch (Exception e)
{
}
if (script.symmetry && script.symmetryDevice != null)
{
script.symmetryDevice.position = Vector3.Reflect(script.selectedDevice.position - script.transform.position, script.transform.right);
script.symmetryDevice.eulerAngles = Vector3.Reflect(script.selectedDevice.eulerAngles, script.transform.up);
script.symmetryDevice.localScale = script.selectedDevice.localScale;
var symmetryCameras = script.symmetryDevice.GetComponentsInChildren<Camera>(true);
for (int i = 0; i < symmetryCameras.Length; ++i)
FixCameraScaling(symmetryCameras[i]);
Undo.RecordObjects(new Transform[] { script.selectedDevice, script.symmetryDevice }, "Change TargetObject and SymmetryTargetObject");
}
else
{
Undo.RecordObject(script.selectedDevice, "Change TargetObject");
}
if (Event.current != null && Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Delete)
{
script.DestroyDevicePrefab(script.selectedDeviceType.ToString());
Debug.Log("BhapticsVRCEditor / <color=red>Delete </color>" + script.selectedDeviceType.ToString() + " Object");
Event.current.Use();
return;
}
}
}
19
Source : SocketIOChatSample.cs
with MIT License
from huanzi-qch
with MIT License
from huanzi-qch
void DrawChatScreen()
{
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
GUILayout.BeginVertical();
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.Label(chatLog, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
string typing = string.Empty;
if (typingUsers.Count > 0)
{
typing += string.Format("{0}", typingUsers[0]);
for (int i = 1; i < typingUsers.Count; ++i)
typing += string.Format(", {0}", typingUsers[i]);
if (typingUsers.Count == 1)
typing += " is typing!";
else
typing += " are typing!";
}
GUILayout.Label(typing);
GUILayout.Label("Type here:");
GUILayout.BeginHorizontal();
message = GUILayout.TextField(message);
if (GUILayout.Button("Send", GUILayout.MaxWidth(100)))
SendMessage();
GUILayout.EndHorizontal();
if (GUI.changed)
UpdateTyping();
GUILayout.EndVertical();
});
}
19
Source : Core.UncensorSelector.SettingsGUI.cs
with GNU General Public License v3.0
from IllusionMods
with GNU General Public License v3.0
from IllusionMods
private void DoSettingsGUI(int id)
{
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
GUILayout.Label("Select uncensors to exclude from random selection");
GUILayout.EndHorizontal();
foreach (var value in AllValues)
{
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
{
GUI.changed = false;
var newVal = GUILayout.Toggle(SelectedGUIDS.Contains(value.GUID), value.Name, GUILayout.ExpandWidth(true));
if (GUI.changed)
{
if (newVal)
{
SelectedGUIDS.Add(value.GUID);
}
else
{
SelectedGUIDS.Remove(value.GUID);
}
Setting.Value = string.Join(",", SelectedGUIDS.ToArray());
}
}
GUILayout.EndHorizontal();
}
GUI.changed = false;
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
{
if (GUILayout.Button("Done"))
{
Visible = false;
var manager = GetConfigurationManager();
if (manager != null) manager.DisplayingWindow = true;
}
}
GUILayout.EndHorizontal();
}
19
Source : ManifestEditor.cs
with MIT License
from IllusionMods
with MIT License
from IllusionMods
public static void OnInspectorGUI()
{
GUI.enabled = true;
GUILayout.Label("Editing: " + Path.Replace("replacedets/Mods/", "").Replace("replacedets/Examples/", ""));
var modGUIDNew = EditorGUILayout.TextField("GUID", ModGUID);
var modNameNew = EditorGUILayout.TextField("Name", ModName);
var modVersionNew = EditorGUILayout.TextField("Version", ModVersion);
var modAuthorNew = EditorGUILayout.TextField("Author", ModAuthor);
var modDescriptionNew = EditorGUILayout.TextField("Description", ModDescription);
var modWebsiteNew = EditorGUILayout.TextField("Website", ModWebsite);
if (!string.IsNullOrEmpty(modGUIDNew) && modGUIDNew != ModGUID)
{
ModGUID = modGUIDNew;
if (ManifestDoreplacedent.Root.Element("guid") == null)
ManifestDoreplacedent.Root.Add(new XElement("guid"));
ManifestDoreplacedent.Root.Element("guid").Value = ModGUID;
ManifestDoreplacedent.Save(Path);
}
if (modNameNew != ModName)
{
ModName = modNameNew;
if (ManifestDoreplacedent.Root.Element("name") == null)
ManifestDoreplacedent.Root.Add(new XElement("name"));
ManifestDoreplacedent.Root.Element("name").Value = ModName;
ManifestDoreplacedent.Save(Path);
}
if (modVersionNew != ModVersion)
{
ModVersion = modVersionNew;
if (ManifestDoreplacedent.Root.Element("version") == null)
ManifestDoreplacedent.Root.Add(new XElement("version"));
ManifestDoreplacedent.Root.Element("version").Value = ModVersion;
ManifestDoreplacedent.Save(Path);
}
if (modAuthorNew != ModAuthor)
{
ModAuthor = modAuthorNew;
if (ManifestDoreplacedent.Root.Element("author") == null)
ManifestDoreplacedent.Root.Add(new XElement("author"));
ManifestDoreplacedent.Root.Element("author").Value = ModAuthor;
ManifestDoreplacedent.Save(Path);
}
if (modDescriptionNew != ModDescription)
{
ModDescription = modDescriptionNew;
if (ManifestDoreplacedent.Root.Element("description") == null)
ManifestDoreplacedent.Root.Add(new XElement("description"));
ManifestDoreplacedent.Root.Element("description").Value = ModDescription;
ManifestDoreplacedent.Save(Path);
}
if (modWebsiteNew != ModWebsite)
{
ModWebsite = modWebsiteNew;
if (ManifestDoreplacedent.Root.Element("website") == null)
ManifestDoreplacedent.Root.Add(new XElement("website"));
ManifestDoreplacedent.Root.Element("website").Value = ModWebsite;
ManifestDoreplacedent.Save(Path);
}
EditorGUILayout.Space();
GUI.enabled = false;
GUILayout.TextArea(ManifestDoreplacedent.ToString(), GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true), GUILayout.MinHeight(70), GUILayout.MaxHeight(250));
GUI.enabled = true;
}
19
Source : RedisWindow.cs
with MIT License
from JasonXuDeveloper
with MIT License
from JasonXuDeveloper
void OnGUI()
{
//GUI样式
GUIStyle header = new GUIStyle();
header.fontSize = 20;
header.normal.textColor = Color.white;
GUIStyle body = new GUIStyle();
body.fontSize = 13;
body.normal.textColor = Color.red;
GUILayout.BeginVertical();
EditorStyles.textArea.wordWrap = true;
if (Language == Language.中文)
{
//全部Key区域
GUILayout.BeginArea(new Rect(25, 10, this.position.width / 3, this.position.height - 10));
EditorGUILayout.LabelField("Db" + SQL_DB + "中的Keys", header);
GUILayout.Space(5);
EditorGUILayout.LabelField("共" + Keys.Count + "Keys", body);
if (GUILayout.Button("新增"))
{
CurrentValue = "";
CurrentKey = "";
SelectedKey = "";
this.Repaint();
}
GUILayout.Space(10);
m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
foreach (var key in Keys)
{
if (GUILayout.Button(key))
{
GetValue(key);
}
}
GUILayout.Space(10);
GUILayout.EndScrollView();
GUILayout.EndArea();
//配置+数据区域
GUILayout.BeginArea(new Rect(this.position.width / 3 + 50, 10, this.position.width / 3 * 2 - 75, this.position.height - 110));
EditorGUILayout.HelpBox("Unity GUI Redis\n" +
"作者: 傑", MessageType.Info);
Language = (Language)EditorGUILayout.EnumPopup("语言(Language)", Language);
//配置区域
m_ScrollPosition2 = EditorGUILayout.BeginScrollView(m_ScrollPosition2);
this.fadeGroup.target = EditorGUILayout.Foldout(this.fadeGroup.target, "基础设置", true);
if (EditorGUILayout.BeginFadeGroup(this.fadeGroup.faded))
{
EditorGUILayout.HelpBox("注意:\n如果Redis服务器外网没访问权,请使用SSH连接\n如果通过SSH连接,数据库IP为Redis配置文件中绑定的地址(理论上为127.0.0.1)\n如果不通过SSH连接,数据库IP为服务器IP\nRedis数据库端口默认是6379\n数据库如果没密码就留空\n数据库默认为0", MessageType.Warning);
SQL_IP = EditorGUILayout.TextField("数据库IP", SQL_IP);
SQL_Port = (uint)EditorGUILayout.IntField("数据库端口", (int)SQL_Port);
SQL_Preplacedword = EditorGUILayout.PreplacedwordField("数据库密码", SQL_Preplacedword);
SQL_DB = EditorGUILayout.IntField("数据库", (int)SQL_DB);
Debug = EditorGUILayout.Toggle("调试模式", Debug);
GUILayout.Space(10);
ConnectThroughSSH = EditorGUILayout.BeginToggleGroup("使用SSH连接(建议开启)", ConnectThroughSSH);
EditorGUILayout.HelpBox("注意:\nSSH服务器必须具有数据库访问权(即数据库在该服务器内或该服务器IP有权限访问数据库)\nSSH端口默认22\nSSH用户为服务器登入用户名,CentOS的机子一般是root,Ubuntu机子是ubuntu,Windows机子是Administrator\nSSH密码为你登入服务器的密码", MessageType.Warning);
SSH_Host = EditorGUILayout.TextField("SSH服务器IP", SSH_Host);
SSH_Port = EditorGUILayout.IntField("端口", SSH_Port);
SSH_User = EditorGUILayout.TextField("用户", SSH_User);
SSH_Preplacedword = EditorGUILayout.PreplacedwordField("密码", SSH_Preplacedword);
EditorGUILayout.EndToggleGroup();
GUILayout.Space(10);
}
EditorGUILayout.EndFadeGroup();
//数据处理区域
GUILayout.Space(5);
CurrentKey = EditorGUILayout.TextField("Key", CurrentKey);
EditorGUILayout.LabelField("Value");
m_ScrollPosition3 = EditorGUILayout.BeginScrollView(m_ScrollPosition3);
CurrentValue = EditorGUILayout.TextArea(CurrentValue, GUILayout.MinHeight(150), GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
if (CurrentKey != "" && CurrentValue != "" && SelectedKey!= "")
{
if (GUILayout.Button("保存"))
{
SetValue();
}
if (GUILayout.Button("删除"))
{
DeleteValue();
}
}
else
{
if (GUILayout.Button("新增"))
{
SetValue();
}
}
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUILayout.EndArea();
//按钮区域
GUILayout.BeginArea(new Rect(this.position.width / 3 + 25 + ((this.position.width / 3 * 2) - 275) / 2, this.position.height - 90, 250, 80));
m_ScrollPosition4 = EditorGUILayout.BeginScrollView(m_ScrollPosition4);
if (GUILayout.Button("刷新Keys"))
{
GetKeys();
}
if (GUILayout.Button("测试连接"))
{
TestConnection();
}
EditorGUILayout.HelpBox("测试连接会阻塞主线程,建议不要在游戏运行时点击测试,慎用!", MessageType.Error);
GUILayout.EndScrollView();
GUILayout.EndArea();
EditorGUILayout.EndVertical();
}
#region 如果不需要英文版可以把下面的删了
else//英文版本
{
//全部Key区域
GUILayout.BeginArea(new Rect(25, 10, this.position.width / 3, this.position.height - 10));
EditorGUILayout.LabelField("Keys in Db" + SQL_DB + "", header);
GUILayout.Space(5);
EditorGUILayout.LabelField(Keys.Count + " Keys in total", body);
if (GUILayout.Button("Add new key"))
{
CurrentValue = "";
CurrentKey = "";
this.Repaint();
}
GUILayout.Space(10);
m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
foreach (var key in Keys)
{
if (GUILayout.Button(key))
{
GetValue(key);
}
}
GUILayout.Space(10);
GUILayout.EndScrollView();
GUILayout.EndArea();
//配置+数据区域
GUILayout.BeginArea(new Rect(this.position.width / 3 + 50, 10, this.position.width / 3 * 2 - 75, this.position.height - 110));
EditorGUILayout.HelpBox("Unity GUI Redis\n" +
"Author: JasonXuDeveloper", MessageType.Info);
Language = (Language)EditorGUILayout.EnumPopup("语言(Language)", Language);
//配置区域
m_ScrollPosition2 = EditorGUILayout.BeginScrollView(m_ScrollPosition2);
this.fadeGroup.target = EditorGUILayout.Foldout(this.fadeGroup.target, "Basics", true);
if (EditorGUILayout.BeginFadeGroup(this.fadeGroup.faded))
{
EditorGUILayout.HelpBox("Note:\nPlease use SSH if your Redis service refuses to connect from your ip\nWhen you are using SSH, please change the SQL IP to bind IP in your redis configuration (usually is 127.0.0.1)\nIf you are not using SSH, change the SQL IP to you Server IP\nDefault port for Redis is 6379\nRemain SQL Preplacedword empty when there is no preplacedword\nDefault database is 9", MessageType.Warning);
SQL_IP = EditorGUILayout.TextField("SQL IP", SQL_IP);
SQL_Port = (uint)EditorGUILayout.IntField("SQL Port", (int)SQL_Port);
SQL_Preplacedword = EditorGUILayout.PreplacedwordField("SQL Preplacedword", SQL_Preplacedword);
SQL_DB = EditorGUILayout.IntField("Database", (int)SQL_DB);
Debug = EditorGUILayout.Toggle("Debug mode", Debug);
GUILayout.Space(10);
ConnectThroughSSH = EditorGUILayout.BeginToggleGroup("Use SSH (Highly recommended)", ConnectThroughSSH);
EditorGUILayout.HelpBox("Note:\nSSH must be avaliable to connect to Redis\nDefault port for SSH is 22\nSSH Username is usually root on CentOS Machines, ubuntu on Ubuntu Machines, Administrator on Windows\nSSH Preplacedword is the preplacedword which you access to your machine", MessageType.Warning);
SSH_Host = EditorGUILayout.TextField("SSH IP", SSH_Host);
SSH_Port = EditorGUILayout.IntField("SSH Port", SSH_Port);
SSH_User = EditorGUILayout.TextField("SSH User", SSH_User);
SSH_Preplacedword = EditorGUILayout.PreplacedwordField("SSH Preplacedword", SSH_Preplacedword);
EditorGUILayout.EndToggleGroup();
GUILayout.Space(10);
}
EditorGUILayout.EndFadeGroup();
//数据处理区域
GUILayout.Space(5);
CurrentKey = EditorGUILayout.TextField("Key", CurrentKey);
EditorGUILayout.LabelField("Value");
m_ScrollPosition3 = EditorGUILayout.BeginScrollView(m_ScrollPosition3);
CurrentValue = EditorGUILayout.TextArea(CurrentValue, GUILayout.MinHeight(150), GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
if (CurrentKey != "" && CurrentValue != "")
{
if (GUILayout.Button("Save"))
{
SetValue();
}
if (GUILayout.Button("Delete"))
{
DeleteValue();
}
}
else
{
if (GUILayout.Button("Add New"))
{
SetValue();
}
}
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUILayout.EndArea();
//按钮区域
GUILayout.BeginArea(new Rect(this.position.width / 3 + 25 + ((this.position.width / 3 * 2) - 275) / 2, this.position.height - 90, 250, 80));
m_ScrollPosition4 = EditorGUILayout.BeginScrollView(m_ScrollPosition4);
if (GUILayout.Button("Refresh Keys"))
{
GetKeys();
}
if (GUILayout.Button("Test Connection"))
{
TestConnection();
}
EditorGUILayout.HelpBox("Test connection will be running on main thread,\nThus it is not recommended to try it while the game is playing,\nPlease be aware before you use this feature", MessageType.Error);
GUILayout.EndScrollView();
GUILayout.EndArea();
EditorGUILayout.EndVertical();
}
#endregion
//删到这里就够了
}
19
Source : Favorite.cs
with GNU General Public License v3.0
from Keelhauled
with GNU General Public License v3.0
from Keelhauled
private void DrawWindow(int id)
{
GUILayout.BeginVertical();
if(GUILayout.Button("Load", GUI.skin.button, GUILayout.ExpandHeight(true)))
{
show = false;
}
if(GUILayout.Button("Favorite", GUI.skin.button, GUILayout.ExpandHeight(true)))
{
show = false;
}
GUILayout.EndVertical();
}
19
Source : CutsceneEditor.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
private void DrawCutsceneHeader(int totalLines, out bool cleared) {
EditorGUILayout.LabelField("Tokens", ShiroiStyles.Header);
var isEmpty = totalLines == 0;
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(ShiroiStyles.AddTokenContent)) {
var rect = new Rect(Event.current.mousePosition, TokenSelectorWindow.Size);
PopupWindow.Show(rect, SelectorWindow);
}
cleared = false;
if (!isEmpty) {
if (GUILayout.Button(ShiroiStyles.ClearCutscene)) {
cleared = true;
Clear(Cutscene);
}
}
EditorGUILayout.EndHorizontal();
//No token in cutscene
if (isEmpty) {
EditorGUILayout.LabelField(ShiroiStyles.NoTokenContent, ShiroiStyles.HeaderCenter);
GUI.enabled = false;
EditorGUILayout.LabelField(GetKaomoji(), ShiroiStyles.Kaomoji, GUILayout.ExpandHeight(true));
} else {
//Reload kaomojis
currentKaomoji = Random.Range(0, ShiroiStyles.Kaomojis.Length - 1);
}
}
19
Source : EntityEditor.cs
with MIT License
from LunariStudios
with MIT License
from LunariStudios
private static void DrawSolution(Solution solution) {
if (solution == null) {
return;
}
if (GUILayout.Button(
solution.Description,
GUILayout.ExpandHeight(true)
)) {
solution.Action();
}
}
19
Source : KKABMX_AdvancedGUI.cs
with GNU Lesser General Public License v3.0
from ManlyMarco
with GNU Lesser General Public License v3.0
from 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
Source : MakerFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView?.ResetTreeCache();
RefreshCurrentWindow();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : MakerCharaFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView?.ResetTreeCache();
OnFolderChanged();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : ClassroomFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (Overlord.DrawDefaultCardsToggle())
OnFolderChanged();
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView.ResetTreeCache();
OnFolderChanged();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : StudioOutfitFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow()
{
GUILayout.BeginVertical();
{
_costumeInfoEntry.FolderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (Overlord.DrawDefaultCardsToggle())
_costumeInfoEntry.InitOutfitList();
if (GUILayout.Button("Refresh outfits"))
{
_costumeInfoEntry.InitOutfitList();
_costumeInfoEntry.FolderTreeView.ResetTreeCache();
_costumeInfoEntry.FolderTreeView.CurrentFolderChanged.Invoke();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(_costumeInfoEntry.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : FreeHFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView.ResetTreeCache();
OnFolderChanged();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : FolderTreeView.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from 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
Source : StudioCharaFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(CharaListEntry entry)
{
GUILayout.BeginVertical();
{
entry.FolderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button("Refresh characters"))
{
entry.InitCharaList(true);
entry.FolderTreeView.ResetTreeCache();
entry.FolderTreeView.CurrentFolderChanged.Invoke();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
Utils.OpenDirInExplorer(entry.CurrentFolder);
if (GUILayout.Button("Screenshot folder"))
Utils.OpenDirInExplorer(Path.Combine(AI_BrowserFolders.UserDataPath, "cap"));
if (GUILayout.Button("Main game folder"))
Utils.OpenDirInExplorer(Paths.GameRootPath);
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : NewGameFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (Overlord.DrawDefaultCardsToggle())
OnFolderChanged();
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView.ResetTreeCache();
OnFolderChanged();
}
if (GUILayout.Button("Open folder in explorer"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : BaseStudioFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private void TreeWindow(T entry)
{
GUILayout.BeginVertical();
{
entry.FolderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button(RefreshLabel))
{
entry.InitListRefresh();
entry.FolderTreeView.ResetTreeCache();
entry.FolderTreeView.CurrentFolderChanged.Invoke();
}
GUILayout.Space(1);
if (GUILayout.Button("Current folder"))
{
Utils.OpenDirInExplorer(entry.CurrentFolder);
}
if (GUILayout.Button("Screenshot folder"))
{
Utils.OpenDirInExplorer(Path.Combine(Utils.NormalizePath(UserData.Path), "cap"));
}
if (GUILayout.Button("Main game folder"))
{
Utils.OpenDirInExplorer(Path.GetDirectoryName(Utils.NormalizePath(UserData.Path)));
}
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
19
Source : NewGameFolders.cs
with GNU General Public License v3.0
from ManlyMarco
with GNU General Public License v3.0
from ManlyMarco
private static void TreeWindow(int id)
{
GUILayout.BeginVertical();
{
_folderTreeView.DrawDirectoryTree();
GUILayout.BeginVertical(GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
{
if (GUILayout.Button("Refresh thumbnails"))
{
_folderTreeView.ResetTreeCache();
OnFolderChanged();
}
if (GUILayout.Button("Open current folder in explorer"))
Utils.OpenDirInExplorer(_folderTreeView.CurrentFolder);
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
See More Examples