public void RefreshProject()
        {
            //ProjectNameNode.Text = "Project Name";

            //ProjectNameNode.Nodes.Clear();

            roundLineDemoViewerControl.RoundLineManager = null;
            roundLineDemoViewerControl.SpriteFont       = null;
            roundLineDemoViewerControl.Effect           = null;

            if (roundLineManager != null)
            {
                roundLineManager = null;
            }

            if (effectManager != null)
            {
                effectManager = null;
            }

            if (fontManager != null)
            {
                fontManager = null;
            }

            if (texture2dManager != null)
            {
                texture2dManager = null;
            }

            if (modelManager != null)
            {
                modelManager = null;
            }

            if (contentManager != null)
            {
                contentManager.Unload();
                contentManager.Dispose();
                contentManager = null;
            }

            if (contentBuilder != null)
            {
                contentBuilder.Clear();
                contentBuilder.Dispose();
                contentBuilder = null;
            }

            if (currentProject != null)
            {
                //ProjectNameNode.Text = currentProject.ProjectName;

                contentBuilder = new ContentBuilder(currentProject.ProjectContentFolder, false);

                contentManager = new ContentManager(this.Services,
                                                    contentBuilder.OutputDirectory);

                modelManager = new XnaModelManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                texture2dManager = new XnaTexture2dManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                fontManager = new XnaFontManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                effectManager = new XnaEffectManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);


                //roundLineTechniqueNames = roundLineManager.TechniqueNames;

                //ProjectNameNode.Nodes.Clear();
                ModelNode     = null;
                Texture2dNode = null;
                FontNode      = null;
                EffectNode    = null;

                //effectViewerControl.Effect = null;

                if (currentProject.LoadedModels.Count > 0)
                {
                    currentProject.LoadedModels = modelManager.RefreshList(currentProject.LoadedModels);

                    //foreach (FyriModel model in currentProject.LoadedModels)
                    //{
                    //    AddModelToTreeView(model);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSphereFileName = Directory.GetCurrentDirectory() + "\\Default\\Sphere.fbx";
                    if (File.Exists(defSphereFileName))
                    {
                        LoadModelToProject(defSphereFileName);
                    }
                }

                if (currentProject.LoadedTexture2ds.Count > 0)
                {
                    currentProject.LoadedTexture2ds = texture2dManager.RefreshList(currentProject.LoadedTexture2ds);

                    //foreach (FyriTexture2d texture in currentProject.LoadedTexture2ds)
                    //{
                    //    AddTexture2dToTreeView(texture);
                    //}
                }

                if (currentProject.LoadedFonts.Count > 0)
                {
                    currentProject.LoadedFonts = fontManager.RefreshList(currentProject.LoadedFonts);

                    //foreach (FyriFont font in currentProject.LoadedFonts)
                    //{
                    //    AddFontToTreeView(font);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSpriteFontFileName = Directory.GetCurrentDirectory() + "\\Default\\SpriteFont.spritefont";
                    if (File.Exists(defSpriteFontFileName))
                    {
                        LoadFontToProject(defSpriteFontFileName);
                    }
                }

                if (currentProject.LoadedEffects.Count > 0)
                {
                    currentProject.LoadedEffects = effectManager.RefreshList(currentProject.LoadedEffects);

                    //foreach (FyriEffect effect in currentProject.LoadedEffects)
                    //{
                    //    AddEffectToTreeView(effect);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defRLEffectFileName = Directory.GetCurrentDirectory() + "\\Default\\RoundLine.fx";
                    if (File.Exists(defRLEffectFileName))
                    {
                        LoadEffectToProject(defRLEffectFileName);
                    }
                }

                FyriEffect roundlineEffect = effectManager.GetEffect("RoundLine");
                FyriFont   roundlineFont   = fontManager.GetFont("SpriteFont");

                roundLineManager = new RoundLineManager();
                roundLineManager.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect);

                roundLineDemoViewerControl.RoundLineManager = roundLineManager;
                roundLineDemoViewerControl.SpriteFont       = roundlineFont.Font;
                roundLineDemoViewerControl.Effect           = roundlineEffect.Effect;
            }
        }
