Beispiel #1
0
        /// <summary>
        ///     Der Grundaufbau für alle Menus
        /// </summary>
        /// <param name="position">Position ist die obere linke Ecke des Menus</param>
        /// <param name="menuFont">Die verwendetete Schriftart</param>
        /// <param name="graphicsDevice">Zum Berechnen der Hintergründe</param>
        /// <param name="direction">Richtung für die Animation zum Öffnen des Menus</param>
        public SimpleMenu(Vector2 position, SpriteFont menuFont, GraphicsDevice graphicsDevice, BlendDirection direction)
        {
            _graphicsDevice = graphicsDevice;
            pos             = position;
            textFont        = menuFont;
            btnWidth        = menuFont.MeasureString("Close").X + 10;
            Texture2D btnCloseTexture = new Texture2D(graphicsDevice, (int)btnWidth, 50);

            Color[] btnColor = new Color[btnCloseTexture.Width * btnCloseTexture.Height];
            for (int i = 0; i < btnColor.Length; i++)
            {
                btnColor[i] = Color.White * 0.5f;
            }
            btnCloseTexture.SetData(btnColor);
            btnClose = new Button("Close", btnCloseTexture, 1, (int)pos.X, (int)pos.Y);
            menuButtons.Add(btnClose);

            blendDirection = direction;

            menuWidth  = menuButtons[menuButtons.Count - 1].TextureDefault.Width;
            menuHeight = menuButtons[menuButtons.Count - 1].GetPosBelow().Y;

            SetBackgroundTexture(bkgColor);
            if (needCloseBtn == true)
            {
                bkgPos = pos;
            }
            else
            {
                bkgPos = btnClose.GetPosBelow();
            }
            allInstances.Add(this);
        }
Beispiel #2
0
        //Button btnPlusBewegung;


        public SkillUpMenu(SpriteFont moveMenuFont, GraphicsDevice graphicsDevice, BlendDirection blend) : base(new Vector2(), moveMenuFont, graphicsDevice, blend)
        {
            Texture2D btnTexture = new Texture2D(graphicsDevice, 25, 25);

            Color[] btnColor = new Color[btnTexture.Width * btnTexture.Height];
            for (int i = 0; i < btnColor.Length; i++)
            {
                btnColor[i] = Color.Aquamarine;
            }
            btnTexture.SetData(btnColor);
            btnPlusWiderstandskraft = new Button("+", btnTexture, 1, btnClose.GetPosBelow());
            btnPlusKoerperkraft     = new Button("+", btnTexture, 1, btnPlusWiderstandskraft.GetPosBelow());
            btnPlusBeweglichkeit    = new Button("+", btnTexture, 1, btnPlusKoerperkraft.GetPosBelow());
            btnPlusAbwehr           = new Button("+", btnTexture, 1, btnPlusBeweglichkeit.GetPosBelow());
            btnPlusWortgewandtheit  = new Button("+", btnTexture, 1, btnPlusAbwehr.GetPosBelow());
            btnPlusLautstaerke      = new Button("+", btnTexture, 1, btnPlusWortgewandtheit.GetPosBelow());
            btnPlusIgnoranz         = new Button("+", btnTexture, 1, btnPlusLautstaerke.GetPosBelow());
            btnPlusGeschwindigkeit  = new Button("+", btnTexture, 1, btnPlusIgnoranz.GetPosBelow());
            btnPlusGlueck           = new Button("+", btnTexture, 1, btnPlusGeschwindigkeit.GetPosBelow());
            menuButtons.Add(btnPlusGlueck);
            //btnPlusBewegung = new Button("+", btnTexture, 1, btnPlusGlueck.GetPosBelow());

            SetMenuHeight();
            menuWidth = btnClose.TextureDefault.Width + moveMenuFont.MeasureString("Name: ").X;
            SetBackgroundTexture(bkgColor);
        }
Beispiel #3
0
 public BlendInfo(int secondaryTextureTile, BlendDirection blendDirection)
 {
     this.secondaryTextureTile = secondaryTextureTile;
     this.blendDirection       = blendDirection;
     this.i3 = uint.MaxValue;
     this.i4 = 2061107200U;
 }
