public static void Draw() { _showStorage = EditorGUILayout.BeginFoldoutHeaderGroup(_showStorage, "Storage", EditorStyles.foldoutHeader); if (_showStorage) { QuotaCollection quota = FurioosInspector.connectionHandler.Quota; RegionCollection region = FurioosInspector.connectionHandler.Region; double amount = double.Parse((quota.storage + quota.extra.storage).ToString(), System.Globalization.NumberStyles.Float); double usage = double.Parse(quota.usage.storage.ToString(), System.Globalization.NumberStyles.Float); float percent = (float)usage / (float)amount; EditorGUILayout.BeginHorizontal(); GUILayout.Label("Space"); Rect progressRect = EditorGUILayout.BeginVertical(); progressRect.x += 2; progressRect.width -= 5; EditorGUI.ProgressBar( progressRect, percent, FurioosInspector.SizeSuffix((float)usage) + " / " + FurioosInspector.SizeSuffix((float)amount) ); GUILayout.Space(20); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Region"); GUILayout.FlexibleSpace(); GUILayout.Label(region.name); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndFoldoutHeaderGroup(); }
private static void Init() { FurioosInspector inspector = (FurioosInspector)EditorWindow.GetWindow(typeof(FurioosInspector), false, "Furioos"); Texture2D logo = new Texture2D(0, 0); string[] iconGUIDS = AssetDatabase.FindAssets("furioos-icon", null); if (iconGUIDS.Length > 0) { string logoPath = AssetDatabase.GUIDToAssetPath(iconGUIDS[0]); logo = (Texture2D)AssetDatabase.LoadAssetAtPath(logoPath, typeof(Texture2D)); } inspector.titleContent = new GUIContent("Furioos", logo); inspector.minSize = new Vector2(350.0f, 520.0f); inspector.Show(); }
public static void Draw() { _showApplication = EditorGUILayout.BeginFoldoutHeaderGroup(_showApplication, "Application", EditorStyles.foldoutHeader); if (_showApplication) { ApplicationCollection[] applications = FurioosInspector.connectionHandler.Applications; GUIContent dropDownContent = new GUIContent( (FurioosInspector.selectedApplication != null) ? FurioosInspector.selectedApplication.name : "Select an application" ); Rect dropdownRect = EditorGUILayout.BeginHorizontal(); if (EditorGUILayout.DropdownButton(dropDownContent, FocusType.Passive)) { GenericMenu menu = new GenericMenu(); for (int i = 0; i < applications.Length; i++) { string id = FurioosInspector.selectedApplication?._id ?? ""; menu.AddItem( new GUIContent(applications[i].name), (id == applications[i]._id), OnApplicationSelected, i ); } menu.AddSeparator(""); menu.AddItem(new GUIContent("Create new application..."), false, OnCreateSelected); menu.DropDown(dropdownRect); menu.ShowAsContext(); } EditorGUILayout.EndHorizontal(); if (FurioosInspector.selectedApplication == null) { EditorGUILayout.EndFoldoutHeaderGroup(); return; } FurioosInspector.selectedApplication.name = EditorGUILayout.TextField(new GUIContent("Name"), FurioosInspector.selectedApplication.name); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Description"); Rect textAreaRect = EditorGUILayout.BeginVertical(); textAreaRect.x += 2; textAreaRect.width -= 5; FurioosInspector.selectedApplication.description = EditorGUI.TextArea(textAreaRect, FurioosInspector.selectedApplication.description); GUILayout.Space(70); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); GUILayout.Space(1); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Thumbnail"); Rect previewRect = EditorGUILayout.BeginVertical(); previewRect.x += 2; previewRect.width -= 5; if (FurioosInspector.selectedApplication.thumbnailUrl != "") { //EditorGUI.DrawPreviewTexture(previewRect, _selectedApplicationThumbnail); } EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); FurioosInspector.selectedApplication.parameters.defaultQuality = (int)(QualityModes)EditorGUILayout.EnumPopup( "Quality", (QualityModes)FurioosInspector.selectedApplication.parameters.defaultQuality ); FurioosInspector.selectedApplication.parameters.mouseLock = EditorGUILayout.Toggle( "Mouse lock", FurioosInspector.selectedApplication.parameters.mouseLock ); FurioosInspector.selectedApplication.parameters.touchConvert = EditorGUILayout.Toggle( "Convert touch", FurioosInspector.selectedApplication.parameters.touchConvert ); GUI.enabled = false; EditorGUILayout.EnumPopup("GPU type", GPUTypes.Standard); GUI.enabled = !FurioosInspector.lockUI; EditorGUILayout.BeginHorizontal(); GUILayout.Label("Size"); GUILayout.FlexibleSpace(); GUILayout.Label( FurioosInspector.SizeSuffix(FurioosInspector.selectedApplication.binaries[0].size) ); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); Rect saveButtonRect = EditorGUILayout.BeginVertical(); saveButtonRect.width /= 2; saveButtonRect.x = saveButtonRect.width / 2; if (GUI.Button(saveButtonRect, "Save changes")) { FurioosInspector.SaveChanges(); } GUILayout.Space(40); EditorGUILayout.EndVertical(); } EditorGUILayout.EndFoldoutHeaderGroup(); }