Exemplo n.º 1
0
    public void render(midp.Graphics g, int top_offset)
    {
        this.top_offset = top_offset;
        switch (this.type)
        {
        case XNAButton.Type.BACK_BTN:
        case XNAButton.Type.UNLOCK_GAME:
            Color color1 = Color.White;
            if (this.state == XNAButton.State.PRESSED || this.state == XNAButton.State.ANIM_GRAY)
            {
                color1 = Color.Gray;
            }
            g.spriteBatch.Draw(this.texture, new Rectangle(this.pos.X, this.pos.Y - top_offset, this.pos.Width, this.pos.Height), color1);
            break;

        case XNAButton.Type.LEADERBOARD_BTN_1:
        case XNAButton.Type.LEADERBOARD_BTN_2:
        case XNAButton.Type.LEADERBOARD_BTN_3:
        case XNAButton.Type.LEADERBOARD_BTN_4:
        case XNAButton.Type.LEADERBOARD_BTN_5:
        case XNAButton.Type.LEADERBOARD_BTN_6:
        case XNAButton.Type.LEADERBOARD_BTN_7:
        case XNAButton.Type.LEADERBOARD_BTN_8:
        case XNAButton.Type.LEADERBOARD_BTN_9:
            Color color2 = Color.White;
            if (this.state == XNAButton.State.PRESSED || this.state == XNAButton.State.ANIM_GRAY)
            {
                color2 = Color.Gray;
            }
            if (this.Highlight)
            {
                g.spriteBatch.Draw(this.texture_high, new Rectangle(this.pos.X, this.pos.Y - top_offset, this.pos.Width, this.pos.Height), color2);
                break;
            }
            g.spriteBatch.Draw(this.texture, new Rectangle(this.pos.X, this.pos.Y - top_offset, this.pos.Width, this.pos.Height), color2);
            break;

        case XNAButton.Type.ACHIEVEMENT_BTN_1:
        case XNAButton.Type.ACHIEVEMENT_BTN_2:
        case XNAButton.Type.ACHIEVEMENT_BTN_3:
        case XNAButton.Type.ACHIEVEMENT_BTN_4:
        case XNAButton.Type.ACHIEVEMENT_BTN_5:
        case XNAButton.Type.ACHIEVEMENT_BTN_6:
        case XNAButton.Type.ACHIEVEMENT_BTN_7:
        case XNAButton.Type.ACHIEVEMENT_BTN_8:
        case XNAButton.Type.ACHIEVEMENT_BTN_9:
        case XNAButton.Type.ACHIEVEMENT_BTN_10:
        case XNAButton.Type.ACHIEVEMENT_BTN_11:
        case XNAButton.Type.ACHIEVEMENT_BTN_12:
        case XNAButton.Type.ACHIEVEMENT_BTN_13:
        case XNAButton.Type.ACHIEVEMENT_BTN_14:
        case XNAButton.Type.ACHIEVEMENT_BTN_15:
        case XNAButton.Type.ACHIEVEMENT_BTN_16:
        case XNAButton.Type.ACHIEVEMENT_BTN_17:
        case XNAButton.Type.ACHIEVEMENT_BTN_18:
            Color color3 = Color.Black;
            if (this.state == XNAButton.State.PRESSED || this.state == XNAButton.State.ANIM_GRAY)
            {
                color3 = Color.Gray;
            }
            g.spriteBatch.Draw(this.texture, new Rectangle(this.pos.X, this.pos.Y - top_offset, this.pos.Width, this.pos.Height), color3);
            XNAButton.tm.drawString(g, this.label, 6, this.pos.X + 5, this.pos.Y + (this.pos.Height >> 1) - top_offset, 10);
            if (XNAButton.AC == null)
            {
                break;
            }
            Achievement achievement = XNAButton.AC.ElementAt <Achievement>((int)(this.type - 10));
            g.drawImage(achievement.IsEarned ? XNAButton.AchievementUnlocked : XNAButton.AchievementLocked, (float)(this.pos.X + this.pos.Width - 70), (float)(this.pos.Y + (this.pos.Height >> 1) - top_offset), 10);
            break;

        case XNAButton.Type.UNLOCKFULL_STORE:
        case XNAButton.Type.UNLOCKFULL_BACK:
            Color color4 = Color.White;
            if (this.state == XNAButton.State.PRESSED || this.state == XNAButton.State.ANIM_GRAY)
            {
                color4 = Color.Gray;
            }
            g.spriteBatch.Draw(this.texture, new Rectangle(this.pos.X, this.pos.Y, this.pos.Width, this.pos.Height), color4);
            XNAButton.tm.drawString(g, this.label, 6, this.pos.X + (this.pos.Width >> 1), this.pos.Y + (this.pos.Height >> 1), 18);
            break;
        }
    }
Exemplo n.º 2
0
 public void render(midp.Graphics g)
 {
     this.render(g, 0);
 }