Example #1
0
        private void DrawHoverTooltip(Rectangle bounds, SpriteBatch sb)
        {
            float     announcerWidth = 80f;
            int       num            = bounds.Height - 80;
            Rectangle rectangle1;

            if (this.hoverIndex > -1 && this.hoverIndex < this.upgradeNames.Count && this.activeState != null)
            {
                Rectangle bounds1 = bounds;
                bounds1.Height = num;
                bool  flag      = (double)this.upgradeCosts[this.hoverIndex] <= (double)this.activeState.points;
                float cornerCut = 20f;
                FancyOutlines.DrawCornerCutOutline(bounds1, sb, cornerCut, this.ThemeColor);
                Rectangle dest = new Rectangle((int)((double)bounds.X + (double)cornerCut + 4.0), bounds.Y + 3, (int)((double)bounds.Width - ((double)cornerCut + 4.0) * 2.0), 40);
                TextItem.doFontLabelToSize(dest, this.upgradeNames[this.hoverIndex], GuiData.font, this.ThemeColorHighlight, false, false);
                rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + dest.Height + 4, bounds.Width - 4, 20);
                string text = flag ? (Settings.ActiveLocale != "en-us" ? LocaleTerms.Loc("UPGRADE AVALIABLE") : "UPGRADE AVAILABLE") : LocaleTerms.Loc("INSUFFICIENT POINTS");
                TextItem.doFontLabelToSize(rectangle1, text, GuiData.font, flag ? this.ThemeColorHighlight * 0.8f : Color.Gray, false, false);
                rectangle1.Y     += rectangle1.Height;
                rectangle1.Height = 50;
                rectangle1.X     += 4;
                rectangle1.Width -= 4;
                float f = this.activeState.points == 0L ? 1f : this.upgradeCosts[this.hoverIndex] / (float)this.activeState.points;
                this.DrawStatsTextBlock(LocaleTerms.Loc("COST"), string.Concat((object)this.upgradeCosts[this.hoverIndex]), (!float.IsNaN(f) ? f * 100f : 100f).ToString("00.0") + LocaleTerms.Loc("% of current Points"), rectangle1, sb, announcerWidth);
                rectangle1.Y += rectangle1.Height;
                this.DrawStatsTextBlock("+PPS", string.Concat((object)this.upgradeValues[this.hoverIndex]), ((double)this.currentRate <= 0.0 ? 100f : (float)((double)this.upgradeValues[this.hoverIndex] / (double)this.currentRate * 100.0)).ToString("00.0") + LocaleTerms.Loc("% of current Points Per Second"), rectangle1, sb, announcerWidth);
                Rectangle rectangle2 = new Rectangle((int)((double)bounds.X + (double)cornerCut + 4.0), rectangle1.Y + rectangle1.Height + 4, (int)((double)bounds.Width - ((double)cornerCut + 4.0) * 2.0), 50);
                if (flag)
                {
                    sb.Draw(this.scanlinesTextBackground, rectangle2, Utils.makeColorAddative(this.ThemeColorHighlight) * 0.6f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "CLICK TO UPGRADE", 3f, 0.1f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite);
                }
                else
                {
                    sb.Draw(this.scanlinesTextBackground, rectangle2, Color.Lerp(this.os.brightLockedColor, Utils.makeColorAddative(Color.Red), 0.2f + Utils.randm(0.8f)) * 0.4f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "INSUFFICIENT POINTS", 3f, 0.1f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite);
                }
            }
            rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + num + 4, bounds.Width - 4, 50);
            float f1 = (double)this.currentRate <= 0.0 ? 0.0f : (float)this.activeState.points / this.currentRate;

            if (float.IsNaN(f1))
            {
                f1 = float.PositiveInfinity;
            }
            this.DrawStatsTextBlock("PPS", this.currentRate.ToString("000.0") ?? "", f1.ToString("00.0") + " " + LocaleTerms.Loc("seconds to double current points"), rectangle1, sb, announcerWidth);
            float totalSeconds = (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;

            for (int index = 0; index < this.UpgradeNotifiers.Count; ++index)
            {
                PointClickerDaemon.UpgradeNotifier upgradeNotifier = this.UpgradeNotifiers[index];
                upgradeNotifier.timer -= totalSeconds * 4f;
                if ((double)upgradeNotifier.timer <= 0.0)
                {
                    this.UpgradeNotifiers.RemoveAt(index);
                    --index;
                }
                else
                {
                    Vector2 vector2 = GuiData.font.MeasureString(upgradeNotifier.text);
                    sb.DrawString(GuiData.font, upgradeNotifier.text, new Vector2((float)rectangle1.X + (float)(((double)rectangle1.Width - (double)announcerWidth) / 2.0) + announcerWidth, (float)(rectangle1.Y + 10)), this.ThemeColorHighlight * upgradeNotifier.timer, 0.0f, vector2 / 2f, (float)(0.5 + (1.0 - (double)upgradeNotifier.timer) * 2.20000004768372), SpriteEffects.None, 0.9f);
                    this.UpgradeNotifiers[index] = upgradeNotifier;
                }
            }
        }
        private void DrawHoverTooltip(Rectangle bounds, SpriteBatch sb)
        {
            var       announcerWidth = 80f;
            var       num1           = bounds.Height - 80;
            Rectangle rectangle1;

            if (hoverIndex > -1 && hoverIndex < upgradeNames.Count && activeState != null)
            {
                var bounds1 = bounds;
                bounds1.Height = num1;
                var flag      = upgradeCosts[hoverIndex] <= (double)activeState.points;
                var cornerCut = 20f;
                FancyOutlines.DrawCornerCutOutline(bounds1, sb, cornerCut, ThemeColor);
                var dest = new Rectangle((int)(bounds.X + (double)cornerCut + 4.0), bounds.Y + 3,
                                         (int)(bounds.Width - (cornerCut + 4.0) * 2.0), 40);
                TextItem.doFontLabelToSize(dest, upgradeNames[hoverIndex], GuiData.font, ThemeColorHighlight);
                rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + dest.Height + 4, bounds.Width - 4, 20);
                var text = flag ? "UPGRADE AVALIABLE" : "INSUFFICIENT POINTS";
                TextItem.doFontLabelToSize(rectangle1, text, GuiData.font, flag ? ThemeColorHighlight * 0.8f : Color.Gray);
                rectangle1.Y     += rectangle1.Height;
                rectangle1.Height = 50;
                rectangle1.X     += 4;
                rectangle1.Width -= 4;
                var f = activeState.points == 0L ? 1f : upgradeCosts[hoverIndex] / activeState.points;
                DrawStatsTextBlock("COST", string.Concat(upgradeCosts[hoverIndex]),
                                   (!float.IsNaN(f) ? f * 100f : 100f).ToString("00.0") + "% of current Points", rectangle1, sb,
                                   announcerWidth);
                rectangle1.Y += rectangle1.Height;
                DrawStatsTextBlock("+PPS", string.Concat(upgradeValues[hoverIndex]),
                                   (currentRate <= 0.0 ? 100f : (float)(upgradeValues[hoverIndex] / (double)currentRate * 100.0))
                                   .ToString("00.0") + "% of current Points Per Second", rectangle1, sb, announcerWidth);
                var rectangle2 = new Rectangle((int)(bounds.X + (double)cornerCut + 4.0),
                                               rectangle1.Y + rectangle1.Height + 4, (int)(bounds.Width - (cornerCut + 4.0) * 2.0), 50);
                if (flag)
                {
                    sb.Draw(scanlinesTextBackground, rectangle2, Utils.makeColorAddative(ThemeColorHighlight) * 0.6f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "CLICK TO UPGRADE", 3f, 0.1f, GuiData.titlefont,
                                                            os, Utils.AddativeWhite);
                }
                else
                {
                    sb.Draw(scanlinesTextBackground, rectangle2,
                            Color.Lerp(os.brightLockedColor, Utils.makeColorAddative(Color.Red), 0.2f + Utils.randm(0.8f)) *
                            0.4f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "INSUFFICIENT POINTS", 3f, 0.1f,
                                                            GuiData.titlefont, os, Utils.AddativeWhite);
                }
            }
            rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + num1 + 4, bounds.Width - 4, 50);
            var f1 = currentRate <= 0.0 ? 0.0f : activeState.points / currentRate;

            if (float.IsNaN(f1))
            {
                f1 = float.PositiveInfinity;
            }
            DrawStatsTextBlock("PPS", currentRate.ToString("000.0") ?? "",
                               f1.ToString("00.0") + " seconds to double current points", rectangle1, sb, announcerWidth);
            var num2 = (float)os.lastGameTime.ElapsedGameTime.TotalSeconds;

            for (var index = 0; index < UpgradeNotifiers.Count; ++index)
            {
                var upgradeNotifier = UpgradeNotifiers[index];
                upgradeNotifier.timer -= num2 * 4f;
                if (upgradeNotifier.timer <= 0.0)
                {
                    UpgradeNotifiers.RemoveAt(index);
                    --index;
                }
                else
                {
                    var vector2 = GuiData.font.MeasureString(upgradeNotifier.text);
                    sb.DrawString(GuiData.font, upgradeNotifier.text,
                                  new Vector2(
                                      rectangle1.X + (float)((rectangle1.Width - (double)announcerWidth) / 2.0) + announcerWidth,
                                      rectangle1.Y + 10), ThemeColorHighlight * upgradeNotifier.timer, 0.0f, vector2 / 2f,
                                  (float)(0.5 + (1.0 - upgradeNotifier.timer) * 2.20000004768372), SpriteEffects.None, 0.9f);
                    UpgradeNotifiers[index] = upgradeNotifier;
                }
            }
        }