private void LogPlayModeState(PlayModeStateChange state) { switch (state) { case PlayModeStateChange.EnteredEditMode: if (_rootView.Contains(_curtain)) { _curtain.RemoveFromHierarchy(); } break; case PlayModeStateChange.ExitingEditMode: break; case PlayModeStateChange.EnteredPlayMode: _rootView.Add(_curtain); break; case PlayModeStateChange.ExitingPlayMode: break; default: break; } }
void UpdateGraphContainer() { IGraphModel graphModel = m_Store.GetState().CurrentGraphModel; if (graphModel != null) { if (m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Remove(m_BlankPage); } if (!m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Insert(0, m_GraphView); } } else { if (m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Remove(m_GraphView); } if (!m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Insert(0, m_BlankPage); } } }
void UpdateGraphContainer() { IGraphModel graphModel = m_Store.GetState().CurrentGraphModel; if (graphModel != null) { if (m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Remove(m_BlankPage); } if (!m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Insert(0, m_GraphView); } if (!rootVisualElement.Contains(m_CompilationPendingLabel)) { rootVisualElement.Add(m_CompilationPendingLabel); } } else { if (m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Remove(m_GraphView); } if (!m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Insert(0, m_BlankPage); } if (rootVisualElement.Contains(m_CompilationPendingLabel)) { rootVisualElement.Remove(m_CompilationPendingLabel); } } }
public void SetArrowActive(bool value) { if (value && !title.Contains(foldout)) { title.Insert(0, foldout); } else if (!value && title.Contains(foldout)) { title.Remove(foldout); } }
static void AddIfNotExists(VisualElement container, VisualElement child, int position = 0) { if (!container.Contains(child)) { container.Insert(position, child); } }
private void SwapStage(LessonStage stage, VisualElement element, bool up) { if (!m_BaseVisualElement.Contains(element)) { return; } int elementIndex = m_BaseVisualElement.IndexOf(element); int swapElementIndex = elementIndex + (up ? -1 : 1); if (swapElementIndex < 0 || swapElementIndex >= m_BaseVisualElement.childCount) { return; } VisualElement swapElement = m_BaseVisualElement.ElementAt(swapElementIndex); if (swapElement.GetType() != element.GetType()) { return; } if (!m_BaseVisualElement.SwapElementsAt(elementIndex, swapElementIndex)) { return; } m_LessonStageFactory.SwapStages(stage, up); }
public void OnEndDependency(UpgradeDependencyMode mode) { if (startNode != null) { if (lastNode != null) { var success = NodeDependencies.CreateDependency(startNode, lastNode, config.techConfig, mode); if (success) { UpdateContents(); } lastNode.ActivatingLinkEnd(); } startNode.ActivatingLinkEnd(); startNode = null; } if (depLine != null) { if (nodeRoot.Contains(depLine)) { nodeRoot.Remove(depLine); } depLine = null; } }
private void RemoveIfContaining(VisualElement element) { if (_detailsContainer.Contains(element)) { _detailsContainer.Remove(element); } }
private void RemoveIfPresent(VisualElement element) { if (container.Contains(element)) { container.Remove(element); } }
public void InitializeGraph() { if (graphView != null && !rootView.Contains(graphView)) { graphView.RemoveFromHierarchy(); } if (graphView == null) { graphView = new UGraphView(); } if (!rootView.Contains(graphView)) { rootView.Add(graphView); } graphView.Initialize(this); ReloadTabbar(); }
void RemoveCurrentObjectVE() { if (mCurrentObjectElement != null && mEditoryBlock.Contains(mCurrentObjectElement)) { mEditoryBlock.Remove(mCurrentObjectElement); } mCurrentObjectElement = null; }
private void RemoveMainUI(VisualElement mainView) { if (mainView.Contains(m_SelectedFrameInspector)) { mainView.Remove(m_SelectedFrameInspector); } mainView.UnregisterCallback <SpriteSelectionChangeEvent>(SelectionChange); }
private void SetVisibility(ScrollView itemBody, bool flag) { if (flag) { if (!bodyElement.Contains(itemBody)) { bodyElement.Add(itemBody); } } else { if (bodyElement.Contains(itemBody)) { bodyElement.Remove(itemBody); } } }
public virtual void Unselect(VisualElement selectionContainer) { var gView = selectionContainer as GraphView; if (gView != null && selectionContainer.Contains(this)) { if (gView.selection.Contains(this)) { gView.RemoveFromSelection(this); } } }
void UpdateParameters() { if (root == null) { root = new VisualElement(); } if (parameters == null || !root.Contains(parameters)) { parameters = new VisualElement(); root.Add(parameters); } SyncParameters(); var serializedInspector = new SerializedObject(this); parameters.Clear(); bool header = true; bool showUpdateButton = false; foreach (var param in visibleParameters) { if (param.settings.isHidden) { continue; } if (header) { var headerLabel = new Label("Exposed Parameters"); headerLabel.AddToClassList("Header"); parameters.Add(headerLabel); header = false; showUpdateButton = true; } var field = CreateParameterVariantView(param, serializedInspector); parameters.Add(field); } if (showUpdateButton) { updateNeededInfoBox = new HelpBox("Parameters have changed, please update the texture to apply the changes.", HelpBoxMessageType.Warning); UpdateIsDirtyAndPreview(); parameters.Add(updateNeededInfoBox); var updateButton = new Button(UpdateAllVariantTextures) { text = "Update Texture(s)" }; updateButton.AddToClassList("UpdateTextureButton"); parameters.Add(updateButton); } }
public void RemoveLine(ScriptLineView scriptLineView) { Lines.Remove(scriptLineView); if (linesContainer.Contains(scriptLineView)) { linesContainer.Remove(scriptLineView); ViewRange = new IntRange(ViewRange.StartIndex, ViewRange.EndIndex - 1); UpdatePaginationLabel(); } ScriptModified = true; }
void SetupNewLevel() { if (mEditorMain.Contains(mLevelData)) { mEditorMain.Remove(mLevelData); } if (mActiveLevel != null) { SetDataFromUXML(); mLevelData.Bind(new SerializedObject(mActiveLevel)); mEditorMain.Add(mLevelData); } }
public virtual bool IsSelected(VisualElement selectionContainer) { var gView = selectionContainer as GraphView; if (gView != null && selectionContainer.Contains(this)) { if (gView.selection.Contains(this)) { return(true); } } return(false); }
void ActivateObjectFieldOfType(AssetMetaData.AssetType pType) { if (mAssetEditorData.Contains(mObjectData)) { mAssetEditorData.Remove(mObjectData); } if (mCurrentAssetData != null) { EditorUtility.SetDirty(mCurrentAssetData); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); mCurrentAssetData = null; } mSelectionField.value = null; SetObjectFieldType(pType); }
private void RemoveDependenciesVisualElement() { try { PackageDependencies dependencies = PackageManagerInjectionHelper.InjectedVisualElement.PackageDetails.dependencies; VisualElement visualElement = dependencies.Element.Q("dependenciesInnerContainer"); if (visualElement.Contains(dependenciesVisualElement)) { visualElement.Remove(dependenciesVisualElement); } } catch (NullReferenceException) { // Thrown when disposing, safe to ignore } }
public virtual void Select(VisualElement selectionContainer, bool additive) { var gView = selectionContainer as GraphView; if (gView != null && selectionContainer.Contains(this)) { if (!gView.selection.Contains(this)) { if (!additive) { gView.ClearSelection(); } gView.AddToSelection(this); } } }
private static T GetOrCreate <T>(VisualElement parent, string name, Action <T> initializer = null) where T : VisualElement, new() { var element = (T)parent.Query <VisualElement>(name: name).First() ?? new T() { name = name }; if (initializer != null) { initializer(element); } if (!parent.Contains(element)) { parent.Add(element); } return(element); }
/* * Core */ public int Render(VisualElement root, Rect rect) { if (Event.current.type != EventType.Layout && !root.Contains(this)) { root.Add(this); } if (Event.current.type == EventType.MouseUp) { OnRadialClickEnd(null); } style.left = (rect.width - Size) / 2; style.top = rect.y; HandleExternalInput(); return(_module.Debug.State ? DebugRender(rect) : 0); }
private void InsertDependenciesVisualElement() { // We only want to do this for packages that are in development, this wouldn't work on other packages anyway if (!currentPackage.HasTag(PackageTag.InDevelopment)) { RemoveDependenciesVisualElement(); return; } PackageDependencies dependencies = PackageManagerInjectionHelper.InjectedVisualElement.PackageDetails.dependencies; VisualElement visualElement = dependencies.Element.Q("dependenciesInnerContainer"); if (!visualElement.Contains(dependenciesVisualElement)) { visualElement.Add(dependenciesVisualElement); } dependenciesVisualElement.UpdatePackage(currentPackage); }
private (int row, int col) GetIndices(TableCell cell) { int row = -1, col = -1; if (keyColumn.Contains(cell)) { col = 0; } for (var i = 0; i < localeColumns.Count; i++) { if (localeColumns[i].Contains(cell)) { col = i + 1; row = localeColumns[i].IndexOf(cell) - 1; break; } } return(row, col); }
public override void OnSelectionChanged(IEnumerable <SearcherItem> items) { if (m_DetailsPanel == null) { return; } var itemsList = items.ToList(); m_DetailsTitle.text = itemsList.First().Name; var graphView = SearcherService.GraphView; foreach (var graphElement in graphView.graphElements.ToList()) { graphView.RemoveElement(graphElement); } if (!m_DetailsPanel.Contains(graphView)) { m_DetailsPanel.Add(graphView); var eventCatcher = new VisualElement(); eventCatcher.RegisterCallback <MouseDownEvent>(e => e.StopImmediatePropagation()); eventCatcher.RegisterCallback <MouseMoveEvent>(e => e.StopImmediatePropagation()); m_DetailsPanel.Add(eventCatcher); eventCatcher.StretchToParentSize(); } var elements = CreateGraphElements(itemsList.First()); foreach (var element in elements) { if (element is INodeModel || element is IStickyNoteModel) { graphView.AddElement(GraphElementFactory.CreateUI(graphView, graphView.store, element)); } } }
void UpdateScrollViewUsage() { m_UseScrollViewConstruct = m_ScrollViewToggle.value; if (m_UseScrollViewConstruct) { m_RootContainer.style.flexDirection = FlexDirection.Column; m_RootContainer.Add(m_ScrollView); m_RowContainer.Add(m_LeftContainer); m_RowContainer.Add(m_RightContainer); } else { if (m_RootContainer.Contains(m_ScrollView)) { m_RootContainer.Remove(m_ScrollView); } m_RootContainer.style.flexDirection = FlexDirection.Row; m_RootContainer.Add(m_LeftContainer); m_RootContainer.Add(m_RightContainer); } }
protected void UpdateGraphContainer() { var graphModel = CommandDispatcher?.State?.WindowState.GraphModel; if (graphModel != null) { if (m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Remove(m_BlankPage); } if (!m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Insert(0, m_GraphView); } if (!m_GraphContainer.Contains(m_SidePanel)) { m_GraphContainer.Add(m_SidePanel); } if (!rootVisualElement.Contains(m_GraphProcessingPendingLabel)) { rootVisualElement.Add(m_GraphProcessingPendingLabel); } } else { if (m_GraphContainer.Contains(m_SidePanel)) { m_GraphContainer.Remove(m_SidePanel); } if (m_GraphContainer.Contains(m_GraphView)) { m_GraphContainer.Remove(m_GraphView); } if (!m_GraphContainer.Contains(m_BlankPage)) { m_GraphContainer.Insert(0, m_BlankPage); } if (rootVisualElement.Contains(m_GraphProcessingPendingLabel)) { rootVisualElement.Remove(m_GraphProcessingPendingLabel); } } }
protected void UpdateExposedParameters() { if (root == null) { return; } if (parameters == null || !root.Contains(parameters)) { parameters = new VisualElement() { name = "ExposedParameters" }; root.Add(parameters); } parameters.Clear(); bool header = true; bool showUpdateButton = false; foreach (var param in graph.exposedParameters) { if (param.settings.isHidden) { continue; } if (header) { var headerLabel = new Label("Exposed Parameters"); headerLabel.AddToClassList("Header"); parameters.Add(headerLabel); header = false; showUpdateButton = true; } VisualElement prop = new VisualElement(); prop.AddToClassList("Indent"); prop.style.display = DisplayStyle.Flex; var p = exposedParameterFactory.GetParameterValueField(param, (newValue) => { param.value = newValue; graph.NotifyExposedParameterValueChanged(param); }); prop.Add(p); parameters.Add(prop); } if (showUpdateButton) { var updateButton = new Button(() => { MixtureGraphProcessor.RunOnce(graph); graph.SaveAllTextures(false); graph.UpdateLinkedVariants(); }) { text = "Update Texture(s)" }; updateButton.AddToClassList("Indent"); updateButton.AddToClassList("UpdateTextureButton"); parameters.Add(updateButton); } }