Exemplo n.º 1
0
        public BitmapFont(string fontFile, string contentManagerName)
        {
            if (FlatRedBall.IO.FileManager.IsRelative(fontFile))
            {
                fontFile = FlatRedBall.IO.FileManager.RelativeDirectory + fontFile;
            }

            string fontContents = FileManager.FromFileText(fontFile);

            mFontFile = FileManager.Standardize(fontFile);

            string[] texturesToLoad = GetSourceTextures(fontContents);

            mTextures = new Texture2D[texturesToLoad.Length];


            string directory   = FileManager.GetDirectory(fontFile);
            string oldRelative = FileManager.RelativeDirectory;

            FileManager.RelativeDirectory = directory;

            for (int i = 0; i < mTextures.Length; i++)
            {
                                #if IOS || ANDROID
                string fileName = texturesToLoad[i].ToLowerInvariant();
                                #else
                string fileName = texturesToLoad[i];
                                #endif
                mTextures[i] = FlatRedBallServices.Load <Texture2D>(fileName, contentManagerName);
            }

            FileManager.RelativeDirectory = oldRelative;

            SetFontPattern(fontContents);
        }
Exemplo n.º 2
0
        protected override void Load(FilePath filePath, out object runtimeObjects, out object dataModel)
        {
            dataModel = null;
            Scene newScene = null;

            try
            {
                if (filePath.Extension == "scnx")
                {
                    newScene = FlatRedBallServices.Load <Scene>(filePath.FullPath,
                                                                GluxManager.ContentManagerName);

                    foreach (Text text in newScene.Texts)
                    {
                        text.AdjustPositionForPixelPerfectDrawing = true;
                        if (ObjectFinder.Self.GlueProject.UsesTranslation)
                        {
                            text.DisplayText = LocalizationManager.Translate(text.DisplayText);
                        }
                    }

                    runtimeObjects = newScene;
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error loading Scene file " + ElementRuntime.ContentDirectory + filePath.FullPath + e.ToString());
            }
            runtimeObjects = newScene;
        }
        static BitmapFont LoadFnt(ReferencedFileSave r)
        {
            BitmapFont bitmapFont;

            bitmapFont = FlatRedBallServices.Load <BitmapFont>(ElementRuntime.ContentDirectory + r.Name, GluxManager.ContentManagerName);
            return(bitmapFont);
        }
        static RuntimeCsvRepresentation LoadCsv(ReferencedFileSave r)
        {
            RuntimeCsvRepresentation rcr = FlatRedBallServices.Load <RuntimeCsvRepresentation>(ElementRuntime.ContentDirectory + r.Name,
                                                                                               GluxManager.ContentManagerName);

            return(rcr);
        }
Exemplo n.º 5
0
        public override ILayoutable GenerateILayoutable(string contentManagerName, Dictionary <string, ILayoutable> namedControls, Dictionary <string, BitmapFont> namedFonts)
        {
            var control = UiControlManager.Instance.CreateControl <FrbUi.Controls.LayoutableSprite>();

            // Since rotation value is relative, we need to set this in the after added event
            control.OnAddedToLayout += delegate {
                control.RelativeRotationZ = (float)(Math.PI * ((RelativeRotationZDegrees ?? 0) / 180));
                control.OnAddedToLayout   = null;
            };

            if (!string.IsNullOrWhiteSpace(AchxName))
            {
                control.AnimationChains = FlatRedBallServices.Load <AnimationChainList>(AchxName, contentManagerName);
            }

            if (!string.IsNullOrWhiteSpace(InitialAnimationChainName))
            {
                control.CurrentAnimationChainName = InitialAnimationChainName;
            }

            SetBaseILayoutableProperties(control, namedControls);
            if (PixelSize != null)
            {
                control.PixelSize = PixelSize.Value;
            }

            if (TextureScale != null)
            {
                control.TextureScale = TextureScale.Value;
            }

            return(control);
        }
 public static void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
                 #if DEBUG
     if (contentManagerName == FlatRedBallServices.GlobalContentManager)
     {
         HasBeenLoadedWithGlobalContentManager = true;
     }
     else if (HasBeenLoadedWithGlobalContentManager)
     {
         throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
     }
                 #endif
     if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/testscreen/gold.png", contentManagerName))
     {
     }
     Gold = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/screens/testscreen/gold.png", contentManagerName);
     if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/parallaxbackground/parallaxtexture.png", contentManagerName))
     {
     }
     ParallaxTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/parallaxbackground/parallaxtexture.png", contentManagerName);
     ParalaxEntity.Entities.ParallaxBackground.LoadStaticContent(contentManagerName);
     CustomLoadStaticContent(contentManagerName);
 }
