Exemple #1
0
 public UIFuneral(float xpos, float ypos, float wide = -1f, float high = -1f, UIMenu link = null)
     : base("", xpos, ypos, wide, high)
 {
     Graphics.fade = 1f;
     this._frame   = new Sprite("deathFrame");
     this._frame.CenterOrigin();
     this._link                 = link;
     this._font                 = new BitmapFont("biosFontUI", 8, 7);
     this._fancyFont            = new FancyBitmapFont("smallFont");
     this._portraitFrame        = new Sprite("funeralPic");
     this._portraitSprite       = new SpriteMap("littleMan", 16, 16);
     this._portraitSprite.frame = UILevelBox.LittleManFrame(Profiles.experienceProfile.numLittleMen - 9, 7);
 }
Exemple #2
0
        public void Draw(
            Vec2 pos,
            Depth depth,
            int variation    = 0,
            ulong seed       = 0,
            bool affectScale = false,
            bool halfscale   = false,
            float angle      = 0.0f)
        {
            if (seed == 0UL && Profiles.experienceProfile != null)
            {
                seed = Profiles.experienceProfile.steamID;
            }
            SpriteMap spriteMap = this.sprite;

            if (this.icon != null)
            {
                spriteMap = this.icon;
            }
            if (spriteMap != null && this.neverFlip)
            {
                spriteMap.flipH = false;
            }
            if (this.name == "EGG")
            {
                VariatingSprite sprite = this.GetSprite(seed, variation, VSType.Egg);
                if (sprite != null)
                {
                    if (sprite.sprite.texture != null)
                    {
                        sprite.sprite.depth = depth + 6;
                        sprite.sprite.scale = this.sprite.scale;
                        DuckGame.Graphics.Draw(sprite.sprite, pos.x - 8f * sprite.sprite.xscale, pos.y - 12f * sprite.sprite.yscale);
                        spriteMap.frame = 0;
                    }
                    if ((sprite.sprite.renderTexture.nativeObject as Microsoft.Xna.Framework.Graphics.RenderTarget2D).IsContentLost)
                    {
                        this._eggSprites.Remove(sprite);
                    }
                }
            }
            else if (this.name == "PHOTO")
            {
                if (this._photoSprite == null)
                {
                    this._photoSprite = new SpriteMap("littleMan", 16, 16);
                }
                this._photoSprite.frame = UILevelBox.LittleManFrame(variation, 7, seed);
                this._photoSprite.depth = depth + 6;
                this._photoSprite.scale = this.sprite.scale;
                DuckGame.Graphics.Draw((Sprite)this._photoSprite, pos.x - 6f * this._photoSprite.xscale, pos.y - 4f * this._photoSprite.yscale, new Rectangle(2f, 0.0f, 12f, 10f));
                DuckGame.Graphics.DrawRect(pos + new Vec2(-6f * this._photoSprite.xscale, -6f * this._photoSprite.yscale), pos + new Vec2(6f * this._photoSprite.xscale, 6f * this._photoSprite.yscale), Colors.DGBlue, depth - 4);
                spriteMap.frame = 0;
            }
            else if (this.name == "EASEL")
            {
                VariatingSprite sprite = this.GetSprite(seed, variation, VSType.Portrait);
                if (sprite != null)
                {
                    sprite.sprite.depth = depth + 6;
                    sprite.sprite.scale = this.sprite.scale;
                    DuckGame.Graphics.Draw(sprite.sprite, pos.x - 9f * sprite.sprite.xscale, pos.y - 8f * sprite.sprite.yscale);
                    spriteMap.frame = 0;
                    if ((sprite.sprite.renderTexture.nativeObject as Microsoft.Xna.Framework.Graphics.RenderTarget2D).IsContentLost)
                    {
                        this._eggSprites.Remove(sprite);
                    }
                }
            }
            else
            {
                spriteMap.frame = variation;
            }
            if (this.font != null && this.sprite == null)
            {
                this.font.scale = new Vec2(1f, 1f);
                this.font.Draw("F", pos + new Vec2(-3.5f, -3f), Color.Black, depth + 8);
            }
            if (affectScale)
            {
                if (halfscale && (spriteMap.width > 30 || spriteMap.height > 30))
                {
                    spriteMap.scale = new Vec2(0.5f);
                }
                else
                {
                    spriteMap.scale = new Vec2(1f);
                }
            }
            spriteMap.depth = depth;
            spriteMap.angle = angle;
            DuckGame.Graphics.Draw((Sprite)spriteMap, pos.x, pos.y);
        }