示例#2
0
        public void RefreshLists()
        {
            ProjectNameNode.Text = this.ProjectName;

            ProjectNameNode.Nodes.Clear();
            contentTreeView.Nodes.Clear();
            contentTreeView.Nodes.Add(ProjectNameNode);

            ModelNode     = null;
            Texture2dNode = null;
            FontNode      = null;
            EffectNode    = null;

            if (LoadedModels.Count > 0)
            {
                LoadedModels = modelManager.RefreshList(LoadedModels);

                foreach (FyriModel model in LoadedModels)
                {
                    AddModelToTreeView(model);
                }
            }
            else
            {
                //Load default Sphere
                string defSphereFileName = Directory.GetCurrentDirectory() + "\\Default\\Sphere.fbx";
                if (File.Exists(defSphereFileName))
                {
                    LoadModelToProject(defSphereFileName);
                }
            }

            if (LoadedTexture2ds.Count > 0)
            {
                LoadedTexture2ds = texture2dManager.RefreshList(LoadedTexture2ds);

                foreach (FyriTexture2d texture in LoadedTexture2ds)
                {
                    AddTexture2dToTreeView(texture);
                }
            }

            if (LoadedFonts.Count > 0)
            {
                LoadedFonts = fontManager.RefreshList(LoadedFonts);

                foreach (FyriFont font in LoadedFonts)
                {
                    AddFontToTreeView(font);
                }
            }
            else
            {
                //Load default Sphere
                string defSpriteFontFileName = Directory.GetCurrentDirectory() + "\\Default\\SpriteFont.spritefont";
                if (File.Exists(defSpriteFontFileName))
                {
                    LoadFontToProject(defSpriteFontFileName);
                }
            }

            if (LoadedEffects.Count > 0)
            {
                LoadedEffects = effectManager.RefreshList(LoadedEffects);

                foreach (FyriEffect effect in LoadedEffects)
                {
                    AddEffectToTreeView(effect);
                }
            }
            else
            {
                //Load default Sphere
                string defRLEffectFileName = Directory.GetCurrentDirectory() + "\\Default\\RoundLine.fx";
                if (File.Exists(defRLEffectFileName))
                {
                    LoadEffectToProject(defRLEffectFileName);
                }
            }
        }