Exemplo n.º 7
0
        public override ILayoutable GenerateILayoutable(string contentManagerName, Dictionary <string, ILayoutable> namedControls, Dictionary <string, BitmapFont> namedFonts)
        {
            var button = UiControlManager.Instance.CreateControl <FrbUi.Controls.Button>();

            SetBaseILayoutableProperties(button, namedControls);

            if (!string.IsNullOrWhiteSpace(AchxFile))
            {
                button.AnimationChains = FlatRedBallServices.Load <AnimationChainList>(AchxFile, contentManagerName);
            }

            SetupSelectableProperties(button);

            if (!string.IsNullOrWhiteSpace(DisabledAnimationChainName))
            {
                button.DisabledAnimationChainName = DisabledAnimationChainName;
            }

            button.Text = Text;
            button.IgnoreCursorEvents = IgnoreCursorEvents ?? false;

            if (!string.IsNullOrWhiteSpace(FontName))
            {
                BitmapFont font;
                if (!namedFonts.TryGetValue(FontName, out font))
                {
                    throw new InvalidOperationException(
                              string.Format("Button tried to use font {0} which is not setup in the UI xml", FontName));
                }

                button.TextFont = font;
            }

            return(button);
        }
        static Scene LoadScnx(ReferencedFileSave r, IElement container)
        {
            Scene newScene = null;

            try
            {
                newScene = FlatRedBallServices.Load <Scene>(ElementRuntime.ContentDirectory + r.Name, GluxManager.ContentManagerName);

                foreach (Text text in newScene.Texts)
                {
                    text.AdjustPositionForPixelPerfectDrawing = true;
                    if (ObjectFinder.Self.GlueProject.UsesTranslation)
                    {
                        text.DisplayText = LocalizationManager.Translate(text.DisplayText);
                    }
                }

                if (!r.IsSharedStatic || container is ScreenSave)
                {
                    newScene.AddToManagers();
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error loading Scene file " + ElementRuntime.ContentDirectory + r.Name + e.ToString());
            }
            return(newScene);
        }
Exemplo n.º 9
0
        public string AddEffect(string fileName, int partIndex)
        {
            // Load the effect
            Effect effect = FlatRedBallServices.Load <Effect>(fileName);

            // Store the effect's short name
            string shortName = ShortName(fileName);

            mEffectFilenames.Add(shortName, fileName);

            // Store the effect
            mEffectDictionary.Add(shortName, effect);

            // Create a list of parameters
            mEffectParameters.Add(shortName, new List <string>());

            // Set effect if needed
            if (partIndex >= 0)
            {
                SetPartEffect(partIndex, shortName);
            }

            // Return the short name
            return(shortName);
        }
        private static void TryHandlePngRefresh(FilePath fileName, List <LoadedFile> allFileObjects)
        {
            var mapLayersReferencingTexture = new List <MapDrawableBatch>();

            // see if this is referenced by any of the existing TMX's
            foreach (var tmxLoadedFile in allFileObjects.Where(item => item.FilePath.Extension == "tmx"))
            {
                var runtimeObject = tmxLoadedFile.RuntimeObject as LayeredTileMap;

                foreach (var mapLayer in runtimeObject.MapLayers)
                {
                    var referencesTexture = mapLayer.Texture.Name == fileName;

                    if (referencesTexture)
                    {
                        mapLayersReferencingTexture.Add(mapLayer);
                    }
                }
            }

            if (mapLayersReferencingTexture.Count > 0)
            {
                FlatRedBallServices.Unload(nameof(TiledRuntimeFileManager));

                var newTexture = FlatRedBallServices.Load <Texture2D>(fileName.FullPath, nameof(TiledRuntimeFileManager));
                // unload the content manager so that we can re-create the files:
                foreach (var layer in mapLayersReferencingTexture)
                {
                    layer.Texture = newTexture;
                }
                // even though we may have handled it, we don't want to return true because
                // other plugins may reload this file too
            }
        }
Exemplo n.º 11
0
        public ReactiveHud()
        {
            mMarkerLayer = SpriteManager.AddLayer();

            #region Create the Sprite Over Marker

            mSpriteOverMarker = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/smallSquareClear.bmp", AppState.Self.PermanentContentManager),
                mMarkerLayer);
            mSpriteOverMarker.RelativeZ = -.0001f;
            mSpriteOverMarker.Visible   = false;
            mSpriteOverMarker.Alpha     = 100;

            #endregion

            #region Create the Current Emitter Marker

            mCurrentEmitterMarker = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/smallSquare.bmp", AppState.Self.PermanentContentManager),
                mMarkerLayer);
            mCurrentEmitterMarker.Visible = false;

            #endregion

            mEmissionAreaVisibleRepresentation = new EmissionAreaVisibleRepresentation();
        }
