/// <summary> /// Sets the visibility of the editor with an optional animation. /// </summary> /// <param name="shouldShow">If set to <c>true</c> editor is visible.</param> /// <param name="animated">If set to <c>true</c> this is animated.</param> public void Show(bool shouldShow, bool animated) { if (heightConstraint != null) { if (animated) { TweenManager.TweenFloat(v => heightConstraint.minHeight = v, heightConstraint.minHeight, shouldShow ? defaultHeight : 0, animationDuration); } else { heightConstraint.minHeight = shouldShow ? defaultHeight : 0; } } else { // Our children is responsible for animating us! for (int i = 0; i < transform.childCount; i++) { Transform child = transform.GetChild(i); SidebarElement childEditor = child.GetComponent <SidebarElement>(); if (childEditor) { childEditor.Show(shouldShow, animated); } } } }
public void UpdateLibraries() { // We want to reset all the libraries. Does not change the current editing // floor. libraries = null; defaultCell.Show(true, true); SetMode(DisplayMode.Loading); ServiceController.shared.GetLibraryList((success, list) => { if (success) { libraries = list; SetMode(DisplayMode.Loaded); defaultCell.Show(libraries.Count == 0, true); ConfigureCells(); } else { // Failed to load the library. SetMode(DisplayMode.LoadFailed); } }); }
/// <summary> /// Updates the UI and populates the fields. /// </summary> /// <param name="selected">Selected object. We look into its components and /// load appropriate sub-editors.</param> /// <param name = "animated">Whether this is animated</param> public void SetSelectedObject(GameObject selected, bool animated = true) { selectedObject = selected; emptyEditor.Show(expandButton.isExpanded && selected == null, animated); landmarkEditor.SetEditingObject(selected); landmarkEditor.Show(expandButton.isExpanded && landmarkEditor.GetEditingObject() != null, animated); aisleEditor.SetEditingObject(selected); aisleEditor.Show(expandButton.isExpanded && aisleEditor.GetEditingObject() != null, animated); aisleAreaEditor.SetEditingObject(selected); aisleAreaEditor.Show(expandButton.isExpanded && aisleAreaEditor.GetEditingObject() != null, animated); wallEditor.SetEditingObject(selected); wallEditor.Show(expandButton.isExpanded && wallEditor.GetEditingObject() != null, animated); rectangleEditor.SetEditingObject(selected); rectangleEditor.Show(expandButton.isExpanded && rectangleEditor.GetEditingObject() != null, animated); }
public void OnExpandButtonPress() { // We want to show or hide everything in the panel. container.Show(expandButton.isExpanded, true); }