Пример #1
0
        public static AxisAlignedCubeSave FromAxisAlignedCube(FlatRedBall.Math.Geometry.AxisAlignedCube cube)
        {
            AxisAlignedCubeSave aacs = new AxisAlignedCubeSave();
            aacs.X = cube.X;
            aacs.Y = cube.Y;
            aacs.Z = cube.Z;

            aacs.ScaleX = cube.ScaleX;
            aacs.ScaleY = cube.ScaleY;
            aacs.ScaleZ = cube.ScaleZ;

            aacs.Name = cube.Name;

            if (cube.Parent != null)
            {
                aacs.Parent = cube.Parent.Name;
            }

            aacs.Alpha = cube.Color.A / 255.0f;
            aacs.Red = cube.Color.R / 255.0f;
            aacs.Green = cube.Color.G / 255.0f;
            aacs.Blue = cube.Color.B / 255.0f;

            return aacs;
        }
Пример #2
0
		public static void LoadEmittersClick(FlatRedBall.Gui.Window callingWindow)
		{
			FileWindow tempWindow = GuiManager.AddFileWindow();
            tempWindow.Filter = "XML Emitter (*.emix)|*.emix";
            tempWindow.CurrentFileType = "emix";
			tempWindow.OkClick += new GuiMessage(LoadEmitterOK);
		}
Пример #3
0
		public static void LoadEmitterOK(FlatRedBall.Gui.Window callingWindow)
		{
			string fileName = ((FileWindow)callingWindow).Results[0];

            AppCommands.Self.File.LoadEmitters(fileName);

		}
		public virtual void AddToManagers (FlatRedBall.Graphics.Layer layerToAddTo)
		{
			LayerProvidedByContainer = layerToAddTo;
			FlatRedBall.SpriteManager.AddPositionedObject(this);
			AddToManagersBottomUp(layerToAddTo);
			CustomInitialize();
		}
        void OnSoundEffectCheckBoxClick(FlatRedBall.Gui.IWindow callingWindow)
        {
            if(this.SoundEffectCheckBox.CurrentState == CheckBox.VariableState.Checked)
            {

            }
        }
        // This class does not support visibility.
        // The reason is because setting visibility
        // on a AxisAlignedRectangle (which would occur
        // in the ToAxisAlignedRectangle method) would add
        // it to the manager.  We can't do that because the ToRuntime
        // methods should not add the object to any manager.  Maybe we'll
        // fix this at some point in the future.
        //public bool Visible;
        //public bool ShouldSerializeVisible()
        //{
        //    return Visible == false;
        //}

        #endregion

        public static AxisAlignedRectangleSave FromAxisAlignedRectangle(FlatRedBall.Math.Geometry.AxisAlignedRectangle rectangle)
        {
            AxisAlignedRectangleSave aars = new AxisAlignedRectangleSave();
            aars.SetFrom(rectangle);

            return aars;
        }
Пример #7
0
        public static CircleSave FromCircle(FlatRedBall.Math.Geometry.Circle circle)
        {
            CircleSave circleSave = new CircleSave();
            circleSave.SetFrom(circle);

            return circleSave;
        }
Пример #8
0
        public static PolygonSave FromPolygon(FlatRedBall.Math.Geometry.Polygon polygon)
        {
            PolygonSave polygonSave = new PolygonSave();

            int pointCount = polygon.Points.Count;
            polygonSave.Points = new Point[pointCount];

            for (int i = 0; i < polygon.Points.Count; i++)
            {
                polygonSave.Points[i] = polygon.Points[i];
            }

            polygonSave.Name = polygon.Name;
            polygonSave.X = polygon.Position.X;
            polygonSave.Y = polygon.Position.Y;
            polygonSave.Z = polygon.Position.Z;

            polygonSave.RotationZ = polygon.RotationZ;

            polygonSave.Alpha = polygon.Color.A / 255.0f;
            polygonSave.Red = polygon.Color.R / 255.0f;
            polygonSave.Green = polygon.Color.G / 255.0f;
            polygonSave.Blue = polygon.Color.B / 255.0f;

            return polygonSave;
        }
 void OnNextQuestionClickTunnel(FlatRedBall.Gui.IWindow callingWindow)
 {
     if (this.NextQuestionClick != null)
     {
         NextQuestionClick(callingWindow);
     }
 }
Пример #10
0
 private void emitAllClick(FlatRedBall.Gui.Window callingWindow)
 {
     foreach (Emitter emitter in EditorData.Emitters)
     {
         emitter.Emit();
     }
 }
Пример #11
0
 private void emitCurrentClick(FlatRedBall.Gui.Window callingWindow)
 {
     if (AppState.Self.CurrentEmitter != null)
     {
         AppState.Self.CurrentEmitter.Emit(null);
     }
 }