Exemplo n.º 12
0
        public override ILayoutable GenerateILayoutable(string contentManagerName, Dictionary <string, ILayoutable> namedControls, Dictionary <string, BitmapFont> namedFonts)
        {
            var layout = UiControlManager.Instance.CreateControl <FrbUi.Layouts.BoxLayout>();

            SetBaseILayoutableProperties(layout, namedControls);
            layout.Spacing         = Spacing ?? 0f;
            layout.Margin          = Margin ?? 0f;
            layout.BackgroundAlpha = BackgroundAlpha ?? 1f;

            if (!string.IsNullOrWhiteSpace(BackgroundAchxFile))
            {
                layout.BackgroundAnimationChains = FlatRedBallServices.Load <AnimationChainList>(BackgroundAchxFile, contentManagerName);
            }

            SetupSelectableProperties(layout);

            switch (Direction)
            {
            case LayoutDirection.Up:
                layout.CurrentDirection = FrbUi.Layouts.BoxLayout.Direction.Up;
                break;

            case LayoutDirection.Down:
                layout.CurrentDirection = FrbUi.Layouts.BoxLayout.Direction.Down;
                break;

            case LayoutDirection.Left:
                layout.CurrentDirection = FrbUi.Layouts.BoxLayout.Direction.Left;
                break;

            case LayoutDirection.Right:
                layout.CurrentDirection = FrbUi.Layouts.BoxLayout.Direction.Right;
                break;
            }

            foreach (var child in Children)
            {
                FrbUi.Layouts.BoxLayout.Alignment childAlignment;
                switch (child.ItemAlignment)
                {
                case BoxLayoutXmlChild.Alignment.Centered:
                    childAlignment = FrbUi.Layouts.BoxLayout.Alignment.Centered;
                    break;

                case BoxLayoutXmlChild.Alignment.Inverse:
                    childAlignment = FrbUi.Layouts.BoxLayout.Alignment.Inverse;
                    break;

                default:
                    childAlignment = FrbUi.Layouts.BoxLayout.Alignment.Default;
                    break;
                }

                var childLayoutable = child.Item.GenerateILayoutable(contentManagerName, namedControls, namedFonts);
                layout.AddItem(childLayoutable, childAlignment);
            }

            return(layout);
        }
Exemplo n.º 13
0
 public void InitializeAssets()
 {
     // Load invisible effect
     if (mMaterial != null && modelViewControl1.GraphicsDevice != null)
     {
         mMaterial.InvisibleEffect = FlatRedBallServices.Load <Effect>(@"Content\simple.fx");
     }
 }
        static Texture2D LoadTexture2D(ReferencedFileSave r)
        {
            Texture2D texture;

            texture = FlatRedBallServices.Load <Texture2D>(ElementRuntime.ContentDirectory + r.Name, GluxManager.ContentManagerName);

            return(texture);
        }
Exemplo n.º 15
0
        private void SetAnimations()
        {
            // Load animation file through content pipeline
            PlayerAnimations = FlatRedBallServices.Load <AnimationChainList>(@"Content/Entities/Player/AnimationChainListFile.achx", "Global");

            SpriteInstance.AnimationChains = PlayerAnimations;
            SpriteInstance.Animate         = true;
        }
        static AnimationChainList LoadAchx(ReferencedFileSave r)
        {
            AnimationChainList newAnimationChainList;
            string             fileToLoad = ElementRuntime.ContentDirectory + r.Name;

            newAnimationChainList = FlatRedBallServices.Load <AnimationChainList>(fileToLoad, GluxManager.ContentManagerName);
            return(newAnimationChainList);
        }
