Here are the examples of the csharp api UnityEngine.GUILayout.EndScrollView() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
192 Examples
19
Source : MemoryProfilerWindow.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI(){
var svrGo = GameObject.FindObjectOfType<LuaSvrGameObject>();
if(svrGo == null){
GUILayout.Label("There is no LuaSvrGameObject in you scene. Run your game first");
return;
}
if(GUILayout.Button("Capture")){
System.GC.Collect ();
LuaDLL.lua_gc(svrGo.state.L, LuaGCOptions.LUA_GCCOLLECT, 0);
_destroyedObjectNames = ObjectCache.GetAlreadyDestroyedObjectNames();
_allObjectNames = ObjectCache.GetAllManagedObjectNames();
cachedDelegateCount = LuaState.main.cachedDelegateCount;
}
GUILayout.Label ("LuaDelegate count:" + cachedDelegateCount);
_showDestroyedObject = EditorGUILayout.Foldout(_showDestroyedObject,"Already Destroyed Unity Object:"+_destroyedObjectNames.Count);
if(_showDestroyedObject){
_scrollPos = GUILayout.BeginScrollView(_scrollPos);
foreach(var name in _destroyedObjectNames){
GUILayout.Label(name);
}
GUILayout.EndScrollView();
}
_showAllObject = EditorGUILayout.Foldout(_showAllObject,"All Managed C# Object:"+_allObjectNames.Count);
if(_showAllObject){
_scrollPos2 = GUILayout.BeginScrollView(_scrollPos2);
foreach(var name in _allObjectNames){
GUILayout.Label(name);
}
GUILayout.EndScrollView();
}
}
19
Source : LuaConsole.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI()
{
if (!initedStyle)
{
GUIStyle entryInfoTyle = "CN EntryInfo";
textAreaStyle.richText = true;
textAreaStyle.normal.textColor = entryInfoTyle.normal.textColor;
initedStyle = true;
}
string[] statehints = new string[LuaState.statemap.Count];
LuaState[] states = new LuaState[LuaState.statemap.Count];
int n = 0;
foreach(var k in LuaState.statemap.Values) {
states[n] = k;
statehints[n++] = k.Name;
}
stateIndex = EditorGUILayout.Popup(stateIndex,statehints);
LuaState l = null;
if (stateIndex >= 0 && stateIndex <states.Length)
l = states[stateIndex];
if (current != null && current != l)
{
current.logDelegate -= AddLog;
current.errorDelegate -= AddError;
}
if(current!=l && l!=null) {
l.logDelegate += AddLog;
l.errorDelegate += AddError;
current = l;
}
//Output Text Area
scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width), GUILayout.ExpandHeight(true));
EditorGUILayout.TextArea(outputText, textAreaStyle, GUILayout.ExpandHeight(true));
GUILayout.EndScrollView();
//Filter Option Toggles
GUILayout.BeginHorizontal();
bool oldToggleLog = toggleLog;
bool oldToggleErr = toggleErr;
toggleLog = GUILayout.Toggle(oldToggleLog, "log", GUILayout.ExpandWidth(false));
toggleErr = GUILayout.Toggle(oldToggleErr, "error", GUILayout.ExpandWidth(false));
//Filter Input Field
GUILayout.Space(10f);
GUILayout.Label("filter:", GUILayout.ExpandWidth(false));
string oldFilterPattern = filterText;
filterText = GUILayout.TextField(oldFilterPattern, GUILayout.Width(200f));
//Menu Buttons
if (GUILayout.Button("clear", GUILayout.ExpandWidth(false)))
{
recordList.Clear();
ConsoleFlush();
}
GUILayout.EndHorizontal();
if (toggleLog != oldToggleLog || toggleErr != oldToggleErr || filterText != oldFilterPattern)
{
ConsoleFlush();
}
if (Event.current.type == EventType.Repaint)
{
inputAreaPosY = GUILayoutUtility.GetLastRect().yMax;
}
//Drag Spliter
ResizeScrollView();
//Input Area
GUI.SetNextControlName("Input");
inputText = EditorGUILayout.TextField(inputText, GUILayout.Height(inputAreaHeight));
if (Event.current.isKey && Event.current.type == EventType.KeyUp)
{
bool refresh = false;
if (Event.current.keyCode == KeyCode.Return)
{
if (inputText != "")
{
if (history.Count == 0 || history[history.Count - 1] != inputText)
{
history.Add(inputText);
}
AddLog(inputText);
DoCommand(inputText);
inputText = "";
refresh = true;
historyIndex = history.Count;
}
}
else if (Event.current.keyCode == KeyCode.UpArrow)
{
if (history.Count > 0)
{
historyIndex = historyIndex - 1;
if (historyIndex < 0)
{
historyIndex = 0;
}
else
{
inputText = history[historyIndex];
refresh = true;
}
}
}
else if (Event.current.keyCode == KeyCode.DownArrow)
{
if (history.Count > 0)
{
historyIndex = historyIndex + 1;
if (historyIndex > history.Count - 1)
{
historyIndex = history.Count - 1;
}
else
{
inputText = history[historyIndex];
refresh = true;
}
}
}
if (refresh)
{
Repaint();
EditorGUIUtility.editingTextField = false;
GUI.FocusControl("Input");
}
}
}
19
Source : SpriteSelector.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI ()
{
EditorGUIUtility.LookLikeControls(80f);
if (mAtlas == null)
{
GUILayout.Label("No Atlas selected.", "LODLevelNotifyText");
}
else
{
bool close = false;
GUILayout.Label(mAtlas.name + " Sprites", "LODLevelNotifyText");
NGUIEditorTools.DrawSeparator();
GUILayout.BeginHorizontal();
GUILayout.Space(84f);
string before = NGUISettings.partialSprite;
string after = EditorGUILayout.TextField("", before, "SearchTextField");
NGUISettings.partialSprite = after;
if (GUILayout.Button("", "SearchCancelButton", GUILayout.Width(18f)))
{
NGUISettings.partialSprite = "";
GUIUtility.keyboardControl = 0;
}
GUILayout.Space(84f);
GUILayout.EndHorizontal();
Texture2D tex = mAtlas.texture as Texture2D;
if (tex == null)
{
GUILayout.Label("The atlas doesn't have a texture to work with");
return;
}
BetterList<string> sprites = mAtlas.GetListOfSprites(NGUISettings.partialSprite);
float size = 80f;
float padded = size + 10f;
int columns = Mathf.FloorToInt(Screen.width / padded);
if (columns < 1) columns = 1;
int offset = 0;
Rect rect = new Rect(10f, 0, size, size);
GUILayout.Space(10f);
mPos = GUILayout.BeginScrollView(mPos);
while (offset < sprites.size)
{
GUILayout.BeginHorizontal();
{
int col = 0;
rect.x = 10f;
for (; offset < sprites.size; ++offset)
{
UIAtlas.Sprite sprite = mAtlas.GetSprite(sprites[offset]);
if (sprite == null) continue;
// Button comes first
if (GUI.Button(rect, ""))
{
float delta = Time.realtimeSinceStartup - mClickTime;
mClickTime = Time.realtimeSinceStartup;
if (spriteName != sprite.name)
{
if (mSprite != null)
{
NGUIEditorTools.RegisterUndo("Atlas Selection", mSprite);
mSprite.spriteName = sprite.name;
mSprite.MakePixelPerfect();
EditorUtility.SetDirty(mSprite.gameObject);
}
else if (mCallback != null)
{
mName = sprite.name;
mCallback(sprite.name);
}
}
else if (delta < 0.5f) close = true;
}
if (Event.current.type == EventType.Repaint)
{
// On top of the button we have a checkboard grid
NGUIEditorTools.DrawTiledTexture(rect, NGUIEditorTools.backdropTexture);
Rect uv = sprite.outer;
if (mAtlas.coordinates == UIAtlas.Coordinates.Pixels)
uv = NGUIMath.ConvertToTexCoords(uv, tex.width, tex.height);
// Calculate the texture's scale that's needed to display the sprite in the clipped area
float scaleX = rect.width / uv.width;
float scaleY = rect.height / uv.height;
// Stretch the sprite so that it will appear proper
float aspect = (scaleY / scaleX) / ((float)tex.height / tex.width);
Rect clipRect = rect;
if (aspect != 1f)
{
if (aspect < 1f)
{
// The sprite is taller than it is wider
float padding = size * (1f - aspect) * 0.5f;
clipRect.xMin += padding;
clipRect.xMax -= padding;
}
else
{
// The sprite is wider than it is taller
float padding = size * (1f - 1f / aspect) * 0.5f;
clipRect.yMin += padding;
clipRect.yMax -= padding;
}
}
GUI.DrawTextureWithTexCoords(clipRect, tex, uv);
// Draw the selection
if (spriteName == sprite.name)
{
NGUIEditorTools.DrawOutline(rect, new Color(0.4f, 1f, 0f, 1f));
}
}
if (++col >= columns)
{
++offset;
break;
}
rect.x += padded;
}
}
GUILayout.EndHorizontal();
GUILayout.Space(padded);
rect.y += padded;
}
GUILayout.EndScrollView();
if (close) Close();
}
}
19
Source : UICameraTool.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI ()
{
EditorGUIUtility.LookLikeControls(80f);
List<Camera> list = NGUIEditorTools.FindInScene<Camera>();
if (list.Count > 0)
{
DrawRow(null);
NGUIEditorTools.DrawSeparator();
mScroll = GUILayout.BeginScrollView(mScroll);
foreach (Camera cam in list) DrawRow(cam);
GUILayout.EndScrollView();
}
else
{
GUILayout.Label("No cameras found in the scene");
}
}
19
Source : UIAtlasMaker.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI ()
{
bool create = false;
bool update = false;
bool replace = false;
string prefabPath = "";
string matPath = "";
// If we have an atlas to work with, see if we can figure out the path for it and its material
if (NGUISettings.atlas != null && NGUISettings.atlas.name == NGUISettings.atlasName)
{
prefabPath = replacedetDatabase.GetreplacedetPath(NGUISettings.atlas.gameObject.GetInstanceID());
if (NGUISettings.atlas.spriteMaterial != null) matPath = replacedetDatabase.GetreplacedetPath(NGUISettings.atlas.spriteMaterial.GetInstanceID());
}
// replacedume default values if needed
if (string.IsNullOrEmpty(NGUISettings.atlasName)) NGUISettings.atlasName = "New Atlas";
if (string.IsNullOrEmpty(prefabPath)) prefabPath = NGUIEditorTools.GetSelectionFolder() + NGUISettings.atlasName + ".prefab";
if (string.IsNullOrEmpty(matPath)) matPath = NGUIEditorTools.GetSelectionFolder() + NGUISettings.atlasName + ".mat";
// Try to load the prefab
GameObject go = replacedetDatabase.LoadreplacedetAtPath(prefabPath, typeof(GameObject)) as GameObject;
if (NGUISettings.atlas == null && go != null) NGUISettings.atlas = go.GetComponent<UIAtlas>();
EditorGUIUtility.LookLikeControls(80f);
GUILayout.Space(6f);
GUILayout.BeginHorizontal();
if (go == null)
{
GUI.backgroundColor = Color.green;
create = GUILayout.Button("Create", GUILayout.Width(76f));
}
else
{
GUI.backgroundColor = Color.red;
create = GUILayout.Button("Replace", GUILayout.Width(76f));
}
GUI.backgroundColor = Color.white;
NGUISettings.atlasName = GUILayout.TextField(NGUISettings.atlasName);
GUILayout.EndHorizontal();
if (create)
{
// If the prefab already exists, confirm that we want to overwrite it
if (go == null || EditorUtility.DisplayDialog("Are you sure?", "Are you sure you want to replace the contents of the " +
NGUISettings.atlasName + " atlas with the textures currently selected in the Project View? All other sprites will be deleted.", "Yes", "No"))
{
replace = true;
// Try to load the material
Material mat = replacedetDatabase.LoadreplacedetAtPath(matPath, typeof(Material)) as Material;
// If the material doesn't exist, create it
if (mat == null)
{
Shader shader = Shader.Find("Unlit/Transparent Colored");
mat = new Material(shader);
// Save the material
replacedetDatabase.Createreplacedet(mat, matPath);
replacedetDatabase.Refresh();
// Load the material so it's usable
mat = replacedetDatabase.LoadreplacedetAtPath(matPath, typeof(Material)) as Material;
}
if (NGUISettings.atlas == null || NGUISettings.atlas.name != NGUISettings.atlasName)
{
// Create a new prefab for the atlas
#if UNITY_3_4
Object prefab = (go != null) ? go : EditorUtility.CreateEmptyPrefab(prefabPath);
#else
Object prefab = (go != null) ? go : PrefabUtility.CreateEmptyPrefab(prefabPath);
#endif
// Create a new game object for the atlas
go = new GameObject(NGUISettings.atlasName);
go.AddComponent<UIAtlas>().spriteMaterial = mat;
// Update the prefab
#if UNITY_3_4
EditorUtility.ReplacePrefab(go, prefab);
#else
PrefabUtility.ReplacePrefab(go, prefab);
#endif
DestroyImmediate(go);
replacedetDatabase.Savereplacedets();
replacedetDatabase.Refresh();
// Select the atlas
go = replacedetDatabase.LoadreplacedetAtPath(prefabPath, typeof(GameObject)) as GameObject;
NGUISettings.atlas = go.GetComponent<UIAtlas>();
}
}
}
ComponentSelector.Draw<UIAtlas>("Select", NGUISettings.atlas, OnSelectAtlas);
List<Texture> textures = GetSelectedTextures();
if (NGUISettings.atlas != null && NGUISettings.atlas.name == NGUISettings.atlasName)
{
Material mat = NGUISettings.atlas.spriteMaterial;
Texture tex = NGUISettings.atlas.texture;
// Material information
GUILayout.BeginHorizontal();
{
if (mat != null)
{
if (GUILayout.Button("Material", GUILayout.Width(76f))) Selection.activeObject = mat;
GUILayout.Label(" " + mat.name);
}
else
{
GUI.color = Color.grey;
GUILayout.Button("Material", GUILayout.Width(76f));
GUI.color = Color.white;
GUILayout.Label(" N/A");
}
}
GUILayout.EndHorizontal();
// Texture atlas information
GUILayout.BeginHorizontal();
{
if (tex != null)
{
if (GUILayout.Button("Texture", GUILayout.Width(76f))) Selection.activeObject = tex;
GUILayout.Label(" " + tex.width + "x" + tex.height);
}
else
{
GUI.color = Color.grey;
GUILayout.Button("Texture", GUILayout.Width(76f));
GUI.color = Color.white;
GUILayout.Label(" N/A");
}
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
NGUISettings.atlasPadding = Mathf.Clamp(EditorGUILayout.IntField("Padding", NGUISettings.atlasPadding, GUILayout.Width(100f)), 0, 8);
GUILayout.Label((NGUISettings.atlasPadding == 1 ? "pixel" : "pixels") + " in-between of sprites");
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
NGUISettings.atlasTrimming = EditorGUILayout.Toggle("Trim Alpha", NGUISettings.atlasTrimming, GUILayout.Width(100f));
GUILayout.Label("Remove empty space");
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
NGUISettings.unityPacking = EditorGUILayout.Toggle("Unity Packer", NGUISettings.unityPacking, GUILayout.Width(100f));
GUILayout.Label("if off, use a custom packer");
GUILayout.EndHorizontal();
if (!NGUISettings.unityPacking)
{
GUILayout.BeginHorizontal();
NGUISettings.forceSquareAtlas = EditorGUILayout.Toggle("Force Square", NGUISettings.forceSquareAtlas, GUILayout.Width(100f));
GUILayout.Label("if on, forces a square atlas texture");
GUILayout.EndHorizontal();
}
#if UNITY_IPHONE || UNITY_ANDROID
GUILayout.BeginHorizontal();
NGUISettings.allow4096 = EditorGUILayout.Toggle("4096x4096", NGUISettings.allow4096, GUILayout.Width(100f));
GUILayout.Label("if off, limit atlases to 2048x2048");
GUILayout.EndHorizontal();
#endif
if (textures.Count > 0)
{
GUI.backgroundColor = Color.green;
update = GUILayout.Button("Add/Update All");
GUI.backgroundColor = Color.white;
}
else
{
NGUIEditorTools.DrawSeparator();
GUILayout.Label("You can reveal more options by selecting\none or more textures in the Project View\nwindow.");
}
}
else
{
NGUIEditorTools.DrawSeparator();
GUILayout.Label("You can create a new atlas by selecting\none or more textures in the Project View\nwindow, then clicking \"Create\".");
}
Dictionary<string, int> spriteList = GetSpriteList(textures);
if (spriteList.Count > 0)
{
NGUIEditorTools.DrawHeader("Sprites");
GUILayout.Space(-7f);
mScroll = GUILayout.BeginScrollView(mScroll);
bool delete = false;
int index = 0;
foreach (KeyValuePair<string, int> iter in spriteList)
{
++index;
NGUIEditorTools.HighlightLine(new Color(0.6f, 0.6f, 0.6f));
GUILayout.BeginHorizontal();
GUILayout.Label(index.ToString(), GUILayout.Width(24f));
GUILayout.Label(iter.Key);
if (iter.Value == 2)
{
GUI.color = Color.green;
GUILayout.Label("Add", GUILayout.Width(27f));
GUI.color = Color.white;
}
else if (iter.Value == 1)
{
GUI.color = Color.cyan;
GUILayout.Label("Update", GUILayout.Width(45f));
GUI.color = Color.white;
}
else
{
if (mDelNames.Contains(iter.Key))
{
GUI.backgroundColor = Color.red;
if (GUILayout.Button("Delete", GUILayout.Width(60f)))
{
delete = true;
}
GUI.backgroundColor = Color.green;
if (GUILayout.Button("X", GUILayout.Width(22f)))
{
mDelNames.Remove(iter.Key);
delete = false;
}
GUI.backgroundColor = Color.white;
}
else
{
// If we have not yet selected a sprite for deletion, show a small "X" button
if (GUILayout.Button("X", GUILayout.Width(22f))) mDelNames.Add(iter.Key);
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
// If this sprite was marked for deletion, remove it from the atlas
if (delete)
{
List<SpriteEntry> sprites = new List<SpriteEntry>();
ExtractSprites(NGUISettings.atlas, sprites);
for (int i = sprites.Count; i > 0; )
{
SpriteEntry ent = sprites[--i];
if (mDelNames.Contains(ent.tex.name))
{
sprites.RemoveAt(i);
}
}
UpdateAtlas(NGUISettings.atlas, sprites);
mDelNames.Clear();
}
else if (update) UpdateAtlas(textures, true);
else if (replace) UpdateAtlas(textures, false);
return;
}
}
19
Source : UIPanelTool.cs
with Apache License 2.0
from 365082218
with Apache License 2.0
from 365082218
void OnGUI ()
{
List<UIPanel> panels = GetListOfPanels();
if (panels != null && panels.Count > 0)
{
UIPanel selectedPanel = NGUITools.FindInParents<UIPanel>(Selection.activeGameObject);
// First, collect a list of panels with their replacedociated widgets
List<Entry> entries = new List<Entry>();
Entry selectedEntry = null;
bool allEnabled = true;
foreach (UIPanel panel in panels)
{
Entry ent = new Entry();
ent.panel = panel;
ent.widgets = GetWidgets(panel);
ent.isEnabled = panel.enabled && NGUITools.GetActive(panel.gameObject);
ent.widgetsEnabled = ent.isEnabled;
if (ent.widgetsEnabled)
{
foreach (UIWidget w in ent.widgets)
{
if (!NGUITools.GetActive(w.gameObject))
{
allEnabled = false;
ent.widgetsEnabled = false;
break;
}
}
}
else allEnabled = false;
entries.Add(ent);
}
// Sort the list alphabetically
entries.Sort(Compare);
EditorGUIUtility.LookLikeControls(80f);
bool showAll = DrawRow(null, null, allEnabled);
NGUIEditorTools.DrawSeparator();
mScroll = GUILayout.BeginScrollView(mScroll);
foreach (Entry ent in entries)
{
if (DrawRow(ent, selectedPanel, ent.widgetsEnabled))
{
selectedEntry = ent;
}
}
GUILayout.EndScrollView();
if (showAll)
{
foreach (Entry ent in entries)
{
SetActiveState(ent.panel, !allEnabled);
}
}
else if (selectedEntry != null)
{
SetActiveState(selectedEntry.panel, !selectedEntry.widgetsEnabled);
}
}
else
{
GUILayout.Label("No UI Panels found in the scene");
}
}
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 EndScrollView()
{
UGUI.EndScrollView();
}
19
Source : Test_CSharp.cs
with GNU General Public License v3.0
from aelariane
with GNU General Public License v3.0
from aelariane
private void OnGUI()
{
this.m_Position = GUILayout.BeginScrollView(this.m_Position, new GUILayoutOption[0]);
GUILayout.Label(this.m_InGameLog, new GUILayoutOption[0]);
GUILayout.EndScrollView();
}
19
Source : AssetDanshariWindow.cs
with MIT License
from akof1314
with MIT License
from akof1314
private void OnGUI()
{
Init();
var style = replacedetDanshariStyle.Get();
if (!m_IsForceText)
{
EditorGUILayout.LabelField(style.forceText);
return;
}
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
GUILayout.FlexibleSpace();
Rect toolBtnRect = GUILayoutUtility.GetRect(style.help, EditorStyles.toolbarDropDown, GUILayout.ExpandWidth(false));
if (GUI.Button(toolBtnRect, style.help, EditorStyles.toolbarDropDown))
{
GenericMenu menu = new GenericMenu();
menu.AddItem(style.about, false, OnContextAbout);
menu.DropDown(toolBtnRect);
}
EditorGUILayout.EndHorizontal();
if (m_ReorderableList != null)
{
m_ScrollViewVector2 = GUILayout.BeginScrollView(m_ScrollViewVector2);
m_ReorderableList.DoLayoutList();
GUILayout.EndScrollView();
}
}
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 : ItemGiver.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
public static void ItemGiverWindow(int windowID)
{
if (ObjectDB.instance == null || ObjectDB.instance.m_items.Count == 0)
return;
GUILayout.Space(EntryPoint.s_boxSpacing);
s_searchTerms = GUILayout.TextField(s_searchTerms);
SearchItem(s_searchTerms);
s_itemGiverScrollPosition = GUILayout.BeginScrollView(s_itemGiverScrollPosition, GUI.skin.box, GUILayout.Height(350));
{
s_selectedItem = GUILayout.SelectionGrid(s_selectedItem, s_itemsGUIFiltered.ToArray(), 4, InterfaceMaker.CustomSkin.GetStyle("flatButton"));
}
GUILayout.EndScrollView();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_item_giver_quanreplacedy :"), GUILayout.ExpandWidth(false));
s_quanreplacedyItem = GUILayout.TextField(s_quanreplacedyItem, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
{
GUILayout.Label(VTLocalization.instance.Localize("$vt_item_giver_quality :"), GUILayout.ExpandWidth(false));
s_qualityItem = GUILayout.TextField(s_qualityItem, GUILayout.ExpandWidth(true));
}
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_item_giver_button")))
{
if (int.TryParse(s_quanreplacedyItem, out int quanreplacedy) && int.TryParse(s_qualityItem, out int quality))
{
Player.m_localPlayer.VTAddItemToInventory(s_itemsFiltered[s_selectedItem].itemPrefab.name, quanreplacedy, quality, s_itemsFiltered[s_selectedItem].variant);
}
}
if (GUI.tooltip != "")
{
GUIContent tooltip = new GUIContent(GUI.tooltip);
Vector2 tooltip_size = new GUIStyle(GUI.skin.textField).CalcSize(tooltip);
Vector2 tooltip_pos = new Vector2();
if (Event.current.mousePosition.x + tooltip_size.x > s_itemGiverRect.width)
tooltip_pos.x = Event.current.mousePosition.x - ((Event.current.mousePosition.x + tooltip_size.x) - (s_itemGiverRect.width));
else
tooltip_pos.x = Event.current.mousePosition.x;
if (Event.current.mousePosition.y + 30 + tooltip_size.y > s_itemGiverRect.height)
tooltip_pos.y = Event.current.mousePosition.y + 30 - ((Event.current.mousePosition.y + 30 + tooltip_size.y) - (s_itemGiverRect.height));
else
tooltip_pos.y = Event.current.mousePosition.y + 30;
GUI.Box(new Rect(tooltip_pos.x, tooltip_pos.y, tooltip_size.x, tooltip_size.y), tooltip, GUI.skin.textField);
}
GUI.DragWindow();
}
19
Source : Popup.cs
with MIT License
from Astropilot
with MIT License
from Astropilot
public override void DoGUIWindow()
{
GUI.skin = InterfaceMaker.CustomSkin;
if ((Event.current.type == EventType.Layout))
{
_displayOptionsCopy = (string[])displayOptions.Clone();
}
GUI.ModalWindow(s_popupWindowId, GetWindowRect(), (id) =>
{
_searchTerms = GUILayout.TextField(_searchTerms);
if (_displayOptionsCopy.Length == 0)
{
GUILayout.Label("No results has been found!", GUILayout.Width(150));
}
else
{
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
for (var j = 0; j < _displayOptionsCopy.Length; ++j)
{
if (GUILayout.Button(_displayOptionsCopy[j], InterfaceMaker.CustomSkin.button))
{
result = j;
}
}
GUILayout.EndScrollView();
}
var ev = Event.current;
if ((ev.rawType == EventType.MouseDown) && !(new Rect(Vector2.zero, size).Contains(ev.mousePosition)))
{
result = -1;
;
}
}
, label, InterfaceMaker.CustomSkin.GetStyle("popup"));
}
19
Source : CinemachineSettings.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
[PreferenceItem("Cinemachine")]
#endif
private static void OnGUI()
{
if (CinemachineHeader != null)
{
const float kWidth = 350f;
float aspectRatio = (float)CinemachineHeader.height / (float)CinemachineHeader.width;
GUILayout.BeginScrollView(Vector2.zero, false, false, GUILayout.Width(kWidth), GUILayout.Height(kWidth * aspectRatio));
Rect texRect = new Rect(0f, 0f, kWidth, kWidth * aspectRatio);
GUILayout.BeginArea(texRect);
GUI.DrawTexture(texRect, CinemachineHeader, ScaleMode.ScaleToFit);
GUILayout.EndArea();
GUILayout.EndScrollView();
}
sScrollPosition = GUILayout.BeginScrollView(sScrollPosition);
//CinemachineCore.sShowHiddenObjects
// = EditorGUILayout.Toggle("Show Hidden Objects", CinemachineCore.sShowHiddenObjects);
ShowCoreSettings = EditorGUILayout.Foldout(ShowCoreSettings, "Runtime Settings");
if (ShowCoreSettings)
{
EditorGUI.indentLevel++;
EditorGUI.BeginChangeCheck();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
Color newActiveGizmoColour = EditorGUILayout.ColorField(Styles.sCoreActiveGizmosColour, CinemachineCoreSettings.ActiveGizmoColour);
if (EditorGUI.EndChangeCheck())
{
CinemachineCoreSettings.ActiveGizmoColour = newActiveGizmoColour;
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
}
if (GUILayout.Button("Reset"))
{
CinemachineCoreSettings.ActiveGizmoColour = CinemachineCoreSettings.kDefaultActiveColour;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
Color newInactiveGizmoColour = EditorGUILayout.ColorField(Styles.sCoreInactiveGizmosColour, CinemachineCoreSettings.InactiveGizmoColour);
if (EditorGUI.EndChangeCheck())
{
CinemachineCoreSettings.InactiveGizmoColour = newInactiveGizmoColour;
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
}
if (GUILayout.Button("Reset"))
{
CinemachineCoreSettings.InactiveGizmoColour = CinemachineCoreSettings.kDefaultInactiveColour;
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
ShowComposerSettings = EditorGUILayout.Foldout(ShowComposerSettings, "Composer Settings");
if (ShowComposerSettings)
{
EditorGUI.indentLevel++;
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
float overlayOpacity = EditorGUILayout.Slider(Styles.sComposerOverlayOpacity, ComposerSettings.OverlayOpacity, 0f, 1f);
if (EditorGUI.EndChangeCheck())
{
ComposerSettings.OverlayOpacity = overlayOpacity;
}
if (GUILayout.Button("Reset"))
{
ComposerSettings.OverlayOpacity = ComposerSettings.kDefaultOverlayOpacity;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
Color newHardEdgeColor = EditorGUILayout.ColorField(Styles.sComposerHardBoundsOverlay, ComposerSettings.HardBoundsOverlayColour);
if (EditorGUI.EndChangeCheck())
{
ComposerSettings.HardBoundsOverlayColour = newHardEdgeColor;
}
if (GUILayout.Button("Reset"))
{
ComposerSettings.HardBoundsOverlayColour = ComposerSettings.kDefaultHardBoundsColour;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
Color newSoftEdgeColor = EditorGUILayout.ColorField(Styles.sComposerSoftBoundsOverlay, ComposerSettings.SoftBoundsOverlayColour);
if (EditorGUI.EndChangeCheck())
{
ComposerSettings.SoftBoundsOverlayColour = newSoftEdgeColor;
}
if (GUILayout.Button("Reset"))
{
ComposerSettings.SoftBoundsOverlayColour = ComposerSettings.kDefaultSoftBoundsColour;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
Color newTargetColour = EditorGUILayout.ColorField(Styles.sComposerTargetOverlay, ComposerSettings.TargetColour);
if (EditorGUI.EndChangeCheck())
{
ComposerSettings.TargetColour = newTargetColour;
}
if (GUILayout.Button("Reset"))
{
ComposerSettings.TargetColour = ComposerSettings.kDefaultTargetColour;
}
EditorGUILayout.EndHorizontal();
EditorGUI.BeginChangeCheck();
float targetSide = EditorGUILayout.FloatField(Styles.sComposerTargetOverlayPixels, ComposerSettings.TargetSize);
if (EditorGUI.EndChangeCheck())
{
ComposerSettings.TargetSize = targetSide;
}
EditorGUI.indentLevel--;
}
if (AdditionalCategories != null)
{
AdditionalCategories();
}
GUILayout.EndScrollView();
//if (GUILayout.Button("Open Doreplacedentation"))
//{
// Application.OpenURL(kCinemachineDocURL);
//}
}
19
Source : AboutWindow.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
private void OnGUI()
{
if (EditorApplication.isCompiling)
{
Close();
}
if (mButtonStyle == null)
{
mButtonStyle = new GUIStyle(GUI.skin.button);
mButtonStyle.richText = true;
}
if (mLabelStyle == null)
{
mLabelStyle = new GUIStyle(EditorStyles.label);
mLabelStyle.wordWrap = true;
mLabelStyle.richText = true;
}
if (mHeaderStyle == null)
{
mHeaderStyle = new GUIStyle(EditorStyles.boldLabel);
mHeaderStyle.wordWrap = true;
}
if (mNotesStyle == null)
{
mNotesStyle = new GUIStyle(EditorStyles.textArea);
mNotesStyle.richText = true;
mNotesStyle.wordWrap = true;
}
using (var vertScope = new EditorGUILayout.VerticalScope())
{
if (CinemachineSettings.CinemachineHeader != null)
{
float headerWidth = position.width;
float aspectRatio = (float)CinemachineSettings.CinemachineHeader.height / (float)CinemachineSettings.CinemachineHeader.width;
GUILayout.BeginScrollView(Vector2.zero, false, false, GUILayout.Width(headerWidth), GUILayout.Height(headerWidth * aspectRatio));
Rect texRect = new Rect(0f, 0f, headerWidth, headerWidth * aspectRatio);
GUILayout.FlexibleSpace();
GUILayout.BeginArea(texRect);
GUI.DrawTexture(texRect, CinemachineSettings.CinemachineHeader, ScaleMode.ScaleToFit);
GUILayout.EndArea();
GUILayout.FlexibleSpace();
GUILayout.EndScrollView();
}
EditorGUILayout.LabelField("Welcome to Cinemachine!", mLabelStyle);
EditorGUILayout.LabelField("Smart camera tools for preplacedionate creators.", mLabelStyle);
EditorGUILayout.LabelField("Below are links to the forums, please reach out if you have any questions or feedback", mLabelStyle);
if (GUILayout.Button("<b>Forum</b>\n<i>Discuss</i>", mButtonStyle))
{
Application.OpenURL("https://forum.unity3d.com/forums/cinemachine.136/");
}
if (GUILayout.Button("<b>Rate it!</b>\nUnity replacedet Store", mButtonStyle))
{
Application.OpenURL("https://www.replacedetstore.unity3d.com/en/#!/content/79898");
}
}
EditorGUILayout.LabelField("Release Notes", mHeaderStyle);
using (var scrollScope = new EditorGUILayout.ScrollViewScope(mReleaseNoteScrollPos, GUI.skin.box))
{
mReleaseNoteScrollPos = scrollScope.scrollPosition;
EditorGUILayout.LabelField(mReleaseNotes, mNotesStyle);
}
}
19
Source : TestResultRenderer.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
public void Draw()
{
if (!m_ShowResults) return;
if (m_FailedTestCollection.Count == 0)
{
GUILayout.Label("All test(s) succeeded", Styles.SucceedLabelStyle, GUILayout.Width(600));
}
else
{
int count = m_FailedTestCollection.Count;
GUILayout.Label(count + " tests failed!", Styles.FailedLabelStyle);
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.ExpandWidth(true));
var text = "";
text += "<b><size=18>Code-based tests</size></b>\n";
text += string.Join("\n", m_FailedTestCollection
.Select(result => result.Name + " " + result.ResultState + "\n" + result.Message)
.ToArray());
if (text.Length > k_MaxStringLength)
text = text.Substring(0, k_MaxStringLength);
GUILayout.TextArea(text, Styles.FailedMessagesStyle);
GUILayout.EndScrollView();
}
if (GUILayout.Button("Close"))
Application.Quit();
}
19
Source : ClipCurveEditor.cs
with MIT License
from BattleDawnNZ
with MIT License
from BattleDawnNZ
public void DrawHeader(Rect headerRect)
{
m_BindingHierarchy.InitIfNeeded(headerRect, m_DataSource, isNewSelection);
try
{
GUILayout.BeginArea(headerRect);
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar);
m_BindingHierarchy.OnGUI(new Rect(0, 0, headerRect.width, headerRect.height));
GUILayout.EndScrollView();
GUILayout.EndArea();
}
catch (Exception e)
{
Debug.LogException(e);
}
}
19
Source : GUIInterface.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void OnGUI()
{
GUI.skin = skin;
GUI.Box(new Rect(0, 0, Screen.width, 30), "");
if (GUI.Button(new Rect(0, 0, 140, 30), LogoButton))
{
Application.OpenURL("https://github.com/BelkinAndrey/OPENTadpole");
}
GUI.Label(new Rect(150, 5, 170, 30), ">> ConnectomTadpole <<");
if (GUI.Button(new Rect(325, 0, 115, 30), " SimWorldTadpole"))
{
Application.LoadLevel(1);
}
if (GUI.Button(new Rect(Screen.width - 30, 0, 30, 30), CloseButton))
{
Application.Quit();
}
if (GUI.Button(new Rect(Screen.width - 60, 0, 30, 30), FullButton))
{
if (!Screen.fullScreen)
{
W = Screen.width;
H = Screen.height;
Screen.fullScreen = true;
Screen.SetResolution(resolutions[resolutions.Length - 1].width, resolutions[resolutions.Length - 1].height, true);
}
else
{
Screen.fullScreen = false;
Screen.SetResolution(W, H, false);
}
}
GetComponent<SaveOpen>().PathFile = GUI.TextField(new Rect(Screen.width - 260, 5, 180, 20), GetComponent<SaveOpen>().PathFile);
if (GUI.Button(new Rect(Screen.width - 80, 0, 20, 30), DownButton))
{
pilot = !pilot;
}
if (GUI.Button(new Rect(Screen.width - 350, 0, 30, 30), ClearButton))
{
PlayerPrefs.SetString("Path", "");
PlayerPrefs.SetFloat("StartZoom", 3200);
PlayerPrefs.SetFloat("CamX", 0);
PlayerPrefs.SetFloat("CamY", -1840);
PlayerPrefs.SetFloat("CamZ", -100);
Application.LoadLevel(0);
}
if (GUI.Button(new Rect(Screen.width - 320, 0, 30, 30), OpenButton))
{
GetComponent<SaveOpen>().Open();
}
if (GUI.Button(new Rect(Screen.width - 290, 0, 30, 30), SaveButton))
{
GetComponent<SaveOpen>().Save();
}
if (pilot)
{
Rect RectPilot = new Rect(Screen.width - 260, 35, 200, 200);
OnRect = RectPilot.Contains(Event.current.mousePosition);
GUILayout.BeginArea(RectPilot, GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
string[] dir = Directory.GetFiles(Application.dataPath + "/Data/", "*.tad");
foreach (string value in dir)
{
GUILayout.BeginHorizontal();
string v = value.Remove(value.Length - 4).Remove(0, Application.dataPath.Length + 6);
if (GUILayout.Button(v))
{
GameObject C = GameObject.Find("Camera");
PlayerPrefs.SetFloat("StartZoom", C.GetComponent<Camera>().orthographicSize);
PlayerPrefs.SetFloat("CamX", C.transform.position.x);
PlayerPrefs.SetFloat("CamY", C.transform.position.y);
PlayerPrefs.SetFloat("CamZ", C.transform.position.z);
PlayerPrefs.SetString("Path", v);
Application.LoadLevel(0);
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
19
Source : GUIEditNeuron.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void DoMyWindow(int windowID)
{
if (GUI.Button(new Rect(160, 2, 18, 18), "x"))
{
EnableWindows = false;
MouseWindowsExit.Invoke();
}
if (GetComponent<SelectionNeuron>().SelectorNeuronOne != null)
{
GUILayout.BeginArea(new Rect(2, 20, 174, 408));
inventoryScroll = GUILayout.BeginScrollView(inventoryScroll, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
EditNeuron = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron;
GUILayout.Label("ID Neuron: " + EditNeuron.IDNeuron.ToString("000000000"));
GUILayout.Label("Type index: " + EditNeuron.Type);
switch (EditNeuron.Type)
{
case 0:
SimpleSummer(EditNeuron);
break;
case 1:
SimpleSummer(EditNeuron);
ModulMod(EditNeuron);
break;
case 2:
SummerdIN(EditNeuron);
break;
default:
break;
}
GUILayout.EndScrollView();
GUILayout.EndArea();
if (GUI.Button(new Rect(2, 428, 88, 20), "Cancel"))
{
EnableWindows = false;
MouseWindowsExit.Invoke();
}
if (GUI.Button(new Rect(91, 428, 88, 20), "Ok"))
{
switch (EditNeuron.Type)
{
case 0:
SimpleSummerOk(EditNeuron);
break;
case 1:
SimpleSummerOk(EditNeuron);
ModulModOk(EditNeuron);
break;
case 2:
SummerdINOk(EditNeuron);
break;
default:
break;
}
}
}
else EditNeuron = null;
GUI.DragWindow();
}
19
Source : GUIWindowEditSynapse.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void DoMyWindow(int windowID)
{
if (GUI.Button(new Rect(408, 2, 18, 18), "x"))
{
EnableWindows = false;
if (GizmaSynapse != null) GizmaSynapse.SetActive(false);
MouseWindowsExit.Invoke();
}
if (GetComponent<SelectionNeuron>().SelectorNeuronOne != null)
{
intButtonPrePost = GUI.SelectionGrid(new Rect(5, 20, 200, 20), intButtonPrePost, ButtonSPrePost, ButtonSPrePost.Length);
GUILayout.BeginArea(new Rect(5, 42, 200, 203), GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
if (intButtonPrePost == 0)
{
List<Synapse> hit = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron.PreSynapses;
for (int i = 0; i < hit.Count; i++)
{
string ButtonName = "" + (i + 1) + ". #" + hit[i].parentNeuron.IDNeuron.ToString("000000") + " >> #" + hit[i].targetNeuron.IDNeuron.ToString("000000");
GUILayout.BeginHorizontal();
if (GUILayout.Button(ButtonName))
{
ButtonOn(hit[i]);
}
GUILayout.EndHorizontal();
}
}
if (intButtonPrePost == 1)
{
List<Synapse> hit = GetComponent<SelectionNeuron>().SelectorNeuronOne.GetComponent<InspectorNeuron>().isNeuron.PostSynapses;
for (int i = 0; i < hit.Count; i++)
{
string ButtonName = "" + (i + 1) + ". #" + hit[i].parentNeuron.IDNeuron.ToString("000000") + " >> #" + hit[i].targetNeuron.IDNeuron.ToString("000000");
GUILayout.BeginHorizontal();
if (GUILayout.Button(ButtonName))
{
ButtonOn(hit[i]);
}
GUILayout.EndHorizontal();
}
}
GUILayout.EndScrollView();
GUILayout.EndArea();
if (EditSynanse != null)
{
GUI.Label(new Rect(210, 40, 100, 20), "Type");
EditSynanse.TypeSynapse = GUI.SelectionGrid(new Rect(310, 40, 100, 20), EditSynanse.TypeSynapse, ButtonTypeS, ButtonTypeS.Length);
GUI.Label(new Rect(210, 65, 100, 20), "Force");
forceS = GUI.TextField(new Rect(310, 65, 100, 20), forceS);
GUI.Label(new Rect(210, 90, 100, 20), "Delay");
delayS = GUI.TextField(new Rect(310, 90, 100, 20), delayS);
// GUI.Label(new Rect(210, 115, 100, 20), "descriptor");
// descriptorS = GUI.TextField(new Rect(310, 115, 100, 20), descriptorS);
// GUI.Label(new Rect(210, 140, 100, 20), "Freeze");
// EditSynanse.Freeze = GUI.Toggle(new Rect(310, 140, 100, 20), EditSynanse.Freeze, "");
GUI.Label(new Rect(210, 165, 200, 20), "Distanse = " + distanse.ToString("0.00"));
if (GUI.Button(new Rect(260, 190, 110, 20), "Delete Synapse")) DeleteSynapse();
if (GUI.Button(new Rect(210, 220, 100, 20), "Close"))
{
EnableWindows = false;
if (GizmaSynapse != null) GizmaSynapse.SetActive(false);
MouseWindowsExit.Invoke();
}
if (GUI.Button(new Rect(315, 220, 100, 20), "OK"))
{
float tryFloat;
if (float.TryParse(forceS, out tryFloat)) EditSynanse.Force = tryFloat;
int tryInt;
if (int.TryParse(delayS, out tryInt)) EditSynanse.Delay = tryInt;
if (int.TryParse(descriptorS, out tryInt)) EditSynanse.descriptor = tryInt;
}
}
else GUI.Label(new Rect(210, 20, 200, 20), "Not select synapse");
}
GUI.DragWindow();
}
19
Source : GUIInterfaceWorld.cs
with MIT License
from BelkinAndrey
with MIT License
from BelkinAndrey
void OnGUI()
{
GUI.skin = skin;
GUI.Box(new Rect(0, 0, Screen.width, 30), "");
if (GUI.Button(new Rect(0, 0, 140, 30), LogoButton))
{
Application.OpenURL("https://github.com/BelkinAndrey/OPENTadpole");
}
GUI.Label(new Rect(150, 5, 170, 30), ">> SimWorldTadpole <<");
if (GUI.Button(new Rect(325, 0, 125, 30), " ConnectomTadpole"))
{
Application.LoadLevel(0);
}
if (GUI.Button(new Rect(Screen.width - 30, 0, 30, 30), CloseButton))
{
Application.Quit();
}
if (GUI.Button(new Rect(Screen.width - 60, 0, 30, 30), FullButton))
{
if (!Screen.fullScreen)
{
W = Screen.width;
H = Screen.height;
Screen.fullScreen = true;
Screen.SetResolution(resolutions[resolutions.Length - 1].width, resolutions[resolutions.Length - 1].height, true);
}
else
{
Screen.fullScreen = false;
Screen.SetResolution(W, H, false);
}
}
GetComponent<LoadBrain>().PathFile = GUI.TextField(new Rect(Screen.width - 260, 5, 180, 20), GetComponent<LoadBrain>().PathFile);
if (GUI.Button(new Rect(Screen.width - 80, 0, 20, 30), DownButton))
{
pilot = !pilot;
}
if (GUI.Button(new Rect(Screen.width - 320, 0, 30, 30), ReStartButton))
{
Application.LoadLevel(1);
}
if (GUI.Button(new Rect(Screen.width - 290, 0, 30, 30), OpenButton))
{
GetComponent<LoadBrain>().Open();
}
if (pilot)
{
Rect RectPilot = new Rect(Screen.width - 260, 35, 200, 200);
OnRect = RectPilot.Contains(Event.current.mousePosition);
GUILayout.BeginArea(RectPilot, GUI.skin.box);
ScrollBlok = GUILayout.BeginScrollView(ScrollBlok, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
string[] dir = Directory.GetFiles(Application.dataPath + "/Data/", "*.tad");
foreach (string value in dir)
{
GUILayout.BeginHorizontal();
string v = value.Remove(value.Length - 4).Remove(0, Application.dataPath.Length + 6);
if (GUILayout.Button(v))
{
PlayerPrefs.SetString("Path", v);
Application.LoadLevel(1);
}
GUILayout.EndHorizontal();
}
GUILayout.EndScrollView();
GUILayout.EndArea();
}
}
19
Source : 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 : SteamVR_Update.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
public void OnGUI()
{
EditorGUILayout.HelpBox("A new version of the SteamVR plugin is available!", MessageType.Warning);
var resourcePath = GetResourcePath();
var logo = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
GUILayout.Label("Current version: " + currentVersion);
GUILayout.Label("New version: " + version);
if (notes != "")
{
GUILayout.Label("Release notes:");
EditorGUILayout.HelpBox(notes, MessageType.Info);
}
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Get Latest Version"))
{
Application.OpenURL(pluginUrl);
}
EditorGUI.BeginChangeCheck();
var doNotShow = GUILayout.Toggle(toggleState, "Do not prompt for this version again.");
if (EditorGUI.EndChangeCheck())
{
toggleState = doNotShow;
var key = string.Format(doNotShowKey, version);
if (doNotShow)
EditorPrefs.SetBool(key, true);
else
EditorPrefs.DeleteKey(key);
}
}
19
Source : SteamVR_UnitySettingsWindow.cs
with GNU General Public License v3.0
from brandonmousseau
with GNU General Public License v3.0
from brandonmousseau
public void OnGUI()
{
var resourcePath = GetResourcePath();
var logo = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
int numItems = 0;
if (!EditorPrefs.HasKey(ignore + buildTarget) &&
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
{
++numItems;
GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget)))
{
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + buildTarget, true);
}
GUILayout.EndHorizontal();
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
{
++numItems;
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}
GUILayout.EndHorizontal();
}
#else
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
{
++numItems;
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}
GUILayout.EndHorizontal();
}
#endif
#if UNITY_2018_1_OR_NEWER
#else
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
{
++numItems;
GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen)))
{
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
}
GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight))
{
++numItems;
GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight)))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + runInBackground) &&
PlayerSettings.runInBackground != recommended_RunInBackground)
{
++numItems;
GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground)))
{
PlayerSettings.runInBackground = recommended_RunInBackground;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + runInBackground, true);
}
GUILayout.EndHorizontal();
}
#if !UNITY_2019_1_OR_NEWER
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
{
++numItems;
GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog)))
{
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
}
GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + resizableWindow) &&
PlayerSettings.resizableWindow != recommended_ResizableWindow)
{
++numItems;
GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow)))
{
PlayerSettings.resizableWindow = recommended_ResizableWindow;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + resizableWindow, true);
}
GUILayout.EndHorizontal();
}
#if UNITY_2018_1_OR_NEWER
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
PlayerSettings.fullScreenMode != recommended_FullScreenMode)
#else
if (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
#endif
{
++numItems;
#if UNITY_2018_1_OR_NEWER
GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.fullScreenMode));
#else
GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode));
#endif
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode)))
{
#if UNITY_2018_1_OR_NEWER
PlayerSettings.fullScreenMode = recommended_FullScreenMode;
#else
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
#endif
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + fullscreenMode, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
{
++numItems;
GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground)))
{
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + visibleInBackground, true);
}
GUILayout.EndHorizontal();
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath) &&
PlayerSettings.renderingPath != recommended_RenderPath)
{
++numItems;
GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA"))
{
PlayerSettings.renderingPath = recommended_RenderPath;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + renderingPath, true);
}
GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace) &&
PlayerSettings.colorSpace != recommended_ColorSpace)
{
++numItems;
GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene"))
{
PlayerSettings.colorSpace = recommended_ColorSpace;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + colorSpace, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
PlayerSettings.gpuSkinning != recommended_GpuSkinning)
{
++numItems;
GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning)))
{
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + gpuSkinning, true);
}
GUILayout.EndHorizontal();
}
#if false
if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering) &&
PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
{
++numItems;
GUILayout.Label(singlePreplacedStereoRendering + string.Format(currentValue, PlayerSettings.singlePreplacedStereoRendering));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePreplacedStereoRendering)))
{
PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
}
GUILayout.EndHorizontal();
}
#endif
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Clear All Ignores"))
{
EditorPrefs.DeleteKey(ignore + buildTarget);
EditorPrefs.DeleteKey(ignore + showUnitySplashScreen);
EditorPrefs.DeleteKey(ignore + defaultIsFullScreen);
EditorPrefs.DeleteKey(ignore + defaultScreenSize);
EditorPrefs.DeleteKey(ignore + runInBackground);
EditorPrefs.DeleteKey(ignore + displayResolutionDialog);
EditorPrefs.DeleteKey(ignore + resizableWindow);
EditorPrefs.DeleteKey(ignore + fullscreenMode);
EditorPrefs.DeleteKey(ignore + visibleInBackground);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorPrefs.DeleteKey(ignore + renderingPath);
#endif
EditorPrefs.DeleteKey(ignore + colorSpace);
EditorPrefs.DeleteKey(ignore + gpuSkinning);
#if false
EditorPrefs.DeleteKey(ignore + singlePreplacedStereoRendering);
#endif
}
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
if (numItems > 0)
{
if (GUILayout.Button("Accept All"))
{
// Only set those that have not been explicitly ignored.
if (!EditorPrefs.HasKey(ignore + buildTarget))
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen))
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
#else
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
#endif
#if UNITY_2018_1_OR_NEWER
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
PlayerSettings.fullScreenMode = recommended_FullScreenMode;
#else
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
if (!EditorPrefs.HasKey(ignore + fullscreenMode))
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
#endif
if (!EditorPrefs.HasKey(ignore + defaultScreenSize))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}
if (!EditorPrefs.HasKey(ignore + runInBackground))
PlayerSettings.runInBackground = recommended_RunInBackground;
#if !UNITY_2019_1_OR_NEWER
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog))
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
#endif
if (!EditorPrefs.HasKey(ignore + resizableWindow))
PlayerSettings.resizableWindow = recommended_ResizableWindow;
if (!EditorPrefs.HasKey(ignore + visibleInBackground))
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath))
PlayerSettings.renderingPath = recommended_RenderPath;
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace))
PlayerSettings.colorSpace = recommended_ColorSpace;
if (!EditorPrefs.HasKey(ignore + gpuSkinning))
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
#if false
if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering))
PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
#endif
EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok");
Close();
}
if (GUILayout.Button("Ignore All"))
{
if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel"))
{
// Only ignore those that do not currently match our recommended settings.
if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
EditorPrefs.SetBool(ignore + buildTarget, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
#else
if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
#endif
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
#if UNITY_2018_1_OR_NEWER
if (PlayerSettings.fullScreenMode != recommended_FullScreenMode)
{
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
EditorPrefs.SetBool(ignore + fullscreenMode, true);
}
#else
if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
EditorPrefs.SetBool(ignore + fullscreenMode, true);
#endif
if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
if (PlayerSettings.runInBackground != recommended_RunInBackground)
EditorPrefs.SetBool(ignore + runInBackground, true);
#if !UNITY_2019_1_OR_NEWER
if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
#endif
if (PlayerSettings.resizableWindow != recommended_ResizableWindow)
EditorPrefs.SetBool(ignore + resizableWindow, true);
if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
EditorPrefs.SetBool(ignore + visibleInBackground, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.renderingPath != recommended_RenderPath)
EditorPrefs.SetBool(ignore + renderingPath, true);
#endif
if (PlayerSettings.colorSpace != recommended_ColorSpace)
EditorPrefs.SetBool(ignore + colorSpace, true);
if (PlayerSettings.gpuSkinning != recommended_GpuSkinning)
EditorPrefs.SetBool(ignore + gpuSkinning, true);
#if false
if (PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
#endif
Close();
}
}
}
else if (GUILayout.Button("Close"))
{
Close();
}
GUILayout.EndHorizontal();
}
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 : StartScreen.cs
with MIT License
from BrunoS3D
with MIT License
from BrunoS3D
public void OnGUI()
{
if( !m_infoDownloaded )
{
m_infoDownloaded = true;
// get affiliate links
StartBackgroundTask( StartRequest( PackageRefURL, ( www ) =>
{
var pack = PackageRef.CreateFromJSON( www.downloadHandler.text );
if( pack != null )
{
m_packageRef = pack;
Repaint();
}
} ) );
// get banner information and texture
StartBackgroundTask( StartRequest( BannerInfoURL, ( www ) =>
{
BannerInfo info = BannerInfo.CreateFromJSON( www.downloadHandler.text );
if( info != null && !string.IsNullOrEmpty( info.ImageUrl ) )
{
StartBackgroundTask( StartTextureRequest( info.ImageUrl, ( www2 ) =>
{
Texture2D texture = DownloadHandlerTexture.GetContent( www2 );
if( texture != null )
m_newsImage = texture;
} ) );
}
if( info != null && info.Version >= m_bannerInfo.Version )
{
m_bannerInfo = info;
}
// improve this later
int major = m_bannerInfo.Version / 100;
int minor = ( m_bannerInfo.Version / 10 ) - major * 10;
int release = m_bannerInfo.Version - major * 100 - minor * 10;
m_newVersion = major + "." + minor + "." + release;
Repaint();
} ) );
}
if( m_buttonStyle == null )
{
m_buttonStyle = new GUIStyle( GUI.skin.button );
m_buttonStyle.alignment = TextAnchor.MiddleLeft;
}
if( m_labelStyle == null )
{
m_labelStyle = new GUIStyle( "BoldLabel" );
m_labelStyle.margin = new RectOffset( 4, 4, 4, 4 );
m_labelStyle.padding = new RectOffset( 2, 2, 2, 2 );
m_labelStyle.fontSize = 13;
}
if( m_linkStyle == null )
{
var inv = replacedetDatabase.LoadreplacedetAtPath<Texture2D>( replacedetDatabase.GUIDToreplacedetPath( "1004d06b4b28f5943abdf2313a22790a" ) ); // find a better solution for transparent buttons
m_linkStyle = new GUIStyle();
m_linkStyle.normal.textColor = new Color( 0.2980392f, 0.4901961f, 1f );
m_linkStyle.hover.textColor = Color.white;
m_linkStyle.active.textColor = Color.grey;
m_linkStyle.margin.top = 3;
m_linkStyle.margin.bottom = 2;
m_linkStyle.hover.background = inv;
m_linkStyle.active.background = inv;
}
EditorGUILayout.BeginHorizontal( GUIStyle.none, GUILayout.ExpandWidth( true ) );
{
// left column
EditorGUILayout.BeginVertical( GUILayout.Width( 175 ) );
{
GUILayout.Label( Resourcesreplacedle, m_labelStyle );
if( GUILayout.Button( WikiButton, m_buttonStyle ) )
Application.OpenURL( WikiURL );
GUILayout.Space( 10 );
GUILayout.Label( "Amplify Products", m_labelStyle );
if( m_packageRef.Links != null )
{
var webIcon = EditorGUIUtility.IconContent( "BuildSettings.Web.Small" ).image;
for( int i = 0; i < m_packageRef.Links.Length; i++ )
{
var gc = new GUIContent( " " + m_packageRef.Links[ i ].replacedle, webIcon );
if( GUILayout.Button( gc, m_buttonStyle ) )
Application.OpenURL( m_packageRef.Links[ i ].Url + RefID );
}
}
GUILayout.Label( "* Affiliate Links", "minilabel" );
}
EditorGUILayout.EndVertical();
// right column
EditorGUILayout.BeginVertical( GUILayout.Width( 650 - 175 - 9 ), GUILayout.ExpandHeight( true ) );
{
GUILayout.Label( Communityreplacedle, m_labelStyle );
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
{
if( GUILayout.Button( DiscordButton, GUILayout.ExpandWidth( true ) ) )
{
Application.OpenURL( DiscordURL );
}
if( GUILayout.Button( ForumButton, GUILayout.ExpandWidth( true ) ) )
{
Application.OpenURL( ForumURL );
}
}
EditorGUILayout.EndHorizontal();
GUILayout.Label( Updatereplacedle, m_labelStyle );
if( m_newsImage != null )
{
var gc = new GUIContent( m_newsImage );
int width = 650 - 175 - 9 - 8;
width = Mathf.Min( m_newsImage.width, width );
int height = m_newsImage.height;
height = (int)( ( width + 8 ) * ( (float)m_newsImage.height / (float)m_newsImage.width ) );
Rect buttonRect = EditorGUILayout.GetControlRect( false, height );
EditorGUIUtility.AddCursorRect( buttonRect, MouseCursor.Link );
if( GUI.Button( buttonRect, gc, m_linkStyle ) )
{
Application.OpenURL( m_bannerInfo.LinkUrl );
}
}
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition, GUILayout.ExpandHeight( true ), GUILayout.ExpandWidth( true ) );
GUILayout.Label( m_bannerInfo.NewsText, "WordWrappedMiniLabel", GUILayout.ExpandHeight( true ) );
GUILayout.EndScrollView();
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
{
EditorGUILayout.BeginVertical();
GUILayout.Label( replacedleSTR, m_labelStyle );
GUILayout.Label( "Installed Version: " + VersionInfo.StaticToString() );
if( m_bannerInfo.Version > VersionInfo.FullNumber )
{
var cache = GUI.color;
GUI.color = Color.red;
GUILayout.Label( "New version available: " + m_newVersion, "BoldLabel" );
GUI.color = cache;
}
else
{
var cache = GUI.color;
GUI.color = Color.green;
GUILayout.Label( "You are using the latest version", "BoldLabel" );
GUI.color = cache;
}
EditorGUILayout.BeginHorizontal();
GUILayout.Label( "Download links:" );
if( GUILayout.Button( "Amplify", m_linkStyle ) )
Application.OpenURL( SiteURL );
GUILayout.Label( "-" );
if( GUILayout.Button( "replacedet Store", m_linkStyle ) )
Application.OpenURL( StoreURL );
EditorGUILayout.EndHorizontal();
GUILayout.Space( 7 );
EditorGUILayout.EndVertical();
GUILayout.FlexibleSpace();
EditorGUILayout.BeginVertical();
GUILayout.Space( 7 );
GUILayout.Label( Icon );
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal( "ProjectBrowserBottomBarBg", GUILayout.ExpandWidth( true ), GUILayout.Height( 22 ) );
{
GUILayout.FlexibleSpace();
EditorGUI.BeginChangeCheck();
var cache = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 100;
m_startup = EditorGUILayout.ToggleLeft( "Show At Startup", m_startup, GUILayout.Width( 120 ) );
EditorGUIUtility.labelWidth = cache;
if( EditorGUI.EndChangeCheck() )
{
EditorPrefs.SetBool( Preferences.PrefStartUp, m_startup );
}
}
EditorGUILayout.EndHorizontal();
// Find a better way to update link buttons without repainting the window
Repaint();
}
19
Source : 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 : TestResultRenderer.cs
with Creative Commons Zero v1.0 Universal
from Colanderp
with Creative Commons Zero v1.0 Universal
from Colanderp
public void Draw()
{
if (!m_ShowResults) return;
if (m_FailedTestCollection.Count == 0)
{
GUILayout.Label("All test succeeded", Styles.SucceedLabelStyle, GUILayout.Width(600));
}
else
{
int count = m_FailedTestCollection.Count;
GUILayout.Label(count + " tests failed!", Styles.FailedLabelStyle);
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUILayout.ExpandWidth(true));
var text = "";
text += "<b><size=18>Code-based tests</size></b>\n";
text += string.Join("\n", m_FailedTestCollection
.Select(result => result.Name + " " + result.ResultState + "\n" + result.Message)
.ToArray());
if (text.Length > k_MaxStringLength)
text = text.Substring(0, k_MaxStringLength);
GUILayout.TextArea(text, Styles.FailedMessagesStyle);
GUILayout.EndScrollView();
}
if (GUILayout.Button("Close"))
Application.Quit();
}
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 : 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();
}
19
Source : SteamVR_Update.cs
with MIT License
from dag10
with MIT License
from dag10
public void OnGUI()
{
EditorGUILayout.HelpBox("A new version of the SteamVR plugin is available!", MessageType.Warning);
var resourcePath = GetResourcePath();
var logo = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
GUILayout.Label("Current version: " + currentVersion);
GUILayout.Label("New version: " + version);
if (notes != "")
{
GUILayout.Label("Release notes:");
EditorGUILayout.HelpBox(notes, MessageType.Info);
}
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Get Latest Version"))
{
Application.OpenURL(pluginUrl);
}
EditorGUI.BeginChangeCheck();
var doNotShow = GUILayout.Toggle(toggleState, "Do not prompt for this version again.");
if (EditorGUI.EndChangeCheck())
{
toggleState = doNotShow;
var key = string.Format(doNotShowKey, version);
if (doNotShow)
EditorPrefs.SetBool(key, true);
else
EditorPrefs.DeleteKey(key);
}
}
19
Source : SteamVR_Settings.cs
with MIT License
from dag10
with MIT License
from dag10
public void OnGUI()
{
var resourcePath = GetResourcePath();
var logo = replacedetDatabase.LoadreplacedetAtPath<Texture2D>(resourcePath + "logo.png");
var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
if (logo)
GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
EditorGUILayout.HelpBox("Recommended project settings for SteamVR:", MessageType.Warning);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
int numItems = 0;
if (!EditorPrefs.HasKey(ignore + buildTarget) &&
EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
{
++numItems;
GUILayout.Label(buildTarget + string.Format(currentValue, EditorUserBuildSettings.activeBuildTarget));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_BuildTarget)))
{
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + buildTarget, true);
}
GUILayout.EndHorizontal();
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
{
++numItems;
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.showUnitySplashScreen));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}
GUILayout.EndHorizontal();
}
#else
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
{
++numItems;
GUILayout.Label(showUnitySplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ShowUnitySplashScreen)))
{
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
}
GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
{
++numItems;
GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen)))
{
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight))
{
++numItems;
GUILayout.Label(defaultScreenSize + string.Format(" ({0}x{1})", PlayerSettings.defaultScreenWidth, PlayerSettings.defaultScreenHeight));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format("Use recommended ({0}x{1})", recommended_DefaultScreenWidth, recommended_DefaultScreenHeight)))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + runInBackground) &&
PlayerSettings.runInBackground != recommended_RunInBackground)
{
++numItems;
GUILayout.Label(runInBackground + string.Format(currentValue, PlayerSettings.runInBackground));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_RunInBackground)))
{
PlayerSettings.runInBackground = recommended_RunInBackground;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + runInBackground, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
{
++numItems;
GUILayout.Label(displayResolutionDialog + string.Format(currentValue, PlayerSettings.displayResolutionDialog));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_DisplayResolutionDialog)))
{
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + resizableWindow) &&
PlayerSettings.resizableWindow != recommended_ResizableWindow)
{
++numItems;
GUILayout.Label(resizableWindow + string.Format(currentValue, PlayerSettings.resizableWindow));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ResizableWindow)))
{
PlayerSettings.resizableWindow = recommended_ResizableWindow;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + resizableWindow, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
{
++numItems;
GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode)))
{
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + fullscreenMode, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
{
++numItems;
GUILayout.Label(visibleInBackground + string.Format(currentValue, PlayerSettings.visibleInBackground));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_VisibleInBackground)))
{
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + visibleInBackground, true);
}
GUILayout.EndHorizontal();
}
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath) &&
PlayerSettings.renderingPath != recommended_RenderPath)
{
++numItems;
GUILayout.Label(renderingPath + string.Format(currentValue, PlayerSettings.renderingPath));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_RenderPath) + " - required for MSAA"))
{
PlayerSettings.renderingPath = recommended_RenderPath;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + renderingPath, true);
}
GUILayout.EndHorizontal();
}
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace) &&
PlayerSettings.colorSpace != recommended_ColorSpace)
{
++numItems;
GUILayout.Label(colorSpace + string.Format(currentValue, PlayerSettings.colorSpace));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_ColorSpace) + " - requires reloading scene"))
{
PlayerSettings.colorSpace = recommended_ColorSpace;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + colorSpace, true);
}
GUILayout.EndHorizontal();
}
if (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
PlayerSettings.gpuSkinning != recommended_GpuSkinning)
{
++numItems;
GUILayout.Label(gpuSkinning + string.Format(currentValue, PlayerSettings.gpuSkinning));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_GpuSkinning)))
{
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + gpuSkinning, true);
}
GUILayout.EndHorizontal();
}
#if false
if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering) &&
PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
{
++numItems;
GUILayout.Label(singlePreplacedStereoRendering + string.Format(currentValue, PlayerSettings.singlePreplacedStereoRendering));
GUILayout.BeginHorizontal();
if (GUILayout.Button(string.Format(useRecommended, recommended_SinglePreplacedStereoRendering)))
{
PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Ignore"))
{
EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
}
GUILayout.EndHorizontal();
}
#endif
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Clear All Ignores"))
{
EditorPrefs.DeleteKey(ignore + buildTarget);
EditorPrefs.DeleteKey(ignore + showUnitySplashScreen);
EditorPrefs.DeleteKey(ignore + defaultIsFullScreen);
EditorPrefs.DeleteKey(ignore + defaultScreenSize);
EditorPrefs.DeleteKey(ignore + runInBackground);
EditorPrefs.DeleteKey(ignore + displayResolutionDialog);
EditorPrefs.DeleteKey(ignore + resizableWindow);
EditorPrefs.DeleteKey(ignore + fullscreenMode);
EditorPrefs.DeleteKey(ignore + visibleInBackground);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorPrefs.DeleteKey(ignore + renderingPath);
#endif
EditorPrefs.DeleteKey(ignore + colorSpace);
EditorPrefs.DeleteKey(ignore + gpuSkinning);
#if false
EditorPrefs.DeleteKey(ignore + singlePreplacedStereoRendering);
#endif
}
GUILayout.EndHorizontal();
GUILayout.EndScrollView();
GUILayout.FlexibleSpace();
GUILayout.BeginHorizontal();
if (numItems > 0)
{
if (GUILayout.Button("Accept All"))
{
// Only set those that have not been explicitly ignored.
if (!EditorPrefs.HasKey(ignore + buildTarget))
#if (UNITY_5_5 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
EditorUserBuildSettings.SwitchActiveBuildTarget(recommended_BuildTarget);
#else
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, recommended_BuildTarget);
#endif
if (!EditorPrefs.HasKey(ignore + showUnitySplashScreen))
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
PlayerSettings.showUnitySplashScreen = recommended_ShowUnitySplashScreen;
#else
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen;
#endif
if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen))
PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen;
if (!EditorPrefs.HasKey(ignore + defaultScreenSize))
{
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth;
PlayerSettings.defaultScreenHeight = recommended_DefaultScreenHeight;
}
if (!EditorPrefs.HasKey(ignore + runInBackground))
PlayerSettings.runInBackground = recommended_RunInBackground;
if (!EditorPrefs.HasKey(ignore + displayResolutionDialog))
PlayerSettings.displayResolutionDialog = recommended_DisplayResolutionDialog;
if (!EditorPrefs.HasKey(ignore + resizableWindow))
PlayerSettings.resizableWindow = recommended_ResizableWindow;
if (!EditorPrefs.HasKey(ignore + fullscreenMode))
PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode;
if (!EditorPrefs.HasKey(ignore + visibleInBackground))
PlayerSettings.visibleInBackground = recommended_VisibleInBackground;
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (!EditorPrefs.HasKey(ignore + renderingPath))
PlayerSettings.renderingPath = recommended_RenderPath;
#endif
if (!EditorPrefs.HasKey(ignore + colorSpace))
PlayerSettings.colorSpace = recommended_ColorSpace;
if (!EditorPrefs.HasKey(ignore + gpuSkinning))
PlayerSettings.gpuSkinning = recommended_GpuSkinning;
#if false
if (!EditorPrefs.HasKey(ignore + singlePreplacedStereoRendering))
PlayerSettings.singlePreplacedStereoRendering = recommended_SinglePreplacedStereoRendering;
#endif
EditorUtility.DisplayDialog("Accept All", "You made the right choice!", "Ok");
Close();
}
if (GUILayout.Button("Ignore All"))
{
if (EditorUtility.DisplayDialog("Ignore All", "Are you sure?", "Yes, Ignore All", "Cancel"))
{
// Only ignore those that do not currently match our recommended settings.
if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget)
EditorPrefs.SetBool(ignore + buildTarget, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen)
#else
if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen)
#endif
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true);
if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen)
EditorPrefs.SetBool(ignore + defaultIsFullScreen, true);
if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)
EditorPrefs.SetBool(ignore + defaultScreenSize, true);
if (PlayerSettings.runInBackground != recommended_RunInBackground)
EditorPrefs.SetBool(ignore + runInBackground, true);
if (PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog)
EditorPrefs.SetBool(ignore + displayResolutionDialog, true);
if (PlayerSettings.resizableWindow != recommended_ResizableWindow)
EditorPrefs.SetBool(ignore + resizableWindow, true);
if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode)
EditorPrefs.SetBool(ignore + fullscreenMode, true);
if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground)
EditorPrefs.SetBool(ignore + visibleInBackground, true);
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
if (PlayerSettings.renderingPath != recommended_RenderPath)
EditorPrefs.SetBool(ignore + renderingPath, true);
#endif
if (PlayerSettings.colorSpace != recommended_ColorSpace)
EditorPrefs.SetBool(ignore + colorSpace, true);
if (PlayerSettings.gpuSkinning != recommended_GpuSkinning)
EditorPrefs.SetBool(ignore + gpuSkinning, true);
#if false
if (PlayerSettings.singlePreplacedStereoRendering != recommended_SinglePreplacedStereoRendering)
EditorPrefs.SetBool(ignore + singlePreplacedStereoRendering, true);
#endif
Close();
}
}
}
else if (GUILayout.Button("Close"))
{
Close();
}
GUILayout.EndHorizontal();
}
19
Source : RunnerConsole.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public override void Render() {
GUIStyle horizontal = new GUIStyle();
horizontal.margin = new RectOffset(10, 11, 0, 0);
GUIStyle statusColor = new GUIStyle(GUI.skin.label);
statusColor.margin = new RectOffset(0, 0, 3, 0);
statusColor.normal.textColor = AutoConsole.Paused ? Color.red : Nexus.TextGreen;
statusColor.fixedWidth = 125;
statusColor.fontStyle = FontStyle.Bold;
GUILayout.Space(15);
EditorGUILayout.BeginHorizontal(horizontal); //For "Running" notification and FPS counter.
if(Application.isPlaying && AutomationMaster.Busy) {
EditorGUILayout.LabelField("Running Test(s)", statusColor);
} else {
AutomationMaster.Busy = false;
EditorGUILayout.LabelField(string.Empty, statusColor);
}
if(Application.isPlaying) {
if(renderPreplacedes == FPS_SAMPLE_RATE && Application.isPlaying) {
fpsSample = Math.Round(1 / Time.deltaTime, 0);
renderPreplacedes = 0;
}
GUIStyle fps = new GUIStyle(GUI.skin.label);
fps.fontSize = 26;
fps.padding = new RectOffset(0, 0, -8, 0);
fps.normal.textColor = GetFpsColor(fpsSample);
GUILayout.FlexibleSpace();
EditorGUILayout.LabelField(string.Format("FPS {0}", fpsSample), new GUILayoutOption[] { GUILayout.Width(50) });
EditorGUILayout.LabelField(string.Format("◈", fpsSample), fps, new GUILayoutOption[] { GUILayout.Width(35) });
GUILayout.Space(-18);
renderPreplacedes++;
}
EditorGUILayout.EndHorizontal(); //End for "Running" notification and FPS counter.
GUIStyle scrollStatus = new GUIStyle(GUI.skin.button);
scrollStatus.margin = new RectOffset(0, 0, 0, 0);
scrollStatus.fontStyle = _autoScroll ? FontStyle.Bold : FontStyle.Normal;
scrollStatus.normal.background = Swat.ToggleButtonBackgroundSelectedTexture;
scrollStatus.normal.textColor = _pubsubMode ? Nexus.TextGreen : Swat.WindowDefaultTextColor;
EditorGUILayout.Space();
GUILayout.BeginHorizontal(horizontal);
EditorGUILayout.LabelField(string.Format("{0} - {1}", AutoConsole.Paused ? "Paused" : "Active", AutoConsole.FilterLevel == MessageLevel.Verbose ? "Verbose" : "Abridged") , statusColor);
EditorGUILayout.Space();
GUILayout.Space(-100);
Nexus.Self.Button("Pubsub", "Show received Pubsub messages.",
new Nexus.SwatDelegate(delegate() {
_pubsubMode = !_pubsubMode;
}), scrollStatus, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
GUILayout.Space(0.65f);
scrollStatus.normal.textColor = _autoScroll ? Nexus.TextGreen : Color.red;
Nexus.Self.Button("Auto Scroll", "Remove all messages in the console.",
new Nexus.SwatDelegate(delegate() {
_autoScroll = !_autoScroll;
}), scrollStatus, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
GUILayout.EndHorizontal();
EditorGUILayout.Space();
GUILayout.BeginHorizontal(horizontal);
GUIStyle button = new GUIStyle(GUI.skin.button);
button.margin = new RectOffset(0, 0, 0, 0);
button.normal.textColor = Swat.ToggleButtonTextColor;
button.normal.background = Swat.ToggleButtonBackgroundTexture;
Nexus.Self.Button("Clear", "Remove all messages in the console.",
new Nexus.SwatDelegate(delegate() {
FileBroker.SaveUnboundFile(string.Format("{0}{1}{2}/console_before_start.txt", FileBroker.BASE_NON_UNITY_PATH, AutomationMaster.ConfigReader.GetString("EDITOR_RESOURCE_CONSOLE_LOG_DIRECTORY"), GameMaster.GAME_NAME), string.Empty);
AutoConsole.messageListDisplayed = new List<AutoConsoleMessage>();
AutoConsole.messageListQueued = new List<AutoConsoleMessage>();
_selectedConsoleMessage = null;
}), button, new GUILayoutOption[] { GUILayout.Width(60), GUILayout.Height(22) });
GUILayout.Space(0.5f);
Nexus.Self.Button(AutoConsole.Paused ? "Resume" : "Pause", "Pause/Continue rendering of new messages in the console. Messages are still received and stored when paused, and will appear immediately when resuming.",
new Nexus.SwatDelegate(delegate() {
AutoConsole.Paused = !AutoConsole.Paused;
}), button, new GUILayoutOption[] { GUILayout.Width(60), GUILayout.Height(22) });
EditorGUILayout.Space();
Nexus.Self.Button("Verbose", "Post ALL messages from the automation framework in the console.",
new Nexus.SwatDelegate(delegate() {
AutoConsole.FilterLevel = MessageLevel.Verbose;
if(_autoScroll) {
_scroll.y = 99999;
_scroll.x = 0;
}
}), button, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
GUILayout.Space(0.65f);
GUIStyle abridged = new GUIStyle(GUI.skin.button);
abridged.margin = new RectOffset(0, 0, 0, 0);
abridged.normal.textColor = Swat.ToggleButtonTextColor;
abridged.normal.background = Swat.ToggleButtonBackgroundTexture;
Nexus.Self.Button("Abridged", "Post only automation messages marked as high priority in the console.",
new Nexus.SwatDelegate(delegate() {
AutoConsole.FilterLevel = MessageLevel.Abridged;
if(_autoScroll) {
_scroll.y = 99999;
_scroll.x = 0;
}
}), abridged, new GUILayoutOption[] { GUILayout.Width(75), GUILayout.Height(22) });
GUILayout.EndHorizontal();
float messageHeight = 15;
GUIStyle consoleBox = new GUIStyle(GUI.skin.box);
consoleBox.fixedHeight = Nexus.Self.position.height - (Application.isPlaying ? 125 : 105);
consoleBox.fixedWidth = Nexus.Self.position.width - 20;
consoleBox.margin = new RectOffset(10, 0, 0, 10);
consoleBox.normal.background = Swat.TabButtonBackgroundTexture;
GUILayout.BeginVertical(consoleBox); //Begin box border around console.
_scroll = GUILayout.BeginScrollView(_scroll);
GUIStyle messageBox = new GUIStyle(GUI.skin.box);
messageBox.normal.background = Swat.TabButtonBackgroundSelectedTexture;
messageBox.margin = new RectOffset(2, 2, 1, 1);
GUIStyle messageBoxText = new GUIStyle(GUI.skin.label);
messageBoxText.normal.textColor = Swat.WindowDefaultTextColor;
messageBox.fixedWidth = consoleBox.fixedWidth - 10;
messageBoxText.fixedWidth = messageBox.fixedWidth - 5;
string lastConsoleMessage = string.Empty;
int duplicateCount = 0;
List<AutoConsoleMessage> consoleMessages = AutoConsole.messageListDisplayed;
for(int m = 0; m < consoleMessages.Count; m++) {
if((_pubsubMode && consoleMessages[m].messageType != ConsoleMessageType.Pubsub) ||(!_pubsubMode && consoleMessages[m].messageType == ConsoleMessageType.Pubsub)) {
continue;
}
//If this is a new console message, and auto scroll is on, scroll down automatically.
if(_autoScroll && m == _lastPreplacedConsoleMessageCount) {
_scroll.y = 99999;
_scroll.x = 0;
}
//Render only messages of the requested filter level.
if(_pubsubMode ||(AutoConsole.FilterLevel == MessageLevel.Abridged && consoleMessages[m].level == MessageLevel.Abridged) || AutoConsole.FilterLevel == MessageLevel.Verbose) {
messageBoxText.normal.textColor = AutoConsole.MessageColor(consoleMessages[m].messageType);
GUILayout.BeginHorizontal(messageBox, new GUILayoutOption[] {
GUILayout.MinWidth(225),
GUILayout.MaxHeight(messageHeight)
});
if(lastConsoleMessage == consoleMessages[m].message) {
duplicateCount++;
consoleMessages.RemoveAt(m - 1);
} else {
lastConsoleMessage = consoleMessages[m].message;
duplicateCount = 0;
}
if(consoleMessages.Count > m) {
if(GUILayout.Button(string.Format("{0} {1}", duplicateCount > 0 ?(duplicateCount + 1).ToString() : string.Empty, consoleMessages[m].message), messageBoxText)) {
if(_selectedConsoleMessage == consoleMessages[m]) {
//If the message has been double-clicked, open this test failure as a single-test, temporary report.
if(DateTime.Now.Subtract(_lastConsoleMessageButtonClick).TotalSeconds < 0.75d && !string.IsNullOrEmpty(consoleMessages[m].testMethod)) {
if(_consoleAbridgedReportTypes.Contains(consoleMessages[m].messageType)) {
_selectedConsoleMessage = null; //Prevents details panel from appearing. We only want it to appear for a single click, not a double click.
AutomationReport.BuildTemporaryReportForSingleConsoleFailure(consoleMessages[m].testMethod);
System.Diagnostics.Process.Start(string.Format("{0}SingleTestAsReportTemp.html", FileBroker.RESOURCES_DIRECTORY));
OpenedTestReport = DateTime.UtcNow;
}
} else {
ConsoleMessage.Pop(_selectedConsoleMessage.message, Enum.GetName(typeof(ConsoleMessageType), _selectedConsoleMessage.messageType), Enum.GetName(typeof(MessageLevel), _selectedConsoleMessage.level), _selectedConsoleMessage.timestamp.ToString());
_selectedConsoleMessage = null;
}
}
_selectedConsoleMessage = consoleMessages[m];
_lastConsoleMessageButtonClick = DateTime.Now;
}
}
GUILayout.EndHorizontal();
}
}
_lastPreplacedConsoleMessageCount = consoleMessages.Count;
GUILayout.EndScrollView();
GUILayout.EndVertical();
}
19
Source : ConsoleMessage.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public override void OnGUI() {
if(Nexus.Self == null || Nexus.Self.SelectedTab.Window.GetType() != constraint) {
Close();
return;
}
if(lastWindowWidth != Nexus.Self.position.width) {
DoPositionWindow = true;
}
if(DoPositionWindow) {
DoPositionWindow = false;
lastWindowWidth = Nexus.Self.position.width;
PositionWindow();
}
GUI.skin.textArea.wordWrap = true;
buttons = new GUIStyle(GUI.skin.button);
buttons.fixedHeight = buttonHeight;
buttons.fixedWidth = buttonWidth;
buttons.margin = new RectOffset(0, 0, 10, 0);
buttons.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
buttonGroup = new GUIStyle();
closeBox = new GUIStyle(GUI.skin.button);
closeBox.fontSize = 16;
closeBox.padding = new RectOffset(2, 0, 0, 0);
closeBox.normal.textColor = Color.red;
detailsBox = new GUIStyle(GUI.skin.box);
detailsBox.margin = new RectOffset(10, 25, 0, 0);
detailsBox.fixedWidth = minSize.x - 20;
detailsBox.fixedHeight = minSize.y - 100;
detailsLabel = new GUIStyle(GUI.skin.label);
detailsLabel.fontStyle = FontStyle.Bold;
detailsLabel.fontSize = 12;
details = new GUIStyle(GUI.skin.textArea);
details.fixedHeight = detailsBox.fixedHeight - 150;
details.fixedWidth = detailsBox.fixedWidth - 15;
details.padding = detailsBox.padding = new RectOffset(5, 5, 5, 5);
divider = new GUIStyle(GUI.skin.box);
divider.normal.background = Swat.MakeTextureFromColor(Color.white);
divider.margin = new RectOffset(25, 0, 10, 20);
header = new GUIStyle(GUI.skin.label);
header.fontSize = 14;
header.fixedHeight = 25;
header.normal.textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black;
header.fontStyle = FontStyle.Bold;
header.alignment = TextAnchor.MiddleCenter;
header.padding = new RectOffset(0, 0, -20, 0);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.Space();
Nexus.Self.Button("X", "Show/Hide test status details section.",
new Nexus.SwatDelegate(delegate() {
IsVisible = false;
Close();
}), closeBox, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) });
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Console Message", header);
GUILayout.Space(10);
GUILayout.BeginVertical(detailsBox);
EditorGUILayout.LabelField("Time:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
EditorGUILayout.SelectableLabel(Timestamp);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Type:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
EditorGUILayout.SelectableLabel(MessageType);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Verbosity:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
EditorGUILayout.SelectableLabel(MessageLevel);
EditorGUILayout.Space();
EditorGUILayout.LabelField("Message:", detailsLabel, new GUILayoutOption[] { GUILayout.Width(120)});
GUILayout.BeginHorizontal();
_scrollConsoleDetails = GUILayout.BeginScrollView(_scrollConsoleDetails, false, true, GUIStyle.none, GUI.skin.verticalScrollbar);
EditorGUILayout.SelectableLabel(Message, details);
GUILayout.EndScrollView();
GUILayout.EndHorizontal();
GUILayout.EndVertical();
buttonGroup.margin = new RectOffset(System.Convert.ToInt32(System.Math.Round(position.width / 2)) - 25, 0, 0, 10);
EditorGUILayout.BeginHorizontal(buttonGroup);
if(GUILayout.Button("Close", buttons)) {
IsVisible = false;
Close();
}
EditorGUILayout.EndHorizontal();
}
19
Source : Manifest.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public override void Render() {
scroll = new Vector2(0, scroll.y);
GUIStyle labels = new GUIStyle(EditorStyles.label);
labels.padding = new RectOffset(25, 15, 2, 2);
GUIStyle cs = new GUIStyle(EditorStyles.label);
cs.padding = new RectOffset(5, 15, 2, 2);
cs.wordWrap = true;
cs.fontStyle = FontStyle.Italic;
EditorGUILayout.LabelField("This feature is incomplete at the moment. It will have as much data about current test run progress as possible. Coming Soon!", cs);
GUILayout.Space(25);
EditorGUILayout.LabelField(string.Format("{0} out of {1} completed!", AutomationMaster.TestRunContext.CompletedTests.Count, AutomationMaster.Methods.Count), labels);
GUILayout.Space(5);
EditorGUILayout.LabelField(string.Format("Currently Running: {0}", AutomationMaster.CurrentTestContext.TestName), labels);
GUIStyle tests = new GUIStyle(EditorStyles.foldout);
tests.margin = new RectOffset(15, 15, 2, 2);
GUILayout.Space(25);
scroll = GUILayout.BeginScrollView(scroll);
for(int x = 0; x < AutomationMaster.Methods.Count; x++) {
EditorGUILayout.Foldout(false, AutomationMaster.Methods[x].Value.Name, tests);
}
GUILayout.EndScrollView();
}
19
Source : CommandConsoleView.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public override void Render() {
console = new GUIStyle(GUI.skin.box);
console.normal.background = Swat.MakeTextureFromColor((Color)new Color32(100, 100, 100, 255));
console.wordWrap = true;
console.normal.textColor = Color.white;
console.padding = new RectOffset(10, 20, 0, 0);
console.fontSize = 15;
console.alignment = TextAnchor.MiddleLeft;
description = new GUIStyle(GUI.skin.label);
description.wordWrap = true;
description.margin = new RectOffset(10, 10, 0, 0);
description.padding = new RectOffset(0, 0, 5, 5);
description.normal.textColor = Swat.WindowDefaultTextColor;
description.fontSize = 12;
args = new GUIStyle(GUI.skin.label);
args.wordWrap = true;
args.margin = new RectOffset(10, 10, 0, 0);
args.normal.textColor = Swat.WindowDefaultTextColor;
args.fontSize = 11;
editorName = new GUIStyle(GUI.skin.label);
editorName.fontSize = 16;
editorName.fixedHeight = 20;
editorName.fontStyle = FontStyle.Bold;
editorName.padding = new RectOffset(8, 0, 0, 0);
editorName.normal.textColor = Swat.WindowDefaultTextColor;
load = new GUIStyle(GUI.skin.box);
load.normal.background = Swat.MakeTextureFromColor((Color)new Color32(75, 75, 75, 255));
load.normal.textColor = Color.white;
load.fontSize = 18;
load.alignment = TextAnchor.MiddleCenter;
open = new GUIStyle(GUI.skin.button);
open.fontSize = 14;
open.fixedHeight = 28;
open.fixedWidth = 100;
open.margin = new RectOffset(10, 10, 0, 0);
open.normal.textColor = Swat.WindowDefaultTextColor;
open.normal.background = open.active.background = open.focused.background = Swat.ToggleButtonBackgroundSelectedTexture;
variables = new GUIStyle(GUI.skin.textField);
variables.fontSize = 12;
variables.margin = new RectOffset(10, 10, 0, 0);
variables.normal.textColor = Swat.WindowDefaultTextColor;
_scroll = GUILayout.BeginScrollView(_scroll);
GUILayout.Space(!Application.isPlaying ? 15 : 45);
EditorGUILayout.LabelField("Filter (Search for command name or description/purpose matching)", description);
search = EditorGUILayout.TextField(search, variables, new GUILayoutOption[] { GUILayout.MaxWidth(400) });
GUILayout.Space(25);
int inputFieldId = 0;
for(int x = 0; x < Commands.Count; x++) {
Command command = Commands[x];
string longestAlias = string.Empty;
bool filterActive = !string.IsNullOrEmpty(search.Trim());
bool filterMatched = false;
for(int l = 0; l < command.Aliases.Count; l++) {
if(filterActive && (command.Aliases[l].ToLower().Contains(search) || command.Purpose.ToLower().Contains(search))) {
filterMatched = true;
}
longestAlias = command.Aliases[l].Length > longestAlias.Length ? command.Aliases[l] : longestAlias;
}
if(filterActive && !filterMatched) {
continue; //Don't render this information; no match found.
}
EditorGUILayout.LabelField(longestAlias, editorName);
GUILayout.Space(4);
EditorGUILayout.LabelField(command.Purpose, description);
GUILayout.Space(6);
if(command.Args.Count > 0) {
for(int a = 0; a < command.Args.Count; a++) {
EditorGUILayout.LabelField(string.Format("(Arg {0}) <{1}> {2}", a, command.Args[a].Key, command.Args[a].Value), description);
GUILayout.Space(2);
}
GUILayout.Space(4);
if(VariableInputFields.Count == inputFieldId) {
VariableInputFields.Add(string.Empty);
}
VariableInputFields[inputFieldId] = EditorGUILayout.TextField(VariableInputFields[inputFieldId], variables, new GUILayoutOption[] { GUILayout.MaxWidth(400) });
GUILayout.Space(8);
inputFieldId++;
}
if(GUILayout.Button("Launch", open)) {
if(!EditorApplication.isPlaying) {
SimpleAlert.Pop("Console commands can only be executed when Play Mode is active.", null);
} else {
ConsoleCommands.SendCommand(string.Format("{0} {1}", longestAlias, VariableInputFields[inputFieldId - 1])); //Minus one because we are handling and incrementing this input before this onClick is implemented.
showCommandLog = true;
}
}
GUILayout.Space(20);
}
GUILayout.Space(40);
GUILayout.EndScrollView();
string arrow = showCommandLog ? "▲" : "▼";
if(Application.isPlaying) {
load.padding = showCommandLog ? new RectOffset(0, 0, -8, 0) : new RectOffset(0, 0, 0, 0);
load.fontSize = 15;
if(GUI.Button(new Rect(0, 24, Nexus.Self.position.width, 30), string.Format("{0} Show Command Log {0}", arrow), load)) {
showCommandLog = !showCommandLog;
}
if(showCommandLog) {
//_scrollConsole = GUI.BeginScrollView(new Rect(0, 30, Nexus.Self.position.width, 400), _scrollConsole, new Rect(0, 30, Nexus.Self.position.width, 400));
GUI.TextArea(new Rect(0, 50, Nexus.Self.position.width, 400), ConsoleCommands.ConsoleLog.text, console);
//GUILayout.EndScrollView();
}
}
}
19
Source : ClipCurveEditor.cs
with GNU Lesser General Public License v3.0
from disruptorbeam
with GNU Lesser General Public License v3.0
from disruptorbeam
public void DrawHeader(Rect headerRect)
{
m_BindingHierarchy.InitIfNeeded(headerRect, m_DataSource, isNewSelection);
try
{
GUILayout.BeginArea(headerRect);
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar);
m_BindingHierarchy.OnGUI(new Rect(0, 0, headerRect.width, headerRect.height));
if (m_BindingHierarchy.treeViewController != null)
m_BindingHierarchy.treeViewController.contextClickItemCallback = ContextClickItemCallback;
GUILayout.EndScrollView();
GUILayout.EndArea();
}
catch (Exception e)
{
Debug.LogException(e);
}
}
19
Source : BindingsPrinterWindow.cs
with MIT License
from Djohnnie
with MIT License
from Djohnnie
protected void OnGUI() {
if (!editor) {
editor = (BindingsPrinterWindow) EditorWindow.GetWindow<BindingsPrinterWindow>();
}
if (!Application.isPlaying) {
GUILayout.FlexibleSpace();
GUILayout.Label("Please execute the bindings printer on Play Mode", EditorStyles.message);
GUILayout.FlexibleSpace();
return;
}
if (ContextRoot.containersData == null || ContextRoot.containersData.Count == 0) {
GUILayout.FlexibleSpace();
GUILayout.Label("There are no containers in the current scene", EditorStyles.message);
GUILayout.FlexibleSpace();
return;
}
// Add window margin.
GUILayout.BeginHorizontal();
GUILayout.Space(WINDOW_MARGIN);
GUILayout.BeginVertical();
this.scrollPosition = GUILayout.BeginScrollView(scrollPosition);
GUILayout.Space(WINDOW_MARGIN);
GUILayout.Label("Adic Bindings Printer", EditorStyles.replacedle);
GUILayout.Label("Displays all bindings of all available containers", EditorStyles.containerInfo);
// Display the containers and their bindings.
for (int dataIndex = 0; dataIndex < ContextRoot.containersData.Count; dataIndex++) {
var data = ContextRoot.containersData[dataIndex];
var bindings = data.container.GetBindings();
GUILayout.Space(20f);
GUILayout.Label("CONTAINER", EditorStyles.containerInfo);
GUILayout.Label(
string.Format("[{1}] {0} ({2} | {3})", data.container.GetType().FullName, dataIndex,
data.container.identifier, (data.destroyOnLoad ? "destroy on load" : "singleton")
),
EditorStyles.replacedle
);
GUILayout.Space(10f);
// Add indentation.
GUILayout.BeginHorizontal();
GUILayout.Space(10);
GUILayout.BeginVertical();
for (int bindingIndex = 0; bindingIndex < bindings.Count; bindingIndex++) {
var binding = bindings[bindingIndex];
GUILayout.Label(binding.ToString(), EditorStyles.bindinds);
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.Space(WINDOW_MARGIN);
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
19
Source : ToluaInjectionBlackListPanel.cs
with MIT License
from focus-creative-games
with MIT License
from focus-creative-games
void OnGUI()
{
InitPathsInfo();
InitFilterListDrawer();
bool execGenerate = false;
GUILayout.BeginHorizontal(EditorStyles.toolbar);
{
if (GUILayout.Button("Add", EditorStyles.toolbarButton))
{
AddNewPath();
}
if (GUILayout.Button("Save", EditorStyles.toolbarButton))
{
SavePathsInfo();
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Generate", EditorStyles.toolbarButton))
{
execGenerate = true;
}
}
GUILayout.EndHorizontal();
GUILayout.BeginVertical();
{
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
{
pathUIList.DoLayoutList();
}
GUILayout.EndScrollView();
}
GUILayout.EndVertical();
if (execGenerate)
{
Generate();
Close();
}
}
19
Source : ChangesView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
private void DoChangesTreeGUI()
{
var rect = GUILayoutUtility.GetLastRect();
GUILayout.BeginHorizontal();
GUILayout.BeginVertical(Styles.CommitFileAreaStyle);
{
treeScroll = GUILayout.BeginScrollView(treeScroll);
{
OnTreeGUI(new Rect(0f, 0f, Position.width, Position.height - rect.height + Styles.CommitAreaPadding));
}
GUILayout.EndScrollView();
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
19
Source : HistoryView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
protected void DoHistoryGui(Rect rect, Action<GitLogEntry> historyControlRightClick = null,
Action<ChangesTreeNode> changesTreeRightClick = null)
{
if (HistoryControl != null)
{
var historyControlRect = new Rect(0f, 0f, Position.width, Position.height - rect.height);
var requiresRepaint = HistoryControl.Render(historyControlRect,
singleClick: entry => {
SelectedEntry = entry;
BuildTreeChanges();
},
doubleClick: entry => {
},
rightClick: historyControlRightClick);
if (requiresRepaint)
Redraw();
}
DoProgressGUI();
if (!SelectedEntry.Equals(GitLogEntry.Default))
{
// Top bar for scrolling to selection or clearing it
GUILayout.BeginHorizontal(EditorStyles.toolbar);
{
if (GUILayout.Button(CommitDetailsreplacedle, Styles.ToolbarButtonStyle))
{
HistoryControl.ScrollTo(HistoryControl.SelectedIndex);
}
if (GUILayout.Button(ClearSelectionButton, Styles.ToolbarButtonStyle, GUILayout.ExpandWidth(false)))
{
SelectedEntry = GitLogEntry.Default;
HistoryControl.SelectedIndex = -1;
}
}
GUILayout.EndHorizontal();
// Log entry details - including changeset tree (if any changes are found)
DetailsScroll = GUILayout.BeginScrollView(DetailsScroll, GUILayout.Height(250));
{
HistoryDetailsEntry(SelectedEntry);
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
GUILayout.Label("Files changed", EditorStyles.boldLabel);
GUILayout.Space(-5);
rect = GUILayoutUtility.GetLastRect();
GUILayout.BeginHorizontal(Styles.HistoryFileTreeBoxStyle);
GUILayout.BeginVertical();
{
var borderLeft = Styles.Label.margin.left;
var treeControlRect = new Rect(rect.x + borderLeft, rect.y, Position.width - borderLeft * 2,
Position.height - rect.height + Styles.CommitAreaPadding);
var treeRect = new Rect(0f, 0f, 0f, 0f);
if (TreeChanges != null)
{
TreeChanges.FolderStyle = Styles.Foldout;
TreeChanges.TreeNodeStyle = Styles.TreeNode;
TreeChanges.ActiveTreeNodeStyle = Styles.ActiveTreeNode;
TreeChanges.FocusedTreeNodeStyle = Styles.FocusedTreeNode;
TreeChanges.FocusedActiveTreeNodeStyle = Styles.FocusedActiveTreeNode;
treeRect = TreeChanges.Render(treeControlRect, DetailsScroll,
singleClick: node => { },
doubleClick: node => { },
rightClick: changesTreeRightClick);
if (TreeChanges.RequiresRepaint)
Redraw();
}
GUILayout.Space(treeRect.y - treeControlRect.y);
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
GUILayout.EndScrollView();
}
}
19
Source : BranchesView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
private void Render()
{
listID = GUIUtility.GetControlID(FocusType.Keyboard);
GUILayout.BeginHorizontal();
{
OnButtonBarGUI();
}
GUILayout.EndHorizontal();
var rect = GUILayoutUtility.GetLastRect();
scroll = GUILayout.BeginScrollView(scroll);
{
OnTreeGUI(new Rect(0f, 0f, Position.width, Position.height - rect.height + Styles.CommitAreaPadding));
}
GUILayout.EndScrollView();
if (Event.current.type == EventType.Repaint)
{
// Effectuating mode switch
if (mode != targetMode)
{
mode = targetMode;
Redraw();
}
}
DoProgressGUI();
}
19
Source : GitHubEnterpriseAuthenticationView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
public override void OnGUI()
{
HandleEnterPressed();
EditorGUIUtility.labelWidth = 90f;
scroll = GUILayout.BeginScrollView(scroll);
{
GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
{
GUILayout.Label(Authreplacedle, Styles.HeaderRepoLabelStyle);
}
GUILayout.EndHorizontal();
GUILayout.BeginVertical();
{
if (!hreplacederverMeta)
{
OnGUIHost();
}
else
{
EditorGUILayout.Space();
EditorGUI.BeginDisabledGroup(true);
{
GUILayout.BeginHorizontal();
{
serverAddress = EditorGUILayout.TextField(ServerAddressLabel, serverAddress, Styles.TextFieldStyle);
}
GUILayout.EndHorizontal();
}
EditorGUI.EndDisabledGroup();
if (!need2fa)
{
if (verifiablePreplacedwordAuthentication)
{
OnGUIUserPreplacedwordLogin();
}
else
{
OnGUITokenLogin();
}
if (OAuthCallbackManager.IsRunning)
{
GUILayout.Space(Styles.BaseSpacing + 3);
GUILayout.BeginHorizontal();
{
GUILayout.FlexibleSpace();
if (GUILayout.Button("Sign in with your browser", Styles.HyperlinkStyle))
{
GUI.FocusControl(null);
Application.OpenURL(oAuthOpenUrl);
}
}
GUILayout.EndHorizontal();
}
}
else
{
OnGUI2FA();
}
}
}
GUILayout.EndVertical();
}
GUILayout.EndScrollView();
}
19
Source : LocksView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
public bool Render(Rect containingRect, Action<GitLock> singleClick = null,
Action<GitLock> doubleClick = null, Action<GitLock> rightClick = null)
{
var requiresRepaint = false;
scroll = GUILayout.BeginScrollView(scroll);
{
controlId = GUIUtility.GetControlID(FocusType.Keyboard);
if (Event.current.type != EventType.Repaint)
{
if (rightClickNextRender != null)
{
rightClickNextRender.Invoke(rightClickNextRenderEntry.GitLock);
rightClickNextRender = null;
rightClickNextRenderEntry = GitLockEntry.Default;
}
}
var startDisplay = scroll.y;
var endDisplay = scroll.y + containingRect.height;
var rect = new Rect(containingRect.x, containingRect.y, containingRect.width, 0);
for (var index = 0; index < gitLockEntries.Count; index++)
{
var entry = gitLockEntries[index];
var entryRect = new Rect(rect.x, rect.y, rect.width, Styles.LocksEntryHeight);
if (Event.current.type == EventType.Layout)
{
var shouldRenderEntry = !(entryRect.y > endDisplay || entryRect.yMax < startDisplay);
visibleItems[entry.GitLock.ID] = shouldRenderEntry;
}
if (visibleItems.ContainsKey(entry.GitLock.ID) && visibleItems[entry.GitLock.ID])
{
entryRect = RenderEntry(entryRect, entry);
}
var entryRequiresRepaint =
HandleInput(entryRect, entry, index, singleClick, doubleClick, rightClick);
requiresRepaint = requiresRepaint || entryRequiresRepaint;
rect.y += entryRect.height;
}
GUILayout.Space(rect.y - containingRect.y);
}
GUILayout.EndScrollView();
return requiresRepaint;
}
19
Source : SettingsView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
public override void OnGUI()
{
scroll = GUILayout.BeginScrollView(scroll);
{
userSettingsView.OnGUI();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
if (Repository != null)
{
OnRepositorySettingsGUI();
GUILayout.Space(EditorGUIUtility.standardVerticalSpacing);
}
gitPathView.OnGUI();
OnPrivacyGui();
OnGeneralSettingsGui();
OnLoggingSettingsGui();
}
GUILayout.EndScrollView();
DoProgressGUI();
}
19
Source : GitHubAuthenticationView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
public override void OnGUI()
{
HandleEnterPressed();
EditorGUIUtility.labelWidth = 90f;
scroll = GUILayout.BeginScrollView(scroll);
{
GUILayout.BeginHorizontal(Styles.AuthHeaderBoxStyle);
{
GUILayout.Label(Authreplacedle, Styles.HeaderRepoLabelStyle);
}
GUILayout.EndHorizontal();
GUILayout.BeginVertical();
{
if (!need2fa)
{
OnGUILogin();
}
else
{
OnGUI2FA();
}
}
GUILayout.EndVertical();
}
GUILayout.EndScrollView();
}
19
Source : HistoryView.cs
with MIT License
from github-for-unity
with MIT License
from github-for-unity
public bool Render(Rect containingRect, Action<GitLogEntry> singleClick = null,
Action<GitLogEntry> doubleClick = null, Action<GitLogEntry> rightClick = null)
{
var requiresRepaint = false;
scroll = GUILayout.BeginScrollView(scroll);
{
controlId = GUIUtility.GetControlID(FocusType.Keyboard);
if (Event.current.type != EventType.Repaint)
{
if (rightClickNextRender != null)
{
rightClickNextRender.Invoke(rightClickNextRenderEntry);
rightClickNextRender = null;
rightClickNextRenderEntry = GitLogEntry.Default;
}
}
var startDisplay = scroll.y;
var endDisplay = scroll.y + containingRect.height;
var rect = new Rect(containingRect.x, containingRect.y, containingRect.width, 0);
for (var index = 0; index < entries.Count; index++)
{
var entry = entries[index];
var entryRect = new Rect(rect.x, rect.y, rect.width, Styles.HistoryEntryHeight);
var shouldRenderEntry = !(entryRect.y > endDisplay || entryRect.yMax < startDisplay);
if (shouldRenderEntry && Event.current.type == EventType.Repaint)
{
RenderEntry(entryRect, entry, index);
}
var entryRequiresRepaint =
HandleInput(entryRect, entry, index, singleClick, doubleClick, rightClick);
requiresRepaint = requiresRepaint || entryRequiresRepaint;
rect.y += Styles.HistoryEntryHeight;
}
GUILayout.Space(rect.y - containingRect.y);
}
GUILayout.EndScrollView();
return requiresRepaint;
}
19
Source : LODAsset.cs
with MIT License
from huailiang
with MIT License
from huailiang
public LodUtil.Direct GUI(LodUtil.Direct direct)
{
if (meshes != null && go != null)
{
scroll = GUILayout.BeginScrollView(scroll);
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.Label(go.name, LODGUI.totalStyle);
direct = (LodUtil.Direct)EditorGUILayout.EnumPopup(direct, GUILayout.MaxWidth(80));
if (GUILayout.Button("Visualize Bounds", GUILayout.MaxWidth(110)))
{
LodUtil.AttachCollider(go);
}
GUILayout.EndHorizontal();
GUILayout.Label("total verts: " + vertCnt + " tris: " + triCnt, LODGUI.totalStyle);
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();
int i = 0;
foreach (var mesh in meshes)
{
GUILayout.BeginHorizontal();
GUIMesh(mesh);
GUILayout.BeginVertical();
GUILayout.Space(24);
GUILayout.Label(mesh.name);
GUILayout.Label("verts: " + mesh.vertexCount);
GUILayout.Label("tris: " + mesh.triangles.Length / 3);
GUILayout.Label("bounds: " + mesh.bounds);
GUILayout.BeginHorizontal();
var render = renders[i++];
var desc = "render bones: " + render.bones.Length + " matrix:" + mesh.bindposes.Length + " weights:" + mesh.boneWeights.Length;
if (GUILayout.Button(desc, UnityEngine.GUI.skin.label) || string.IsNullOrEmpty(boneInfo)) BoneInfo(render);
GUILayout.EndHorizontal();
desc = "skin ";
if (has(mesh.uv)) desc += "uv ";
if (has(mesh.uv2)) desc += "uv2 ";
if (has(mesh.uv3)) desc += "uv3 ";
if (has(mesh.uv4)) desc += "uv4 ";
if (has(mesh.normals)) desc += "normal ";
if (has(mesh.tangents)) desc += "tangent ";
if (has(mesh.colors)) desc += "color ";
if (mesh.subMeshCount > 1) desc += "submesh ";
GUILayout.Label(desc);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
GUILayout.EndHorizontal();
GUILayout.Space(10);
GUILayout.Label(boneInfo);
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
else
{
GUILayout.Label("no gameobject attached");
}
return direct;
}
19
Source : SimpleTest.cs
with MIT License
from huanzi-qch
with MIT License
from huanzi-qch
void OnGUI()
{
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.Label(Text);
GUILayout.EndScrollView();
GUILayout.Space(5);
GUILayout.FlexibleSpace();
address = GUILayout.TextField(address);
if (this.eventSource == null && GUILayout.Button("Open Server-Sent Events"))
{
// Create the EventSource instance
this.eventSource = new EventSource(new Uri(this.address));
// Subscribe to generic events
this.eventSource.OnOpen += OnOpen;
this.eventSource.OnClosed += OnClosed;
this.eventSource.OnError += OnError;
this.eventSource.OnStateChanged += this.OnStateChanged;
this.eventSource.OnMessage += OnMessage;
// Subscribe to an application specific event
this.eventSource.On("datetime", OnDateTime);
// Start to connect to the server
this.eventSource.Open();
Text += "Opening Server-Sent Events...\n";
}
if (this.eventSource != null && this.eventSource.State == States.Open)
{
GUILayout.Space(10);
if (GUILayout.Button("Close"))
{
// Close the connection
this.eventSource.Close();
}
}
});
}
19
Source : AuthenticationSample.cs
with MIT License
from huanzi-qch
with MIT License
from huanzi-qch
void OnGUI()
{
GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
{
scrollPos = GUILayout.BeginScrollView(scrollPos, false, false);
GUILayout.BeginVertical();
if (signalRConnection.AuthenticationProvider == null)
{
GUILayout.BeginHorizontal();
GUILayout.Label("Username (Enter 'User'):");
userName = GUILayout.TextField(userName, GUILayout.MinWidth(100));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("Roles (Enter 'Invoker' or 'Admin'):");
role = GUILayout.TextField(role, GUILayout.MinWidth(100));
GUILayout.EndHorizontal();
if (GUILayout.Button("Log in"))
Restart();
}
for (int i = 0; i < signalRConnection.Hubs.Length; ++i)
(signalRConnection.Hubs[i] as BaseHub).Draw();
GUILayout.EndVertical();
GUILayout.EndScrollView();
});
}
See More Examples