Exemplo n.º 1
0
 public void LoadStage()
 {
     if (json_file != null)
     {
         stage_info = JsonUtility.FromJson <StageInfo>(json_file.text);
     }
     else
     {
         stage_info = StageInfo.LoadStageInfoFile(directory, filename);
     }
     stage_info.LoadDirectory(directory);
 }
Exemplo n.º 2
0
 public void LoadStageList()
 {
     Debug.Log(FileLoader.StageDir.FullName);
     DirectoryInfo[] individualStages = FileLoader.StageDir.GetDirectories();
     foreach (DirectoryInfo stageDir in individualStages)
     {
         string combinedPath = Path.Combine(stageDir.FullName, "stage_info.json");
         if (File.Exists(combinedPath))
         {
             string    json = File.ReadAllText(combinedPath);
             StageInfo info = JsonUtility.FromJson <StageInfo>(json);
             info.LoadDirectory(stageDir.Name);
             portraitRig.AddPanel(info);
         }
     }
 }
Exemplo n.º 3
0
    public static StageInfo LoadStageInfoFile(string directory, string filename = "stage_info.json")
    {
        string dir          = Path.Combine(FileLoader.StageDir.FullName, directory);
        string combinedPath = Path.Combine(dir, filename);

        if (File.Exists(combinedPath))
        {
            string    json = File.ReadAllText(combinedPath);
            StageInfo info = JsonUtility.FromJson <StageInfo>(json);
            info.LoadDirectory(directory);
            return(info);
        }
        else
        {
            Debug.LogWarning("No stage file found at " + directory + "/" + filename);
            return(null);
        }
    }