void CheckAvailability() { style.display = Unsupported.IsDeveloperBuild() && ModeService.hasSwitchableModes ? DisplayStyle.Flex : DisplayStyle.None; UpdateContent(); }
public void OnEnable() { m_PageManager.onRefreshOperationStart += OnRefreshOperationStartOrFinish; m_PageManager.onRefreshOperationFinish += OnRefreshOperationStartOrFinish; m_PageManager.onVisualStateChange += OnVisualStateChange; m_PageManager.onListRebuild += OnListRebuild; m_PageManager.onListUpdate += OnListUpdate; m_PageManager.onSelectionChanged += OnSelectionChanged; m_AssetStoreCallQueue.onCheckUpdateProgress += OnCheckUpdateProgress; m_UnityConnect.onUserLoginStateChange += OnUserLoginStateChange; m_SettingsProxy.onSeeAllVersionsChanged += OnSeeAllPackageVersionsChanged; m_PackageFiltering.onFilterTabChanged += OnFilterTabChanged; listView.OnEnable(); packageLoadBar.OnEnable(); if (!Unsupported.IsDeveloperBuild() && m_SettingsProxy.seeAllPackageVersions) { m_SettingsProxy.seeAllPackageVersions = false; m_SettingsProxy.Save(); } // manually build the items on initialization to refresh the UI OnListRebuild(m_PageManager.GetCurrentPage()); }
public void OnGUI() { GUILayout.BeginArea(new Rect(0f, 0f, kWindowSize.x, kWindowSize.y)); if (Unity.PackageManager.PackageManager.Instance == null) { GUILayout.Box(new GUIContent("Package Manager Unavailable"), Unity.PackageManager.UI.Styles.debugBox, new GUILayoutOption[0]); } else { if (Unsupported.IsDeveloperBuild()) { this.ChannelSelector(); } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(200f), GUILayout.ExpandWidth(true) }; GUILayout.BeginVertical(options); this.listView.parent = this; this.listView.OnGUI(); GUILayout.EndVertical(); if (Event.current.type == EventType.Layout) { this.infoView.package = this.listView.SelectedPackage; } this.infoView.OnGUI(); GUILayout.EndArea(); } }
void OnEnable() { #if UNITY_2018_3_OR_NEWER if (m_ConsoleAttachToPlayerState == null) { m_ConsoleAttachToPlayerState = new ConsoleAttachToPlayerState(this); } #endif MakeSureConsoleAlwaysOnlyOne(); titleContent = EditorGUIUtility.TextContentWithIcon("Console", "UnityEditor.ConsoleWindow"); titleContent = new GUIContent(titleContent) { text = "ConsoleT" }; ms_ConsoleWindow = this; #if UNITY_2018_1_OR_NEWER m_DevBuild = Unsupported.IsDeveloperMode(); #else m_DevBuild = Unsupported.IsDeveloperBuild(); #endif LogEntries.wrapped.searchHistory = m_SearchHistory; Constants.LogStyleLineCount = EditorPrefs.GetInt("ConsoleWindowLogLineCount", 2); Application.logMessageReceived += DoLogChanged; }
private void UploadAPK(bool retryUpload) { if (this.OnProgress != null) { this.OnProgress(this, "Copying APK package to device " + this._device.Describe()); } string str = this._device.Install(this._installPath, null); if (!retryUpload && (str.Contains("[INSTALL_FAILED_UPDATE_INCOMPATIBLE]") || str.Contains("[INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]"))) { Debug.LogWarning("Application update incompatible (signed with different keys?); removing previous installation (PlayerPrefs will be lost)...\n"); if (this.OnProgress != null) { this.OnProgress(this, "Removing " + this._packageName + " from device " + this._device.Describe()); } this._device.Uninstall(this._packageName, null); this.UploadAPK(true); } else { if (((str.Contains("protocol failure") || str.Contains("No space left on device")) || (str.Contains("[INSTALL_FAILED_INSUFFICIENT_STORAGE]") || str.Contains("[INSTALL_FAILED_UPDATE_INCOMPATIBLE]"))) || ((str.Contains("[INSTALL_FAILED_MEDIA_UNAVAILABLE]") || str.Contains("[INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]")) || str.Contains("Failure ["))) { Debug.LogError("Installation failed with the following output:\n" + str); CancelPostProcess.AbortBuildPointToConsole("Unable to install APK!", "Installation failed."); } bool flag = this._developmentPlayer || Unsupported.IsDeveloperBuild(); if (this.OnProgress != null) { this.OnProgress(this, "Setting device property CheckJNI to " + flag); } this._device.SetProperty("debug.checkjni", !flag ? "0" : "1", null); } }
/// <summary> /// Sets the default values for the preferences, when `default(type)` is not the right default value. /// </summary> protected virtual void SetDefaultValues() { if (Unsupported.IsDeveloperBuild()) { SetBoolNoEditorUpdate(BoolPref.ErrorOnRecursiveDispatch, true); } }
public virtual void AddItemsToMenu(GenericMenu menu) { menu.AddItem(new GUIContent("Reload"), false, new GenericMenu.MenuFunction(this.Reload)); if (Unsupported.IsDeveloperBuild()) { menu.AddItem(new GUIContent("About"), false, new GenericMenu.MenuFunction(this.About)); } }
void InitDefaultForEditorPrefs() { // specific default values, if you want something else than VSPreferences default for editor if (Unsupported.IsDeveloperBuild()) { base.SetBool(BoolPref.ErrorOnRecursiveDispatch, true); base.SetBool(BoolPref.ErrorOnMultipleDispatchesPerFrame, true); } }
public static void StorePanelPrefs() { if (Unsupported.IsDeveloperBuild() || UnityConnect.preferencesEnabled) { foreach (KeyValuePair <string, CloudPanelPref> pair in m_CloudPanelPref) { pair.Value.StoreCloudServicePref(); } } }
public static void StorePanelPrefs() { if (!Unsupported.IsDeveloperBuild() && !UnityConnect.preferencesEnabled) { return; } foreach (KeyValuePair <string, UnityConnectPrefs.CloudPanelPref> current in UnityConnectPrefs.m_CloudPanelPref) { current.Value.StoreCloudServicePref(); } }
public ScriptingImplementation[] Enabled() { if (Unsupported.IsDeveloperBuild()) { return(new ScriptingImplementation[] { ScriptingImplementation.Mono2x, ScriptingImplementation.IL2CPP }); } return(new ScriptingImplementation[1]); }
public override void ShowPlatformBuildOptions() { if (!InternalEditorUtility.RunningUnderWindows8()) { GUILayout.Label(EditorGUIUtility.TextContent("You have to use Windows 8 or greater for this build."), EditorStyles.wordWrappedLabel, new GUILayoutOption[0]); } int selectedIndex = Math.Max(0, Array.IndexOf <WSASDK>(this.wsaSDKs, EditorUserBuildSettings.wsaSDK)); selectedIndex = EditorGUILayout.Popup(this.wsaSDK, selectedIndex, this.wsaSDKStrings, new GUILayoutOption[0]); EditorUserBuildSettings.wsaSDK = this.wsaSDKs[selectedIndex]; selectedIndex = Math.Max(0, Array.IndexOf <WSASubtarget>(this.wsaSubtargets, EditorUserBuildSettings.wsaSubtarget)); selectedIndex = EditorGUILayout.Popup(this.wsaSubtarget, selectedIndex, this.wsaSubtargetStrings, new GUILayoutOption[0]); EditorUserBuildSettings.wsaSubtarget = this.wsaSubtargets[selectedIndex]; GUI.enabled = EditorUserBuildSettings.wsaSDK == WSASDK.UWP; selectedIndex = Math.Max(0, Array.IndexOf <WSAUWPBuildType>(this.uwpBuildTypes, EditorUserBuildSettings.wsaUWPBuildType)); selectedIndex = EditorGUILayout.Popup(this.uapBuildType, selectedIndex, this.uwpBuildTypeStrings, new GUILayoutOption[0]); EditorUserBuildSettings.wsaUWPBuildType = this.uwpBuildTypes[selectedIndex]; selectedIndex = Math.Max(0, Array.IndexOf <string>(this.uwpSDKs, EditorUserBuildSettings.wsaUWPSDK)); selectedIndex = EditorGUILayout.Popup(this.uwpSDK, selectedIndex, this.uwpSDKStrings, new GUILayoutOption[0]); EditorUserBuildSettings.wsaUWPSDK = this.uwpSDKs[selectedIndex]; GUI.enabled = (EditorUserBuildSettings.wsaSDK == WSASDK.UniversalSDK81) || (EditorUserBuildSettings.wsaSDK == WSASDK.UWP); selectedIndex = Math.Max(0, Array.IndexOf <WSABuildAndRunDeployTarget>(this.wsaBuildAndRunDeployTargets, EditorUserBuildSettings.wsaBuildAndRunDeployTarget)); selectedIndex = EditorGUILayout.Popup(this.wsaBuildAndRunDeployTarget, selectedIndex, this.wsaBuildAndRunDeployTargetStrings, new GUILayoutOption[0]); EditorUserBuildSettings.wsaBuildAndRunDeployTarget = this.wsaBuildAndRunDeployTargets[selectedIndex]; GUI.enabled = true; ScriptingImplementation currentScriptingBackend = this.CurrentScriptingBackend; if (currentScriptingBackend == ScriptingImplementation.WinRTDotNET) { if (!this.targetExtension.hasDotNetPlayers) { EditorGUILayout.HelpBox("Currently selected scripting backend (.NET) is not installed.", MessageType.Error); } } else if (EditorUserBuildSettings.wsaSDK != WSASDK.UWP) { EditorGUILayout.HelpBox("Currently selected scripting backend (IL2CPP) does not support selected SDK.", MessageType.Error); } else if (!this.targetExtension.hasIl2CppPlayers) { EditorGUILayout.HelpBox("Currently selected scripting backend (IL2CPP) is not installed.", MessageType.Error); } UserBuildSettings.copyReferences = EditorGUILayout.Toggle(this.copyReferences, UserBuildSettings.copyReferences, new GUILayoutOption[0]); EditorGUILayout.LabelField(EditorGUIUtility.TextContent("Debugging"), EditorStyles.boldLabel, new GUILayoutOption[0]); EditorGUI.BeginDisabledGroup(currentScriptingBackend != ScriptingImplementation.WinRTDotNET); EditorUserBuildSettings.wsaGenerateReferenceProjects = EditorGUILayout.Toggle(this.generateCSharpProjectsText, EditorUserBuildSettings.wsaGenerateReferenceProjects, new GUILayoutOption[0]); EditorGUI.EndDisabledGroup(); if (Unsupported.IsDeveloperBuild() && GUILayout.Button("Copy Pdb files to SourceBuild", new GUILayoutOption[0])) { this.CopyPdbFilesToAppX(); } }
public static void StorePanelPrefs() { if (!Unsupported.IsDeveloperBuild() && !UnityConnect.preferencesEnabled) { return; } using (Dictionary <string, UnityConnectPrefs.CloudPanelPref> .Enumerator enumerator = UnityConnectPrefs.m_CloudPanelPref.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.Value.StoreCloudServicePref(); } } }
public static int GetServiceEnv(string serviceName) { if (Unsupported.IsDeveloperBuild() || UnityConnect.preferencesEnabled) { return(EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelServer", serviceName))); } for (int index = 0; index < UnityConnectPrefs.kEnvironmentFamilies.Length; ++index) { if (UnityConnectPrefs.kEnvironmentFamilies[index].Equals(UnityConnect.instance.configuration, StringComparison.InvariantCultureIgnoreCase)) { return(index); } } return(0); }
public void Execute(PostProcessorContext context) { if (this.OnProgress != null) { this.OnProgress(this, "Building"); } string str = context.Get <string>("StagingArea"); int system = context.Get <int>("ProjectType"); if (system != 1) { throw new UnityException("Illegal project type: " + system); } AndroidProjectExport.Create(system).Export(context, null); bool flag = PlayerSettings.Android.keyaliasName.Length != 0; bool flag2 = context.Get <bool>("DevelopmentPlayer"); string sourceFileName = ""; string task = ""; string[] components = new string[] { "Temp", "gradleOut" }; string workingdir = Paths.Combine(components); if (flag2 || Unsupported.IsDeveloperBuild()) { task = "assembleDebug"; string[] textArray2 = new string[] { workingdir, "build", "outputs", "apk", "gradleOut-debug.apk" }; sourceFileName = Paths.Combine(textArray2); } else { if (!flag) { CancelPostProcess.AbortBuild("Build Failure", "Release builds have to be signed when using Gradle", null); return; } task = "assembleRelease"; string[] textArray3 = new string[] { workingdir, "build", "outputs", "apk", "gradleOut-release.apk" }; sourceFileName = Paths.Combine(textArray3); } GradleWrapper.Run(workingdir, task, delegate(string task) { if (((this.OnProgress != null) && (task != "")) && (task[0] == ':')) { this.OnProgress(this, "Task " + task.Substring(1)); } }); string[] textArray4 = new string[] { str, "Package.apk" }; File.Move(sourceFileName, Paths.Combine(textArray4)); }
public ScriptingImplementation[] Enabled() { ScriptingImplementation[] result; if (Unsupported.IsDeveloperBuild()) { result = new ScriptingImplementation[] { ScriptingImplementation.Mono2x, ScriptingImplementation.IL2CPP }; } else { result = new ScriptingImplementation[1]; } return(result); }
private void BuildApk(PostProcessorContext context) { bool flag = context.Get <bool>("DevelopmentPlayer"); AndroidLibraries libraries = context.Get <AndroidLibraries>("AndroidLibraries"); bool flag2 = PlayerSettings.Android.keyaliasName.Length != 0; string str = Path.Combine(Environment.CurrentDirectory, this._stagingArea); string[] first = new string[] { "apk", $"{str}/Package_unaligned.apk", "-z", $"{str}/assets.ap_", "-z", $"{str}/bin/resources.ap_", "-nf", $"{str}/libs", "-f", $"{str}/bin/classes.dex", "-v" }; foreach (string str2 in libraries.GetLibraryDirectories()) { string[] second = new string[] { "-nf", str2 }; first = first.Concat <string>(second).ToArray <string>(); } foreach (string str3 in libraries.GetAssetsDirectories()) { string[] textArray3 = new string[] { "-A", str3 }; first = first.Concat <string>(textArray3).ToArray <string>(); } if (flag2) { string str4 = !Path.IsPathRooted(PlayerSettings.Android.keystoreName) ? Path.Combine(Directory.GetCurrentDirectory(), PlayerSettings.Android.keystoreName) : PlayerSettings.Android.keystoreName; string[] textArray4 = new string[] { "-k", str4, "-kp", PlayerSettings.Android.keystorePass, "-kk", PlayerSettings.Android.keyaliasName, "-kkp", PlayerSettings.Android.keyaliasPass }; first = first.Concat <string>(textArray4).ToArray <string>(); } if (flag || Unsupported.IsDeveloperBuild()) { string[] textArray5 = new string[] { "-d" }; first = first.Concat <string>(textArray5).ToArray <string>(); } if (File.Exists(Path.Combine(this._stagingArea, "raw.ap_"))) { string[] textArray6 = new string[] { "-z", $"{str}/raw.ap_" }; first = first.Concat <string>(textArray6).ToArray <string>(); } string message = TasksCommon.SDKTool(context, first, this._stagingArea, "Failed to build apk."); string fileName = Path.Combine(this._stagingArea, "Package_unaligned.apk"); FileInfo info = new FileInfo(fileName); if (!File.Exists(fileName) || (info.Length == 0L)) { Debug.LogError(message); CancelPostProcess.AbortBuildPointToConsole("APK Builder Failed!", "Failed to build APK package."); } }
void OnContextChange() { // Sync the toolbar m_PickToggle.SetValueWithoutNotify(m_Context.pickElement); m_ShowLayoutToggle.SetValueWithoutNotify(m_Context.showLayoutBound); if (Unsupported.IsDeveloperBuild()) { m_RepaintOverlayToggle.SetValueWithoutNotify(m_Context.showRepaintOverlay); m_ShowDrawStatsToggle.SetValueWithoutNotify(m_Context.showDrawStats); m_BreakBatchesToggle.SetValueWithoutNotify(m_Context.breakBatches); m_ShowWireframeToggle.SetValueWithoutNotify(m_Context.showWireframe); ApplyToPanel(m_Context); } panelDebug?.MarkDirtyRepaint(); panelDebug?.MarkDebugContainerDirtyRepaint(); }
void BuildGraphViewContextualMenu() { if (!(m_Evt.target is GraphView) && !(m_Evt.target is Placemat)) { return; } m_Evt.menu.AppendAction("Create Node", menuAction => { m_GraphView.window.DisplaySmartSearch(menuAction); }); m_Evt.menu.AppendAction("Create Placemat", menuAction => { Vector2 mousePosition = menuAction?.eventInfo?.mousePosition ?? Event.current.mousePosition; Vector2 graphPosition = m_GraphView.contentViewContainer.WorldToLocal(mousePosition); m_Store.Dispatch(new CreatePlacematAction(null, new Rect(graphPosition.x, graphPosition.y, 200, 200))); }); m_Evt.menu.AppendSeparator(); if (!(m_Evt.target is GraphView)) { return; } m_Evt.menu.AppendAction("Cut", menuAction => m_GraphView.InvokeCutSelectionCallback(), x => m_GraphView.CanCutSelection() ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled); m_Evt.menu.AppendAction("Copy", menuAction => m_GraphView.InvokeCopySelectionCallback(), x => m_GraphView.CanCopySelection() ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled); m_Evt.menu.AppendAction("Paste", menuAction => m_GraphView.InvokePasteCallback(), x => m_GraphView.CanPaste() ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled); if (Unsupported.IsDeveloperBuild()) { m_Evt.menu.AppendSeparator(); m_Evt.menu.AppendAction("Internal/Refresh All UI", menuAction => m_Store.Dispatch(new RefreshUIAction(UpdateFlags.All))); } }
void OnContextChange() { // Sync the toolbar m_PickToggle.SetValueWithoutNotify(m_Context.pickElement); m_ShowLayoutToggle.SetValueWithoutNotify(m_Context.showLayoutBound); if (Unsupported.IsDeveloperBuild()) { m_RepaintOverlayToggle.SetValueWithoutNotify(m_Context.showRepaintOverlay); m_ShowDrawStatsToggle.SetValueWithoutNotify(m_Context.showDrawStats); var updater = (panel as BaseVisualElementPanel)?.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater; if (updater != null) { updater.DebugGetRenderChain().drawStats = m_Context.showDrawStats; } } panelDebug?.MarkDirtyRepaint(); panelDebug?.MarkDebugContainerDirtyRepaint(); }
public static int GetServiceEnv(string serviceName) { int result; if (Unsupported.IsDeveloperBuild() || UnityConnect.preferencesEnabled) { result = EditorPrefs.GetInt(UnityConnectPrefs.ServicePrefKey("CloudPanelServer", serviceName)); } else { for (int i = 0; i < UnityConnectPrefs.kEnvironmentFamilies.Length; i++) { string text = UnityConnectPrefs.kEnvironmentFamilies[i]; if (text.Equals(UnityConnect.instance.configuration, StringComparison.InvariantCultureIgnoreCase)) { result = i; return(result); } } result = 0; } return(result); }
void BuildRefactorContextualMenu(IReadOnlyCollection <IGraphElementModel> selectedModels) { var models = selectedModels.OfType <INodeModel>().ToArray(); if (!models.Any()) { return; } var canDisable = models.Any(); var willDisable = models.Any(n => n.State == ModelState.Enabled); if (canDisable) { m_Evt.menu.AppendAction(willDisable ? "Disable Selection" : "Enable Selection", menuAction => { m_Store.Dispatch(new SetNodeEnabledStateAction(models, willDisable ? ModelState.Disabled : ModelState.Enabled)); }); } if (Unsupported.IsDeveloperBuild()) { m_Evt.menu.AppendAction("Internal/Redefine Node", action => { foreach (var model in selectedModels.OfType <NodeModel>()) { model.DefineNode(); } }, _ => DropdownMenuAction.Status.Normal); m_Evt.menu.AppendAction("Internal/Refresh Selected Element(s)", menuAction => { m_Store.Dispatch(new RefreshUIAction(selectedModels.ToList())); }, _ => DropdownMenuAction.Status.Normal); } }
public void OnGUI() { if (m_ScheduledWindowPicking) { if (m_PickingData.TrySelectWindow(m_ScheduledWindowPicking)) { EndPicking(m_PickingData.Selected); m_VisualTreeTreeView.ExpandAll(); } m_ScheduledWindowPicking = null; } else if (m_ScheduleRestoreSelection) { m_ScheduleRestoreSelection = false; if (m_PickingData.TryRestoreSelectedWindow(m_LastWindowTitle)) { EndPicking(m_PickingData.Selected); m_VisualTreeTreeView.ExpandAll(); } else { m_LastWindowTitle = String.Empty; } } EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); bool refresh = false; EditorGUI.BeginChangeCheck(); m_PickingData.DoSelectDropDown(() => { Dictionary <int, Panel> .Enumerator it = UIElementsUtility.GetPanelsIterator(); while (it.MoveNext()) { it.Current.Value.panelDebug = null; } m_Refresh = true; }); bool includeShadowHierarchy = GUILayout.Toggle(m_VisualTreeTreeView.includeShadowHierarchy, Styles.includeShadowHierarchyContent, EditorStyles.toolbarButton); if (includeShadowHierarchy != m_VisualTreeTreeView.includeShadowHierarchy) { m_VisualTreeTreeView.includeShadowHierarchy = includeShadowHierarchy; refresh = true; } GUI.enabled = m_CurPanel.HasValue; bool newPickingElementInPanel = GUILayout.Toggle(m_PickingElementInPanel, Styles.pickElementInPanelContent, EditorStyles.toolbarButton); m_PickingElementInPanel = newPickingElementInPanel; GUI.enabled = true; m_Overlay = GUILayout.Toggle(m_Overlay, Styles.overlayContent, EditorStyles.toolbarButton); // Note for future us : the UXML reload feature isn't quite ready to be public if (Unsupported.IsDeveloperBuild()) { bool uxmlLiveReloadIsEnabled = RetainedMode.UxmlLiveReloadIsEnabled; bool newUxmlLiveReloadIsEnabled = GUILayout.Toggle(uxmlLiveReloadIsEnabled, Styles.liveReloadContent, EditorStyles.toolbarButton); if (newUxmlLiveReloadIsEnabled != uxmlLiveReloadIsEnabled) { RetainedMode.UxmlLiveReloadIsEnabled = newUxmlLiveReloadIsEnabled; } } EditorGUILayout.EndHorizontal(); if (refresh || m_Refresh) { EndPicking(m_PickingData.Selected); } if (m_CurPanel.HasValue) { if (m_CurPanel.Value.Panel.panelDebug.enabled != (m_Overlay || m_PickingElementInPanel)) { m_CurPanel.Value.Panel.panelDebug.enabled = m_Overlay || m_PickingElementInPanel; m_CurPanel.Value.Panel.visualTree.Dirty(ChangeType.Repaint); } SplitterGUILayout.BeginHorizontalSplit(m_SplitterState, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); SplitterGUILayout.EndHorizontalSplit(); float column1Width = m_SplitterState.realSizes.Length > 0 ? m_SplitterState.realSizes[0] : 150; float column2Width = position.width - column1Width; Rect column1Rect = new Rect(0, EditorGUI.kWindowToolbarHeight, column1Width, position.height - EditorGUI.kWindowToolbarHeight); Rect column2Rect = new Rect(column1Width, EditorGUI.kWindowToolbarHeight, column2Width, column1Rect.height); m_VisualTreeTreeView.OnGUI(column1Rect); DrawSelection(column2Rect); // Draw separator EditorGUI.DrawRect( new Rect(column1Width + column1Rect.xMin, column1Rect.y, 1, column1Rect.height), Styles.separatorColor); } }
private void DoGraphToolbar(Rect toolbarRect) { GUILayout.BeginArea(toolbarRect); GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]); if (this.miniTool) { if (GUILayout.Button(AnimatorControllerTool.s_Styles.visibleOFF, AnimatorControllerTool.s_Styles.invisibleButton, new GUILayoutOption[0])) { this.miniTool = false; } GUILayout.Space(10f); } AnimatorControllerTool.BreadCrumbElement[] array = this.m_BreadCrumbs.ToArray(); for (int i = 0; i < array.Length; i++) { AnimatorControllerTool.BreadCrumbElement breadCrumbElement = array[i]; if (this.miniTool && i == 0) { if (EditorGUILayout.ButtonMouseDown(new GUIContent(breadCrumbElement.name), FocusType.Keyboard, EditorStyles.toolbarPopup, new GUILayoutOption[0])) { AnimatorControllerLayer[] layers = this.animatorController.layers; GenericMenu genericMenu = new GenericMenu(); for (int j = 0; j < layers.Length; j++) { genericMenu.AddItem(new GUIContent(layers[j].name), false, new GenericMenu.MenuFunction2(this.SetCurrentLayer), j); } genericMenu.AddSeparator(string.Empty); genericMenu.AddItem(new GUIContent("Create New Layer"), false, new GenericMenu.MenuFunction(this.AddNewLayer)); genericMenu.ShowAsContext(); } } else { EditorGUI.BeginChangeCheck(); GUILayout.Toggle(i == array.Length - 1, breadCrumbElement.name, (i != 0) ? AnimatorControllerTool.s_Styles.breadCrumbMid : AnimatorControllerTool.s_Styles.breadCrumbLeft, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.GoToBreadCrumbTarget(breadCrumbElement.target); } } } GUILayout.FlexibleSpace(); using (new EditorGUI.DisabledScope(this.animatorController == null)) { if (Unsupported.IsDeveloperBuild() && GUILayout.Button("Select Graph", EditorStyles.toolbarButton, new GUILayoutOption[0])) { if (this.m_BreadCrumbs.Last <AnimatorControllerTool.BreadCrumbElement>().target is AnimatorStateMachine) { Selection.activeObject = this.stateMachineGraph; } else { Selection.activeObject = this.blendTreeGraph; } } } AnimatorControllerTool.BreadCrumbElement breadCrumbElement2 = this.m_BreadCrumbs.LastOrDefault <AnimatorControllerTool.BreadCrumbElement>(); if (breadCrumbElement2 != null && breadCrumbElement2.target is AnimatorStateMachine) { this.m_AutoLiveLink = GUILayout.Toggle(this.m_AutoLiveLink, "Auto Live Link", EditorStyles.toolbarButton, new GUILayoutOption[0]); } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
private static MethodInfo[] FetchStaticAPIMethodInfo() { bool isDevBuild = Unsupported.IsDeveloperBuild(); return(AppDomain.CurrentDomain.GetAllStaticMethods(isDevBuild)); }
public static int GetLastColumnIndex() => (!Unsupported.IsDeveloperBuild() ? 15 : 0x16);
public new void OnEnable() { base.OnEnable(); DebuggerEventDispatchingStrategy.s_GlobalPanelDebug = this; m_DebuggerSelection = new DebuggerSelection(); m_RepaintOverlay = new RepaintOverlayPainter(); m_PickOverlay = new HighlightOverlayPainter(); m_LayoutOverlay = new LayoutOverlayPainter(); var root = this.rootVisualElement; var sheet = EditorGUIUtility.Load(k_DefaultStyleSheetPath) as StyleSheet; root.styleSheets.Add(sheet); StyleSheet colorSheet; if (EditorGUIUtility.isProSkin) { colorSheet = EditorGUIUtility.Load(k_DefaultDarkStyleSheetPath) as StyleSheet; } else { colorSheet = EditorGUIUtility.Load(k_DefaultLightStyleSheetPath) as StyleSheet; } root.styleSheets.Add(colorSheet); root.Add(m_Toolbar); m_PickToggle = new ToolbarToggle() { name = "pickToggle" }; m_PickToggle.text = "Pick Element"; m_PickToggle.RegisterValueChangedCallback((e) => { m_PickElement = e.newValue; // On OSX, as focus-follow-mouse is not supported, // we explicitly focus the EditorWindow when enabling picking if (Application.platform == RuntimePlatform.OSXEditor) { Panel p = m_DebuggerSelection.panel as Panel; if (p != null) { TryFocusCorrespondingWindow(p); } } }); m_Toolbar.Add(m_PickToggle); m_ShowLayoutToggle = new ToolbarToggle() { name = "layoutToggle" }; m_ShowLayoutToggle.SetValueWithoutNotify(m_ShowLayoutBound); m_ShowLayoutToggle.text = "Show Layout"; m_ShowLayoutToggle.RegisterValueChangedCallback((e) => { m_ShowLayoutBound = e.newValue; panelDebug?.MarkDirtyRepaint(); panelDebug?.MarkDebugContainerDirtyRepaint(); }); m_Toolbar.Add(m_ShowLayoutToggle); if (Unsupported.IsDeveloperBuild()) { m_RepaintOverlayToggle = new ToolbarToggle() { name = "repaintOverlayToggle" }; m_RepaintOverlayToggle.text = "Repaint Overlay"; m_RepaintOverlayToggle.RegisterValueChangedCallback((e) => m_ShowRepaintOverlay = e.newValue); m_Toolbar.Add(m_RepaintOverlayToggle); m_UXMLLiveReloadToggle = new ToolbarToggle() { name = "UXMLReloadToggle" }; m_UXMLLiveReloadToggle.SetValueWithoutNotify(RetainedMode.UxmlLiveReloadIsEnabled); m_UXMLLiveReloadToggle.text = "UXML Live Reload"; m_UXMLLiveReloadToggle.RegisterValueChangedCallback((e) => RetainedMode.UxmlLiveReloadIsEnabled = e.newValue); m_Toolbar.Add(m_UXMLLiveReloadToggle); m_ShowDrawStatsToggle = new ToolbarToggle() { name = "drawStatsToggle" }; m_ShowDrawStatsToggle.text = "Draw Stats"; m_ShowDrawStatsToggle.RegisterValueChangedCallback((e) => { var updater = (panel as BaseVisualElementPanel)?.GetUpdater(VisualTreeUpdatePhase.Repaint) as UIRRepaintUpdater; if (updater != null) { updater.DebugGetRenderChain().drawStats = e.newValue; } panelDebug?.MarkDirtyRepaint(); }); m_Toolbar.Add(m_ShowDrawStatsToggle); } var splitter = new DebuggerSplitter(); root.Add(splitter); m_TreeViewContainer = new DebuggerTreeView(m_DebuggerSelection, SelectElement); m_TreeViewContainer.style.flexGrow = 1f; splitter.leftPane.Add(m_TreeViewContainer); m_StylesDebuggerContainer = new StylesDebugger(m_DebuggerSelection); splitter.rightPane.Add(m_StylesDebuggerContainer); }
public void Initialize(EditorWindow debuggerWindow, VisualElement root, DebuggerContext context) { base.Initialize(debuggerWindow); m_Root = root; m_Context = context; m_Context.onStateChange += OnContextChange; var sheet = EditorGUIUtility.Load(k_DefaultStyleSheetPath) as StyleSheet; m_Root.styleSheets.Add(sheet); StyleSheet colorSheet; if (EditorGUIUtility.isProSkin) { colorSheet = EditorGUIUtility.Load(k_DefaultDarkStyleSheetPath) as StyleSheet; } else { colorSheet = EditorGUIUtility.Load(k_DefaultLightStyleSheetPath) as StyleSheet; } m_Root.styleSheets.Add(colorSheet); m_Root.Add(m_Toolbar); m_PickToggle = new ToolbarToggle() { name = "pickToggle" }; m_PickToggle.text = "Pick Element"; m_PickToggle.RegisterValueChangedCallback((e) => { m_Context.pickElement = e.newValue; // On OSX, as focus-follow-mouse is not supported, // we explicitly focus the EditorWindow when enabling picking if (Application.platform == RuntimePlatform.OSXEditor) { Panel p = m_Context.selection.panel as Panel; if (p != null) { TryFocusCorrespondingWindow(p.ownerObject); } } }); m_Toolbar.Add(m_PickToggle); m_ShowLayoutToggle = new ToolbarToggle() { name = "layoutToggle" }; m_ShowLayoutToggle.text = "Show Layout"; m_ShowLayoutToggle.RegisterValueChangedCallback((e) => { m_Context.showLayoutBound = e.newValue; }); m_Toolbar.Add(m_ShowLayoutToggle); if (Unsupported.IsDeveloperBuild()) { m_RepaintOverlayToggle = new ToolbarToggle() { name = "repaintOverlayToggle" }; m_RepaintOverlayToggle.text = "Repaint Overlay"; m_RepaintOverlayToggle.RegisterValueChangedCallback((e) => m_Context.showRepaintOverlay = e.newValue); m_Toolbar.Add(m_RepaintOverlayToggle); m_ShowDrawStatsToggle = new ToolbarToggle() { name = "drawStatsToggle" }; m_ShowDrawStatsToggle.text = "Draw Stats"; m_ShowDrawStatsToggle.RegisterValueChangedCallback((e) => { m_Context.showDrawStats = e.newValue; }); m_Toolbar.Add(m_ShowDrawStatsToggle); } var splitter = new DebuggerSplitter(); m_Root.Add(splitter); m_TreeViewContainer = new DebuggerTreeView(m_Context.selection, SelectElement); m_TreeViewContainer.style.flexGrow = 1f; splitter.leftPane.Add(m_TreeViewContainer); m_StylesDebuggerContainer = new StylesDebugger(m_Context.selection); splitter.rightPane.Add(m_StylesDebuggerContainer); DebuggerEventDispatchingStrategy.s_GlobalPanelDebug = this; m_RepaintOverlay = new RepaintOverlayPainter(); m_PickOverlay = new HighlightOverlayPainter(); m_LayoutOverlay = new LayoutOverlayPainter(); OnContextChange(); }
public static int GetLastColumnIndex() { return((!Unsupported.IsDeveloperBuild()) ? 15 : 22); }
public PackageManagerProjectSettingsProvider(string path, SettingsScope scopes, IEnumerable <string> keywords = null) : base(path, scopes, keywords) { activateHandler = (s, element) => { ResolveDependencies(); // Create a child to make sure all the style sheets are not added to the root. rootVisualElement = new ScrollView(); rootVisualElement.StretchToParentSize(); rootVisualElement.AddStyleSheetPath(StylesheetPath.scopedRegistriesSettings); rootVisualElement.AddStyleSheetPath(StylesheetPath.projectSettings); rootVisualElement.AddStyleSheetPath(EditorGUIUtility.isProSkin ? StylesheetPath.stylesheetDark : StylesheetPath.stylesheetLight); rootVisualElement.AddStyleSheetPath(StylesheetPath.stylesheetCommon); rootVisualElement.styleSheets.Add(m_ResourceLoader.packageManagerCommonStyleSheet); element.Add(rootVisualElement); m_GeneralTemplate = EditorGUIUtility.Load(k_GeneralServicesTemplatePath) as VisualTreeAsset; VisualElement newVisualElement = new VisualElement(); m_GeneralTemplate.CloneTree(newVisualElement); rootVisualElement.Add(newVisualElement); cache = new VisualElementCache(rootVisualElement); advancedSettingsFoldout.SetValueWithoutNotify(m_SettingsProxy.advancedSettingsExpanded); m_SettingsProxy.onAdvancedSettingsFoldoutChanged += OnAdvancedSettingsFoldoutChanged; advancedSettingsFoldout.RegisterValueChangedCallback(changeEvent => { if (changeEvent.target == advancedSettingsFoldout) { m_SettingsProxy.advancedSettingsExpanded = changeEvent.newValue; } }); scopedRegistriesSettingsFoldout.SetValueWithoutNotify(m_SettingsProxy.scopedRegistriesSettingsExpanded); m_SettingsProxy.onScopedRegistriesSettingsFoldoutChanged += OnScopedRegistriesSettingsFoldoutChanged; scopedRegistriesSettingsFoldout.RegisterValueChangedCallback(changeEvent => { if (changeEvent.target == scopedRegistriesSettingsFoldout) { m_SettingsProxy.scopedRegistriesSettingsExpanded = changeEvent.newValue; } }); preReleaseInfoBox.Q <Button>().clickable.clicked += () => { m_ApplicationProxy.OpenURL($"https://docs.unity3d.com/{m_ApplicationProxy.shortUnityVersion}/Documentation/Manual/pack-preview.html"); }; enablePreReleasePackages.SetValueWithoutNotify(m_SettingsProxy.enablePreReleasePackages); enablePreReleasePackages.RegisterValueChangedCallback(changeEvent => { var newValue = changeEvent.newValue; if (newValue != m_SettingsProxy.enablePreReleasePackages) { var saveIt = true; if (newValue && !m_SettingsProxy.oneTimeWarningShown) { if (m_ApplicationProxy.DisplayDialog("showPreReleasePackages", L10n.Tr("Show pre-release packages"), k_Message, L10n.Tr("I understand"), L10n.Tr("Cancel"))) { m_SettingsProxy.oneTimeWarningShown = true; } else { saveIt = false; } } if (saveIt) { m_SettingsProxy.enablePreReleasePackages = newValue; m_SettingsProxy.Save(); PackageManagerWindowAnalytics.SendEvent("togglePreReleasePackages"); } } enablePreReleasePackages.SetValueWithoutNotify(m_SettingsProxy.enablePreReleasePackages); }); UIUtils.SetElementDisplay(seeAllPackageVersions, Unsupported.IsDeveloperBuild()); seeAllPackageVersions.SetValueWithoutNotify(m_SettingsProxy.seeAllPackageVersions); seeAllPackageVersions.RegisterValueChangedCallback(changeEvent => { seeAllPackageVersions.SetValueWithoutNotify(changeEvent.newValue); var newValue = changeEvent.newValue; if (newValue != m_SettingsProxy.seeAllPackageVersions) { m_SettingsProxy.seeAllPackageVersions = newValue; m_SettingsProxy.Save(); } }); }; }