コード例 #1
0
        public static void SaveActiveScene(string fileName)
        {
            SpriteEditorScene sceneSave = SpriteEditorScene.FromScene(mBlockingScene);

            sceneSave.Save(fileName);

            mBlockingScene.Name = fileName;
        }
コード例 #2
0
        void SaveSceneOk(Window callingWindow)
        {
            string fileName = ((FileWindow)callingWindow).Results[0];

            SpriteEditorScene ses = SpriteEditorScene.FromScene(EditorData.Scene);

            ses.Save(fileName);
        }
コード例 #3
0
        public static void SaveScene(string fileName)
        {
            if (mScene == null)
            {
                GuiManager.ShowMessageBox("There's no scene to save.", "Error Saving");
            }
            else
            {
                SpriteEditorScene spriteEditorScene = SpriteEditorScene.FromScene(mScene);

                spriteEditorScene.Save(fileName);
            }
        }
コード例 #4
0
        static bool SaveScene(string name, bool assetsRelativeToScene)
        {
            string oldRelativeDirectory = FileManager.RelativeDirectory;

            assetsRelativeToScene = true;

            if (assetsRelativeToScene)
            {
                FileManager.RelativeDirectory = FileManager.GetDirectory(name);
            }

            SpriteEditorScene ses = SpriteEditorScene.FromScene(SceneSaving);

            ses.AssetsRelativeToSceneFile = assetsRelativeToScene;

            ses.Save(name);

            FileManager.RelativeDirectory = oldRelativeDirectory;
            return(true);
        }
コード例 #5
0
        public bool SaveScene(string name, bool areAssetsRelativeToScene)
        {
            string oldRelativeDirectory = FileManager.RelativeDirectory;

            if (areAssetsRelativeToScene)
            {
                FileManager.RelativeDirectory = FileManager.GetDirectory(name);
            }

            // This will reduce the file size if we use a lot of SpriteGrids
            for (int i = 0; i < GameData.Scene.SpriteGrids.Count; i++)
            {
                GameData.Scene.SpriteGrids[i].TrimGrid();
            }

            SpriteEditorScene ses = SpriteEditorScene.FromScene(GameData.Scene);

            ses.AssetsRelativeToSceneFile = areAssetsRelativeToScene;



            ses.Save(name);

            // TODO:  Need to check if file saving worked properly.
            bool wasSceneSaved = true;

            if (wasSceneSaved)
            {
                #region create the SpriteEditorSceneProperties

                GameData.SpriteEditorSceneProperties.SetFromRuntime(
                    GameData.Camera,
                    GameData.BoundsCamera,
                    GameData.EditorProperties.PixelSize,
                    GuiData.CameraBoundsPropertyGrid.Visible
                    );


                GameData.SpriteEditorSceneProperties.WorldAxesVisible = GameData.EditorProperties.WorldAxesDisplayVisible;

                GameData.SpriteEditorSceneProperties.TextureDisplayRegionsList.Clear();

                for (int k = 0; k < GuiData.ListWindow.TextureListBox.Count; k++)
                {
                    TextureDisplayRegionsSave tdrs = new TextureDisplayRegionsSave();

                    CollapseItem item = GuiData.ListWindow.TextureListBox[k];

                    // The FileManager's relative directory has been set, so we just have to call MakeRelative and it should work fine
                    tdrs.TextureName =
                        FileManager.MakeRelative(((Texture2D)item.ReferenceObject).SourceFile());

                    tdrs.DisplayRegions = GuiData.ListWindow.CreateTextureReferences(item);

                    GameData.SpriteEditorSceneProperties.TextureDisplayRegionsList.Add(tdrs);
                }


                GameData.SpriteEditorSceneProperties.Save(FileManager.RemoveExtension(name) + ".sep");

                #endregion

                FlatRedBallServices.Owner.Text = "SpriteEditor - Currently editing " + name;
                // As mentioned in the othe area where GameData.Filename is set, I'm not
                // sure why we were removing the extension.  I've commented out the extension
                // removal since it causes problems with CTRL+S
                // name = FileManager.RemoveExtension(name);
                GameData.FileName = name;
                if (SavedSuccess != null)
                {
                    SavedSuccess(this, null);
                }
            }

            FileManager.RelativeDirectory = oldRelativeDirectory;
            if (!wasSceneSaved)
            {
                GuiManager.ShowMessageBox("Could not save " + GameData.FileName + ".  Is the file readonly?", "Error Saving");
            }
            return(wasSceneSaved);
        }