Пример #12
0
 void OnXboxAButtonRollOn(FlatRedBall.Gui.IWindow callingWindow)
 {
     if (canRollOver)
     {
         AButtonInst.RotationZ = 1;
     }
 }
Пример #13
0
// Generated AddToManagers
		public virtual void ReAddToManagers (FlatRedBall.Graphics.Layer layerToAddTo)
		{
			LayerProvidedByContainer = layerToAddTo;
			FlatRedBall.SpriteManager.AddPositionedObject(this);
			FlatRedBall.SpriteManager.AddToLayer(Sprite, LayerProvidedByContainer);
			FlatRedBall.Math.Geometry.ShapeManager.AddToLayer(Cuerpo, LayerProvidedByContainer);
		}
Пример #14
0
		public override void AddToManagers (FlatRedBall.Graphics.Layer layerToAddTo)
		{
			LayerProvidedByContainer = layerToAddTo;
			FlatRedBall.SpriteManager.AddToLayer(Sprite, LayerProvidedByContainer);
			FlatRedBall.Math.Geometry.ShapeManager.AddToLayer(Cuerpo, LayerProvidedByContainer);
			base.AddToManagers(layerToAddTo);
			CustomInitialize();
		}
Пример #15
0
        public static bool IsGue(FlatRedBall.Glue.SaveClasses.NamedObjectSave item)
        {
            return item.SourceType == FlatRedBall.Glue.SaveClasses.SourceType.File &&
                !string.IsNullOrEmpty(item.SourceFile) &&
                !string.IsNullOrEmpty(item.SourceName) &&
                (FileManager.GetExtension(item.SourceFile) == "gusx" || FileManager.GetExtension(item.SourceFile) == "gucx");

        }
