private void SaveSceneToFolder(PopupWindowArgs args, ProjectItem folder) { if (folder.Children != null && folder.Children.Any(p => p.Name.ToLower() == Input.text.ToLower() && p.IsScene)) { PopupWindow.Show("Scene with same name already exits", "Do you want to override it?", "Yes", yes => { RuntimeUndo.Purge(); ShowProgress = true; m_projectManager.SaveScene(folder.Children.Where(p => p.Name.ToLower() == Input.text.ToLower() && p.IsScene).First(), () => { ShowProgress = false; m_parentPopup.Close(false); }); }, "No", no => Input.ActivateInputField()); args.Cancel = true; } else { ProjectItem newScene = ProjectItem.CreateScene(Input.text); folder.AddChild(newScene); RuntimeUndo.Purge(); ShowProgress = true; m_projectManager.SaveScene(newScene, () => { ShowProgress = false; m_parentPopup.Close(false); }); } }
//private void OnResourcesDoubleClick(object sender, ProjectResourcesEventArgs e) //{ // if (e.ItemObjectPair != null && e.ItemObjectPair.IsNone) // { // IsNoneSelected = true; // } // else // { // IsNoneSelected = false; // if (e.ItemObjectPair != null) // { // SelectedObject = e.ItemObjectPair.Object; // } // else // { // SelectedObject = null; // } // } // m_parentPopup.Close(true); //} private void OnOK(PopupWindowArgs args) { if (SelectedObject == null && !IsNoneSelected) { args.Cancel = true; } }
private void OnOK(PopupWindowArgs args) { if (m_treeView.SelectedItem == null) { args.Cancel = true; return; } if (string.IsNullOrEmpty(Input.text)) { args.Cancel = true; Input.ActivateInputField(); return; } if (Input.text != null && Input.text.Length > 0 && (!char.IsLetter(Input.text[0]) || Input.text[0] == '-')) { PopupWindow.Show("Scene name is invalid", "Scene name should start with letter", "OK"); args.Cancel = true; return; } if (!ProjectItem.IsValidName(Input.text)) { PopupWindow.Show("Scene name is invalid", "Scene name contains invalid characters", "OK"); args.Cancel = true; return; } ProjectItem selectedItem = (ProjectItem)m_treeView.SelectedItem; if (selectedItem.IsScene) { if (Input.text.ToLower() == selectedItem.Name.ToLower()) { PopupWindow.Show("Scene with same name already exits", "Do you want to override it?", "Yes", yes => { RuntimeUndo.Purge(); ShowProgress = true; m_projectManager.SaveScene(selectedItem, () => { ShowProgress = false; m_parentPopup.Close(false); }); }, "No", no => Input.ActivateInputField()); args.Cancel = true; } else { ProjectItem folder = selectedItem.Parent; SaveSceneToFolder(args, folder); } } else { ProjectItem folder = selectedItem; SaveSceneToFolder(args, folder); } }
private void OnOK(PopupWindowArgs args) { if (m_treeView.SelectedItem == null) { args.Cancel = true; return; } }
private void OnOK(PopupWindowArgs args) { if (m_builtInTreeView.SelectedItem == null && IsBuiltInLibrary || m_externalTreeView.SelectedItem == null && !IsBuiltInLibrary) { args.Cancel = true; return; } }
private void OnOK(PopupWindowArgs args) { if (!IsValidHex()) { args.Cancel = true; } else { SelectedColor = HexToColor(InputHex.text); } }
private void OnOK(PopupWindowArgs args) { if (!m_parentPopup.IsContentLoaded) { args.Cancel = true; return; } if (m_treeView.SelectedItemsCount == 0) { args.Cancel = true; return; } }
private void OnCancel(PopupWindowArgs args) { if (m_editor.IsBusy) { args.Cancel = true; return; } if (m_coCreatePreviews != null) { StopCoroutine(m_coCreatePreviews); m_coCreatePreviews = null; } if (m_treeView.Items != null) { m_project.UnloadImportItems(m_treeView.Items.OfType <ProjectItem>().FirstOrDefault()); } else { Debug.LogWarning("m_treeView.Items == null"); } }