コード例 #1
0
    public IEnumerator SaveMapProcess()
    {
        yield return null;

        // Wait for all process to finish
        while (Markers.MarkersControler.IsUpdating)
        {
            //Debug.Log("Wait for markers to finish...");
            InfoPopup.Show(true, "Saving map...\nWait for markers upadate task...");
            yield return new WaitForSeconds(0.5f);
        }
        while (PropsRenderer.IsUpdating)
        {
            //Debug.Log("Wait for props to finish...");
            InfoPopup.Show(true, "Saving map...\nWait for props upadate task...");
            yield return new WaitForSeconds(0.5f);
        }
        while (UnitsControler.IsUpdating)
        {
            //Debug.Log("Wait for units to finish...");
            InfoPopup.Show(true, "Saving map...\nWait for units upadate task...");
            yield return new WaitForSeconds(0.5f);
        }
        while (DecalsControler.IsUpdating)
        {
            //Debug.Log("Wait for decals to finish...");
            InfoPopup.Show(true, "Saving map...\nWait for decals upadate task...");
            yield return new WaitForSeconds(0.5f);
        }

        GenerateBackupPath();
        PreviewTex.ForcePreviewMode(true);

        yield return null;

        // Scenario.lua
        string ScenarioFilePath = LoadedMapFolderPath + ScenarioFileName + ".lua";
        if (BackupFiles && System.IO.File.Exists(ScenarioFilePath))
            System.IO.File.Move(ScenarioFilePath, BackupPath + "/" + ScenarioFileName + ".lua");

        SaveReclaim();
        ScenarioLuaFile.Save(ScenarioFilePath);
        yield return null;

        //Save.lua
        string SaveFilePath = MapRelativePath(ScenarioLuaFile.Data.save);
        string FileName = ScenarioLuaFile.Data.save;
        string[] Names = FileName.Split(("/").ToCharArray());
        if (BackupFiles && System.IO.File.Exists(SaveFilePath))
            System.IO.File.Move(SaveFilePath, BackupPath + "/" + Names[Names.Length - 1]);

        SaveLuaFile.Save(SaveFilePath);
        yield return null;

        SaveScmap();
        yield return null;

        SaveTablesLua();
        yield return null;

        InfoPopup.Show(false);
        SavingMapProcess = false;
        GenericInfoPopup.ShowInfo("Map saved!\n" + FolderName + "/" + ScenarioFileName + ".lua" );
    }
コード例 #2
0
    public IEnumerator SaveMapProcess()
    {
        yield return(null);


        // Wait for all process to finish
        while (Markers.MarkersControler.IsUpdating)
        {
            yield return(null);
        }
        while (PropsRenderer.IsUpdating)
        {
            yield return(null);
        }
        while (UnitsControler.IsUpdating)
        {
            yield return(null);
        }
        while (DecalsControler.IsUpdating)
        {
            yield return(null);
        }


        GenerateBackupPath();
        PreviewTex.ForcePreviewMode(true);
        yield return(null);

        // Scenario.lua
        string ScenarioFilePath = LoadedMapFolderPath + ScenarioFileName + ".lua";

        if (BackupFiles && System.IO.File.Exists(ScenarioFilePath))
        {
            System.IO.File.Move(ScenarioFilePath, BackupPath + "/" + ScenarioFileName + ".lua");
        }
        ScenarioLuaFile.Save(ScenarioFilePath);
        yield return(null);



        //Save.lua
        string SaveFilePath = MapRelativePath(ScenarioLuaFile.Data.save);
        string FileName     = ScenarioLuaFile.Data.save;

        string[] Names = FileName.Split(("/").ToCharArray());
        if (BackupFiles && System.IO.File.Exists(SaveFilePath))
        {
            System.IO.File.Move(SaveFilePath, BackupPath + "/" + Names[Names.Length - 1]);
        }

        SaveLuaFile.Save(SaveFilePath);
        yield return(null);

        //SaveScenarioLua();
        //SaveSaveLua();
        //SaveScriptLua(ScriptId);

        SaveScmap();
        yield return(null);

        SaveTablesLua();
        yield return(null);

        InfoPopup.Show(false);
        SavingMapProcess = false;
        GenericInfoPopup.ShowInfo("Map saved!\n" + FolderName + "/" + ScenarioFileName + ".lua");
    }