示例#3
0
        public void RefreshProject()
        {
            ProjectNameNode.Text = "Project Name";

            ProjectNameNode.Nodes.Clear();

            if (spriterManager != null)
            {
                spriterManager = null;
            }

            if (effectManager != null)
            {
                effectManager = null;
            }

            if (fontManager != null)
            {
                fontManager = null;
            }

            if (texture2dManager != null)
            {
                texture2dManager = null;
            }

            if (modelManager != null)
            {
                modelManager = null;
            }

            if (contentManager != null)
            {
                contentManager.Unload();
                contentManager.Dispose();
                contentManager = null;
            }

            if (contentBuilder != null)
            {
                contentBuilder.Clear();
                contentBuilder.Dispose();
                contentBuilder = null;
            }

            if (currentProject != null)
            {
                ProjectNameNode.Text = currentProject.ProjectName;

                contentBuilder = new ContentBuilder(currentProject.ProjectContentFolder, false);

                contentManager = new ContentManager(this.Services,
                                                    contentBuilder.OutputDirectory);

                modelManager = new XnaModelManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                texture2dManager = new XnaTexture2dManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                fontManager = new XnaFontManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                effectManager = new XnaEffectManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                spriterManager = new XnaSpriterManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                ProjectNameNode.Nodes.Clear();
                ModelNode     = null;
                Texture2dNode = null;
                FontNode      = null;
                EffectNode    = null;
                SpriterNode   = null;

                effectViewerControl.Effect = null;

                if (currentProject.LoadedModels.Count > 0)
                {
                    currentProject.LoadedModels = modelManager.RefreshList(currentProject.LoadedModels);

                    foreach (FyriModel model in currentProject.LoadedModels)
                    {
                        AddModelToTreeView(model);
                    }
                }
                else
                {
                    //Load default Sphere
                    string defSphereFileName = Directory.GetCurrentDirectory() + "\\Default\\Sphere.fbx";
                    if (File.Exists(defSphereFileName))
                    {
                        LoadModelToProject(defSphereFileName);
                    }
                }

                if (currentProject.LoadedTexture2ds.Count > 0)
                {
                    currentProject.LoadedTexture2ds = texture2dManager.RefreshList(currentProject.LoadedTexture2ds);

                    foreach (FyriTexture2d texture in currentProject.LoadedTexture2ds)
                    {
                        AddTexture2dToTreeView(texture);
                    }
                }

                if (currentProject.LoadedFonts.Count > 0)
                {
                    currentProject.LoadedFonts = fontManager.RefreshList(currentProject.LoadedFonts);

                    foreach (FyriFont font in currentProject.LoadedFonts)
                    {
                        AddFontToTreeView(font);
                    }
                }

                if (currentProject.LoadedEffects.Count > 0)
                {
                    currentProject.LoadedEffects = effectManager.RefreshList(currentProject.LoadedEffects);

                    foreach (FyriEffect effect in currentProject.LoadedEffects)
                    {
                        AddEffectToTreeView(effect);
                    }
                }
            }
        }
        public void RefreshProject()
        {
            //ProjectNameNode.Text = "Project Name";

            //ProjectNameNode.Nodes.Clear();

            xnaToolBox1.ToolSelectionChanged   += SetTool;
            xna2dShapeControl1.ItemsSelected   += ItemsSelected;
            propertyGrid1.PropertyValueChanged += new PropertyValueChangedEventHandler(propertyGrid1_PropertyValueChanged);

            xna2dShapeControl1.Project          = null;
            xna2dShapeControl1.TextureManager   = null;
            xna2dShapeControl1.RoundLineManager = null;
            xna2dShapeControl1.LineBatch        = null;
            xna2dShapeControl1.SpriteFont       = null;
            xna2dShapeControl1.Effect           = null;
            xna2dShapeControl1.DrawingContext   = null;

            if (drawingContext != null)
            {
                drawingContext = null;
            }

            if (roundLineManager != null)
            {
                roundLineManager = null;
            }

            if (lineBatch != null)
            {
                lineBatch = null;
            }

            if (effectManager != null)
            {
                effectManager = null;
            }

            if (fontManager != null)
            {
                fontManager = null;
            }

            if (texture2dManager != null)
            {
                texture2dManager = null;
            }

            if (modelManager != null)
            {
                modelManager = null;
            }

            if (contentManager != null)
            {
                contentManager.Unload();
                contentManager.Dispose();
                contentManager = null;
            }

            if (contentBuilder != null)
            {
                contentBuilder.Clear();
                contentBuilder.Dispose();
                contentBuilder = null;
            }

            if (currentProject != null)
            {
                //ProjectNameNode.Text = currentProject.ProjectName;

                contentBuilder = new ContentBuilder(currentProject.ProjectContentFolder, false);

                contentManager = new ContentManager(this.Services,
                                                    contentBuilder.OutputDirectory);

                modelManager = new XnaModelManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                texture2dManager = new XnaTexture2dManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                fontManager = new XnaFontManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                effectManager = new XnaEffectManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);


                //roundLineTechniqueNames = roundLineManager.TechniqueNames;

                //ProjectNameNode.Nodes.Clear();
                ModelNode     = null;
                Texture2dNode = null;
                FontNode      = null;
                EffectNode    = null;

                //effectViewerControl.Effect = null;

                if (currentProject.LoadedModels.Count > 0)
                {
                    currentProject.LoadedModels = modelManager.RefreshList(currentProject.LoadedModels);

                    //foreach (FyriModel model in currentProject.LoadedModels)
                    //{
                    //    AddModelToTreeView(model);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSphereFileName = Directory.GetCurrentDirectory() + "\\Default\\Sphere.fbx";
                    if (File.Exists(defSphereFileName))
                    {
                        LoadModelToProject(defSphereFileName);
                    }
                }

                if (currentProject.LoadedTexture2ds.Count > 0)
                {
                    currentProject.LoadedTexture2ds = texture2dManager.RefreshList(currentProject.LoadedTexture2ds);

                    //foreach (FyriTexture2d texture in currentProject.LoadedTexture2ds)
                    //{
                    //    AddTexture2dToTreeView(texture);
                    //}
                }

                if (currentProject.LoadedFonts.Count > 0)
                {
                    currentProject.LoadedFonts = fontManager.RefreshList(currentProject.LoadedFonts);

                    //foreach (FyriFont font in currentProject.LoadedFonts)
                    //{
                    //    AddFontToTreeView(font);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSpriteFontFileName = Directory.GetCurrentDirectory() + "\\Default\\SpriteFont.spritefont";
                    if (File.Exists(defSpriteFontFileName))
                    {
                        LoadFontToProject(defSpriteFontFileName);
                    }
                }

                if (currentProject.LoadedEffects.Count > 0)
                {
                    currentProject.LoadedEffects = effectManager.RefreshList(currentProject.LoadedEffects);

                    //foreach (FyriEffect effect in currentProject.LoadedEffects)
                    //{
                    //    AddEffectToTreeView(effect);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defRLEffectFileName = Directory.GetCurrentDirectory() + "\\Default\\RoundLine.fx";
                    if (File.Exists(defRLEffectFileName))
                    {
                        LoadEffectToProject(defRLEffectFileName);
                    }
                }

                FyriEffect roundlineEffect = effectManager.GetEffect("RoundLine");
                FyriFont   roundlineFont   = fontManager.GetFont("SpriteFont");

                roundLineManager = new RoundLineManager();
                roundLineManager.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect);

                lineBatch = new XnaLine2dBatch();
                lineBatch.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect);

                drawingContext = new XnaDrawingContext(this.graphicsDeviceService.GraphicsDevice);


                xna2dShapeControl1.ShapeProperties  = this.propertyGrid1;
                xna2dShapeControl1.ToolBox          = this.xnaToolBox1;
                xna2dShapeControl1.RoundLineManager = roundLineManager;
                xna2dShapeControl1.LineBatch        = lineBatch;
                xna2dShapeControl1.SpriteFont       = roundlineFont.Font;
                xna2dShapeControl1.Effect           = roundlineEffect.Effect;
                xna2dShapeControl1.DrawingContext   = drawingContext;
                xna2dShapeControl1.TextureManager   = texture2dManager;
                xna2dShapeControl1.Project          = currentProject;
            }
        }
        public void RefreshProject()
        {
            //ProjectNameNode.Text = "Project Name";

            //ProjectNameNode.Nodes.Clear();

            //xna2dSvgPaintVC.DrawingBatch = null;
            //xna2dSvgPaintVC.DrawingContext = null;
            //xna2dSvgPaintVC.LineBatch = null;
            //xna2dSvgPaintVC.SpriteFont = null;
            //xna2dSvgPaintVC.Effect = null;
            //xna2dSvgPaintVC.Texture = null;

            _svgMainFiles.XnaItems = null;

            if (drawingContext != null)
            {
                drawingContext = null;
            }

            if (drawingBatch != null)
            {
                drawingBatch = null;
            }

            if (lineBatch != null)
            {
                lineBatch = null;
            }

            if (effectManager != null)
            {
                effectManager = null;
            }

            if (fontManager != null)
            {
                fontManager = null;
            }

            if (texture2dManager != null)
            {
                texture2dManager = null;
            }

            if (modelManager != null)
            {
                modelManager = null;
            }

            if (contentManager != null)
            {
                contentManager.Unload();
                contentManager.Dispose();
                contentManager = null;
            }

            if (contentBuilder != null)
            {
                contentBuilder.Clear();
                contentBuilder.Dispose();
                contentBuilder = null;
            }

            if (currentProject != null)
            {
                //ProjectNameNode.Text = currentProject.ProjectName;

                contentBuilder = new ContentBuilder(currentProject.ProjectContentFolder, false);

                contentManager = new ContentManager(this.Services,
                                                    contentBuilder.OutputDirectory);

                modelManager = new XnaModelManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                texture2dManager = new XnaTexture2dManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                fontManager = new XnaFontManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);

                effectManager = new XnaEffectManager(contentBuilder, contentManager, currentProject.OriginalContentFolder);


                //roundLineTechniqueNames = roundLineManager.TechniqueNames;

                //ProjectNameNode.Nodes.Clear();
                ModelNode     = null;
                Texture2dNode = null;
                FontNode      = null;
                EffectNode    = null;

                //effectViewerControl.Effect = null;

                if (currentProject.LoadedModels.Count > 0)
                {
                    currentProject.LoadedModels = modelManager.RefreshList(currentProject.LoadedModels);

                    //foreach (FyriModel model in currentProject.LoadedModels)
                    //{
                    //    AddModelToTreeView(model);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSphereFileName = Directory.GetCurrentDirectory() + "\\Default\\Sphere.fbx";
                    if (File.Exists(defSphereFileName))
                    {
                        LoadModelToProject(defSphereFileName);
                    }
                }

                if (currentProject.LoadedTexture2ds.Count > 0)
                {
                    currentProject.LoadedTexture2ds = texture2dManager.RefreshList(currentProject.LoadedTexture2ds);

                    //foreach (FyriTexture2d texture in currentProject.LoadedTexture2ds)
                    //{
                    //    AddTexture2dToTreeView(texture);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defTulipsPngFileName = Directory.GetCurrentDirectory() + "\\Default\\Tulips.png";
                    if (File.Exists(defTulipsPngFileName))
                    {
                        LoadTexture2dToProject(defTulipsPngFileName);
                    }
                }

                if (currentProject.LoadedFonts.Count > 0)
                {
                    currentProject.LoadedFonts = fontManager.RefreshList(currentProject.LoadedFonts);

                    //foreach (FyriFont font in currentProject.LoadedFonts)
                    //{
                    //    AddFontToTreeView(font);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defSpriteFontFileName = Directory.GetCurrentDirectory() + "\\Default\\SpriteFont.spritefont";
                    if (File.Exists(defSpriteFontFileName))
                    {
                        LoadFontToProject(defSpriteFontFileName);
                    }

                    string defSegoeFontFileName = Directory.GetCurrentDirectory() + "\\Default\\SegoeUI.spritefont";
                    if (File.Exists(defSegoeFontFileName))
                    {
                        LoadFontToProject(defSegoeFontFileName);
                    }
                }

                if (currentProject.LoadedEffects.Count > 0)
                {
                    currentProject.LoadedEffects = effectManager.RefreshList(currentProject.LoadedEffects);

                    //foreach (FyriEffect effect in currentProject.LoadedEffects)
                    //{
                    //    AddEffectToTreeView(effect);
                    //}
                }
                else
                {
                    //Load default Sphere
                    string defRLEffectFileName = Directory.GetCurrentDirectory() + "\\Default\\RoundLine.fx";
                    if (File.Exists(defRLEffectFileName))
                    {
                        LoadEffectToProject(defRLEffectFileName);
                    }
                }

                FyriEffect    roundlineEffect = effectManager.GetEffect("RoundLine");
                FyriFont      roundlineFont   = fontManager.GetFont("SpriteFont");
                FyriFont      segoeUIFont     = fontManager.GetFont("SegoeUI");
                FyriTexture2d tulipsPng       = texture2dManager.GetTexture2d("Tulips");

                lineBatch = new XnaLine2dBatch();
                lineBatch.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect);

                drawingBatch   = new XnaDrawingBatch(this.graphicsDeviceService.GraphicsDevice);
                drawingContext = new XnaDrawingContext(this.graphicsDeviceService.GraphicsDevice);

                _svgMainFiles.XnaItems = new XnaItems();
                _svgMainFiles.XnaItems.ModelManager     = modelManager;
                _svgMainFiles.XnaItems.Texture2dManager = texture2dManager;
                _svgMainFiles.XnaItems.EffectManager    = effectManager;
                _svgMainFiles.XnaItems.FontManager      = fontManager;

                _svgMainFiles.XnaItems.DrawingBatch   = drawingBatch;
                _svgMainFiles.XnaItems.DrawingContext = drawingContext;
                _svgMainFiles.XnaItems.LineBatch      = lineBatch;

                //xna2dSvgPaintVC.SpriteFont = segoeUIFont.Font;
                //xna2dSvgPaintVC.Effect = roundlineEffect.Effect;
                //xna2dSvgPaintVC.Texture = tulipsPng.Texture;
                //xna2dSvgPaintVC.DrawingBatch = drawingBatch;
                //xna2dSvgPaintVC.DrawingContext = drawingContext;
                //xna2dSvgPaintVC.LineBatch = lineBatch;
            }
        }