Пример #1
0
    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.Id,
                              project.SceneId,
                              sceneName,
                              project.Modified.ToString());
                projectTiles.Add(tile);
            } catch (ItemNotFoundException ex) {
                Debug.LogError(ex);
                Notifications.Instance.SaveLogs("Failed to load scene name.");
            }
        }
        Button button = Instantiate(TileNewPrefab, ProjectsDynamicContent.transform).GetComponent <Button>();

        // TODO new scene
        button.onClick.AddListener(() => NewProjectDialog.Open());
    }
Пример #2
0
 public void AddNew()
 {
     if (ScenesList.gameObject.activeSelf)
     {
         ShowNewSceneDialog();
     }
     else if (ProjectsList.gameObject.activeSelf)
     {
         NewProjectDialog.Open();
     }
 }