Exemplo n.º 17
0
        public EditorHandles()
        {
            spritesAlreadyChanged = new PositionedObjectList <PositionedObject>();

            Layer axisLayer = SpriteManager.AddLayer();

            origin = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/Origin.png", GuiManager.InternalGuiContentManagerName), axisLayer);
            origin.Name = "OriginOfEditAxes";
            editAxisSpriteArray.Add(origin);

            xAxis = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/MoveX.png", GuiManager.InternalGuiContentManagerName), axisLayer);

            editAxisSpriteArray.Add(xAxis);

            yAxis = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/MoveY.png", GuiManager.InternalGuiContentManagerName), axisLayer);
            editAxisSpriteArray.Add(yAxis);

            zAxis = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/MoveZ.png", GuiManager.InternalGuiContentManagerName), axisLayer);
            editAxisSpriteArray.Add(zAxis);

            xScale = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/ScaleX.png", GuiManager.InternalGuiContentManagerName), axisLayer);
            editAxisSpriteArray.Add(xScale);

            yScale = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/ScaleY.png", GuiManager.InternalGuiContentManagerName), axisLayer);
            editAxisSpriteArray.Add(yScale);

            xRot = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/RotateX.png", GuiManager.InternalGuiContentManagerName), axisLayer);

            editAxisSpriteArray.Add(xRot);

            yRot = SpriteManager.AddSprite(
                FlatRedBallServices.Load <Texture2D>("Content/EditorHandles/RotateY.png", GuiManager.InternalGuiContentManagerName), axisLayer);



            editAxisSpriteArray.Add(yRot);

            xAxis.AttachTo(origin, true);
            yAxis.AttachTo(origin, true);
            zAxis.AttachTo(origin, true);
            xScale.AttachTo(origin, true);
            yScale.AttachTo(origin, true);
            xRot.AttachTo(origin, true);
            yRot.AttachTo(origin, true);

            Scale = 1;

            editAxisSpriteArray.Visible = false;
            mCursorOverAxis             = false;
            mVisible = false;
        }
