Esempio n. 1
0
        static void DefaultReplaceTexture(Texture2D oldTexture, Texture2D newTexture)
        {
            foreach (SpriteGrid sg in SceneSaving.SpriteGrids)
            {
                sg.ReplaceTexture(oldTexture, newTexture);
            }

            // If necessary replace textures on the UI
            //if (GuiData.ToolsWindow.currentTextureDisplay.UpOverlayTexture == oldTexture)
            //{
            //    GuiData.ToolsWindow.currentTextureDisplay.SetOverlayTextures(newTexture, null);
            //}

            FlatRedBallServices.ReplaceFromFileTexture2D(oldTexture, newTexture, mContentManager);

            //GuiData.ListWindow.Add(newTexture);
        }
Esempio n. 2
0
        /// <summary>
        /// Replaces the oldTexture with the newTexture
        /// </summary>
        /// <remarks>
        /// Calls the SpriteManager's ReplaceTexture method to perform regular FlatRedBall
        /// texture replacement.  Also replaces all textures on the SpriteGrid, texture ListBox,
        /// and toolsWindow.
        /// </remarks>
        /// <param name="oldTexture">The old texture to replace.</param>
        /// <param name="newTexture">The new texture to replace with.</param>
        #endregion
        public static void ReplaceTexture(Texture2D oldTexture, Texture2D newTexture)
        {
            foreach (SpriteGrid sg in Scene.SpriteGrids)
            {
                sg.ReplaceTexture(oldTexture, newTexture);
            }

            if (GuiData.ToolsWindow.currentTextureDisplay.UpOverlayTexture == oldTexture)
            {
                GuiData.ToolsWindow.currentTextureDisplay.SetOverlayTextures(newTexture, null);
            }

            FlatRedBallServices.ReplaceFromFileTexture2D(oldTexture, newTexture, SceneContentManager);

            GuiData.ListWindow.ReplaceTexture(oldTexture, newTexture);

            GuiData.TextureCoordinatesSelectionWindow.ReplaceTexture(oldTexture, newTexture);
        }
Esempio n. 3
0
        private void CopyAssetsToFileFolder(Window callingWindow)
        {
            string directory = FileManager.GetDirectory(mLastFileName);

            List <string> filesToMakeDotDot = EditorData.EditorProperties.FilesToMakeDotDotRelative;

            foreach (Texture2D texture in mTexturesNotRelative)
            {
                if (!filesToMakeDotDot.Contains(texture.Name))
                {
                    if (!System.IO.File.Exists(directory + FileManager.RemovePath(texture.Name)))
                    {
                        System.IO.File.Copy(texture.Name, directory + FileManager.RemovePath(texture.Name));
                    }

                    FlatRedBallServices.ReplaceFromFileTexture2D(texture,
                                                                 FlatRedBallServices.Load <Texture2D>(directory + FileManager.RemovePath(texture.Name)),
                                                                 AppState.Self.PermanentContentManager);
                }
            }

            foreach (AnimationChainList animationChainList in mAnimationChainListsNotRelative)
            {
                if (!filesToMakeDotDot.Contains(animationChainList.Name))
                {
                    if (!System.IO.File.Exists(directory + FileManager.RemovePath(animationChainList.Name)))
                    {
                        System.IO.File.Copy(animationChainList.Name, directory + FileManager.RemovePath(animationChainList.Name));
                    }

                    animationChainList.Name = directory + FileManager.RemovePath(animationChainList.Name);
                }
            }

            PerformSave(callingWindow);
        }