Ejemplo n.º 1
0
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            this.Click += OnClick;
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            SpriteInstance.TextureScale = 1f;
            SpriteInstance.Red          = 0.1f;
            SpriteInstance.Green        = 0.1f;
            SpriteInstance.Blue         = 0.1f;
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.AttachTo(this, false);
            }
            if (TextInstance.Parent == null)
            {
                TextInstance.Z = 5f;
            }
            else
            {
                TextInstance.RelativeZ = 5f;
            }
            TextInstance.AdjustPositionForPixelPerfectDrawing = false;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 2
0
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.AttachTo(this, false);
            }
            TextInstance.DisplayText = "99";
            if (TextInstance.Parent == null)
            {
                TextInstance.X = 50f;
            }
            else
            {
                TextInstance.RelativeX = 50f;
            }
            if (TextInstance.Parent == null)
            {
                TextInstance.Y = 80f;
            }
            else
            {
                TextInstance.RelativeY = 80f;
            }
            TextInstance.TextureScale   = 10f;
            TextInstance.ColorOperation = FlatRedBall.Graphics.ColorOperation.ColorTextureAlpha;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 3
0
        // Generated Methods
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            this.AfterFontSizeSet += OnAfterFontSizeSet;
            this.AfterRedSet      += OnAfterRedSet;
            this.AfterGreenSet    += OnAfterGreenSet;
            this.AfterBlueSet     += OnAfterBlueSet;
            if (LabelText.Parent == null)
            {
                LabelText.CopyAbsoluteToRelative();
                LabelText.AttachTo(this, false);
            }
            LabelText.DisplayText     = "Unset Label";
            LabelText.Font            = Paint100;
            LabelText.NewLineDistance = 136.5f;
            LabelText.Scale           = 91f;
            LabelText.Spacing         = 91f;
            LabelText.Blue            = 1f;
                        #if FRB_MDX
            LabelText.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Subtract;
                        #else
            LabelText.ColorOperation = FlatRedBall.Graphics.ColorOperation.Subtract;
                        #endif
            LabelText.Green = 1f;
            LabelText.Red   = 1f;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 4
0
        public Hero(string name, HeroClass heroClass)
        {
            Collect = false;
            Online = TimeSpan.Zero;
            Target = Position;
            AcceptArrows = true;
            zLastPosition = Position;
            Netid = 0;
            Name = name;
            Class = heroClass;
            Position.Z = ZLayer.Npc;
            WalkingSpeed = 10;

            SpriteManager.AddPositionedObject(this);

            Collider = ShapeManager.AddCircle();
            Collider.AttachTo(this, false);
            Collider.Visible = false;

            Sprite = LoadSprite();
            Sprite.AttachTo(this, false);
            Sprite.Resize(4);
            Sprite.AnimationSpeed = 0.1f;            

            Label = TextManager.AddText(name, Globals.Font);
            Label.AttachTo(this, false);
            Label.HorizontalAlignment = HorizontalAlignment.Center;
            Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z);            

            InitStats();
        }
Ejemplo n.º 5
0
        // Generated Methods
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.AttachTo(this, false);
            }
            TextInstance.DisplayText     = "TEEEST";
            TextInstance.Font            = MazetechFont;
            TextInstance.NewLineDistance = 9f;
            TextInstance.Scale           = 6f;
            TextInstance.Spacing         = 6f;
            if (TextInstance.Parent == null)
            {
                TextInstance.Z = 15f;
            }
            else
            {
                TextInstance.RelativeZ = 15f;
            }
            TextInstance.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Center;
            TextInstance.VerticalAlignment   = FlatRedBall.Graphics.VerticalAlignment.Center;
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            SpriteInstance.Texture      = MessageTexture;
            SpriteInstance.TextureScale = 2.5f;
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.Z = -10f;
            }
            else
            {
                SpriteInstance.RelativeZ = -10f;
            }
            SpriteInstance.Visible = true;
            if (mCollision.Parent == null)
            {
                mCollision.CopyAbsoluteToRelative();
                mCollision.AttachTo(this, false);
            }
            Collision.Color   = Color.Red;
            Collision.Height  = 200f;
            Collision.Visible = false;
            Collision.Width   = 32f;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 6