Exemplo n.º 18
0
 public static void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
     ContentManagerName = contentManagerName;
                 #if DEBUG
     if (contentManagerName == FlatRedBallServices.GlobalContentManager)
     {
         HasBeenLoadedWithGlobalContentManager = true;
     }
     else if (HasBeenLoadedWithGlobalContentManager)
     {
         throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
     }
                 #endif
     bool registerUnload = false;
     if (LoadedContentManagers.Contains(contentManagerName) == false)
     {
         LoadedContentManagers.Add(contentManagerName);
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("BoardTileStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilenone.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileNone = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilenone.png", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tileotexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileOTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tileotexture.png", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilextexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         TileXTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/boardtile/tilextexture.png", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("BoardTileStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }
Exemplo n.º 19
0
        private void CopyAssetsToFileFolder(Window callingWindow)
        {
            string directory = FileManager.GetDirectory(mLastFileName);

            #region Copy Texture2Ds and replace references

            foreach (Texture2D texture in mTexturesNotRelative)
            {
                if (!System.IO.File.Exists(directory + FileManager.RemovePath(texture.Name)))
                {
                    System.IO.File.Copy(texture.Name, directory + FileManager.RemovePath(texture.Name));
                }
                GameData.ReplaceTexture(texture,
                                        FlatRedBallServices.Load <Texture2D>(directory + FileManager.RemovePath(texture.Name), GameData.SceneContentManager));
            }
            #endregion

            #region Copy AnimationChainLists and replace references

            foreach (AnimationChainList animationChainList in mAnimationChainListsNotRelative)
            {
                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);
            }

            #endregion

            #region Copy Fnt Files and replace references

            foreach (string oldFnt in mFntFilesNotRelative)
            {
                if (!System.IO.File.Exists(directory + FileManager.RemovePath(oldFnt)))
                {
                    System.IO.File.Copy(
                        oldFnt,
                        directory + FileManager.RemovePath(oldFnt));

                    foreach (Text text in GameData.Scene.Texts)
                    {
                        if (text.Font.FontFile == oldFnt)
                        {
                            // A little inefficient because it hits the file for the same information.
                            // Revisit this if it's a performance problem.
                            text.Font.SetFontPatternFromFile(directory + FileManager.RemovePath(oldFnt));
                        }
                    }
                }
            }


            #endregion

            SaveSceneFileWindowOk(callingWindow);
        }
Exemplo n.º 20
0
        public override ILayoutable GenerateILayoutable(string contentManagerName, Dictionary <string, ILayoutable> namedControls, Dictionary <string, BitmapFont> namedFonts)
        {
            var layout = UiControlManager.Instance.CreateControl <FrbUi.Layouts.GridLayout>();

            SetBaseILayoutableProperties(layout, namedControls);
            layout.Spacing = Spacing ?? 0f;
            layout.Margin  = Margin ?? 0f;
            layout.Alpha   = Alpha ?? 1f;

            if (!string.IsNullOrWhiteSpace(BackgroundAchxFile))
            {
                layout.BackgroundAnimationChains = FlatRedBallServices.Load <AnimationChainList>(BackgroundAchxFile, contentManagerName);
            }

            SetupSelectableProperties(layout);

            foreach (var child in Children.Where(x => x.Item != null))
            {
                FrbUi.Layouts.GridLayout.HorizontalAlignment horizontalAlignment;
                FrbUi.Layouts.GridLayout.VerticalAlignment   verticalAlignment;

                switch (child.HorizontalAlignment)
                {
                case GridLayoutXmlChild.HorizontalAlignments.Center:
                    horizontalAlignment = FrbUi.Layouts.GridLayout.HorizontalAlignment.Center;
                    break;

                case GridLayoutXmlChild.HorizontalAlignments.Right:
                    horizontalAlignment = FrbUi.Layouts.GridLayout.HorizontalAlignment.Right;
                    break;

                default:
                    horizontalAlignment = FrbUi.Layouts.GridLayout.HorizontalAlignment.Left;
                    break;
                }

                switch (child.VerticalAlignment)
                {
                case GridLayoutXmlChild.VerticalAlignments.Center:
                    verticalAlignment = FrbUi.Layouts.GridLayout.VerticalAlignment.Center;
                    break;

                case GridLayoutXmlChild.VerticalAlignments.Bottom:
                    verticalAlignment = FrbUi.Layouts.GridLayout.VerticalAlignment.Bottom;
                    break;

                default:
                    verticalAlignment = FrbUi.Layouts.GridLayout.VerticalAlignment.Top;
                    break;
                }

                var item = child.Item.GenerateILayoutable(contentManagerName, namedControls, namedFonts);
                layout.AddItem(item, child.RowIndex, child.ColumnIndex, horizontalAlignment, verticalAlignment);
            }

            return(layout);
        }
Exemplo n.º 21
0
        public ToolsWindow(Cursor cursor) : base()
        {
            messages = GuiData.Messages;

            SetPositionTL(3.5f, 63.8f);

            HasCloseButton = true;

            moveObject      = AddToggleButton();
            moveObject.Text = "Move";
            moveObject.SetOverlayTextures(
                FlatRedBallServices.Load <Texture2D>("Content/icons/Tools/move.tga", AppState.Self.PermanentContentManager),
                null);

            attachObject      = AddToggleButton();
            attachObject.Text = "Attach";
            moveObject.AddToRadioGroup(attachObject);
            attachObject.SetOverlayTextures(
                FlatRedBallServices.Load <Texture2D>("Content/icons/attach.tga", AppState.Self.PermanentContentManager),
                null);


            detachObject         = AddButton();
            detachObject.Text    = "Detach";
            detachObject.Enabled = false;
            detachObject.SetOverlayTextures(
                FlatRedBallServices.Load <Texture2D>("Content/icons/detach.tga", AppState.Self.PermanentContentManager),
                null);
            detachObject.Click += new GuiMessage(messages.DetachObjectClick);


            copyEmitter      = AddButton();
            copyEmitter.Text = "Copy";
            copyEmitter.SetOverlayTextures(
                FlatRedBallServices.Load <Texture2D>("Content/icons/duplicate.tga", AppState.Self.PermanentContentManager),
                null);
            copyEmitter.Click  += new GuiMessage(CopyEmitterClick);
            copyEmitter.Enabled = false;

            scaleEmitterTime      = AddButton();
            scaleEmitterTime.Text = "Scale Emitter Speed";
            scaleEmitterTime.SetOverlayTextures(15, 2);
            scaleEmitterTime.Click  += new GuiMessage(ScaleEmitterTimeClick);
            scaleEmitterTime.Enabled = false;

            #region DownZFreeRotateButton

            this.mDownZFreeRotateButton = base.AddToggleButton();


            mDownZFreeRotateButton.SetOverlayTextures(
                FlatRedBallServices.Load <Texture2D>(@"Content\DownZ.png", FlatRedBallServices.GlobalContentManager),
                FlatRedBallServices.Load <Texture2D>(@"Content\FreeRotation.png", FlatRedBallServices.GlobalContentManager));


            #endregion
        }
Exemplo n.º 22
0
        static public Cursor AddCursor(Camera camera)
        {
            Cursor cursorToAdd = new Cursor(camera);

            cursorToAdd.SetCursor(
                FlatRedBallServices.Load <Texture2D>("Assets/Textures/cursor1.bmp", InternalGuiContentManagerName), -.5f, 1);

            mCursors.Add(cursorToAdd);
            return(cursorToAdd);
        }
Exemplo n.º 23
0
 public void Initialize(GraphicsDevice device, Camera camera)
 {
     Width       = device.PresentationParameters.BackBufferWidth;
     Height      = device.PresentationParameters.BackBufferHeight;
     this.device = device;
     spriteBatch = new SpriteBatch(this.device);
     effect      = FlatRedBallServices.Load <Effect>(@"Content\Shaders\BloomExtract");
     effect.Parameters["BloomThreshold"].SetValue(Threshold);
     initialized = true;
 }
Exemplo n.º 24
0
        public static void LoadScene(string fileName)
        {
            if (mLoadedScene != null)
            {
                UnloadScene();
            }

            mLoadedScene = FlatRedBallServices.Load <Scene>(fileName, SceneContentManager);
            mLoadedScene.AddToManagers();
        }
        void OnLoadNodeNetworkOk(Window callingWindow)
        {
            CloseNodeNetworkClick(null);

            string fileName = ((FileWindow)callingWindow).Results[0];

            mNodeNetwork = FlatRedBallServices.Load <NodeNetwork>(fileName);

            mNodeNetwork.Visible = true;
        }
Exemplo n.º 26
0
        public ToggleButton AddToggleButton(string textureToUse, string contentManagerName)
        {
            ToggleButton button     = this.AddToggleButton();
            Texture2D    newTexture = FlatRedBallServices.Load <Texture2D>(textureToUse, contentManagerName);

            button.SetOverlayTextures(
                newTexture, newTexture);

            return(button);
        }
Exemplo n.º 27
0
        private void LoadPick(List <GameObject> gameObjects)
        {
            foreach (NetConnection Player in mAgent.Connections)
            {
                Player.Ready = false;
            }
            foreach (Player p in PlayerList)
            {
                p.Kill(gameObjects);
            }
            foreach (GameObject g in new List <GameObject>(gameObjects))
            {
                if (g is Projectile)
                {
                    g.Kill(gameObjects);
                }
            }
            PlayerList.Clear();
            Aliveplayers.Clear();
            for (byte i = 0; i < 12; i++)
            {
                if (i < 9)
                {
                    PickButtons.Add(new MenuButton(game, SpriteManager.AddSprite(Textures.spelltextures[i]), i));
                }
                else
                {
                    PickButtons.Add(new MenuButton(game, SpriteManager.AddSprite(Textures.playertextures[i - 9]), i));
                }
                PickButtons[i].Sprite.Position.Y -= i % 3 * 100 - 300;
                PickButtons[i].Sprite.Position.X += ((i / 3) * 100) - 150f;
                PickButtons[i].Sprite.Width       = 50;
                PickButtons[i].Sprite.Height      = 50;
                //for (int n = 0; n < 3; n++)
                //{

                //}
            }
            for (int i = 0; i <= 9; i += 3)
            {
                cosmetics.Add(new Sprite());
                cosmetics[cosmetics.Count - 1].Texture  = FlatRedBallServices.Load <Texture2D>(Textures.PickHighlight);
                cosmetics[cosmetics.Count - 1].Position = PickButtons[i].Sprite.Position;
                cosmetics[cosmetics.Count - 1].Width    = 80;
                cosmetics[cosmetics.Count - 1].Height   = 80;
                SpriteManager.AddSprite(cosmetics[cosmetics.Count - 1]);
            }

            Sprite t = new Sprite();

            t.Texture = FlatRedBallServices.Load <Texture2D>(Textures.Go);
            PickButtons.Add(new MenuButton(game, t, 254));
            SpriteManager.AddSprite(t);
            t.Position = new Vector3(400, -250, 0);
        }
Exemplo n.º 28
0
        private void CheckForExtraFiles(string fileLoaded)
        {
            #region Try loading the .sep file

            try
            {
                if (System.IO.File.Exists(FileManager.RemoveExtension(fileLoaded) + ".sep"))
                {
                    GameData.SpriteEditorSceneProperties = SpriteEditorSceneProperties.Load(FileManager.RemoveExtension(fileLoaded) + ".sep");

                    SpriteEditorSceneProperties sesp = GameData.SpriteEditorSceneProperties;

                    if (sesp != null)
                    {
                        string directory = FileManager.GetDirectory(fileLoaded);

                        sesp.SetCameras(GameData.Camera, GameData.BoundsCamera);

                        GameData.EditorProperties.WorldAxesDisplayVisible = sesp.WorldAxesVisible;
                        GameData.EditorProperties.PixelSize = sesp.PixelSize;

                        if (sesp.BoundsVisible)
                        {
                            GuiData.CameraBoundsPropertyGrid.Visible = true;
                        }


                        // add the textures from the SpriteEditorSceneProperties
                        if (sesp.TextureDisplayRegionsList != null)
                        {
                            foreach (TextureDisplayRegionsSave textureReference in sesp.TextureDisplayRegionsList)
                            {
                                string fileName = directory + textureReference.TextureName;
                                if (System.IO.File.Exists(fileName))
                                {
                                    Texture2D texture = FlatRedBallServices.Load <Texture2D>(fileName, GameData.SceneContentManager);

                                    foreach (DisplayRegion displayRegion in textureReference.DisplayRegions)
                                    {
                                        GuiData.ListWindow.AddDisplayRegion(displayRegion, texture);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                // do nothing, it's ok.
            }

            #endregion
        }
Exemplo n.º 29
0
        /// <summary>
        /// Creates a new AnimationFrame.
        /// </summary>
        /// <param name="textureName">The string name of the Texture2D to use for this AnimationFrame.
        /// This will be loaded through the content pipeline using the arugment contentManagerName.</param>
        /// <param name="frameLength">The amount of time in seconds that this AnimationFrame will display for when
        /// it is used in an AnimationChain.</param>
        /// <param name="contentManagerName">The content manager name to use when loading the Texture2D .</param>
        #endregion
        public AnimationFrame(string textureName, float frameLength, string contentManagerName)
        {
            Texture        = FlatRedBallServices.Load <Texture2D>(textureName, contentManagerName);
            FrameLength    = frameLength;
            FlipHorizontal = false;
            FlipVertical   = false;

            Instructions = new List <Instruction>();

            TextureName = textureName;
        }
Exemplo n.º 30
0
 public static new void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new ArgumentException("contentManagerName cannot be empty or null");
     }
     ContentManagerName = contentManagerName;
     PlatformerCharacterBase.LoadStaticContent(contentManagerName);
                 #if DEBUG
     if (contentManagerName == FlatRedBallServices.GlobalContentManager)
     {
         HasBeenLoadedWithGlobalContentManager = true;
     }
     else if (HasBeenLoadedWithGlobalContentManager)
     {
         throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
     }
                 #endif
     bool registerUnload = false;
     if (LoadedContentManagers.Contains(contentManagerName) == false)
     {
         LoadedContentManagers.Add(contentManagerName);
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (!FlatRedBallServices.IsLoaded <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName))
         {
             registerUnload = true;
         }
         AnimationChainListFile = FlatRedBallServices.Load <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/playertexture.png", ContentManagerName))
         {
             registerUnload = true;
         }
         PlayerTexture = FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/playertexture.png", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }