public async Task UpdateBuildAndSaveBtns() { bool success = false, successForce = false; string messageForce = ""; ButtonWithTooltip button = null; switch (GameManager.Instance.GetGameState()) { case GameManager.GameStateEnum.ProjectEditor: (successForce, messageForce) = await GameManager.Instance.CloseProject(true, true); button = CloseProjectBtn; if (!ProjectManager.Instance.ProjectChanged) { BuildBtn.SetInteractivity(true); SaveProjectBtn.SetInteractivity(false, "There are no unsaved changes"); if (ProjectManager.Instance.ProjectMeta.HasLogic) { BuildAndRunBtn.SetInteractivity(true); } } else { BuildBtn.SetInteractivity(false, "There are unsaved changes on project"); BuildAndRunBtn.SetInteractivity(false, "There are unsaved changes on project"); SaveProjectBtn.SetInteractivity(true); } break; case GameManager.GameStateEnum.SceneEditor: (successForce, messageForce) = await GameManager.Instance.CloseScene(true, true); button = CloseSceneBtn; if (!SceneManager.Instance.SceneChanged) { SaveSceneBtn.SetInteractivity(false, "There are no unsaved changes"); CreateProjectBtn.SetInteractivity(true); } else { SaveSceneBtn.SetInteractivity(true); CreateProjectBtn.SetInteractivity(false, "There are unsaved changes"); } break; } if (button != null) { if (successForce) { button.SetInteractivity(true); } else { button.SetInteractivity(false, messageForce); } } }
private void OnOpenProjectEditor(object sender, EventArgs eventArgs) { ProjectControlButtons.SetActive(true); SceneAndProjectControlButtons.SetActive(true); if (ProjectManager.Instance.ProjectMeta.HasLogic) { BuildAndRunBtn.SetInteractivity(true); } else { BuildAndRunBtn.SetInteractivity(false, "Project without defined logic could not be run from editor"); } }
private void OnOpenProjectEditor(object sender, EventArgs eventArgs) { unsavedChanges = true; ProjectControlButtons.SetActive(true); ServicesUpdated(null, new Base.ServiceEventArgs(null)); Services.SetActive(true); if (ProjectManager.Instance.Project.HasLogic) { BuildAndRunBtn.SetInteractivity(true); } else { BuildAndRunBtn.SetInteractivity(false, "Project without defined logic could not be run from editor"); } }