Beispiel #4
0
 public BlendInfo(int secondaryTextureTile, BlendDirection blendDirection)
 {
     this.secondaryTextureTile = secondaryTextureTile;
     this.blendDirection = blendDirection;
     this.i3 = uint.MaxValue;
     this.i4 = 2061107200U;
 }
    public void PlayBlend(string clipName, BlendDirection direction = BlendDirection.Down, int fadeFrame = 0)
    {
        if (animationClips == null)
        {
            return;
        }
        if (string.IsNullOrEmpty(clipName))
        {
            mBlendAnimationClip = null;

            return;
        }
        if (mBlendAnimationClip != null && mBlendAnimationClip.Name == clipName)
        {
            return;
        }
        blendDirection = direction;

        mBlendAnimationClip = animationClips.Find(x => x.Name == clipName);
        if (mBlendAnimationClip != null)
        {
            mBlendAnimationClip.Reset(this, 0);
            mBlendBeginAt   = mBlendAnimationClip.CurrentFrame;
            mBlendFadeFrame = Mathf.Clamp(fadeFrame, 0, mBlendAnimationClip.FrameCount / 2);
            mBlendEnd       = false;
            mBlendBegin     = true;
        }
    }
Beispiel #6
0
 public byte[] FromBlendDirection(BlendDirection bd)
 {
     byte[] numArray = new byte[6];
     for (int index = 0; index < numArray.Length; ++index)
     {
         if ((bd & (BlendDirection)(1 << index)) != (BlendDirection)0)
             numArray[index] = (byte)1;
     }
     return numArray;
 }
Beispiel #7
0
 public byte[] FromBlendDirection(BlendDirection bd)
 {
     byte[] numArray = new byte[6];
     for (int index = 0; index < numArray.Length; ++index)
     {
         if ((bd & (BlendDirection)(1 << index)) != (BlendDirection)0)
         {
             numArray[index] = (byte)1;
         }
     }
     return(numArray);
 }
Beispiel #8
0
        private static byte[] ToBytes(BlendDirection value)
        {
            var result = new byte[4];

            var byteValue = (byte)value;

            for (var i = 0; i < result.Length; i++)
            {
                result[i] = (byte)(value.HasFlag((BlendDirection)(1 << i)) ? 1 : 0);
            }

            return(result);
        }
Beispiel #9
0
 public BlendInfo(BinaryReader br)
 {
     this = new BlendInfo();
     this.secondaryTextureTile = br.ReadInt32();
     this.blendDirection = this.ToBlendDirection(br.ReadBytes(6));
     this.i3 = br.ReadUInt32();
     if ((int)this.i3 != -1)
         Console.WriteLine("!\t Asset: BlendTileData.BlendInfo expected 0xffffffff for i3 instead of 0x{0:x8}", (object)this.i3);
     this.i4 = br.ReadUInt32();
     if ((int)this.i4 == 2061107200)
         return;
     Console.WriteLine("!\t Asset: BlendTileData.BlendInfo expected 0x7ada0000 for i4 instead of 0x{0:x8}", (object)this.i4);
 }