Пример #16
0
        public void addEmitterClick(FlatRedBall.Gui.Window callingWindow)
        {
            TextInputWindow tempWindow = GuiManager.ShowTextInputWindow("Enter a name for the new Emitter", "Add Particle");

            tempWindow.Text = "Emitter" + NumberOfEmittersCreated;
            NumberOfEmittersCreated++;

            tempWindow.OkClick += new GuiMessage(addEmitterOkClick);
        }
        public override ICodeBlock GenerateActivity(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
        {
            if (Active)
            {
                codeBlock.Line("TimeManager.SumTimeSection(\"Throwaway\");");
            }

            return codeBlock;
        }
Пример #18
0
 public override ICodeBlock GenerateAddToManagers(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
 {
     //foreach (var namedObject in element.AllNamedObjects.Where(item => IsGue(item)))
     //{
     //    //FlatRedBall.Gui.GuiManager.AddWindow(mNarrowButtonIWindow);
     //    codeBlock.Line("FlatRedBall.Gui.GuiManager.AddWindow(" + GetWrapperNameFor(namedObject) + ");");
     //}
     return base.GenerateAddToManagers(codeBlock, element);
 }
Пример #19
0
 static void OnElementRemoved(FlatRedBall.Glue.SaveClasses.IElement obj)
 {
     if (obj != null)
     {
         mElementSettingsSave.SetElementCameraSave(obj, SpriteManager.Camera);
         mElementSettingsSave.Save(ElementSettingsSaveFileName);
         GlueViewState.Self.CurrentElement = null;
     }
 }
Пример #20
0
 void OnXBoxAButtonRollOff(FlatRedBall.Gui.IWindow callingWindow)
 {
     if (canRollOver)
     {
         AButtonInst.RotationZ = 0;
         AButtonInst.RotationX = 0;
         AButtonInst.RotationY = 0;
     }
 }
Пример #21
0
        public override ICodeBlock GenerateFields(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
        {
            //foreach (var namedObject in element.AllNamedObjects.Where(item => IsGue(item) && 
            //    NamedObjectSaveCodeGenerator.GetFieldCodeGenerationType(item) == CodeGenerationType.Full))
            //{
            //    codeBlock.Line("FlatRedBall.Gum.GueIWindowWrapper " + GetWrapperNameFor(namedObject) + ";");
            //}

            return codeBlock;
        }
Пример #22
0
        public static LinkSave FromLink(FlatRedBall.AI.Pathfinding.Link link)
        {
            LinkSave linkSave = new LinkSave();

            linkSave.Cost = link.Cost;
            linkSave.NodeLinkingTo = link.NodeLinkingTo.Name;

            return linkSave;

        }
Пример #23
0
        public List<InstructionSet> ToInstructionSetList(FlatRedBall.Scene scene)
        {
            List<InstructionSet> instructionSetList = new List<InstructionSet>(InstructionSetSaves.Count);

            foreach (InstructionSetSave instructionSetSave in InstructionSetSaves)
            {
                instructionSetList.Add(instructionSetSave.ToInstructionSet(scene));
            }

            return instructionSetList;
        }
        public override ICodeBlock GenerateActivity(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
        {
            if (element.SupportsAdvancedInterpolation())
            {
                foreach (var enumName in element.GetStateEnumNames())
                {
                    codeBlock.Line(TweenerNameFor(enumName) + ".Update(FlatRedBall.TimeManager.SecondDifference);");

                }
            }
            return codeBlock;
        }
Пример #25
0
 private void AddFileToFoundFiles(FlatRedBall.Glue.VSHelpers.Projects.ProjectBase project, string fileName, string absoluteFileName)
 {
     mFoundFiles.Add(new FileData
     {
         ProjectType = project.FolderName,
         FileName = fileName,
         ProjectFile = absoluteFileName,
         ServerFile = _url + fileName,
         DiskFile = _savePath + @"\" + fileName,
         TimestampFile = _savePath + @"\" + FileManager.RemovePath(fileName) + "-timestamp.txt"
     });
 }
Пример #26
0
        public NamedObjectSave SpriteSaveToNamedObjectSave(FlatRedBall.Content.Scene.SpriteSave sprite)
        {
            NamedObjectSave toReturn = new NamedObjectSave();

            toReturn.SourceType = SourceType.FlatRedBallType;
            toReturn.SourceClassType = "Sprite";
            toReturn.InstanceName = sprite.Name;

            AddVariablesForAllProperties(sprite, toReturn);

            return toReturn;
        }
Пример #27
0
 void OnClick(FlatRedBall.Gui.IWindow callingWindow)
 {
     //checks what state the checkbox is in and changes it on click
     if(this.CurrentState == CheckBox.VariableState.Checked)
     {
             this.CurrentState = CheckBox.VariableState.Unchecked;
     }
     else
     {
             this.CurrentState = CheckBox.VariableState.Checked;
     }
 }
Пример #28
0
        private void CheckTrashCollision(Orbit1 orbit1Instance, FlatRedBall.Math.PositionedObjectList<Trash> trashList, int p)
        {
            var trashLockoutFromSpace = new List<Trash>();

            foreach (var trash in trashList.Where(t => !t.Attached))
            {
                //Check if trash hit other trash
                foreach (var otherTrash in trashList)
                {
                    //Ignore trashes on the planet
                    if (otherTrash == trash || otherTrash.OnConveyor)
                    {
                        continue;
                    }

                    if (trash.CollisionCircle.CollideAgainstBounce(otherTrash.CollisionCircle, 10F, 0.1F, 0))
                    {
                        //trash.AttachTo(null, false);
                        //otherTrash.AttachTo(null, false);
                        trash.Detach();
                        otherTrash.Detach();

                        //trash fly to space
                        return;
                    }
                }

                //Only allow attach once
                if (!trash.Attached && trash.CollisionCircle.CollideAgainstBounce(Orbit1Instance.Circle, 0, 100, 2))
                {
                    trash.AttachTo(Orbit1Instance, true);
                    trash.Attached = true;
                }

                int halfScreenWidth = FlatRedBallServices.ClientWidth/2;
                int halfScreenHeight = FlatRedBallServices.ClientHeight/2;
                if (!trash.OnConveyor && (trash.X > halfScreenWidth ||
                    trash.X < -halfScreenWidth ||
                    trash.Y > halfScreenHeight ||
                    trash.Y < -halfScreenHeight))
                {
                    trashLockoutFromSpace.Add(trash);
                }
            }

            //Remove the trash from game
            foreach (var trash in trashLockoutFromSpace)
            {
                trashList.Remove(trash);
                trash.RemoveSelfFromListsBelongingTo();
                trash.Destroy();
            }
        }
Пример #29
0
        public static NodeNetworkSave FromNodeNetwork(FlatRedBall.AI.Pathfinding.NodeNetwork nodeNetwork)
        {
            NodeNetworkSave nodeNetworkSave = new NodeNetworkSave();

            foreach (FlatRedBall.AI.Pathfinding.PositionedNode positionedNode in nodeNetwork.Nodes)
            {
                nodeNetworkSave.PositionedNodes.Add(
                    PositionedNodeSave.FromPositionedNode(positionedNode));
            }

            return nodeNetworkSave;

        }
        public override ICodeBlock GenerateAdditionalMethods(ICodeBlock codeBlock, FlatRedBall.Glue.SaveClasses.IElement element)
        {
            if (element.SupportsAdvancedInterpolation())
            {

                
                foreach (var enumName in element.GetStateEnumNames())
                {
                    codeBlock = GenerateInterpolateToStateAdvanced(codeBlock, enumName);

                }
            }
            return codeBlock;
        }