public void UpdateProjects(object sender, EventArgs eventArgs) { ProjectTiles.Clear(); foreach (Transform t in ProjectsDynamicContent.transform) { Destroy(t.gameObject); } foreach (IO.Swagger.Model.ListProjectsResponseData project in Base.GameManager.Instance.Projects) { ProjectTile tile = Instantiate(ProjectTilePrefab, ProjectsDynamicContent.transform).GetComponent <ProjectTile>(); bool starred = PlayerPrefsHelper.LoadBool("project/" + project.Id + "/starred", false); try { string sceneName = GameManager.Instance.GetSceneName(project.SceneId); tile.InitTile(project.Name, () => GameManager.Instance.OpenProject(project.Id), () => ProjectOptionMenu.Open(tile), starred, project.Modified, project.Modified, project.Id, project.SceneId, sceneName); ProjectTiles.Add(tile); } catch (ItemNotFoundException ex) { Debug.LogError(ex); Notifications.Instance.SaveLogs("Failed to load scene name."); } } SortCurrentList(); // Button button = Instantiate(TileNewPrefab, ProjectsDynamicContent.transform).GetComponent<Button>(); // TODO new scene // button.onClick.AddListener(() => NewProjectDialog.Open()); }
public void UpdateProjects(object sender, EventArgs eventArgs) { ProjectTiles.Clear(); foreach (Transform t in ProjectsDynamicContent.transform) { if (t.gameObject.tag != "Persistent") { Destroy(t.gameObject); } } foreach (IO.Swagger.Model.ListProjectsResponseData project in Base.GameManager.Instance.Projects) { ProjectTile tile = Instantiate(ProjectTilePrefab, ProjectsDynamicContent.transform).GetComponent <ProjectTile>(); bool starred = PlayerPrefsHelper.LoadBool("project/" + project.Id + "/starred", false); if (project.Problems == null) { try { string sceneName = GameManager.Instance.GetSceneName(project.SceneId); tile.InitTile(project.Name, () => GameManager.Instance.OpenProject(project.Id), () => ProjectOptionMenu.Open(tile), starred, project.Created, project.Modified, project.Id, project.SceneId, sceneName); } catch (ItemNotFoundException ex) { Debug.LogError(ex); tile.InitInvalidProject(project.Id, project.Name, project.Created, project.Modified, starred, "Scene not found"); } } else { string sceneName = "unknown"; try { sceneName = GameManager.Instance.GetSceneName(project.SceneId); } catch (ItemNotFoundException) { } tile.InitInvalidProject(project.Id, project.Name, project.Created, project.Modified, starred, project.Problems.FirstOrDefault(), sceneName); } ProjectTiles.Add(tile); } SortCurrentList(); GameManager.Instance.HideLoadingScreen(); // Button button = Instantiate(TileNewPrefab, ProjectsDynamicContent.transform).GetComponent<Button>(); // TODO new scene // button.onClick.AddListener(() => NewProjectDialog.Open()); }
public void UpdateProjects(object sender, EventArgs eventArgs) { projectTiles.Clear(); foreach (Transform t in ProjectsDynamicContent.transform) { Destroy(t.gameObject); } foreach (IO.Swagger.Model.ListProjectsResponseData project in Base.GameManager.Instance.Projects) { ProjectTile tile = Instantiate(ProjectTilePrefab, ProjectsDynamicContent.transform).GetComponent <ProjectTile>(); bool starred = PlayerPrefsHelper.LoadBool("project/" + project.Id + "/starred", false); tile.InitTile(project.Name, () => Base.GameManager.Instance.OpenProject(project.Id), () => ProjectOptionMenu.Open(tile), starred, project.Id, project.SceneId); projectTiles.Add(tile); } Button button = Instantiate(TileNewPrefab, ProjectsDynamicContent.transform).GetComponent <Button>(); // TODO new scene button.onClick.AddListener(() => NewProjectDialog.WindowManager.OpenWindow()); }