Beispiel #10
0
        private static readonly Color colBlendIn = Color.DarkBlue;         // only ever used about 10%, so needs to be quite dark
        public static void BlendPanelBackground(Control pnl, Graphics gr, BlendDirection direction)
        {
            // for use during the paint event handler of the given control
            if (Utilities.Low_Graphics_Safe())
            {
                return;
            }
            // In order to cope with multiple rows (or lines) we need to work within the top-level blended control, which I think will always be placed directly on the form
            // calculate the bounding box of the container, relative to my coordinates
            Rectangle container   = new Rectangle(0, 0, pnl.Width, pnl.Height);
            Control   testControl = pnl;

            while (testControl.Parent != null && !(testControl.Parent is Form))
            {
                container.X   -= testControl.Left;
                container.Y   -= testControl.Top;
                testControl    = testControl.Parent;
                container.Size = testControl.Size;
            }
            Point dark;

            switch (direction)
            {
            case BlendDirection.Off:
                return;

            case BlendDirection.Down:
                dark        = new Point(0, container.Height);                  // pnl.Height)
                container.X = 0;
                break;

            default:
                dark        = new Point(pnl.Width, 0);
                container.Y = 0;
                Debug.Assert(direction == BlendDirection.Right);
                break;
            }
            using (LinearGradientBrush br = new LinearGradientBrush(container.Location, dark, Color.White, Color.Black))             // colours changed below
            {
                ColorBlend blend = new ColorBlend(3);
                blend.Positions = new float[] { 0, 0.7f, 0.85f, 1 };
                Color baseColour = Color.FromKnownColor(KnownColor.Control);
                blend.Colors           = new Color[] { baseColour, baseColour.MixWith(colBlendIn, 98), baseColour.MixWith(colBlendIn, 95), baseColour.MixWith(colBlendIn, 92) };
                br.InterpolationColors = blend;
                gr.FillRectangle(br, 0, 0, pnl.Width, pnl.Height);
            }
        }
Beispiel #11
0
 public BlendInfo(BinaryReader br)
 {
     this = new BlendInfo();
     this.secondaryTextureTile = br.ReadInt32();
     this.blendDirection       = this.ToBlendDirection(br.ReadBytes(6));
     this.i3 = br.ReadUInt32();
     if ((int)this.i3 != -1)
     {
         Console.WriteLine("!\t Asset: BlendTileData.BlendInfo expected 0xffffffff for i3 instead of 0x{0:x8}", (object)this.i3);
     }
     this.i4 = br.ReadUInt32();
     if ((int)this.i4 == 2061107200)
     {
         return;
     }
     Console.WriteLine("!\t Asset: BlendTileData.BlendInfo expected 0x7ada0000 for i4 instead of 0x{0:x8}", (object)this.i4);
 }
Beispiel #12
0
        public FightMenu(SpriteFont menuFont, GraphicsDevice graphicsDevice, BlendDirection direction) : base(new Vector2(0, graphicsDevice.Viewport.Bounds.Center.Y), menuFont, graphicsDevice, direction)
        {
            needCloseBtn = false;
            btnWidth     = menuFont.MeasureString("Attack 1").X + 10;
            Texture2D btnTexture = new Texture2D(graphicsDevice, (int)btnWidth, 50);

            Color[] btnColor = new Color[btnTexture.Width * btnTexture.Height];
            for (int i = 0; i < btnColor.Length; i++)
            {
                btnColor[i] = Color.Red * 0.8f;
            }
            btnTexture.SetData(btnColor);

            btnAttack1 = new Button("Attack 1", btnTexture, 1, pos);
            menuButtons.Add(btnAttack1);
            btnAttack2 = new Button("Attack 2", btnTexture, 1, btnAttack1.GetPosBelow());
            menuButtons.Add(btnAttack2);
            btnGiveUp = new Button("Give Up", btnTexture, 1, btnAttack2.GetPosBelow());
            menuButtons.Add(btnGiveUp);

            SetMenuHeight();
            menuWidth = graphicsDevice.Viewport.Width;
            SetBackgroundTexture(Color.Green);
        }
Beispiel #13
0
 public BlendEffectConfigToken(BlendDirection direction)
 {
     blendDirection = direction;
 }
 public LevelObjectiveMenu(SpriteFont menuFont, GraphicsDevice graphicsDevice, BlendDirection direction) : base(new Vector2(), menuFont, graphicsDevice, direction)
 {
     pos    = new Vector2((_graphicsDevice.Viewport.Width / 2) - 90, 0);
     bkgPos = pos;
     btnClose.MoveButton(pos - Vector2.UnitX * btnClose.TextureDefault.Width);
     menuHeight = menuFont.MeasureString("Placeholder").Y;
     menuWidth  = _graphicsDevice.Viewport.Width / 2;
 }