0
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (ScorePoints.Parent == null)
            {
                ScorePoints.CopyAbsoluteToRelative();
                ScorePoints.AttachTo(this, false);
            }
            ScorePoints.DisplayText = "99";
            if (ScorePoints.Parent == null)
            {
                ScorePoints.X = 20f;
            }
            else
            {
                ScorePoints.RelativeX = 20f;
            }
            if (ScorePoints.Parent == null)
            {
                ScorePoints.Y = 270f;
            }
            else
            {
                ScorePoints.RelativeY = 270f;
            }
            if (ScoreLabel.Parent == null)
            {
                ScoreLabel.CopyAbsoluteToRelative();
                ScoreLabel.AttachTo(this, false);
            }
            ScoreLabel.DisplayText = "Points";
            if (ScoreLabel.Parent == null)
            {
                ScoreLabel.X = -20f;
            }
            else
            {
                ScoreLabel.RelativeX = -20f;
            }
            if (ScoreLabel.Parent == null)
            {
                ScoreLabel.Y = 270f;
            }
            else
            {
                ScoreLabel.RelativeY = 270f;
            }
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 7
0
        // Generated Methods
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.RelativeZ += -40;
                TextInstance.AttachTo(SpriteManager.Camera, false);
            }
            TextInstance.DisplayText         = "THE LOST FEDORA\n\nPress ENTER to start the game\nPress ESC to exit";
            TextInstance.Visible             = true;
            TextInstance.VerticalAlignment   = FlatRedBall.Graphics.VerticalAlignment.Center;
            TextInstance.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Center;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates a new Text with the argument string which will only be drawn in the argument Camera's
        /// destination.
        /// </summary>
        /// <remarks>
        /// The new text will be stored both by the camera and the TextManager's managed invisible Texts array.
        /// The text is automatically attached to the argument Camera so to be moved, it must either
        /// be detached or moved with relative variables.
        /// </remarks>
        /// <param name="s">The string to show.</param>
        /// <param name="cameraToAddTo">The camera that the newly created Text belongs to.</param>
        /// <returns>Reference to the newly created Text.</returns>
        #endregion
        static public Text AddText(string s, Camera cameraToAddTo)
        {
            Text t = new Text();

            t.DisplayText = s;
            t.AttachTo(cameraToAddTo, true);
            cameraToAddTo.Layer.Add(t);
#if DEBUG
            if (mAutomaticallyUpdatedTexts.Contains(t))
            {
                throw new InvalidOperationException("Can't add the text to the Automatically Updated (Managed) Text list because it's already there.  This error is here to prevent you from double-adding Texts.");
            }
#endif

            mAutomaticallyUpdatedTexts.Add(t);


            return(t);
        }
Ejemplo n.º 9
0
        // Generated Methods
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (TheEndText.Parent == null)
            {
                TheEndText.CopyAbsoluteToRelative();
                TheEndText.RelativeZ += -40;
                TheEndText.AttachTo(SpriteManager.Camera, false);
            }
            TheEndText.DisplayText = "The End.\nPress Enter To Go To Main Menu!";
            if (TheEndText.Parent == null)
            {
                TheEndText.X = 0f;
            }
            else
            {
                TheEndText.RelativeX = 0f;
            }
            if (TheEndText.Parent == null)
            {
                TheEndText.Y = 0f;
            }
            else
            {
                TheEndText.RelativeY = 0f;
            }
            if (TheEndText.Parent == null)
            {
                TheEndText.Z = 25f;
            }
            else
            {
                TheEndText.RelativeZ = 25f - 40.0f;
            }
            TheEndText.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Center;
            TheEndText.Visible             = false;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 10
0
        protected bool Collect; //used to signal running events that this window has been destroyed

        public Window(Window owner = null, bool modal = false, string sprite = "")
        {            
            if (owner != null && modal)
                throw new ArgumentException("Child cannot be modal");
            Collect = false;
            Immovable = false;
            zEventEscape = null;
            zModal = modal;
            Name = string.Empty;
            zOrigin = new Vector2(0, 0);
            if (sprite == "")
                zSprite = SpriteManager.AddSprite(Path.Make(Path.Misc, "pixel.bmp"));
            else
                zSprite = SpriteManager.AddSprite(sprite);
            zSprite.ColorOperation = ColorOperation.ColorTextureAlpha;
            Color = Color.White;
            zVisible = true;
            OnClick = delegate () { };
            Hover = delegate () { };
            HoverMousedown = delegate () { };
            MouseLeave = delegate () { };
            MouseEnter = delegate () { };
            zParent = owner;
            zChildren = new List<Window>();
            zText = TextManager.AddText(string.Empty, Globals.Font);
            zText.ColorOperation = ColorOperation.ColorTextureAlpha;
            zText.AttachTo(zSprite, false);
            Size = new Vector2(1, 1);
            if (owner == null)
                InitializeAsTopLevel();
            else
                InitializeAsChild();
            SpriteManager.AddToLayer(zSprite, zLayer);
            TextManager.AddToLayer(zText, zLayer);
            zSprite.AttachTo(Camera.Main, true);
        }
