Ejemplo n.º 1
0
        private static void DrawAchievement(SpriteBatch sb, ref Vector2 center, AchievementCompleteUI.DrawCache ach)
        {
            float alpha = ach.Alpha;

            if ((double)alpha > 0.0)
            {
                string    text        = ach.Title;
                Vector2   center1     = center;
                Vector2   vector2     = Main.fontItemStack.MeasureString(text);
                float     num         = ach.Scale * 1.1f;
                Rectangle rectangle   = Utils.CenteredRectangle(center1, (vector2 + new Vector2(58f, 10f)) * num);
                Vector2   mouseScreen = Main.MouseScreen;
                bool      flag        = rectangle.Contains(Utils.ToPoint(mouseScreen));
                Color     c           = flag ? new Color(64, 109, 164) * 0.75f : new Color(64, 109, 164) * 0.5f;
                Utils.DrawInvBG(sb, rectangle, c);
                float   scale    = num * 0.3f;
                Color   color    = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor / 5, (int)Main.mouseTextColor);
                Vector2 position = Utils.Right(rectangle) - Vector2.UnitX * num * (float)(12.0 + (double)scale * (double)ach.Frame.Width);
                sb.Draw(AchievementCompleteUI.AchievementsTexture, position, new Rectangle?(ach.Frame), Color.White * alpha, 0.0f, new Vector2(0.0f, (float)(ach.Frame.Height / 2)), scale, SpriteEffects.None, 0.0f);
                sb.Draw(AchievementCompleteUI.AchievementsTextureBorder, position, new Rectangle?(), Color.White * alpha, 0.0f, new Vector2(0.0f, (float)(ach.Frame.Height / 2)), scale, SpriteEffects.None, 0.0f);
                Utils.DrawBorderString(sb, text, position - Vector2.UnitX * 10f, color * alpha, num * 0.9f, 1f, 0.4f, -1);
                if (flag)
                {
                    Main.player[Main.myPlayer].mouseInterface = true;
                    if (Main.mouseLeft && Main.mouseLeftRelease)
                    {
                        AchievementsUI.OpenAndGoto(ach.theAchievement);
                        ach.TimeLeft = 0;
                    }
                }
            }
            ach.ApplyHeight(ref center);
        }
Ejemplo n.º 2
0
 public static void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     if (!Main.gameMenu && Main.player[Main.myPlayer].dead && !Main.player[Main.myPlayer].ghost)
     {
         AchievementsUI.Close();
         Main.playerInventory = false;
     }
     else
     {
         if (Main.gameMenu)
         {
             return;
         }
         Main.mouseText = false;
         Main.instance.GUIBarsDraw();
         if (!Main.achievementsWindow)
         {
             Main.InGameUI.SetState((UIState)null);
         }
         Main.instance.DrawMouseOver();
         Main.DrawThickCursor(false);
         spriteBatch.Draw(Main.cursorTextures[0], new Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1)), new Rectangle?(), new Color((int)((double)Main.cursorColor.R * 0.200000002980232), (int)((double)Main.cursorColor.G * 0.200000002980232), (int)((double)Main.cursorColor.B * 0.200000002980232), (int)((double)Main.cursorColor.A * 0.5)), 0.0f, new Vector2(), Main.cursorScale * 1.1f, SpriteEffects.None, 0.0f);
         spriteBatch.Draw(Main.cursorTextures[0], new Vector2((float)Main.mouseX, (float)Main.mouseY), new Rectangle?(), Main.cursorColor, 0.0f, new Vector2(), Main.cursorScale, SpriteEffects.None, 0.0f);
     }
 }
Ejemplo n.º 3
0
        private static void DrawAchievement(SpriteBatch sb, ref Vector2 center, DrawCache ach)
        {
            float alpha = ach.Alpha;

            if (alpha > 0f)
            {
                string    title       = ach.Title;
                Vector2   center2     = center;
                Vector2   value       = Main.fontItemStack.MeasureString(title);
                float     num         = ach.Scale * 1.1f;
                Rectangle r           = Utils.CenteredRectangle(center2, (value + new Vector2(58f, 10f)) * num);
                Vector2   mouseScreen = Main.MouseScreen;
                bool      flag        = r.Contains(mouseScreen.ToPoint());
                Color     c           = flag ? (new Color(64, 109, 164) * 0.75f) : (new Color(64, 109, 164) * 0.5f);
                Utils.DrawInvBG(sb, r, c);
                float   num2   = num * 0.3f;
                Color   value2 = new Color(Main.mouseTextColor, Main.mouseTextColor, (int)Main.mouseTextColor / 5, Main.mouseTextColor);
                Vector2 vector = r.Right() - Vector2.UnitX * num * (12f + num2 * (float)ach.Frame.Width);
                sb.Draw(AchievementsTexture, vector, ach.Frame, Color.White * alpha, 0f, new Vector2(0f, ach.Frame.Height / 2), num2, SpriteEffects.None, 0f);
                sb.Draw(AchievementsTextureBorder, vector, null, Color.White * alpha, 0f, new Vector2(0f, ach.Frame.Height / 2), num2, SpriteEffects.None, 0f);
                Utils.DrawBorderString(sb, title, vector - Vector2.UnitX * 10f, value2 * alpha, num * 0.9f, 1f, 0.4f);
                if (flag)
                {
                    Main.player[Main.myPlayer].mouseInterface = true;
                    if (Main.mouseLeft && Main.mouseLeftRelease)
                    {
                        AchievementsUI.OpenAndGoto(ach.theAchievement);
                        ach.TimeLeft = 0;
                    }
                }
            }
            ach.ApplyHeight(ref center);
        }
Ejemplo n.º 4
0
 public static void OpenAndGoto(Achievement achievement)
 {
     AchievementsUI.Open();
     Main.AchievementsMenu.GotoAchievement(achievement);
 }