Here are the examples of the csharp api UnityEngine.GUILayout.EndVertical() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
490 Examples
19
Source : ComponentSelector.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
static public void Draw<T> (string buttonName, T obj, OnSelectionCallback cb, params GUILayoutOption[] options) where T : MonoBehaviour
{
GUILayout.BeginHorizontal();
bool show = GUILayout.Button(buttonName, "DropDownButton", GUILayout.Width(76f));
#if !UNITY_3_4
GUILayout.BeginVertical();
GUILayout.Space(5f);
#endif
T o = EditorGUILayout.ObjectField(obj, typeof(T), false, options) as T;
#if !UNITY_3_4
GUILayout.EndVertical();
#endif
if (o != null && Selection.activeObject != o.gameObject && GUILayout.Button("Edit", GUILayout.Width(40f)))
{
Selection.activeObject = o.gameObject;
}
GUILayout.EndHorizontal();
if (show) Show<T>(cb);
else if (o != obj) cb(o);
}
19
Source : UIPopupListInspector.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
public override void OnInspectorGUI ()
{
EditorGUIUtility.LookLikeControls(80f);
mList = target as UIPopupList;
ComponentSelector.Draw<UIAtlas>(mList.atlas, OnSelectAtlas);
ComponentSelector.Draw<UIFont>(mList.font, OnSelectFont);
GUILayout.BeginHorizontal();
UILabel lbl = EditorGUILayout.ObjectField("Text Label", mList.textLabel, typeof(UILabel), true) as UILabel;
if (mList.textLabel != lbl)
{
RegisterUndo();
mList.textLabel = lbl;
if (lbl != null) lbl.text = mList.selection;
}
GUILayout.Space(44f);
GUILayout.EndHorizontal();
if (mList.atlas != null)
{
NGUIEditorTools.SpriteField("Background", mList.atlas, mList.backgroundSprite, OnBackground);
NGUIEditorTools.SpriteField("Highlight", mList.atlas, mList.highlightSprite, OnHighlight);
GUILayout.BeginHorizontal();
GUILayout.Space(6f);
GUILayout.Label("Options");
GUILayout.EndHorizontal();
string text = "";
foreach (string s in mList.items) text += s + "\n";
GUILayout.Space(-14f);
GUILayout.BeginHorizontal();
GUILayout.Space(84f);
string modified = EditorGUILayout.TextArea(text, GUILayout.Height(100f));
GUILayout.EndHorizontal();
if (modified != text)
{
RegisterUndo();
string[] split = modified.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
mList.items.Clear();
foreach (string s in split) mList.items.Add(s);
if (string.IsNullOrEmpty(mList.selection) || !mList.items.Contains(mList.selection))
{
mList.selection = mList.items.Count > 0 ? mList.items[0] : "";
}
}
string sel = NGUIEditorTools.DrawList("Selection", mList.items.ToArray(), mList.selection);
if (mList.selection != sel)
{
RegisterUndo();
mList.selection = sel;
}
UIPopupList.Position pos = (UIPopupList.Position)EditorGUILayout.EnumPopup("Position", mList.position);
if (mList.position != pos)
{
RegisterUndo();
mList.position = pos;
}
float ts = EditorGUILayout.FloatField("Text Scale", mList.textScale);
Color tc = EditorGUILayout.ColorField("Text Color", mList.textColor);
Color bc = EditorGUILayout.ColorField("Background", mList.backgroundColor);
Color hc = EditorGUILayout.ColorField("Highlight", mList.highlightColor);
GUILayout.BeginHorizontal();
bool isLocalized = EditorGUILayout.Toggle("Localized", mList.isLocalized, GUILayout.Width(100f));
bool isAnimated = EditorGUILayout.Toggle("Animated", mList.isAnimated);
GUILayout.EndHorizontal();
if (mList.textScale != ts ||
mList.textColor != tc ||
mList.highlightColor != hc ||
mList.backgroundColor != bc ||
mList.isLocalized != isLocalized ||
mList.isAnimated != isAnimated)
{
RegisterUndo();
mList.textScale = ts;
mList.textColor = tc;
mList.backgroundColor = bc;
mList.highlightColor = hc;
mList.isLocalized = isLocalized;
mList.isAnimated = isAnimated;
}
NGUIEditorTools.DrawSeparator();
GUILayout.BeginHorizontal();
GUILayout.Space(6f);
GUILayout.Label("Padding", GUILayout.Width(76f));
GUILayout.BeginVertical();
GUILayout.Space(-12f);
Vector2 padding = EditorGUILayout.Vector2Field("", mList.padding);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
if (mList.padding != padding)
{
RegisterUndo();
mList.padding = padding;
}
EditorGUIUtility.LookLikeControls(100f);
GameObject go = EditorGUILayout.ObjectField("Event Receiver", mList.eventReceiver,
typeof(GameObject), true) as GameObject;
string fn = EditorGUILayout.TextField("Function Name", mList.functionName);
if (mList.eventReceiver != go || mList.functionName != fn)
{
RegisterUndo();
mList.eventReceiver = go;
mList.functionName = fn;
}
}
}
19
Source : CloudSettingsEditor.cs
with MIT License
from adrianpolimeni
with MIT License
from adrianpolimeni
private static Texture2D TextureField(string name, Texture2D texture)
{
GUILayout.BeginVertical();
var style = new GUIStyle(GUI.skin.label);
style.alignment = TextAnchor.UpperCenter;
style.fixedWidth = 64;
GUILayout.Label(name, style);
var result = (Texture2D)EditorGUILayout.ObjectField(texture, typeof(Texture2D), false, GUILayout.Width(64), GUILayout.Height(64));
GUILayout.EndVertical();
return result;
}
19
Source : GUILayout.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
public static void EndVertical()
{
UGUI.EndVertical();
}
19
Source : ConsoleScript.cs
with GNU General Public License v3.0
from AndrasMumm
with GNU General Public License v3.0
from AndrasMumm
void DrawLogList()
{
GUIStyle badgeStyle = GUI.skin.box;
badgeStyle.fontSize = logFontSize;
GUIStyle logStyle = GUI.skin.label;
logStyle.fontSize = logFontSize;
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
// Used to determine height of acreplacedulated log labels.
GUILayout.BeginVertical();
var visibleLogs = logs.Where(IsLogVisible);
foreach (Log log in visibleLogs)
{
DrawLog(log, logStyle, badgeStyle);
}
GUILayout.EndVertical();
var innerScrollRect = GUILayoutUtility.GetLastRect();
GUILayout.EndScrollView();
var outerScrollRect = GUILayoutUtility.GetLastRect();
// If we're scrolled to bottom now, guarantee that it continues to be in next cycle.
if (Event.current.type == EventType.Repaint && IsScrolledToBottom(innerScrollRect, outerScrollRect))
{
ScrollToBottom();
}
}
19
Source : ConsoleScript.cs
with GNU General Public License v3.0
from AndrasMumm
with GNU General Public License v3.0
from AndrasMumm
void DrawToolbar()
{
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();
if (GUILayout.Button(clearLabel))
{
logs.Clear();
}
if (GUILayout.Button("Reload Scene"))
{
Scene scene = SceneManager.GetActiveScene();
SceneManager.LoadScene(scene.name);
}
GUILayout.EndVertical();
foreach (LogType logType in Enum.GetValues(typeof(LogType)))
{
var currentState = logTypeFilters[logType];
var label = logType.ToString();
logTypeFilters[logType] = GUILayout.Toggle(currentState, label, GUILayout.ExpandWidth(false));
GUILayout.Space(20);
}
isCollapsed = GUILayout.Toggle(isCollapsed, collapseLabel, GUILayout.ExpandWidth(false));
GUILayout.EndHorizontal();
}
19
Source : PathFinderVisualizer.cs
with GNU Lesser General Public License v3.0
from ApexGameTools
with GNU Lesser General Public License v3.0
from ApexGameTools
private void OnGUI()
{
if (_styles == null)
{
_styles = new Styles();
}
if (costInfo != CostDiplay.None)
{
if (Camera.main == null)
{
return;
}
var nodes = _engine.expandedSet;
for (int i = 0; i < nodes.Count; i++)
{
var n = nodes[i];
if ((n == null) || (n is PortalCell))
{
continue;
}
int cost;
switch (costInfo)
{
case CostDiplay.MoveCost:
{
cost = n.g;
break;
}
case CostDiplay.Heuristics:
{
cost = n.h;
break;
}
default:
{
cost = n.f;
break;
}
}
var pos = Camera.main.WorldToScreenPoint(n.position);
pos.y = Screen.height - pos.y;
GUI.color = Color.black;
GUI.Label(new Rect(pos.x - 10f, pos.y - 6f, 50f, 20f), cost.ToString());
}
}
if (showInstructions)
{
float width = 300f;
float height = Screen.height * 0.9f;
GUILayout.BeginArea(new Rect(5f, (Screen.height / 2f) - (height / 2f), width, height), GUI.skin.window);
GUILayout.BeginVertical();
GUILayout.Label("Path Finder Visualization", _styles.headerStyle);
GUILayout.Label("Blue Squares represent the node being processed.");
GUILayout.Label("Yellow Squares represent the nodes that have been processed (closed).");
GUILayout.Label("Green Squares represent expanded nodes yet to be processed.");
GUILayout.Label("Purple Squares represent nodes from which a portal is crossed.");
GUILayout.Label("\nLeft click to set the Starting Point.\n\nRight click to set the End Point.\n\nPress 'Space' to visualize.\n\nPress 'R' to reset.");
GUILayout.EndVertical();
GUILayout.EndArea();
}
}
19
Source : DebugChooseFormationComponent.cs
with GNU Lesser General Public License v3.0
from ApexGameTools
with GNU Lesser General Public License v3.0
from ApexGameTools
private void OnGUI()
{
var selected = GameServices.gameStateManager.unitSelection.selected;
if (selected.groupCount <= 0 || selected.memberCount <= 0)
{
return;
}
if (guiSkin != null && GUI.skin != guiSkin)
{
GUI.skin = guiSkin;
}
float width = 150f;
float height = Screen.height * 0.9f;
float buttonHeight = height / 8f;
GUILayout.BeginArea(new Rect(5f, (Screen.height / 2f) - (height / 2f), width, height));
GUILayout.BeginVertical();
if (GUILayout.Button("Circle Formation (F1)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F1))
{
SetFormation(new FormationEllipsoid(formationSpacing));
}
else if (GUILayout.Button("Grid Formation (F2)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F2))
{
SetFormation(new FormationGrid(formationSpacing));
}
else if (GUILayout.Button("Spiral Formation (F3)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F3))
{
SetFormation(new FormationSpiral(formationSpacing));
}
else if (GUILayout.Button("Wing Formation (F4)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F4))
{
SetFormation(new FormationWing(formationSpacing));
}
else if (GUILayout.Button("Row Formation (F5)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F5))
{
SetFormation(new FormationRow(formationSpacing));
}
else if (GUILayout.Button("Line Formation (F6)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKeyUp(KeyCode.F6))
{
SetFormation(new FormationLine(formationSpacing));
}
else if (GUILayout.Button("No Formation (F7)", GUILayout.Width(width), GUILayout.Height(buttonHeight)) || Input.GetKey(KeyCode.F7))
{
SetFormation(null);
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
19
Source : ARCoreProjectSettingsWindow.cs
with GNU General Public License v3.0
from ARPOISE
with GNU General Public License v3.0
from ARPOISE
private void OnGUI()
{
GUILayout.BeginVertical();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
GUIStyle replacedleStyle = new GUIStyle(GUI.skin.label);
replacedleStyle.alignment = TextAnchor.MiddleCenter;
replacedleStyle.stretchWidth = true;
replacedleStyle.fontSize = 14;
replacedleStyle.fixedHeight = 20;
EditorGUILayout.LabelField("ARCore Project Settings", replacedleStyle);
GUILayout.Space(15);
ARCoreProjectSettings.Instance.IsARCoreRequired =
EditorGUILayout.Toggle("ARCore Required", ARCoreProjectSettings.Instance.IsARCoreRequired);
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
ARCoreProjectSettings.Instance.IsInstantPreviewEnabled =
EditorGUILayout.Toggle("Instant Preview enabled",
ARCoreProjectSettings.Instance.IsInstantPreviewEnabled);
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
bool newARCoreIOSEnabled =
EditorGUILayout.Toggle("iOS Support Enabled",
ARCoreProjectSettings.Instance.IsIOSSupportEnabled);
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
EditorGUILayout.LabelField("Cloud Anchor API Keys");
EditorGUILayout.BeginHorizontal();
GUILayout.Space(s_GroupFieldIndent);
EditorGUILayout.LabelField("Android", GUILayout.Width(EditorGUIUtility.labelWidth - s_GroupFieldIndent));
ARCoreProjectSettings.Instance.CloudServicesApiKey =
EditorGUILayout.TextField(ARCoreProjectSettings.Instance.CloudServicesApiKey);
EditorGUILayout.EndHorizontal();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
EditorGUILayout.BeginHorizontal();
GUILayout.Space(s_GroupFieldIndent);
EditorGUILayout.LabelField("iOS", GUILayout.Width(EditorGUIUtility.labelWidth - s_GroupFieldIndent));
ARCoreProjectSettings.Instance.IosCloudServicesApiKey =
EditorGUILayout.TextField(ARCoreProjectSettings.Instance.IosCloudServicesApiKey);
EditorGUILayout.EndHorizontal();
GUILayout.Space(10);
if (GUI.changed)
{
if (newARCoreIOSEnabled != ARCoreProjectSettings.Instance.IsIOSSupportEnabled)
{
ARCoreProjectSettings.Instance.IsIOSSupportEnabled = newARCoreIOSEnabled;
ARCoreIOSSupportHelper.SetARCoreIOSSupportEnabled(newARCoreIOSEnabled);
}
ARCoreProjectSettings.Instance.Save();
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Close", GUILayout.Width(50), GUILayout.Height(20)))
{
Close();
}
EditorGUILayout.EndHorizontal();
GUILayout.EndVertical();
}
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 : TMP_SpriteAssetImporter.cs
with MIT License
from ashishgopalhattimare
with MIT License
from ashishgopalhattimare
void DrawEditorPanel()
{
// label
GUILayout.Label("Import Settings", EditorStyles.boldLabel);
EditorGUI.BeginChangeCheck();
// Sprite Texture Selection
m_JsonFile = EditorGUILayout.ObjectField("Sprite Data Source", m_JsonFile, typeof(Textreplacedet), false) as Textreplacedet;
m_SpriteDataFormat = (SpritereplacedetImportFormats)EditorGUILayout.EnumPopup("Import Format", m_SpriteDataFormat);
// Sprite Texture Selection
m_SpriteAtlas = EditorGUILayout.ObjectField("Sprite Texture Atlas", m_SpriteAtlas, typeof(Texture2D), false) as Texture2D;
if (EditorGUI.EndChangeCheck())
{
m_CreationFeedback = string.Empty;
}
GUILayout.Space(10);
GUI.enabled = m_JsonFile != null && m_SpriteAtlas != null && m_SpriteDataFormat == SpritereplacedetImportFormats.TexturePacker;
// Create Sprite replacedet
if (GUILayout.Button("Create Sprite replacedet"))
{
m_CreationFeedback = string.Empty;
// Read json data file
if (m_JsonFile != null && m_SpriteDataFormat == SpritereplacedetImportFormats.TexturePacker)
{
TexturePacker.SpriteDataObject sprites = JsonUtility.FromJson<TexturePacker.SpriteDataObject>(m_JsonFile.text);
if (sprites != null && sprites.frames != null && sprites.frames.Count > 0)
{
int spriteCount = sprites.frames.Count;
// Update import results
m_CreationFeedback = "<b>Import Results</b>\n--------------------\n";
m_CreationFeedback += "<color=#C0ffff><b>" + spriteCount + "</b></color> Sprites were imported from file.";
// Create sprite info list
m_SpriteInfoList = CreateSpriteInfoList(sprites);
}
}
}
GUI.enabled = true;
// Creation Feedback
GUILayout.Space(5);
GUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.Height(60));
{
EditorGUILayout.LabelField(m_CreationFeedback, TMP_UIStyleManager.label);
}
GUILayout.EndVertical();
GUILayout.Space(5);
GUI.enabled = m_JsonFile != null && m_SpriteAtlas && m_SpriteInfoList != null && m_SpriteInfoList.Count > 0; // Enable Save Button if font_Atlas is not Null.
if (GUILayout.Button("Save Sprite replacedet") && m_JsonFile != null)
{
string filePath = EditorUtility.SaveFilePanel("Save Sprite replacedet File", new FileInfo(replacedetDatabase.GetreplacedetPath(m_JsonFile)).DirectoryName, m_JsonFile.name, "replacedet");
if (filePath.Length == 0)
return;
SaveSpritereplacedet(filePath);
}
GUI.enabled = true;
}
19
Source : MiscHacks.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
public static void DisplayGUI()
{
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_damage_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_player :"), GUILayout.ExpandWidth(false));
s_playerDamageIdx = RGUI.SelectionPopup(s_playerDamageIdx, s_playerNames.ToArray());
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_value :"), GUILayout.ExpandWidth(false));
s_damageToDeal = GUILayout.TextField(s_damageToDeal, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_player")))
{
if (int.TryParse(s_damageToDeal, out int damage))
{
s_players[s_playerDamageIdx].VTDamage(damage);
}
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_enreplacedies")))
{
DamageAllCharacters();
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_players")))
{
DamageAllOtherPlayers();
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_event_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_event_message :"), GUILayout.ExpandWidth(false));
s_worldMessageText = GUILayout.TextField(s_worldMessageText, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_event_button")))
{
MessageAllInRange(MessageHud.MessageType.Center, s_worldMessageText);
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_chat_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_username :"), GUILayout.ExpandWidth(false));
s_chatUsernameText = GUILayout.TextField(s_chatUsernameText, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_message :"), GUILayout.ExpandWidth(false));
s_chatMessageText = GUILayout.TextField(s_chatMessageText, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
s_isShoutMessage = GUILayout.Toggle(s_isShoutMessage, "");
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_shout"));
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_chat_button")))
{
ChatMessage(s_isShoutMessage ? Talker.Type.Shout : Talker.Type.Normal, s_chatUsernameText, s_chatMessageText);
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_esp_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_player_esp_button : " + (EntryPoint.s_showPlayerESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
EntryPoint.s_showPlayerESP = !EntryPoint.s_showPlayerESP;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_monster_esp_button : " + (EntryPoint.s_showMonsterESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
EntryPoint.s_showMonsterESP = !EntryPoint.s_showMonsterESP;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_dropped_esp_button : " + (EntryPoint.s_showDroppedESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
EntryPoint.s_showDroppedESP = !EntryPoint.s_showDroppedESP;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_deposit_esp_button : " + (EntryPoint.s_showDepositESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
EntryPoint.s_showDepositESP = !EntryPoint.s_showDepositESP;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_pickable_esp_button : " + (EntryPoint.s_showPickableESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
EntryPoint.s_showPickableESP = !EntryPoint.s_showPickableESP;
}
}
GUILayout.EndVertical();
}
19
Source : PlayerHacks.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
public static void DisplayGUI()
{
GUILayout.BeginHorizontal();
{
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_general_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_god_mode : " + (Player.m_localPlayer.VTInGodMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
Player.m_localPlayer.VTSetGodMode(!Player.m_localPlayer.VTInGodMode());
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_inf_stamina_me : " + (s_isInfiniteStaminaMe ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
s_isInfiniteStaminaMe = !s_isInfiniteStaminaMe;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_inf_stamina_others : " + (s_isInfiniteStaminaOthers ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
s_isInfiniteStaminaOthers = !s_isInfiniteStaminaOthers;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_no_stamina : " + (s_isNoStaminaOthers ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
s_isNoStaminaOthers = !s_isNoStaminaOthers;
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_fly_mode : " + (Player.m_localPlayer.VTInFlyMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
Player.m_localPlayer.VTSetFlyMode(!Player.m_localPlayer.VTInFlyMode());
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_ghost_mode : " + (Player.m_localPlayer.VTInGhostMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
Player.m_localPlayer.VTSetGhostMode(!Player.m_localPlayer.VTInGhostMode());
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_nop_lacement_cost : " + (Player.m_localPlayer.VTIsNoPlacementCost() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
Player.m_localPlayer.VTSetNoPlacementCost(!Player.m_localPlayer.VTIsNoPlacementCost());
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_explore_minimap")))
{
Minimap.instance.VTExploreAll();
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_reset_minimap")))
{
Minimap.instance.VTReset();
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_tame_creatures")))
{
Player.m_localPlayer.VTTameNearbyCreatures();
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_infinite_weight : " + (Player.m_localPlayer.VTIsInventoryInfiniteWeight() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
{
Player.m_localPlayer.VTInventoryInfiniteWeight(!Player.m_localPlayer.VTIsInventoryInfiniteWeight());
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical();
{
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_teleport_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_player_teleport_player :"), GUILayout.ExpandWidth(false));
s_teleportTargetIdx = RGUI.SelectionPopup(s_teleportTargetIdx, s_netPlayerNames.ToArray());
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_teleport_button")))
{
if (s_netPlayers != null && s_teleportTargetIdx < s_netPlayers.Count && s_teleportTargetIdx >= 0)
{
Player.m_localPlayer.VTTeleportTo(s_netPlayers[s_teleportTargetIdx]);
}
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_heal_manager_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_player_heal_player :"), GUILayout.ExpandWidth(false));
s_healTargetIdx = RGUI.SelectionPopup(s_healTargetIdx, s_playerNames.ToArray());
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_heal_selected_player")))
{
if (s_healTargetIdx < s_players.Count && s_healTargetIdx >= 0)
{
s_players[s_healTargetIdx].VTHeal();
}
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_heal_all_players")))
{
foreach (Player player in s_players)
{
player.VTHeal();
}
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_power_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_player_power_name :"), GUILayout.ExpandWidth(false));
s_guardianPowerIdx = RGUI.SelectionPopup(s_guardianPowerIdx, s_guardianPowers.Keys.Select(p => VTLocalization.instance.Localize(p)).ToArray());
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_power_active_me")))
{
if (Player.m_localPlayer != null)
{
Player.m_localPlayer.VTActiveGuardianPower(s_guardianPowers[s_guardianPowerIdx]);
}
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_power_active_all")))
{
if (s_guardianPowers.ContainsKey(s_guardianPowerIdx))
{
AllPlayersActiveGuardianPower(s_guardianPowers[s_guardianPowerIdx]);
}
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_skill_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_player_skill_name :"), GUILayout.ExpandWidth(false));
s_skillNameIdx = RGUI.SelectionPopup(s_skillNameIdx, s_skills.ToArray());
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_player_skill_level :"), GUILayout.ExpandWidth(false));
s_skillLevelIdx = RGUI.SelectionPopup(s_skillLevelIdx, s_levels.ToArray());
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_skill_button")))
{
if (s_skillNameIdx < s_skills.Count && s_skillNameIdx >= 0)
{
if (int.TryParse(s_levels[s_skillLevelIdx], out int levelInt))
{
Player.m_localPlayer.VTUpdateSkillLevel(s_skills[s_skillNameIdx], levelInt);
}
}
}
}
GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
19
Source : EntitiesItemsHacks.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
public static void DisplayGUI()
{
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_enreplacedies_spawn_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_enreplacedies_spawn_enreplacedy_name :"), GUILayout.ExpandWidth(false));
s_enreplacedyPrefabIdx = RGUI.SearchableSelectionPopup(s_enreplacedyPrefabIdx, s_enreplacedyPrefabsFiltered.ToArray(), ref s_enreplacedySearchTerms);
SearchItem(s_enreplacedySearchTerms);
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_enreplacedies_spawn_quanreplacedy :"), GUILayout.ExpandWidth(false));
s_enreplacedyQuanreplacedyText = GUILayout.TextField(s_enreplacedyQuanreplacedyText, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_enreplacedies_spawn_level :"), GUILayout.ExpandWidth(false));
s_enreplacedyLevelIdx = RGUI.SelectionPopup(s_enreplacedyLevelIdx, s_enreplacedyLevels.ToArray());
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_enreplacedies_spawn_button")))
{
if (int.TryParse(s_enreplacedyQuanreplacedyText, out int enreplacedyQuanreplacedy) && int.TryParse(s_enreplacedyLevels[s_enreplacedyLevelIdx], out int enreplacedyLevel))
{
if (enreplacedyQuanreplacedy <= 100 && s_enreplacedyPrefabIdx < s_enreplacedyPrefabsFiltered.Count && s_enreplacedyPrefabIdx >= 0)
{
SpawnEnreplacedies(s_enreplacedyPrefabsFiltered[s_enreplacedyPrefabIdx], enreplacedyLevel, enreplacedyQuanreplacedy);
}
}
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_enreplacedies_drops_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_enreplacedies_drops_button")))
{
RemoveAllDrops();
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_enreplacedies_item_giver_replacedle"), GUI.skin.box, GUILayout.ExpandWidth(false));
{
GUILayout.Space(EntryPoint.s_boxSpacing);
if (GUILayout.Button(EntryPoint.s_showItemGiver ? VTLocalization.instance.Localize("$vt_enreplacedies_item_giver_button_hide") : VTLocalization.instance.Localize("$vt_enreplacedies_item_giver_button_show")))
{
EntryPoint.s_showItemGiver = !EntryPoint.s_showItemGiver;
}
}
GUILayout.EndVertical();
}
19
Source : ExampleHelpWindow.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
private void DrawWindow(int id, float maxWidth)
{
GUILayout.BeginVertical(GUI.skin.box);
GUILayout.Label(m_Description);
GUILayout.EndVertical();
if (GUILayout.Button("Got it!"))
{
mShowingHelpWindow = false;
}
}
19
Source : PluginSettings.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
[SettingsProvider]
private static SettingsProvider RiderPreferencesItem()
{
if (!RiderScriptEditor.IsRiderInstallation(RiderScriptEditor.CurrentEditor))
return null;
if (!RiderScriptEditorData.instance.shouldLoadEditorPlugin)
return null;
var provider = new SettingsProvider("Preferences/Rider", SettingsScope.User)
{
label = "Rider",
keywords = new[] { "Rider" },
guiHandler = (searchContext) =>
{
EditorGUIUtility.labelWidth = 200f;
EditorGUILayout.BeginVertical();
GUILayout.BeginVertical();
LogEventsCollectorEnabled =
EditorGUILayout.Toggle(new GUIContent("Preplaced Console to Rider:"), LogEventsCollectorEnabled);
GUILayout.EndVertical();
GUILayout.Label("");
if (!string.IsNullOrEmpty(EditorPluginInterop.LogPath))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Log file:");
var previous = GUI.enabled;
GUI.enabled = previous && SelectedLoggingLevel != LoggingLevel.OFF;
var button = GUILayout.Button(new GUIContent("Open log"));
if (button)
{
//UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal(PluginEntryPoint.LogPath, 0);
// works much faster than the commented code, when Rider is already started
CodeEditor.CurrentEditor.OpenProject(EditorPluginInterop.LogPath, 0, 0);
}
GUI.enabled = previous;
GUILayout.EndHorizontal();
}
var loggingMsg =
@"Sets the amount of Rider Debug output. If you are about to report an issue, please select Verbose logging level and attach Unity console output to the issue.";
SelectedLoggingLevel =
(LoggingLevel) EditorGUILayout.EnumPopup(new GUIContent("Logging Level:", loggingMsg),
SelectedLoggingLevel);
EditorGUILayout.HelpBox(loggingMsg, MessageType.None);
var githubRepo = "https://github.com/JetBrains/resharper-unity";
var caption = $"<color=#0000FF>{githubRepo}</color>";
LinkButton(caption: caption, url: githubRepo);
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
var replacedembly = EditorPluginInterop.EditorPluginreplacedembly;
if (replacedembly != null)
{
var version = replacedembly.GetName().Version;
GUILayout.Label("Plugin version: " + version, ourVersionInfoStyle);
}
GUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
};
return provider;
}
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 : TimelineWindow_Gui.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void TimelineSectionGUI()
{
GUILayout.BeginVertical();
{
GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Width(position.width - state.sequencerHeaderWidth));
{
DoSequenceSelectorGUI();
DoBreadcrumbGUI();
OptionsGUI();
}
GUILayout.EndHorizontal();
TimelineGUI();
}
GUILayout.EndVertical();
}
19
Source : TimelineWindow_HeaderGui.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void SequencerHeaderGUI()
{
using (new EditorGUI.DisabledScope(state.editSequence.replacedet == null))
{
GUILayout.BeginVertical();
{
TransportToolbarGUI();
GUILayout.BeginHorizontal(GUILayout.Width(sequenceHeaderRect.width));
{
if (state.editSequence.replacedet != null)
{
GUILayout.Space(DirectorStyles.kBaseIndent);
AddButtonGUI();
GUILayout.FlexibleSpace();
EditModeToolbarGUI(currentMode);
ShowMarkersButton();
EditorGUILayout.Space();
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
}
19
Source : TimelineWindow_TrackGui.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void TracksGUI(Rect clientRect, WindowState state, TimelineModeGUIState trackState)
{
if (Event.current.type == EventType.Repaint && treeView != null)
{
state.spaceParreplacedioner.Clear();
}
if (state.IsEditingASubTimeline() && !state.IsEditingAnEmptyTimeline())
{
var headerRect = clientRect;
headerRect.width = state.sequencerHeaderWidth;
Graphics.DrawBackgroundRect(state, headerRect);
var clipRect = clientRect;
clipRect.xMin = headerRect.xMax;
Graphics.DrawBackgroundRect(state, clipRect, subSequenceMode: true);
}
else
{
Graphics.DrawBackgroundRect(state, clientRect);
}
if (!state.IsEditingAnEmptyTimeline())
m_TimeArea.DrawMajorTicks(sequenceContentRect, state.referenceSequence.frameRate);
GUILayout.BeginVertical();
{
GUILayout.Space(5.0f);
GUILayout.BeginHorizontal();
if (this.state.editSequence.replacedet == null)
DrawNoSequenceGUI(state);
else
DrawTracksGUI(clientRect, trackState);
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
Graphics.DrawShadow(clientRect);
}
19
Source : TimelineWindow_TrackGui.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void DrawNoSequenceGUI(WindowState windowState)
{
bool showCreateButton = false;
var currentlySelectedGo = UnityEditor.Selection.activeObject != null ? UnityEditor.Selection.activeObject as GameObject : null;
var textContent = DirectorStyles.noTimelinereplacedetSelected;
var existingDirector = currentlySelectedGo != null ? currentlySelectedGo.GetComponent<PlayableDirector>() : null;
var existingreplacedet = existingDirector != null ? existingDirector.playablereplacedet : null;
if (currentlySelectedGo != null && !TimelineUtility.IsPrefabOrreplacedet(currentlySelectedGo) && existingreplacedet == null)
{
showCreateButton = true;
textContent = new GUIContent(String.Format(DirectorStyles.createTimelineOnSelection.text, currentlySelectedGo.name, "a Director component and a Timeline replacedet"));
}
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
GUILayout.Label(textContent);
if (showCreateButton)
{
GUILayout.BeginHorizontal();
var textSize = GUI.skin.label.CalcSize(textContent);
GUILayout.Space((textSize.x / 2.0f) - (WindowConstants.createButtonWidth / 2.0f));
if (GUILayout.Button("Create", GUILayout.Width(WindowConstants.createButtonWidth)))
{
var message = DirectorStyles.createNewTimelineText.text + " '" + currentlySelectedGo.name + "'";
string newSequencePath = EditorUtility.SaveFilePanelInProject(DirectorStyles.createNewTimelineText.text, currentlySelectedGo.name + "Timeline", "playable", message, ProjectWindowUtil.GetActiveFolderPath());
if (!string.IsNullOrEmpty(newSequencePath))
{
var newreplacedet = CreateInstance<Timelinereplacedet>();
replacedetDatabase.Createreplacedet(newreplacedet, newSequencePath);
Undo.IncrementCurrentGroup();
if (existingDirector == null)
{
existingDirector = Undo.AddComponent<PlayableDirector>(currentlySelectedGo);
}
existingDirector.playablereplacedet = newreplacedet;
SetCurrentTimeline(existingDirector);
var newTrack = TimelineHelpers.CreateTrack<AnimationTrack>();
windowState.previewMode = false;
TimelineUtility.SetSceneGameObject(windowState.editSequence.director, newTrack, currentlySelectedGo);
}
// If we reach this point, the state of the pannel has changed; skip the rest of this GUI phase
// Fixes: case 955831 - [OSX] NullReferenceException when creating a timeline on a selected object
GUIUtility.ExitGUI();
}
GUILayout.EndHorizontal();
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
}
19
Source : TimelineWindow_TrackGui.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
void DrawTracksGUI(Rect clientRect, TimelineModeGUIState trackState)
{
GUILayout.BeginVertical(GUILayout.Height(clientRect.height));
if (treeView != null)
{
if (Event.current.type == EventType.Layout)
{
OverlayDrawData.Clear();
}
treeView.OnGUI(clientRect);
if (Event.current.type == EventType.Repaint)
{
foreach (var overlayData in OverlayDrawData)
{
using (new GUIViewportScope(sequenceContentRect))
DrawOverlay(overlayData);
}
}
}
GUILayout.EndVertical();
}
19
Source : GUILayout.cs
with MIT License
from bbepis
with MIT License
from bbepis
protected override void CloseScope()
{
EndVertical();
}
19
Source : ConfigurationManager.cs
with GNU Lesser General Public License v3.0
from BepInEx
with GNU Lesser General Public License v3.0
from BepInEx
private void DrawSinglePlugin(PluginSettingsData plugin)
{
GUILayout.BeginVertical(GUI.skin.box);
var categoryHeader = _showDebug ?
new GUIContent($"{plugin.Info.Name.TrimStart('!')} {plugin.Info.Version}", "GUID: " + plugin.Info.GUID) :
new GUIContent($"{plugin.Info.Name.TrimStart('!')} {plugin.Info.Version}");
var isSearching = !string.IsNullOrEmpty(SearchString);
{
var hasWebsite = plugin.Website != null;
if (hasWebsite)
{
GUILayout.BeginHorizontal();
GUILayout.Space(29); // Same as the URL button to keep the plugin name centered
}
if (SettingFieldDrawer.DrawPluginHeader(categoryHeader, plugin.Collapsed && !isSearching) && !isSearching)
plugin.Collapsed = !plugin.Collapsed;
if (hasWebsite)
{
var origColor = GUI.color;
GUI.color = Color.gray;
if (GUILayout.Button(new GUIContent("URL", plugin.Website), GUI.skin.label, GUILayout.ExpandWidth(false)))
Utils.OpenWebsite(plugin.Website);
GUI.color = origColor;
GUILayout.EndHorizontal();
}
}
if (isSearching || !plugin.Collapsed)
{
foreach (var category in plugin.Categories)
{
if (!string.IsNullOrEmpty(category.Name))
{
if (plugin.Categories.Count > 1 || !_hideSingleSection.Value)
SettingFieldDrawer.DrawCategoryHeader(category.Name);
}
foreach (var setting in category.Settings)
{
DrawSingleSetting(setting);
GUILayout.Space(2);
}
}
}
GUILayout.EndVertical();
}
19
Source : SettingFieldDrawer.cs
with GNU Lesser General Public License v3.0
from BepInEx
with GNU Lesser General Public License v3.0
from BepInEx
private static void DrawFlagsField(SettingEntryBase setting, IList enumValues, int maxWidth)
{
var currentValue = Convert.ToInt64(setting.Get());
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.MaxWidth(maxWidth));
{
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 > maxWidth)
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.Set(Enum.ToObject(setting.SettingType, newValue));
}
}
}
}
GUILayout.EndHorizontal();
}
GUI.changed = false;
}
GUILayout.EndVertical();
// Make sure the reset button is properly spaced
GUILayout.FlexibleSpace();
}
19
Source : ConfigurationManager.cs
with GNU Lesser General Public License v3.0
from BepInEx
with GNU Lesser General Public License v3.0
from BepInEx
private void SettingsWindow(int id)
{
DrawWindowHeader();
_settingWindowScrollPos = GUILayout.BeginScrollView(_settingWindowScrollPos, false, true);
var scrollPosition = _settingWindowScrollPos.y;
var scrollHeight = SettingWindowRect.height;
GUILayout.BeginVertical();
{
if (string.IsNullOrEmpty(SearchString))
{
DrawTips();
if (_tipsHeight == 0 && Event.current.type == EventType.Repaint)
_tipsHeight = (int)GUILayoutUtility.GetLastRect().height;
}
var currentHeight = _tipsHeight;
foreach (var plugin in _filteredSetings)
{
var visible = plugin.Height == 0 || currentHeight + plugin.Height >= scrollPosition && currentHeight <= scrollPosition + scrollHeight;
if (visible)
{
try
{
DrawSinglePlugin(plugin);
}
catch (ArgumentException)
{
// Needed to avoid GUILayout: Mismatched LayoutGroup.Repaint crashes on large lists
}
if (plugin.Height == 0 && Event.current.type == EventType.Repaint)
plugin.Height = (int)GUILayoutUtility.GetLastRect().height;
}
else
{
try
{
GUILayout.Space(plugin.Height);
}
catch (ArgumentException)
{
// Needed to avoid GUILayout: Mismatched LayoutGroup.Repaint crashes on large lists
}
}
currentHeight += plugin.Height;
}
if (_showDebug)
{
GUILayout.Space(10);
GUILayout.Label("Plugins with no options available: " + _modsWithoutSettings);
}
else
{
// Always leave some space in case there's a dropdown box at the very bottom of the list
GUILayout.Space(70);
}
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
if (!SettingFieldDrawer.DrawCurrentDropdown())
DrawTooltip(SettingWindowRect);
}
19
Source : GUIDebug.cs
with MIT License
from blueinsert
with MIT License
from blueinsert
private void ShowMessage(Dictionary<string, string> msgDic, int areaIndex)
{
GUIStyle fontStyle = new GUIStyle();
fontStyle.normal.background = null; //设置背景填充
fontStyle.normal.textColor = new Color(0, 0, 1); //设置字体颜色
fontStyle.fontSize = 35; //字体大小
var areaStartPos = m_areaStartPos[areaIndex];
GUI.color = Color.blue;
GUILayout.BeginArea(new UnityEngine.Rect(areaStartPos.x, areaStartPos.y, m_areaSize.x, m_areaSize.y));
m_scrollPositions[areaIndex] = GUILayout.BeginScrollView(m_scrollPositions[areaIndex], GUILayout.Width(Screen.width / 2), GUILayout.Height(Screen.height));
GUILayout.BeginVertical();
foreach (var kv in msgDic)
{
GUILayout.Label(new GUIContent(kv.Key + ":" + kv.Value), fontStyle);
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
GUILayout.EndArea();
}
19
Source : TweenMainEditor.cs
with MIT License
from blueinsert
with MIT License
from blueinsert
protected void EndContents()
{
GUILayout.Space(3f);
GUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
19
Source : NameMgrWindow.cs
with MIT License
from BlueMonk1107
with MIT License
from BlueMonk1107
private void OnGUI()
{
GUILayout.Label("资源名称管理器");
NameMgrWindowData.UpdateData();
foreach (var pair in NameMgrWindowData.SpriteDic)
{
GUILayout.BeginHorizontal();
GUILayout.Label("路径:", GUILayout.MaxWidth(50));
GUILayout.Label(pair.Key.FolderPath, GUILayout.MaxWidth(150));
GUILayout.Label("范例:", GUILayout.MaxWidth(50));
GUILayout.Label(pair.Key.NameTip, GUILayout.MaxWidth(150));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
foreach (var path in pair.Value)
{
GUILayout.BeginVertical();
var texture2D = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(path);
GUILayout.Box(texture2D, GUILayout.Height(80), GUILayout.Width(80));
var name = Path.GetFileNameWithoutExtension(path);
if (!_namesDic.ContainsKey(name)) _namesDic[name] = name;
GUILayout.BeginHorizontal();
_namesDic[name] = GUILayout.TextArea(_namesDic[name], GUILayout.Width(40));
if (GUILayout.Button("确认", GUILayout.Width(30)))
{
if (name != _namesDic[name])
{
ChangeFileName(name, _namesDic[name], path);
_namesDic.Remove(name);
}
replacedetDatabase.Refresh();
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
}
19
Source : Inspector.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
public static void AddArray(SerializedProperty prop, GUIContent guiContent, bool editHierarchy, bool changeOrder, DrawArrayElement drawArrayElement = null, OnAddToArray onAddToArray = null, DrawArrayElementLabel drawArrayElementLabel = null, bool showHeading = true) {
int resetIndent = EditorGUI.indentLevel;
// Array heading
if (showHeading) {
GUILayout.BeginHorizontal();
GUILayout.Space(EditorGUI.indentLevel * indent);
if (drawArrayElement == null) {
GUILayout.Label(guiContent.text + " (" + prop.arraySize.ToString() + ")", GUILayout.Width(150));
} else {
EditorGUILayout.PropertyField(prop, new GUIContent(guiContent.text + " (" + prop.arraySize.ToString() + ")", string.Empty), false, GUILayout.Width(150));
}
GUILayout.EndHorizontal();
}
int deleteIndex = -1;
if (drawArrayElement == null || !showHeading) prop.isExpanded = true;
// Draw Array elements
if (prop.isExpanded) {
for(int i = 0; i < prop.arraySize; i++) {
GUILayout.BeginHorizontal(); // Main
GUILayout.Space(((EditorGUI.indentLevel + 1) * indent));
GUILayout.BeginVertical();
element = prop.GetArrayElementAtIndex(i);
// Label
GUILayout.BeginHorizontal();
if (editHierarchy && GUILayout.Button(new GUIContent("-", "Remove"), changeOrder? EditorStyles.miniButtonLeft: EditorStyles.miniButton, GUILayout.Width(20))){
deleteIndex = i;
}
if (changeOrder) {
if (GUILayout.Button(new GUIContent("<", "Move up"), editHierarchy? EditorStyles.miniButtonMid: EditorStyles.miniButtonLeft, GUILayout.Width(20))) {
int moveTo = i == 0? prop.arraySize - 1: i - 1;
prop.MoveArrayElement(i, moveTo);
prop.isExpanded = true;
}
if (GUILayout.Button(new GUIContent(">", "Move down"), EditorStyles.miniButtonRight, GUILayout.Width(20))) {
int moveTo = i == prop.arraySize - 1? 0: i + 1;
prop.MoveArrayElement(i, moveTo);
prop.isExpanded = true;
}
}
// Calling the DrawArrayElementLabel delegate
if (drawArrayElementLabel != null) {
drawArrayElementLabel(element, editHierarchy);
}
GUILayout.EndHorizontal(); // End Label
// Array Element
GUILayout.BeginVertical();
if (element.isExpanded && drawArrayElement != null) {
drawArrayElement(element, editHierarchy);
}
GUILayout.EndVertical();
GUILayout.Space(5);
GUILayout.EndVertical(); // End Style
GUILayout.EndHorizontal(); // End Main
}
// Deleting array elements
if (deleteIndex != -1) prop.DeleteArrayElementAtIndex(deleteIndex);
// Adding array elements
GUILayout.BeginHorizontal();
GUILayout.Space(((EditorGUI.indentLevel + 1) * indent) + 4);
GUILayout.BeginVertical();
if (editHierarchy && GUILayout.Button(new GUIContent("+", "Add"), EditorStyles.miniButton, GUILayout.Width(20))) {
prop.arraySize ++;
if (onAddToArray != null) onAddToArray(prop.GetArrayElementAtIndex(prop.arraySize - 1));
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
EditorGUI.indentLevel = resetIndent;
}
19
Source : PickUp2Handed.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
void OnGUI() {
GUILayout.BeginHorizontal();
GUILayout.Space(GUIspace);
if (!holding) {
if (GUILayout.Button("Pick Up " + obj.name)) {
interactionSystem.StartInteraction(FullBodyBipedEffector.LeftHand, obj, false);
interactionSystem.StartInteraction(FullBodyBipedEffector.RightHand, obj, false);
}
} else {
GUILayout.BeginVertical();
if (holdingRight)
{
if (GUILayout.Button("Release Right"))
{
interactionSystem.ResumeInteraction(FullBodyBipedEffector.RightHand);
}
}
if (holdingLeft)
{
if (GUILayout.Button("Release Left"))
{
interactionSystem.ResumeInteraction(FullBodyBipedEffector.LeftHand);
}
}
if (GUILayout.Button("Drop " + obj.name)) {
interactionSystem.ResumeAll();
}
GUILayout.EndVertical();
}
GUILayout.EndHorizontal();
}
19
Source : SteamVR_Skeleton_PoserEditor.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
void DrawPoseEditorMenu()
{
if (Application.isPlaying)
{
EditorGUILayout.LabelField("Cannot modify pose while in play mode.");
}
else
{
bool createNew = false;
LoadDefaultPreviewHands();
activePoseIndex = previewPoseSelection.intValue;
if (activePoseIndex == 0)
activePoseProp = skeletonMainPoseProperty;
else
activePoseProp = skeletonAdditionalPosesProperty.GetArrayElementAtIndex(activePoseIndex - 1);
//box containing all pose editing controls
GUILayout.BeginVertical("box");
poseEditorExpanded.boolValue = IndentedFoldoutHeader(poseEditorExpanded.boolValue, "Pose Editor");
if (poseEditorExpanded.boolValue)
{
//show selectable menu of all poses, highlighting the one that is selected
EditorGUILayout.Space();
poser.poseNames = new string[skeletonAdditionalPosesProperty.arraySize + 1];
for (int i = 0; i < skeletonAdditionalPosesProperty.arraySize + 1; i++)
{
if (i == 0)
// main pose special case
poser.poseNames[i] = skeletonMainPoseProperty.objectReferenceValue == null ? "[not set]" : skeletonMainPoseProperty.objectReferenceValue.name + " (MAIN)";
else
// additional poses from array
poser.poseNames[i] = skeletonAdditionalPosesProperty.GetArrayElementAtIndex(i - 1).objectReferenceValue == null ? "[not set]" : skeletonAdditionalPosesProperty.GetArrayElementAtIndex(i - 1).objectReferenceValue.name;
}
EditorGUILayout.BeginHorizontal();
int poseSelected = GUILayout.Toolbar(activePoseIndex, poser.poseNames);
if (poseSelected != activePoseIndex)
{
forceUpdateHands = true;
activePoseIndex = poseSelected;
PoseChanged = true;
previewPoseSelection.intValue = activePoseIndex;
serializedObject.ApplyModifiedProperties();
}
EditorGUILayout.BeginVertical(GUILayout.MaxWidth(32));
if (GUILayout.Button("+", GUILayout.MaxWidth(32)))
{
skeletonAdditionalPosesProperty.InsertArrayElementAtIndex(skeletonAdditionalPosesProperty.arraySize);
}
//only allow deletion of additional poses
EditorGUI.BeginDisabledGroup(skeletonAdditionalPosesProperty.arraySize == 0 || activePoseIndex == 0);
if (GUILayout.Button("-", GUILayout.MaxWidth(32)) && skeletonAdditionalPosesProperty.arraySize > 0)
{
skeletonAdditionalPosesProperty.DeleteArrayElementAtIndex(activePoseIndex - 1);
skeletonAdditionalPosesProperty.DeleteArrayElementAtIndex(activePoseIndex - 1);
if (activePoseIndex >= skeletonAdditionalPosesProperty.arraySize + 1)
{
activePoseIndex = skeletonAdditionalPosesProperty.arraySize;
previewPoseSelection.intValue = activePoseIndex;
return;
}
}
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndVertical();
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
GUILayout.BeginVertical("box");
// sides of pose editor
GUILayout.BeginHorizontal();
//pose controls
GUILayout.BeginVertical(GUILayout.MaxWidth(200));
GUILayout.Label("Current Pose:");
if (PoseChanged)
{
PoseChanged = false;
forceUpdateHands = true;
if (activePoseIndex == 0)
activePoseProp = skeletonMainPoseProperty;
else
activePoseProp = skeletonAdditionalPosesProperty.GetArrayElementAtIndex(activePoseIndex - 1);
activePose = (SteamVR_Skeleton_Pose)activePoseProp.objectReferenceValue;
}
activePose = (SteamVR_Skeleton_Pose)activePoseProp.objectReferenceValue;
if (activePoseProp.objectReferenceValue == null)
{
if (previewLeftInstanceProperty.objectReferenceValue != null)
DestroyImmediate(previewLeftInstanceProperty.objectReferenceValue);
if (previewRightInstanceProperty.objectReferenceValue != null)
DestroyImmediate(previewRightInstanceProperty.objectReferenceValue);
EditorGUILayout.BeginHorizontal();
activePoseProp.objectReferenceValue = EditorGUILayout.ObjectField(activePoseProp.objectReferenceValue, typeof(SteamVR_Skeleton_Pose), false);
if (GUILayout.Button("Create")) createNew = true;
EditorGUILayout.EndHorizontal();
if (createNew)
{
string fullPath = EditorUtility.SaveFilePanelInProject("Create New Skeleton Pose", "newPose", "replacedet", "Save file");
if (string.IsNullOrEmpty(fullPath) == false)
{
SteamVR_Skeleton_Pose newPose = ScriptableObject.CreateInstance<SteamVR_Skeleton_Pose>();
replacedetDatabase.Createreplacedet(newPose, fullPath);
replacedetDatabase.Savereplacedets();
activePoseProp.objectReferenceValue = newPose;
serializedObject.ApplyModifiedProperties();
}
}
}
else
{
activePoseProp.objectReferenceValue = EditorGUILayout.ObjectField(activePoseProp.objectReferenceValue, typeof(SteamVR_Skeleton_Pose), false);
DrawPoseControlButtons();
UpdatePreviewHand(previewLeftInstanceProperty, showLeftPreviewProperty, SteamVR_Settings.instance.previewHandLeft, activePose.leftHand, activePose, forceUpdateHands);
UpdatePreviewHand(previewRightInstanceProperty, showRightPreviewProperty, SteamVR_Settings.instance.previewHandRight, activePose.rightHand, activePose, forceUpdateHands);
forceUpdateHands = false;
GUILayout.EndVertical();
GUILayout.Space(10);
if (handTexL == null)
handTexL = (Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/HandLeftIcon.png");
if (handTexR == null)
handTexR = (Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/HandRightIcon.png");
//Left Hand
GUILayout.Space(32);
EditorGUILayout.BeginVertical();
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
GUI.color = new Color(1, 1, 1, showLeftPreviewProperty.boolValue ? 1 : 0.25f);
if (GUILayout.Button(handTexL, GUI.skin.label, GUILayout.Width(64), GUILayout.Height(64)))
{
showLeftPreviewProperty.boolValue = !showLeftPreviewProperty.boolValue;
//forceUpdateHands = true;
}
GUI.color = Color.white;
EditorGUIUtility.labelWidth = 48;
EditorGUILayout.LabelField("Left Hand", EditorStyles.boldLabel);
EditorGUIUtility.labelWidth = 0;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
bool showLeft = showLeftPreviewProperty.boolValue;
DrawHand(showLeft, activePose.leftHand, activePose.rightHand, getLeftFromOpposite, showLeftPreviewProperty);
EditorGUILayout.EndVertical();
EditorGUI.BeginDisabledGroup((showLeftPreviewProperty.boolValue && showRightPreviewProperty.boolValue) == false);
getRightFromOpposite = GUILayout.Button("Copy Left pose to Right hand");
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical();
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
EditorGUIUtility.labelWidth = 48;
EditorGUILayout.LabelField("Right Hand", EditorStyles.boldLabel);
EditorGUIUtility.labelWidth = 0;
GUI.color = new Color(1, 1, 1, showRightPreviewProperty.boolValue ? 1 : 0.25f);
if (GUILayout.Button(handTexR, GUI.skin.label, GUILayout.Width(64), GUILayout.Height(64)))
{
showRightPreviewProperty.boolValue = !showRightPreviewProperty.boolValue;
//forceUpdateHands = true;
}
GUI.color = Color.white;
EditorGUILayout.EndHorizontal();
bool showRight = showLeftPreviewProperty.boolValue;
DrawHand(showRight, activePose.rightHand, activePose.leftHand, getRightFromOpposite, showRightPreviewProperty);
EditorGUILayout.EndVertical();
EditorGUI.BeginDisabledGroup((showLeftPreviewProperty.boolValue && showRightPreviewProperty.boolValue) == false);
getLeftFromOpposite = GUILayout.Button("Copy Right pose to Left hand");
EditorGUI.EndDisabledGroup();
}
/*
if (activePoseProp.objectReferenceValue == null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(activePoseProp);
createNew = GUILayout.Button("Create");
EditorGUILayout.EndHorizontal();
}
else
{
EditorGUILayout.PropertyField(activePoseProp);
DrawDivider();
DrawSaveButtons();
if (PoseChanged)
{
PoseChanged = false;
forceUpdateHands = true;
}
UpdatePreviewHand(previewLeftInstanceProperty, showLeftPreviewProperty, previewLeftHandPrefab, activePose.leftHand, forceUpdateHands);
UpdatePreviewHand(previewRightInstanceProperty, showRightPreviewProperty, previewRightHandPrefab, activePose.rightHand, forceUpdateHands);
}
activePoseProp.objectReferenceValue = newPose;
serializedObject.ApplyModifiedProperties();
}
}
*/
GUILayout.EndVertical();
EditorGUILayout.EndVertical();
GUILayout.EndHorizontal();
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginHorizontal();
EditorGUIUtility.labelWidth = 120;
poserScale.floatValue = EditorGUILayout.FloatField("Preview Pose Scale", poserScale.floatValue);
if (poserScale.floatValue <= 0) poserScale.floatValue = 1;
EditorGUIUtility.labelWidth = 0;
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
if (EditorGUI.EndChangeCheck())
{
forceUpdateHands = true;
}
}
GUILayout.EndVertical();
}
}
19
Source : IKSolverFullBodyBipedInspector.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
private static void AddBody(SerializedProperty prop, SerializedProperty chain, GUIContent guiContent) {
EditorGUILayout.PropertyField(chain, guiContent, false);
GUILayout.BeginHorizontal();
GUILayout.Space(10);
GUILayout.BeginVertical();
if (chain.isExpanded) {
var effectors = prop.FindPropertyRelative("effectors");
var effector = effectors.GetArrayElementAtIndex(0);
var spineMapping = prop.FindPropertyRelative("spineMapping");
var headMapping = prop.FindPropertyRelative("boneMappings").GetArrayElementAtIndex(0);
GUILayout.BeginVertical(style);
DrawLabel("Body Effector", startEffectorIcon);
AddProperty(effector.FindPropertyRelative("target"), new GUIContent("Target", "Target Transform (optional, you can also use bodyEffector.position and bodyEffector.rotation directly)."));
AddProperty(effector.FindPropertyRelative("positionWeight"), new GUIContent("Position Weight", "The weight of pinning the effector bone to the effector position."));
AddProperty(effector.FindPropertyRelative("effectChildNodes"), new GUIContent("Use Thighs", "If true, the effect of the body effector will be applied to also the thigh effectors (IKEffector.effectChildNodes)."));
DrawLabel("Chain", null);
// Spine stiffness
AddProperty(prop.FindPropertyRelative("spineStiffness"), new GUIContent("Spine Stiffness", "The bend resistance of the spine."));
// Pull Body
AddProperty(prop.FindPropertyRelative("pullBodyVertical"), new GUIContent("Pull Body Vertical", "Weight of hand effectors pulling the body vertically."));
AddProperty(prop.FindPropertyRelative("pullBodyHorizontal"), new GUIContent("Pull Body Horizontal", "Weight of hand effectors pulling the body horizontally."));
DrawLabel("Mapping", null);
AddProperty(spineMapping.FindPropertyRelative("iterations"), new GUIContent("Spine Iterations", "The number of FABRIK iterations for mapping the spine bones to the solver armature."));
AddProperty(spineMapping.FindPropertyRelative("twistWeight"), new GUIContent("Spine Twist Weight", "The weight of spine twist."));
AddProperty(headMapping.FindPropertyRelative("maintainRotationWeight"), new GUIContent("Maintain Head Rot", "The weight of maintaining the bone's animated rotation in world space."));
GUILayout.Space(5);
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
19
Source : IKSolverFullBodyBipedInspector.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
private static void AddLimb(SerializedProperty prop, SerializedProperty chain, FullBodyBipedChain chainType, GUIContent guiContent) {
EditorGUILayout.PropertyField(chain, guiContent, false);
GUILayout.BeginHorizontal();
GUILayout.Space(10);
GUILayout.BeginVertical();
if (chain.isExpanded) {
var effectors = prop.FindPropertyRelative("effectors");
var endEffector = effectors.GetArrayElementAtIndex(GetEndEffectorIndex(chainType));
var startEffector = effectors.GetArrayElementAtIndex(GetStartEffectorIndex(chainType));
var mapping = prop.FindPropertyRelative("limbMappings").GetArrayElementAtIndex(GetLimbMappingIndex(chainType));
GUILayout.BeginVertical(style);
DrawLabel(GetEndEffectorName(chainType), endEffectorIcon);
AddProperty(endEffector.FindPropertyRelative("target"), new GUIContent("Target", "Target Transform (optional, you can also use IKEffector.position and IKEffector.rotation directly)."));
AddProperty(endEffector.FindPropertyRelative("positionWeight"), new GUIContent("Position Weight", "The weight of pinning the effector bone to the effector position."));
AddProperty(endEffector.FindPropertyRelative("rotationWeight"), new GUIContent("Rotation Weight", "The weight of pinning the effector bone to the effector rotation."));
AddProperty(endEffector.FindPropertyRelative("maintainRelativePositionWeight"), new GUIContent("Maintain Relative Pos", "Maintains the position of the hand/foot fixed relative to the chest/hips while effector positionWeight is not weighed in."));
DrawLabel(GetStartEffectorName(chainType), startEffectorIcon);
AddProperty(startEffector.FindPropertyRelative("target"), new GUIContent("Target", "Target Transform (optional, you can also use IKEffector.position and IKEffector.rotation directly)."));
AddProperty(startEffector.FindPropertyRelative("positionWeight"), new GUIContent("Position Weight", "The weight of pinning the effector bone to the effector position."));
DrawLabel("Chain", null);
AddProperty(chain.FindPropertyRelative("pull"), new GUIContent("Pull", "The weight of pulling other chains."));
AddProperty(chain.FindPropertyRelative("reach"), new GUIContent("Reach", "Pulls the first node closer to the last node of the chain."));
AddProperty(chain.FindPropertyRelative("push"), new GUIContent("Push", "The weight of the end-effector pushing the first node."));
AddProperty(chain.FindPropertyRelative("pushParent"), new GUIContent("Push Parent", "The amount of push force transferred to the parent (from hand or foot to the body)."));
AddProperty(chain.FindPropertyRelative("reachSmoothing"), new GUIContent("Reach Smoothing", "Smoothing the effect of the Reach with the expense of some accuracy."));
AddProperty(chain.FindPropertyRelative("pushSmoothing"), new GUIContent("Push Smoothing", "Smoothing the effect of the Push."));
AddProperty(chain.FindPropertyRelative("bendConstraint").FindPropertyRelative("bendGoal"), new GUIContent("Bend Goal", "The Transform to bend towards (optional, you can also use ik.leftArmChain.bendConstraint.direction)."));
AddProperty(chain.FindPropertyRelative("bendConstraint").FindPropertyRelative("weight"), new GUIContent("Bend Goal Weight", "The weight of to bending towards the Bend Goal (optional, you can also use ik.leftArmChain.bendConstraint.weight)."));
DrawLabel("Mapping", null);
AddProperty(mapping.FindPropertyRelative("weight"), new GUIContent("Mapping Weight", "The weight of mapping the limb to it's IK pose. This can be useful if you want to disable the effect of IK for the limb."));
AddProperty(mapping.FindPropertyRelative("maintainRotationWeight"), new GUIContent(GetEndBoneMappingName(chainType), "The weight of maintaining the bone's animated rotation in world space."));
GUILayout.Space(5);
GUILayout.EndVertical();
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
19
Source : SteamVR_Skeleton_PoserEditor.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
void DrawBlendingBehaviourMenu()
{
if (handMaskTextures == null)
{
handMaskTextures = new Texture[] { (Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Palm.png"),
(Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Thumb.png"),
(Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Index.png"),
(Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Middle.png"),
(Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Ring.png"),
(Texture)EditorGUIUtility.Load("replacedets/SteamVR/Input/Editor/Resources/Icons/handmask_Pinky.png")
};
}
GUILayout.Space(10);
GUILayout.BeginVertical("box");
blendEditorExpanded.boolValue = IndentedFoldoutHeader(blendEditorExpanded.boolValue, "Blending Editor");
if (blendEditorExpanded.boolValue)
{
//show selectable menu of all poses, highlighting the one that is selected
EditorGUILayout.Space();
for (int i = 0; i < blendingBehaviourArray.arraySize; i++)
{
SerializedProperty blender = blendingBehaviourArray.GetArrayElementAtIndex(i);
SerializedProperty blenderName = blender.FindPropertyRelative("name");
SerializedProperty blenderEnabled = blender.FindPropertyRelative("enabled");
SerializedProperty blenderInfluence = blender.FindPropertyRelative("influence");
SerializedProperty blenderPose = blender.FindPropertyRelative("pose");
SerializedProperty blenderType = blender.FindPropertyRelative("type");
SerializedProperty blenderUseMask = blender.FindPropertyRelative("useMask");
SerializedProperty blenderValue = blender.FindPropertyRelative("value");
SerializedProperty blenderMask = blender.FindPropertyRelative("mask").FindPropertyRelative("values");
SerializedProperty blenderPreview = blender.FindPropertyRelative("previewEnabled");
GUILayout.Space(10);
float bright = blenderEnabled.boolValue ? 0.6f : 0.9f; // grey out box when disabled
if (EditorGUIUtility.isProSkin) bright = 1;
GUI.color = new Color(bright, bright, bright);
GUILayout.BeginVertical("box");
GUI.color = Color.white;
blenderPreview.boolValue = IndentedFoldoutHeader(blenderPreview.boolValue, blenderName.stringValue, 1);
//SerializedProperty blenderValue = blender.FindProperty("value");
EditorGUIUtility.labelWidth = 64;
EditorGUILayout.BeginHorizontal();
DrawBlenderLogo(blenderType);
EditorGUILayout.PropertyField(blenderEnabled);
GUILayout.FlexibleSpace();
EditorGUI.BeginDisabledGroup(i == 0);
if (GUILayout.Button("Move Up"))
{
blendingBehaviourArray.MoveArrayElement(i, i - 1);
}
EditorGUI.EndDisabledGroup();
EditorGUI.BeginDisabledGroup(i == blendingBehaviourArray.arraySize - 1);
if (GUILayout.Button("Move Down"))
{
blendingBehaviourArray.MoveArrayElement(i, i + 1);
}
EditorGUI.EndDisabledGroup();
GUILayout.Space(6);
GUI.color = new Color(0.9f, 0.8f, 0.78f);
if (GUILayout.Button("Delete"))
{
if (EditorUtility.DisplayDialog("", "Do you really want to delete this Blend Behaviour?", "Yes", "Cancel"))
{
blendingBehaviourArray.DeleteArrayElementAtIndex(i);
return;
}
}
GUI.color = Color.white;
EditorGUILayout.EndHorizontal();
if (blenderPreview.boolValue)
{
EditorGUILayout.PropertyField(blenderName);
EditorGUILayout.BeginHorizontal();
//EditorGUILayout.BeginVertical();
EditorGUILayout.BeginVertical();
EditorGUILayout.Slider(blenderInfluence, 0, 1);
blenderPose.intValue = EditorGUILayout.Popup("Pose", blenderPose.intValue, poser.poseNames);
GUILayout.Space(20);
EditorGUILayout.PropertyField(blenderType);
if (Application.isPlaying)
{
GUILayout.Space(10);
GUI.color = new Color(0, 0, 0, 0.3f);
EditorGUILayout.LabelField("", GUI.skin.box, GUILayout.Height(20), GUILayout.ExpandWidth(true));
GUI.color = Color.white;
Rect fillRect = GUILayoutUtility.GetLastRect();
EditorGUI.DrawRect(fillRectHorizontal(fillRect, blenderValue.floatValue), Color.green);
}
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical(GUILayout.MaxWidth(100));
EditorGUILayout.PropertyField(blenderUseMask);
if (blenderUseMask.boolValue)
{
DrawMaskEnabled(blenderMask);
}
else
{
DrawMaskDisabled(blenderMask);
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
DrawDivider();
EditorGUIUtility.labelWidth = 0;
if (blenderType.intValue == (int)SteamVR_Skeleton_Poser.PoseBlendingBehaviour.BlenderTypes.Manual)
{
EditorGUILayout.Slider(blenderValue, 0, 1);
}
if (blenderType.intValue == (int)SteamVR_Skeleton_Poser.PoseBlendingBehaviour.BlenderTypes.replacedogAction)
{
SerializedProperty blenderAction = blender.FindPropertyRelative("action_single");
SerializedProperty blenderSmooth = blender.FindPropertyRelative("smoothingSpeed");
EditorGUILayout.PropertyField(blenderAction);
EditorGUILayout.PropertyField(blenderSmooth);
}
if (blenderType.intValue == (int)SteamVR_Skeleton_Poser.PoseBlendingBehaviour.BlenderTypes.BooleanAction)
{
SerializedProperty blenderAction = blender.FindPropertyRelative("action_bool");
SerializedProperty blenderSmooth = blender.FindPropertyRelative("smoothingSpeed");
EditorGUILayout.PropertyField(blenderAction);
EditorGUILayout.PropertyField(blenderSmooth);
}
}
GUILayout.EndVertical();
}
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("+", GUILayout.MaxWidth(32)))
{
int i = blendingBehaviourArray.arraySize;
blendingBehaviourArray.InsertArrayElementAtIndex(i);
blendingBehaviourArray.GetArrayElementAtIndex(i).FindPropertyRelative("name").stringValue = "New Behaviour";
blendingBehaviourArray.GetArrayElementAtIndex(i).FindPropertyRelative("enabled").boolValue = true;
blendingBehaviourArray.GetArrayElementAtIndex(i).FindPropertyRelative("influence").floatValue = 1;
blendingBehaviourArray.GetArrayElementAtIndex(i).FindPropertyRelative("previewEnabled").boolValue = true;
serializedObject.ApplyModifiedProperties();
poser.blendingBehaviours[i].mask.Reset();
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
19
Source : SteamVR_Menu.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
void OnGUI()
{
if (overlay == null)
return;
var texture = overlay.texture as RenderTexture;
var prevActive = RenderTexture.active;
RenderTexture.active = texture;
if (Event.current.type == EventType.Repaint)
GL.Clear(false, true, Color.clear);
var area = new Rect(0, 0, texture.width, texture.height);
// Account for screen smaller than texture (since mouse position gets clamped)
if (Screen.width < texture.width)
{
area.width = Screen.width;
overlay.uvOffset.x = -(float)(texture.width - Screen.width) / (2 * texture.width);
}
if (Screen.height < texture.height)
{
area.height = Screen.height;
overlay.uvOffset.y = (float)(texture.height - Screen.height) / (2 * texture.height);
}
GUILayout.BeginArea(area);
if (background != null)
{
GUI.DrawTexture(new Rect(
(area.width - background.width) / 2,
(area.height - background.height) / 2,
background.width, background.height), background);
}
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
if (logo != null)
{
GUILayout.Space(area.height / 2 - logoHeight);
GUILayout.Box(logo);
}
GUILayout.Space(menuOffset);
bool bHideMenu = GUILayout.Button("[Esc] - Close menu");
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale: {0:N4}", scale));
{
var result = GUILayout.HorizontalSlider(scale, scaleLimits.x, scaleLimits.y);
if (result != scale)
{
SetScale(result);
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale limits:"));
{
var result = GUILayout.TextField(scaleLimitX);
if (result != scaleLimitX)
{
if (float.TryParse(result, out scaleLimits.x))
scaleLimitX = result;
}
}
{
var result = GUILayout.TextField(scaleLimitY);
if (result != scaleLimitY)
{
if (float.TryParse(result, out scaleLimits.y))
scaleLimitY = result;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label(string.Format("Scale rate:"));
{
var result = GUILayout.TextField(scaleRateText);
if (result != scaleRateText)
{
if (float.TryParse(result, out scaleRate))
scaleRateText = result;
}
}
GUILayout.EndHorizontal();
if (SteamVR.active)
{
var vr = SteamVR.instance;
GUILayout.BeginHorizontal();
{
var t = SteamVR_Camera.sceneResolutionScale;
int w = (int)(vr.sceneWidth * t);
int h = (int)(vr.sceneHeight * t);
int pct = (int)(100.0f * t);
GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", w, h, pct));
var result = Mathf.RoundToInt(GUILayout.HorizontalSlider(pct, 50, 200));
if (result != pct)
{
SteamVR_Camera.sceneResolutionScale = (float)result / 100.0f;
}
}
GUILayout.EndHorizontal();
}
var tracker = SteamVR_Render.Top();
if (tracker != null)
{
tracker.wireframe = GUILayout.Toggle(tracker.wireframe, "Wireframe");
if (SteamVR.settings.trackingSpace == ETrackingUniverseOrigin.TrackingUniverseSeated)
{
if (GUILayout.Button("Switch to Standing"))
SteamVR.settings.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseStanding;
if (GUILayout.Button("Center View"))
{
var chaperone = OpenVR.Chaperone;
if (chaperone != null)
chaperone.ResetZeroPose(SteamVR.settings.trackingSpace);
}
}
else
{
if (GUILayout.Button("Switch to Seated"))
SteamVR.settings.trackingSpace = ETrackingUniverseOrigin.TrackingUniverseSeated;
}
}
#if !UNITY_EDITOR
if (GUILayout.Button("Exit"))
Application.Quit();
#endif
GUILayout.Space(menuOffset);
var env = System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
if (env != null)
{
GUILayout.Label("VR_OVERRIDE=" + env);
}
GUILayout.Label("Graphics device: " + SystemInfo.graphicsDeviceVersion);
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndArea();
if (cursor != null)
{
float x = Input.mousePosition.x, y = Screen.height - Input.mousePosition.y;
float w = cursor.width, h = cursor.height;
GUI.DrawTexture(new Rect(x, y, w, h), cursor);
}
RenderTexture.active = prevActive;
if (bHideMenu)
HideMenu();
}
19
Source : About.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public void OnGUI()
{
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition );
GUILayout.BeginVertical();
GUILayout.Space( 10 );
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Box( m_aboutImage, GUIStyle.none );
if( Event.current.type == EventType.MouseUp &&
GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) )
{
Application.OpenURL( "http://www.amplify.pt" );
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUIStyle labelStyle = new GUIStyle( EditorStyles.label );
labelStyle.alignment = TextAnchor.MiddleCenter;
labelStyle.wordWrap = true;
GUILayout.Label( "\nAmplify Occlusion " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) );
GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) );
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
19
Source : ScriptableForgeEditor.cs
with MIT License
from ByronMayne
with MIT License
from ByronMayne
private void DrawWidgets()
{
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition);
{
GUILayout.BeginVertical((GUIStyle)"GameViewBackground");
{
DrawSpacer();
GUILayout.Space(5.0f);
for (int i = 0; i < m_Target.Widgets.Count; i++)
{
m_Target.Widgets[i].OnWidgetGUI(m_Styles);
DrawSpacer();
}
GUILayout.FlexibleSpace();
}
GUILayout.EndVertical();
}
GUILayout.EndScrollView();
}
19
Source : ScriptableForgeEditor.cs
with MIT License
from ByronMayne
with MIT License
from ByronMayne
private void DrawButtons()
{
GUILayout.BeginVertical((GUIStyle)"ProfilerTimelineLeftPane");
{
DrawSpacer();
if (GUILayout.Button(ScriptForgeLabels.generateAllForgesLabel, m_Styles.button))
{
for (int i = 0; i < m_Target.Widgets.Count; i++)
{
m_Target.Widgets[i].OnGenerate(false);
}
}
EditorGUILayout.BeginHorizontal();
{
DrawAddForgeButton();
if (GUILayout.Button(ScriptForgeLabels.openAllWidgetsLabel, m_Styles.buttonMiddle))
{
for (int i = 0; i < m_Target.Widgets.Count; i++)
{
m_Target.Widgets[i].isOpen = true;
}
}
if (GUILayout.Button(ScriptForgeLabels.closeAllWidgetsLabel, m_Styles.buttonRight))
{
for (int i = 0; i < m_Target.Widgets.Count; i++)
{
m_Target.Widgets[i].isOpen = false;
}
}
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(5.0f);
}
GUILayout.EndVertical();
}
19
Source : UI+Builders.cs
with MIT License
from cabarius
with MIT License
from cabarius
public static void TabBar(ref int selected, Action header = null, params NamedAction[] actions) {
if (selected >= actions.Count())
selected = 0;
var sel = selected;
var replacedles = actions.Select((a, i) => i == sel ? a.name.orange().bold() : a.name);
UI.SelectionGrid(ref selected, replacedles.ToArray(), 8, UI.Width(UI.ummWidth - 60));
GL.BeginVertical("box");
header?.Invoke();
actions[selected].action();
GL.EndVertical();
}
19
Source : GUISubScope.cs
with MIT License
from cabarius
with MIT License
from cabarius
public void Dispose() {
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
19
Source : DebugMenu.cs
with MIT License
from ccgould
with MIT License
from ccgould
private void ColorChangerMenu()
{
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();
GUILayout.Label("R");
_rTextBox = GUILayout.TextField(_rTextBox, GUILayout.Width(100));
rSliderValue = GUILayout.HorizontalSlider(rSliderValue, 0.0F, 1.0F);
_rTextBox = rSliderValue.ToString();
GUILayout.EndVertical();
GUILayout.BeginVertical();
GUILayout.Label("G");
_gTextBox = GUILayout.TextField(_gTextBox, GUILayout.Width(100));
gSliderValue = GUILayout.HorizontalSlider(gSliderValue, 0.0F, 1.0F);
_gTextBox = gSliderValue.ToString();
GUILayout.EndVertical();
GUILayout.BeginVertical();
GUILayout.Label("B");
_bTextBox = GUILayout.TextField(_bTextBox, GUILayout.Width(100));
bSliderValue = GUILayout.HorizontalSlider(bSliderValue, 0.0F, 1.0F);
_bTextBox = bSliderValue.ToString();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.BeginVertical("Box");
_selGridInt = GUILayout.SelectionGrid(_selGridInt, _selStrings, 1);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Get Demo Objects"))
{
GetFCSDemos();
}
if (GUILayout.Button("Change Color"))
{
ChangeSelectedColor();
}
GUILayout.EndHorizontal();
}
19
Source : DebugMenu.cs
with MIT License
from ccgould
with MIT License
from ccgould
private void OnGUI()
{
if (_isOpen == false)
{
return;
}
Rect windowRect = GUILayout.Window(2352, Size, (id) =>
{
GUILayout.Box("P to show/hide cursor");
GUILayout.BeginVertical();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
_normalSkinSize = GUI.skin.label.fontSize;
GUI.skin.label.fontSize = 15;
GUILayout.Label("FCSDemo Controller");
GUI.skin.label.fontSize = _normalSkinSize;
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.BeginHorizontal();
if (GUILayout.Button("Color Changer Menu"))
_showDebugMenuNo = 0;
GUILayout.EndHorizontal();
GUILayout.Space(20f);
if (_showDebugMenuNo == 0)
ColorChangerMenu();
else
GUILayout.Label("No Menu Selected");
GUILayout.EndVertical();
}, "FCSDemo Controller");
}
19
Source : Yodo1AdIntegrationManagerWindow.cs
with MIT License
from Crazy-Marvin
with MIT License
from Crazy-Marvin
private void OnGUI()
{
// OnGUI is called on each frame draw, so we don't want to do any unnecessary calculation if we can avoid it. So only calculate it when the width actually changed.
if (Math.Abs(previousWindowWidth - position.width) > 1)
{
previousWindowWidth = position.width;
CalculateFieldWidth();
}
using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPosition, false, false))
{
scrollPosition = scrollView.scrollPosition;
GUILayout.Space(5);
EditorGUILayout.LabelField("Conflict SDKs", replacedleLabelStyle);
if (Yodo1AdBuildCheck.HasConflict())
{
// Draw mediated networks
DrawMediatedNetworks();
// Draw doreplacedentation notes
EditorGUILayout.LabelField(new GUIContent(note), wrapTextLabelStyle);
if (GUILayout.Button(new GUIContent(doreplacedentationLink), linkLabelStyle))
{
Application.OpenURL(doreplacedentationLink);
}
}
else
{
GUIStyle gUIStyle2 = new GUIStyle();
gUIStyle2.padding = new RectOffset(0, 10, 10, 0);
GUILayout.BeginVertical(gUIStyle2, new GUILayoutOption[0]);
GUILayout.Label("There is no conflict with MAS SDK");
GUILayout.EndVertical();
}
}
}
19
Source : Yodo1AdWindows.cs
with MIT License
from Crazy-Marvin
with MIT License
from Crazy-Marvin
private void DrawContent()
{
GUIStyle gUIStyle = new GUIStyle
{
padding = new RectOffset(20, 10, 20, 0)
};
GUILayout.BeginVertical(gUIStyle, new GUILayoutOption[0]);
GUIStyle gUIStyle2 = new GUIStyle();
gUIStyle2.padding = new RectOffset(0, 10, 10, 0);
GUILayout.BeginVertical();
GUILayout.BeginHorizontal(gUIStyle2, new GUILayoutOption[0]);
//Set AppKey
GUILayout.Label("MAS App Key", GUILayout.Width(120));
if (selectPlarformTab == PlatfromTab.iOS)
{
this.App_iOSKey = GUILayout.TextField(this.App_iOSKey.Trim());
if (!string.IsNullOrEmpty(this.App_iOSKey))
{
if (!IsIOSRunTime && string.IsNullOrEmpty(this.adSettings.iOSSettings.AdmobAppID.Trim()))
{
resultString = RequestAdmobConfig(this.App_iOSKey);
IsIOSRunTime = true;
}
}
}
else
{
this.App_AndroidKey = GUILayout.TextField(this.App_AndroidKey.Trim());
if (!string.IsNullOrEmpty(this.App_AndroidKey))
{
if (!IsAndroidRunTime && string.IsNullOrEmpty(this.adSettings.androidSettings.AdmobAppID.Trim()))
{
resultString = RequestAdmobConfig(this.adSettings.androidSettings.AppKey);
IsAndroidRunTime = true;
}
}
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
if (selectPlarformTab == PlatfromTab.iOS)
{
if (string.IsNullOrEmpty(this.adSettings.iOSSettings.AppKey.Trim()))
{
EditorGUILayout.HelpBox("Please fill in the MAS app key correctly, you can find your app key on the MAS dashboard.", MessageType.Error);
GUILayout.Space(15);
}
}
else
{
if (string.IsNullOrEmpty(this.adSettings.androidSettings.AppKey.Trim()))
{
EditorGUILayout.HelpBox("Please fill in the MAS app key correctly, you can find your app key on the MAS dashboard.", MessageType.Error);
GUILayout.Space(15);
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(gUIStyle2, new GUILayoutOption[0]);
GUILayout.Label("Select the MAS SDK to be integrated:");
string imagePath = Application.dataPath + "/Yodo1/MAS/Editor/refresh.png";
FileStream fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
byte[] thebytes = new byte[fs.Length];
fs.Read(thebytes, 0, (int)fs.Length);
fs.Close();
fs.Dispose();
Texture2D image = new Texture2D(30, 30);
image.LoadImage(thebytes);
GUILayout.BeginHorizontal(gUIStyle2, new GUILayoutOption[0]);
//Set AdMob App ID
GUILayout.Label("AdMob App ID", GUILayout.Width(120));
if (selectPlarformTab == PlatfromTab.iOS)
{
this.adSettings.iOSSettings.AdmobAppID = GUILayout.TextField(this.adSettings.iOSSettings.AdmobAppID);
GUILayout.Space(20);
if (GUILayout.Button("Refresh", GUILayout.Width(60)))
{
resultString = RequestAdmobConfig(this.adSettings.iOSSettings.AppKey);
this.SaveConfig();
}
}
else
{
this.adSettings.androidSettings.AdmobAppID = GUILayout.TextField(this.adSettings.androidSettings.AdmobAppID);
GUILayout.Space(20);
if (GUILayout.Button("Refresh", GUILayout.Width(60)))
{
resultString = RequestAdmobConfig(this.adSettings.androidSettings.AppKey);
this.SaveConfig();
}
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
if (selectPlarformTab == PlatfromTab.iOS)
{
if (string.IsNullOrEmpty(this.adSettings.iOSSettings.AdmobAppID.Trim()))
{
if (string.IsNullOrEmpty(resultString))
{
EditorGUILayout.HelpBox("A null or incorrect value will cause a crash when it builds. Please make sure to copy Admob App ID from MAS dashboard.", MessageType.Info);
}
else
{
EditorGUILayout.HelpBox(resultString, MessageType.Error);
}
}
}
else
{
if (string.IsNullOrEmpty(this.adSettings.androidSettings.AdmobAppID.Trim()))
{
if (string.IsNullOrEmpty(resultString))
{
EditorGUILayout.HelpBox("A null or incorrect value will cause a crash when it builds. Please make sure to copy Admob App ID from MAS dashboard.", MessageType.Info);
}
else
{
EditorGUILayout.HelpBox(resultString, MessageType.Error);
}
}
}
GUILayout.EndVertical();
GUILayout.EndVertical();
}
19
Source : Yodo1AdWindows.cs
with MIT License
from Crazy-Marvin
with MIT License
from Crazy-Marvin
private void OnGUI()
{
this.scrollPosition = GUILayout.BeginScrollView(this.scrollPosition, new GUILayoutOption[0]);
DrawContent();
GUIStyle gUIStyle = new GUIStyle();
gUIStyle.padding = new RectOffset(10, 10, 10, 0);
GUILayout.BeginVertical(gUIStyle, new GUILayoutOption[0]);
if (GUILayout.Button("Save Configuration"))
{
this.SaveConfig();
}
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
19
Source : SoftMaskableEditor.cs
with GNU General Public License v3.0
from Cytoid
with GNU General Public License v3.0
from Cytoid
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
serializedObject.Update();
DrawMaskInteractions();
// maskInteraction = (MaskInteraction)EditorGUILayout.EnumPopup("Mask Interaction", maskInteraction);
serializedObject.ApplyModifiedProperties();
/*
EditorGUI.indentLevel++;
var l = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 60;
using (new EditorGUILayout.HorizontalScope())
{
EditorGUILayout.ObjectField("Mask 0", null, typeof(Mask), false);
EditorGUILayout.EnumPopup (MaskIntr.None);
}
EditorGUIUtility.labelWidth = l;
EditorGUI.indentLevel--;
var spMaskInteraction = serializedObject.FindProperty ("m_MaskInteraction");
MaskIntr intr0 = (MaskIntr)((spMaskInteraction.intValue >> 0) & 0x3);
MaskIntr intr1 = (MaskIntr)((spMaskInteraction.intValue >> 2) & 0x3);
MaskIntr intr2 = (MaskIntr)((spMaskInteraction.intValue >> 4) & 0x3);
MaskIntr intr3 = (MaskIntr)((spMaskInteraction.intValue >> 6) & 0x3);
using (var ccs = new EditorGUI.ChangeCheckScope ()) {
intr0 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 0", intr0);
intr1 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 1", intr1);
intr2 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 2", intr2);
intr3 = (MaskIntr)EditorGUILayout.EnumPopup ("Layer 3", intr3);
if (ccs.changed) {
current.SetMaskInteractions (intr0,intr1,intr2,intr3);
}
}
*/
// spMaskInteraction.intValue = (intr0 << 0) | (intr1 << 2) | (intr2 << 4) | (intr3 << 6);
//
// serializedObject.ApplyModifiedProperties ();
var current = target as SoftMaskable;
current.GetComponentsInChildren<Graphic> (true, s_Graphics);
var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent<SoftMaskable> () && (!x.GetComponent<Mask> () || x.GetComponent<Mask> ().showMaskGraphic)).ToList ();
if (0 < fixTargets.Count)
{
GUILayout.BeginHorizontal ();
EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
GUILayout.BeginVertical ();
if (GUILayout.Button ("Fix"))
{
foreach (var p in fixTargets)
{
p.gameObject.AddComponent<SoftMaskable> ();
}
}
if (GUILayout.Button ("Ping"))
{
EditorGUIUtility.PingObject (fixTargets [0]);
}
GUILayout.EndVertical ();
GUILayout.EndHorizontal ();
}
if(s_TypeTMPro != null)
{
ShowTMProWarning (_shader, _mobileShader, _spriteShader, m => { });
var textMeshPro = current.GetComponent (s_TypeTMPro);
if (textMeshPro != null)
{
Material [] fontSharedMaterials = s_PiFontSharedMaterials.GetValue (textMeshPro, new object [0]) as Material [];
ShowMaterialEditors (fontSharedMaterials, 1, fontSharedMaterials.Length - 1);
}
}
if (!DetectMask (current.transform.parent))
{
GUILayout.BeginHorizontal ();
EditorGUILayout.HelpBox ("This is unnecessary SoftMaskable.\nCan't find any SoftMask components above.", MessageType.Warning);
if (GUILayout.Button ("Remove", GUILayout.Height (40)))
{
DestroyImmediate (current);
Utils.MarkPrefabDirty ();
}
GUILayout.EndHorizontal ();
}
}
19
Source : AssetBundleBuildTab.cs
with GNU General Public License v3.0
from Cytoid
with GNU General Public License v3.0
from Cytoid
internal void OnGUI()
{
m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
bool newState = false;
var centeredStyle = new GUIStyle(GUI.skin.GetStyle("Label"));
centeredStyle.alignment = TextAnchor.UpperCenter;
GUILayout.Label(new GUIContent("Example build setup"), centeredStyle);
//basic options
EditorGUILayout.Space();
GUILayout.BeginVertical();
// build target
using (new EditorGUI.DisabledScope (!replacedetBundleModel.Model.DataSource.CanSpecifyBuildTarget)) {
ValidBuildTarget tgt = (ValidBuildTarget)EditorGUILayout.EnumPopup(m_TargetContent, m_UserData.m_BuildTarget);
if (tgt != m_UserData.m_BuildTarget)
{
m_UserData.m_BuildTarget = tgt;
if(m_UserData.m_UseDefaultPath)
{
m_UserData.m_OutputPath = "replacedetBundles/";
m_UserData.m_OutputPath += m_UserData.m_BuildTarget.ToString();
//EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "replacedetBundleOutputPath", m_OutputPath);
}
}
}
////output path
using (new EditorGUI.DisabledScope (!replacedetBundleModel.Model.DataSource.CanSpecifyBuildOutputDirectory)) {
EditorGUILayout.Space();
GUILayout.BeginHorizontal();
var newPath = EditorGUILayout.TextField("Output Path", m_UserData.m_OutputPath);
if (!System.String.IsNullOrEmpty(newPath) && newPath != m_UserData.m_OutputPath)
{
m_UserData.m_UseDefaultPath = false;
m_UserData.m_OutputPath = newPath;
//EditorUserBuildSettings.SetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "replacedetBundleOutputPath", m_OutputPath);
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Browse", GUILayout.MaxWidth(75f)))
BrowseForFolder();
if (GUILayout.Button("Reset", GUILayout.MaxWidth(75f)))
ResetPathToDefault();
//if (string.IsNullOrEmpty(m_OutputPath))
// m_OutputPath = EditorUserBuildSettings.GetPlatformSettings(EditorUserBuildSettings.activeBuildTarget.ToString(), "replacedetBundleOutputPath");
GUILayout.EndHorizontal();
EditorGUILayout.Space();
newState = GUILayout.Toggle(
m_ForceRebuild.state,
m_ForceRebuild.content);
if (newState != m_ForceRebuild.state)
{
if (newState)
m_UserData.m_OnToggles.Add(m_ForceRebuild.content.text);
else
m_UserData.m_OnToggles.Remove(m_ForceRebuild.content.text);
m_ForceRebuild.state = newState;
}
newState = GUILayout.Toggle(
m_CopyToStreaming.state,
m_CopyToStreaming.content);
if (newState != m_CopyToStreaming.state)
{
if (newState)
m_UserData.m_OnToggles.Add(m_CopyToStreaming.content.text);
else
m_UserData.m_OnToggles.Remove(m_CopyToStreaming.content.text);
m_CopyToStreaming.state = newState;
}
}
// advanced options
using (new EditorGUI.DisabledScope (!replacedetBundleModel.Model.DataSource.CanSpecifyBuildOptions)) {
EditorGUILayout.Space();
m_AdvancedSettings = EditorGUILayout.Foldout(m_AdvancedSettings, "Advanced Settings");
if(m_AdvancedSettings)
{
var indent = EditorGUI.indentLevel;
EditorGUI.indentLevel = 1;
CompressOptions cmp = (CompressOptions)EditorGUILayout.IntPopup(
m_CompressionContent,
(int)m_UserData.m_Compression,
m_CompressionOptions,
m_CompressionValues);
if (cmp != m_UserData.m_Compression)
{
m_UserData.m_Compression = cmp;
}
foreach (var tog in m_ToggleData)
{
newState = EditorGUILayout.ToggleLeft(
tog.content,
tog.state);
if (newState != tog.state)
{
if (newState)
m_UserData.m_OnToggles.Add(tog.content.text);
else
m_UserData.m_OnToggles.Remove(tog.content.text);
tog.state = newState;
}
}
EditorGUILayout.Space();
EditorGUI.indentLevel = indent;
}
}
// build.
EditorGUILayout.Space();
if (GUILayout.Button("Build") )
{
EditorApplication.delayCall += ExecuteBuild;
}
GUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}
19
Source : SoftMaskEditor.cs
with GNU General Public License v3.0
from Cytoid
with GNU General Public License v3.0
from Cytoid
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
var current = target as SoftMask;
current.GetComponentsInChildren<Graphic> (true, s_Graphics);
var fixTargets = s_Graphics.Where (x => x.gameObject != current.gameObject && !x.GetComponent<SoftMaskable> () && (!x.GetComponent<Mask> () || x.GetComponent<Mask> ().showMaskGraphic)).ToList ();
if (0 < fixTargets.Count)
{
GUILayout.BeginHorizontal ();
EditorGUILayout.HelpBox ("There are child Graphics that does not have a SoftMaskable component.\nAdd SoftMaskable component to them.", MessageType.Warning);
GUILayout.BeginVertical ();
if (GUILayout.Button ("Fix"))
{
foreach (var p in fixTargets)
{
p.gameObject.AddComponent<SoftMaskable> ();
}
Utils.MarkPrefabDirty ();
}
if (GUILayout.Button ("Ping"))
{
EditorGUIUtility.PingObject (fixTargets[0]);
}
GUILayout.EndVertical ();
GUILayout.EndHorizontal ();
}
// Preview buffer.
GUILayout.BeginHorizontal (EditorStyles.helpBox);
if (s_Preview != (s_Preview = EditorGUILayout.ToggleLeft ("Preview Buffer", s_Preview, GUILayout.MaxWidth (EditorGUIUtility.labelWidth))))
{
EditorPrefs.SetBool (k_PrefsPreview, s_Preview);
}
if (s_Preview)
{
var tex = current.softMaskBuffer;
var width = tex.width * 64 / tex.height;
EditorGUI.DrawPreviewTexture (GUILayoutUtility.GetRect (width, 64), tex, null, ScaleMode.ScaleToFit);
Repaint ();
}
GUILayout.FlexibleSpace ();
GUILayout.EndHorizontal ();
}
19
Source : ActionsAndVariablesWindow.cs
with GNU General Public License v3.0
from Cytoid
with GNU General Public License v3.0
from Cytoid
void OnRegistryGUI(CRegistry registry)
{
GUILayout.BeginVertical();
{
GUILayout.BeginHorizontal();
{
var oldFilterText = m_filterText;
m_filterText = GUILayout.TextField(m_filterText, filterTextStyle);
if (GUILayout.Button(GUIContent.none, filterButtonStyle))
{
m_filterText = "";
}
if (oldFilterText != m_filterText)
{
EditorPrefs.SetString(PrefsKeyFilterText, m_filterText);
}
}
GUILayout.EndHorizontal();
m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition);
{
var filterText = m_filterText.ToLower();
GUILayout.Label("Actions", headerLabelStyle);
foreach (var action in registry.actions)
{
if (m_filterText.Length == 0 || action.Name.ToLower().Contains(filterText))
{
OnActionGUI(action);
}
}
GUILayout.Label("Variables", headerLabelStyle);
foreach (var cvar in registry.cvars)
{
if (m_filterText.Length == 0 || cvar.Name.ToLower().Contains(filterText))
{
OnVariableGUI(cvar);
}
}
}
GUILayout.EndScrollView();
}
GUILayout.EndVertical();
}
See More Examples