Ejemplo n.º 11
0
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            this.BoatNearDock += OnBoatNearDock;
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.AttachTo(this, false);
            }
            TextInstance.DisplayText         = "Accoster (E)";
            TextInstance.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Right;
            TextInstance.VerticalAlignment   = FlatRedBall.Graphics.VerticalAlignment.Center;
            TextInstance.Visible             = false;
            if (mCircleInstance.Parent == null)
            {
                mCircleInstance.CopyAbsoluteToRelative();
                mCircleInstance.AttachTo(this, false);
            }
            CircleInstance.Radius  = 48f;
            CircleInstance.Visible = false;
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 12
0
        private void CustomInitialize()
        {
            facing = Game1.RIGHT;
            CurrentState = VariableState.R_Idle;

            this.PlayerIndex = 0;
            Acceleration.Y = -400F;

            debugText = TextManager.AddText("");
            debugText.Position.Y += 40;
            debugText.AttachTo(this, true);
            UpdateDebugText();
        }
Ejemplo n.º 13
0
        public Button(GuiSkin guiSkin, Cursor cursor)
            : base(guiSkin, cursor)
        {
            mUpSkin = guiSkin.ButtonSkin;
            mDownSkin = guiSkin.ButtonDownSkin;

            mTextObject = TextManager.AddText(this.Text, guiSkin.ButtonSkin.Font);
            mTextObject.HorizontalAlignment = HorizontalAlignment.Center;
            mTextObject.VerticalAlignment = VerticalAlignment.Center;
            mTextObject.AttachTo(SpriteFrame, false);
            mTextObject.RelativeZ = -.001f * FlatRedBall.Math.MathFunctions.ForwardVector3.Z;

            SetTexturePropertiesFromSkin(mUpSkin);

            ScaleX = 1;
            ScaleY = 1;
        }
Ejemplo n.º 14
0
        public virtual void PostInitialize()
        {
            bool oldShapeManagerSuppressAdd = FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue;

            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = true;
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.CopyAbsoluteToRelative();
                SpriteInstance.AttachTo(this, false);
            }
            if (SpriteInstance.Parent == null)
            {
                SpriteInstance.Z = 10f;
            }
            else
            {
                SpriteInstance.RelativeZ = 10f;
            }
            SpriteInstance.Texture          = null;
            SpriteInstance.TextureScale     = 0.75f;
            SpriteInstance.AnimationChains  = AnimationChain;
            SpriteInstance.CurrentChainName = "Idle";
            if (TextInstance.Parent == null)
            {
                TextInstance.CopyAbsoluteToRelative();
                TextInstance.AttachTo(this, false);
            }
            TextInstance.DisplayText         = "Player";
            TextInstance.HorizontalAlignment = FlatRedBall.Graphics.HorizontalAlignment.Center;
            if (TextInstance.Parent == null)
            {
                TextInstance.Y = 32f;
            }
            else
            {
                TextInstance.RelativeY = 32f;
            }
            if (mHitbox.Parent == null)
            {
                mHitbox.CopyAbsoluteToRelative();
                mHitbox.AttachTo(this, false);
            }
            if (Hitbox.Parent == null)
            {
                Hitbox.Z = 15f;
            }
            else
            {
                Hitbox.RelativeZ = 15f;
            }
            Hitbox.Width   = 32f;
            Hitbox.Height  = 32f;
            Hitbox.Visible = false;
            Hitbox.RepositionDirections = FlatRedBall.Math.Geometry.RepositionDirections.All;
            if (WeaponInstance.Parent == null)
            {
                WeaponInstance.CopyAbsoluteToRelative();
                WeaponInstance.AttachTo(this, false);
            }
            mGeneratedCollision = new FlatRedBall.Math.Geometry.ShapeCollection();
            mGeneratedCollision.AxisAlignedRectangles.AddOneWay(mHitbox);
            FlatRedBall.Math.Geometry.ShapeManager.SuppressAddingOnVisibilityTrue = oldShapeManagerSuppressAdd;
        }
Ejemplo n.º 15
0
 private void InitLabel()
 {
     Label = TextManager.AddText(Name, Globals.Font);
     Label.AttachTo(this, false);
     Label.HorizontalAlignment = HorizontalAlignment.Center;
     Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z);
 }