Beispiel #1
0
 private System.Collections.Generic.IEnumerable <FlatRedBall.Instructions.Instruction> FadeOutAnimationRelativeInstructions(object target)
 {
     {
     }
     {
         var toReturn = new FlatRedBall.Instructions.DelegateInstruction(() =>
         {
             var relativeStart = ElementSave.AllStates.FirstOrDefault(item => item.Name == "Fading/NotFaded").Clone();
             var relativeEnd   = ElementSave.AllStates.FirstOrDefault(item => item.Name == "Fading/Faded").Clone();
             Gum.DataTypes.Variables.StateSaveExtensionMethods.SubtractFromThis(relativeEnd, relativeStart);
             var difference = relativeEnd;
             Gum.DataTypes.Variables.StateSave first  = GetCurrentValuesOnState(Fading.Faded);
             Gum.DataTypes.Variables.StateSave second = first.Clone();
             Gum.DataTypes.Variables.StateSaveExtensionMethods.AddIntoThis(second, difference);
             FlatRedBall.Glue.StateInterpolation.Tweener tweener = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: 1, type: FlatRedBall.Glue.StateInterpolation.InterpolationType.Linear, easing: FlatRedBall.Glue.StateInterpolation.Easing.Out);
             tweener.Owner           = this;
             tweener.PositionChanged = newPosition => this.InterpolateBetween(first, second, newPosition);
             tweener.Start();
             StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
         }
                                                                         );
         toReturn.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + 0;
         toReturn.Target        = target;
         yield return(toReturn);
     }
 }
        public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
        {
            if (stateToInterpolateTo == VariableState.abariguessshowing)
            {
            }
            else if (stateToInterpolateTo == VariableState.adiamondshowing)
            {
            }
            else if (stateToInterpolateTo == VariableState.FRB_iconshowing)
            {
            }
            else if (stateToInterpolateTo == VariableState.somethingshowing)
            {
            }
            else if (stateToInterpolateTo == VariableState.Veilstone_Corner_Moon_StoneShowing)
            {
            }
            else if (stateToInterpolateTo == VariableState.ROLLING)
            {
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #3
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(TankColor stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  TankColor.Orange:
                TurretInstance.InterpolateToState(GreasyPlatypusSlapper.Entities.Turret.TurretColor.Orange, secondsToTake);
                break;

            case  TankColor.Red:
                TurretInstance.InterpolateToState(GreasyPlatypusSlapper.Entities.Turret.TurretColor.Red, secondsToTake);
                break;

            case  TankColor.Green:
                TurretInstance.InterpolateToState(GreasyPlatypusSlapper.Entities.Turret.TurretColor.Green, secondsToTake);
                break;

            case  TankColor.Olive:
                TurretInstance.InterpolateToState(GreasyPlatypusSlapper.Entities.Turret.TurretColor.Olive, secondsToTake);
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <TankColor>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #4
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
        {
            if (stateToInterpolateTo == VariableState.Flying)
            {
            }
            else if (stateToInterpolateTo == VariableState.Impact)
            {
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #5
0
 private System.Collections.Generic.IEnumerable <FlatRedBall.Instructions.Instruction> FadeOutAnimationInstructions(object target)
 {
     {
         var toReturn = new FlatRedBall.Instructions.DelegateInstruction(() => this.CurrentFadingState = Fading.NotFaded);
         toReturn.TimeToExecute = FlatRedBall.TimeManager.CurrentTime;
         toReturn.Target        = target;
         yield return(toReturn);
     }
     {
         var toReturn = new FlatRedBall.Instructions.DelegateInstruction(() => this.InterpolateTo(Fading.Faded, 1, FlatRedBall.Glue.StateInterpolation.InterpolationType.Linear, FlatRedBall.Glue.StateInterpolation.Easing.Out, FadeOutAnimation));
         toReturn.Target        = target;
         toReturn.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + 0;
         yield return(toReturn);
     }
 }
Beispiel #6
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(IconState stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  IconState.Selected:
                break;

            case  IconState.NotSelected:
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <IconState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #7
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
        {
            if (stateToInterpolateTo == VariableState.Enabled)
            {
                SpriteInstance.AlphaRate = (1f - SpriteInstance.Alpha) / (float)secondsToTake;
            }
            else if (stateToInterpolateTo == VariableState.Disabled)
            {
                SpriteInstance.AlphaRate = (0.1f - SpriteInstance.Alpha) / (float)secondsToTake;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #8
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(PlayerType stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  PlayerType.Computer:
                break;

            case  PlayerType.Human:
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <PlayerType>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
        public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  VariableState.Opaque:
                SpriteObject.AlphaRate = (1f - SpriteObject.Alpha) / (float)secondsToTake;
                break;

            case  VariableState.Transparent:
                SpriteObject.AlphaRate = (0f - SpriteObject.Alpha) / (float)secondsToTake;
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            FlatRedBall.Instructions.InstructionManager.Add(instruction);
            return(instruction);
        }
Beispiel #10
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  VariableState.Idle:
                break;

            case  VariableState.Walk:
                break;

            case  VariableState.Jump:
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <VariableState>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
        public FlatRedBall.Instructions.Instruction InterpolateToState(Jump stateToInterpolateTo, double secondsToTake)
        {
            if (stateToInterpolateTo == Jump.InAir)
            {
            }
            else if (stateToInterpolateTo == Jump.Landing)
            {
            }
            else if (stateToInterpolateTo == Jump.PreparingJump)
            {
            }
            else if (stateToInterpolateTo == Jump.NotJumping)
            {
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <Jump>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
        public FlatRedBall.Instructions.Instruction InterpolateToState(CurrentlyActive stateToInterpolateTo, double secondsToTake)
        {
            if (stateToInterpolateTo == CurrentlyActive.Active)
            {
                SpriteInstance.RedRate   = (0.1f - SpriteInstance.Red) / (float)secondsToTake;
                SpriteInstance.GreenRate = (1f - SpriteInstance.Green) / (float)secondsToTake;
                SpriteInstance.BlueRate  = (1f - SpriteInstance.Blue) / (float)secondsToTake;
                SpriteInstance.AlphaRate = (255f - SpriteInstance.Alpha) / (float)secondsToTake;
            }
            else if (stateToInterpolateTo == CurrentlyActive.Inactive)
            {
                SpriteInstance.RedRate   = (1f - SpriteInstance.Red) / (float)secondsToTake;
                SpriteInstance.GreenRate = (0f - SpriteInstance.Green) / (float)secondsToTake;
                SpriteInstance.BlueRate  = (0f - SpriteInstance.Blue) / (float)secondsToTake;
                SpriteInstance.AlphaRate = (100f - SpriteInstance.Alpha) / (float)secondsToTake;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <CurrentlyActive>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #13
0
        public FlatRedBall.Instructions.Instruction InterpolateToState(TurretColor stateToInterpolateTo, double secondsToTake)
        {
            switch (stateToInterpolateTo)
            {
            case  TurretColor.Orange:
                break;

            case  TurretColor.Red:
                break;

            case  TurretColor.Green:
                break;

            case  TurretColor.Olive:
                break;
            }
            var instruction = new FlatRedBall.Instructions.DelegateInstruction <TurretColor>(StopStateInterpolation, stateToInterpolateTo);

            instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
            this.Instructions.Add(instruction);
            return(instruction);
        }
Beispiel #14
0
        public static void StaticInitialize(string projectFileName)
        {
            if (mManagers == null)
            {
                mManagers = new SystemManagers();
                mManagers.Initialize(FlatRedBallServices.GraphicsDevice);
                mManagers.Renderer.Camera.AbsoluteLeft = 0;
                mManagers.Renderer.Camera.AbsoluteTop  = 0;


                // Need to do the zoom here in response to the FRB camera vs. the Gum camera
                mManagers.Renderer.Camera.CameraCenterOnScreen = CameraCenterOnScreen.TopLeft;
                mManagers.Renderer.Camera.X = 0;
                mManagers.Renderer.Camera.Y = 0;

                SystemManagers.Default = mManagers;
                FlatRedBallServices.AddManager(RenderingLibrary.SystemManagers.Default);

                RenderingLibrary.Graphics.Text.RenderBoundaryDefault = false;
                // FlatRedBall uses premult alpha.
                RenderingLibrary.Graphics.Renderer.NormalBlendState = Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend;

                UpdateDisplayToMainFrbCamera();


                var idb = new GumIdb();
                // We don't want the UI to be at Z=0 because it will render
                // at the same Z along with FRB entities and environments so UI might
                // be hidden. The proper way to solve this is to use Layers, but
                // this shouldn't be creating new Layers, that's up to the user.
                // Let's make it have a positive Z so it draws in more things at once
                idb.Z = 10;

                // This could be called on a secondary thread, like if called by GlobalContent, so we
                // want this to happen on the primary thread:
                Action primaryThreadAction = () =>
                {
                    FlatRedBall.SpriteManager.AddDrawableBatch(idb);
                    FlatRedBall.Screens.ScreenManager.PersistentDrawableBatches.Add(idb);
                };

                var instruction = new FlatRedBall.Instructions.DelegateInstruction(primaryThreadAction);
                FlatRedBall.Instructions.InstructionManager.Add(instruction);
            }

            if (projectFileName == null)
            {
                throw new Exception("The GumIDB must be initialized with a valid (non-null) project file.");
            }

            string errors;

            mProjectFileName = projectFileName;

            if (FlatRedBall.IO.FileManager.IsRelative(mProjectFileName))
            {
                mProjectFileName = FlatRedBall.IO.FileManager.RelativeDirectory + mProjectFileName;
            }

            // First let's set the relative directory to the file manager's relative directory so we can load
            // the file normally...
            ToolsUtilities.FileManager.RelativeDirectory = FlatRedBall.IO.FileManager.RelativeDirectory;

            GumLoadResult result;

            ObjectFinder.Self.GumProjectSave = GumProjectSave.Load(mProjectFileName, out result);

#if DEBUG
            if (ObjectFinder.Self.GumProjectSave == null)
            {
                throw new Exception("Could not find Gum project at " + mProjectFileName);
            }

            if (!string.IsNullOrEmpty(result.ErrorMessage))
            {
                throw new Exception(result.ErrorMessage);
            }

            if (result.MissingFiles.Count != 0)
            {
                throw new Exception("Missing files starting with " + result.MissingFiles[0]);
            }
#endif

            // Now we can set the directory to Gum's root:
            ToolsUtilities.FileManager.RelativeDirectory = ToolsUtilities.FileManager.GetDirectory(mProjectFileName);

            // The Gum tool does a lot more init than this, but we're going to only do a subset
            //of initialization for performance
            // reasons:
            foreach (var item in ObjectFinder.Self.GumProjectSave.Screens)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.Components)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.StandardElements)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
                //for atlased colored rectangles
                if (item.Name == "ColoredRectangle")
                {
                    RenderingLibrary.Graphics.SolidRectangle.AtlasedTextureName = "..\\Graphics\\Misc\\ColoredRectangle.png";
                }
            }

            StandardElementsManager.Self.Initialize();
        }
 public FlatRedBall.Instructions.Instruction InterpolateToState(ChosenMenuOption stateToInterpolateTo, double secondsToTake)
 {
     switch(stateToInterpolateTo)
     {
         case  ChosenMenuOption.Quit:
             break;
         case  ChosenMenuOption.Options:
             break;
         case  ChosenMenuOption.LevelSelect:
             break;
         case  ChosenMenuOption.None:
             break;
     }
     var instruction = new FlatRedBall.Instructions.DelegateInstruction<ChosenMenuOption>(StopStateInterpolation, stateToInterpolateTo);
     instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
     this.Instructions.Add(instruction);
     return instruction;
 }
 public FlatRedBall.Instructions.Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
 {
     switch(stateToInterpolateTo)
     {
         case  VariableState.Activated:
             OverallAlphaVelocity = (1f - OverallAlpha) / (float)secondsToTake;
             break;
         case  VariableState.Deactivated:
             OverallAlphaVelocity = (0f - OverallAlpha) / (float)secondsToTake;
             break;
     }
     var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
     instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
     this.Instructions.Add(instruction);
     return instruction;
 }
		public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake)
		{
			switch(stateToInterpolateTo)
			{
				case  VariableState.Hayek:
					break;
				case  VariableState.Keynes:
					break;
				case  VariableState.Malthus:
					break;
				case  VariableState.Smith:
					break;
				case  VariableState.Hayek2:
					break;
				case  VariableState.Keynes2:
					break;
				case  VariableState.Malthus2:
					break;
				case  VariableState.Smith2:
					break;
			}
			var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
			instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
			FlatRedBall.Instructions.InstructionManager.Add(instruction);
			return instruction;
		}
Beispiel #18
0
		public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake)
		{
			switch(stateToInterpolateTo)
			{
				case  VariableState.Parado:
					break;
				case  VariableState.Caminando:
					break;
				case  VariableState.Agachado:
					break;
				case  VariableState.BloqueoArriba:
					break;
				case  VariableState.BloqueoAbajo:
					break;
				case  VariableState.GolpeArriba:
					break;
				case  VariableState.GolpeAbajo:
					break;
				case  VariableState.Especial1:
					break;
				case  VariableState.Especial2:
					break;
				case  VariableState.Super:
					break;
				case  VariableState.Golpeado:
					break;
				case  VariableState.Muerto:
					break;
				case  VariableState.FlipParado:
					break;
				case  VariableState.FlipCaminando:
					break;
				case  VariableState.FlipAgachado:
					break;
				case  VariableState.FlipBloqueoArriba:
					break;
				case  VariableState.FlipBloqueoAbajo:
					break;
				case  VariableState.FlipGolpeArriba:
					break;
				case  VariableState.FlipGolpeAbajo:
					break;
				case  VariableState.FlipEspecial1:
					break;
				case  VariableState.FlipEspecial2:
					break;
				case  VariableState.FlipSuper:
					break;
				case  VariableState.FlipGolpeado:
					break;
				case  VariableState.FlipMuerto:
					break;
				case  VariableState.Boom:
					break;
				case  VariableState.Bust:
					break;
				case  VariableState.FlipBoom:
					break;
				case  VariableState.FlipBust:
					break;
				case  VariableState.Nulo:
					break;
			}
			var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
			instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
			this.Instructions.Add(instruction);
			return instruction;
		}
Beispiel #19
0
        public static void StaticInitialize(string projectFileName)
        {
            if (mManagers == null)
            {
                mManagers = new SystemManagers();
                mManagers.Initialize(FlatRedBallServices.GraphicsDevice);
                mManagers.Renderer.Camera.AbsoluteLeft = 0;
                mManagers.Renderer.Camera.AbsoluteTop = 0;

                var viewport = mManagers.Renderer.GraphicsDevice.Viewport;
                viewport.Width = FlatRedBall.Math.MathFunctions.RoundToInt(FlatRedBall.Camera.Main.DestinationRectangle.Width);
                viewport.Height = FlatRedBall.Math.MathFunctions.RoundToInt(FlatRedBall.Camera.Main.DestinationRectangle.Height);
                mManagers.Renderer.GraphicsDevice.Viewport = viewport;

                if (FlatRedBall.Camera.Main.Orthogonal)
                {
                    GraphicalUiElement.CanvasHeight = FlatRedBall.Camera.Main.OrthogonalHeight;
                    GraphicalUiElement.CanvasWidth = FlatRedBall.Camera.Main.OrthogonalWidth;
                }
                else
                {
                    GraphicalUiElement.CanvasHeight = FlatRedBall.Camera.Main.DestinationRectangle.Height;
                    GraphicalUiElement.CanvasWidth = FlatRedBall.Camera.Main.DestinationRectangle.Width;
                }

                // Need to do the zoom here in response to the FRB camera vs. the Gum camera
                mManagers.Renderer.Camera.Zoom = viewport.Height / (float)GraphicalUiElement.CanvasHeight;
                mManagers.Renderer.Camera.CameraCenterOnScreen = CameraCenterOnScreen.TopLeft;
                mManagers.Renderer.Camera.X = 0;
                mManagers.Renderer.Camera.Y = 0;

                SystemManagers.Default = mManagers;
                FlatRedBallServices.AddManager(RenderingLibrary.SystemManagers.Default);

                RenderingLibrary.Graphics.Text.RenderBoundaryDefault = false;
                // FlatRedBall uses premult alpha.
                RenderingLibrary.Graphics.Renderer.NormalBlendState = Microsoft.Xna.Framework.Graphics.BlendState.AlphaBlend;


                var idb = new GumIdb();
                // We don't want the UI to be at Z=0 because it will render 
                // at the same Z along with FRB entities and environments so UI might 
                // be hidden. The proper way to solve this is to use Layers, but
                // this shouldn't be creating new Layers, that's up to the user.
                // Let's make it have a positive Z so it draws in more things at once 
                idb.Z = 10;

                // This could be called on a secondary thread, like if called by GlobalContent, so we
                // want this to happen on the primary thread:
                Action primaryThreadAction = () =>
                {
                    FlatRedBall.SpriteManager.AddDrawableBatch(idb);
                    FlatRedBall.Screens.ScreenManager.PersistentDrawableBatches.Add(idb);
                };

                var instruction = new FlatRedBall.Instructions.DelegateInstruction(primaryThreadAction);
                FlatRedBall.Instructions.InstructionManager.Add(instruction);

            }

            if (projectFileName == null)
            {
                throw new Exception("The GumIDB must be initialized with a valid (non-null) project file.");
            }

            string errors;
            mProjectFileName = projectFileName;

            if (FlatRedBall.IO.FileManager.IsRelative(mProjectFileName))
            {
                mProjectFileName = FlatRedBall.IO.FileManager.RelativeDirectory + mProjectFileName;
            }

            // First let's set the relative directory to the file manager's relative directory so we can load
            // the file normally...
            ToolsUtilities.FileManager.RelativeDirectory = FlatRedBall.IO.FileManager.RelativeDirectory;

            GumLoadResult result;

            ObjectFinder.Self.GumProjectSave = GumProjectSave.Load(mProjectFileName, out result);

#if DEBUG
            if(ObjectFinder.Self.GumProjectSave == null)
            {
                throw new Exception("Could not find Gum project at " + mProjectFileName);
            }

            if(!string.IsNullOrEmpty(result.ErrorMessage))
            {
                throw new Exception(result.ErrorMessage);

            }

            if(result.MissingFiles.Count != 0)
            {
                throw new Exception("Missing files starting with " + result.MissingFiles[0]);
            }
#endif

            // Now we can set the directory to Gum's root:
            ToolsUtilities.FileManager.RelativeDirectory = ToolsUtilities.FileManager.GetDirectory(mProjectFileName);

            // The Gum tool does a lot more init than this, but we're going to only do a subset 
            //of initialization for performance
            // reasons:
            foreach (var item in ObjectFinder.Self.GumProjectSave.Screens)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.Components)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
            }
            foreach (var item in ObjectFinder.Self.GumProjectSave.StandardElements)
            {
                // Only initialize using the default state
                if (item.DefaultState != null)
                {
                    item.Initialize(item.DefaultState);
                }
                //for atlased colored rectangles
                if (item.Name == "ColoredRectangle")
                    RenderingLibrary.Graphics.SolidRectangle.AtlasedTextureName = "..\\Graphics\\Misc\\ColoredRectangle.png";
            }

            StandardElementsManager.Self.Initialize();
        }
		public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake)
		{
			switch(stateToInterpolateTo)
			{
				case  VariableState.Opaque:
					SpriteObject.AlphaRate = (1f - SpriteObject.Alpha) / (float)secondsToTake;
					break;
				case  VariableState.Transparent:
					SpriteObject.AlphaRate = (0f - SpriteObject.Alpha) / (float)secondsToTake;
					break;
			}
			var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
			instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
			FlatRedBall.Instructions.InstructionManager.Add(instruction);
			return instruction;
		}
		public FlatRedBall.Instructions.Instruction InterpolateToState (VariableState stateToInterpolateTo, double secondsToTake)
		{
			switch(stateToInterpolateTo)
			{
				case  VariableState.Orden1:
					break;
				case  VariableState.Orden2:
					break;
			}
			var instruction = new FlatRedBall.Instructions.DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
			instruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + secondsToTake;
			this.Instructions.Add(instruction);
			return instruction;
		}
Beispiel #22
0
        private string ProcessMessage(string message)
        {
            var screen =
                FlatRedBall.Screens.ScreenManager.CurrentScreen;
            bool handledImmediately = false;

            string data = null;

            if (message.Contains(":"))
            {
                data    = message.Substring(message.IndexOf(":") + 1);
                message = message.Substring(0, message.IndexOf(":"));
            }

            switch (message)
            {
            case "GetCurrentScreen":
                handledImmediately = true;
                return(screen.GetType().FullName);
            }

            if (!handledImmediately)
            {
                FlatRedBall.Instructions.InstructionManager.AddSafe(() =>
                {
                    switch (message)
                    {
                    case "RestartScreen":
                        screen.RestartScreen(true);
                        break;

                    case "ReloadGlobal":
                        GlobalContent.Reload(GlobalContent.GetFile(data));
                        break;

                    case "TogglePause":

                        if (screen.IsPaused)
                        {
                            screen.UnpauseThisScreen();
                        }
                        else
                        {
                            screen.PauseThisScreen();
                        }

                        break;

                    case "AdvanceOneFrame":
                        screen.UnpauseThisScreen();
                        var delegateInstruction = new FlatRedBall.Instructions.DelegateInstruction(() =>
                        {
                            screen.PauseThisScreen();
                        });
                        delegateInstruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + .001;

                        FlatRedBall.Instructions.InstructionManager.Instructions.Add(delegateInstruction);
                        break;

                    case "SetSpeed":
                        var timeFactor = int.Parse(data);
                        FlatRedBall.TimeManager.TimeFactor = timeFactor / 100.0f;
                        break;

                    case "SetVariable":

                        HandleSetVariable(data);

                        break;
                    }
                });
            }

            return("true");
        }