public void ShowBootCanvas() { if (bootCanvasShown) { return; } GameObject[] rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects(); disabledObjects = new List <GameObject>(); foreach (GameObject obj in rootObjects) { Bridge bridgeComponent = obj.GetComponent <Bridge>(); if (bridgeComponent != bridge) { if (obj.activeSelf) { disabledObjects.Add(obj); obj.SetActive(false); } } } bootCanvas.gameObject.SetActive(true); booterPanelState = BooterPanelState.Boot; updateInterface = true; bootCanvasShown = true; }
public void HandleRevert() { editingBootConfiguration = null; updateInterface = true; booterPanelState = BooterPanelState.Boot; UpdateInterfacePanels(); }
public void HandleEdit() { editingBootConfiguration = (JObject)currentBootConfiguration.DeepClone(); updateInterface = true; booterPanelState = BooterPanelState.Edit; UpdateInterfacePanels(); }
public void HandleDelete() { string question = "Delete \"" + (string)currentBootConfiguration["name"] + "\"?"; questionLabel.text = question; booterPanelState = BooterPanelState.Question; questionAction = QuestionAction.Delete; UpdateInterfacePanels(); }
public void HandleSave() { bootConfigurations[currentBootConfigurationIndex] = editingBootConfiguration; editingBootConfiguration = null; updateInterface = true; booterPanelState = BooterPanelState.Boot; SaveBootConfigurations(); }
public void HandleNoButton() { switch (questionAction) { case QuestionAction.Delete: booterPanelState = BooterPanelState.Edit; UpdateInterfacePanels(); break; case QuestionAction.Duplicate: booterPanelState = BooterPanelState.Boot; UpdateInterfacePanels(); break; } }
public void HandleDuplicate() { duplicateName = (string)currentBootConfiguration["name"]; if (duplicateName == null) { duplicateName = ""; } while (FindBootConfigurationIndex(duplicateName) >= 0) { duplicateName += " Copy"; } string question = "Duplicate to \"" + (string)duplicateName + "\"?"; questionLabel.text = question; booterPanelState = BooterPanelState.Question; questionAction = QuestionAction.Duplicate; UpdateInterfacePanels(); }
public void HandleYesButton() { switch (questionAction) { case QuestionAction.Delete: if (bootConfigurations.Count > 1) { bootConfigurations.RemoveAt(currentBootConfigurationIndex); if (currentBootConfigurationIndex >= bootConfigurations.Count) { currentBootConfigurationIndex = bootConfigurations.Count - 1; } currentBootConfiguration = (JObject)bootConfigurations[currentBootConfigurationIndex]; PlayerPrefs.SetInt(currentBootConfigurationIndexKey, currentBootConfigurationIndex); } SaveBootConfigurations(); booterPanelState = BooterPanelState.Boot; updateInterface = true; break; case QuestionAction.Duplicate: JObject newBootConfiguration = new JObject(); foreach (var item in currentBootConfiguration) { string key = item.Key; if (key == "name") { newBootConfiguration[key] = duplicateName; } else if (key == "editable") { newBootConfiguration[key] = true; } else { newBootConfiguration[key] = item.Value; } } currentBootConfigurationIndex++; bootConfigurations.Insert(currentBootConfigurationIndex, newBootConfiguration); editingBootConfiguration = (JObject)newBootConfiguration.DeepClone(); SaveBootConfigurations(); booterPanelState = BooterPanelState.Edit; updateInterface = true; break; } }