protected void Update() { if (EditorApplication.isPlayingOrWillChangePlaymode) { // Not allowed in play mode CWiz.ShowNotification("Cannot use OSA wizard during play mode", false, false); Close(); return; } UpdateImplWithoutChecks(); // Wait for scripts recompilation if (EditorApplication.isCompiling) { return; } // It's ok to delay the starting of updates until the gui resources are initialized, in order to have averything prepared if (_GUIResourcesInitialized) { UpdateImpl(); } // SlowUpdate calling if (_CurrentFrameInSlowUpdateCycle % CWiz.SLOW_UPDATE_SKIPPED_FRAMES == 0) { _CurrentFrameInSlowUpdateCycle = 0; SlowUpdate(); } else { ++_CurrentFrameInSlowUpdateCycle; } }
protected override void OnSubmitClicked() { // Commented: this is already checked and if there's and error, the submit button is disabled //string reasonIfNotValid; //// Validate again, to make sure the hierarchy wasn't modified //if (!Validate(out reasonIfNotValid)) //{ // DemosUtil.ShowCouldNotExecuteCommandNotification(this); // Debug.Log("OSA: Could not create ScrollView on the selected object: " + reasonIfNotValid); // return; //} var parentGO = Selection.gameObjects[0]; GameObject go = new GameObject("OSA", typeof(RectTransform)); var image = go.AddComponent <Image>(); var c = Color.white; c.a = .13f; image.color = c; var scrollRect = go.AddComponent <ScrollRect>(); var scrollRectRT = scrollRect.transform as RectTransform; var parentRT = parentGO.transform as RectTransform; scrollRectRT.anchorMin = new Vector2(Mathf.Clamp01(CWiz.SPACE_FOR_SCROLLBAR / parentRT.rect.width), Mathf.Clamp01(CWiz.SPACE_FOR_SCROLLBAR / parentRT.rect.height)); scrollRectRT.anchorMax = Vector2.one - scrollRectRT.anchorMin; scrollRectRT.sizeDelta = Vector2.zero; GameObjectUtility.SetParentAndAlign(go, parentGO); var viewportRT = CreateRTAndSetParent("Viewport", go.transform); viewportRT.gameObject.AddComponent <Image>(); viewportRT.gameObject.AddComponent <Mask>().showMaskGraphic = false; var contentRT = CreateRTAndSetParent("Content", viewportRT); scrollRect.content = contentRT; #if SCROLLRECT_HAS_VIEWPORT scrollRect.viewport = viewportRT; #endif Canvas.ForceUpdateCanvases(); // Register the creation in the undo system Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); Selection.activeObject = go; ConfigureScrollView(scrollRect, viewportRT); Close(); var validationResult = InitOSAWindow.Validate(false, scrollRect, false); // checkForWindows=false, becase this windows is already opened if (!validationResult.isValid) { CWiz.ShowCouldNotExecuteCommandNotification(this); Debug.LogError("OSA: Unexpected internal error while trying to initialize. Details(next line):\n" + validationResult.reasonIfNotValid + "\n" + validationResult.ToString()); return; } InitOSAWindow.Open(InitOSAWindow.Parameters.Create(validationResult, false, true, true, true)); }
public static void GetAvailableOSAImplementations(List <Type> list, bool excludeExampleImplementations, Type implementedInterface = null, Type withoutImplementedInterface = null) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { foreach (var type in assembly.GetTypes()) { if (type.IsAbstract) { continue; } if (!type.IsClass) { continue; } if (type.IsGenericType) { continue; } if (type.IsNested) { continue; } if (type.IsNotPublic) { continue; } if (!CWiz.IsSubclassOfOSA(type)) { continue; } if (excludeExampleImplementations && ( type.Name.ToLower().Contains("example") ////|| type.Name == typeof(Demos.SimpleExample.SimpleTutorial).Name //|| type.Name == "SimpleExample" //|| type.Name == typeof(CustomAdapters.DateTimePicker.DateTimePickerAdapter).Name || type.Name == "DateTimePickerAdapter" )) { continue; } // Excluding TableView's base classes, which will be used automatically if (type.Name == "BasicHeaderTupleAdapter" || type.Name == "BasicTupleAdapter") { continue; } if (implementedInterface != null) { if (!OSAUtil.DotNETCoreCompat_IsAssignableFrom(implementedInterface, type)) { continue; } } if (withoutImplementedInterface != null) { if (OSAUtil.DotNETCoreCompat_IsAssignableFrom(withoutImplementedInterface, type)) { continue; } } list.Add(type); } } }