Esempio n. 1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            CalculatedStyle innerDimensions = GetInnerDimensions();
            CalculatedStyle dimensions      = _worldIcon.GetDimensions();
            float           x1    = dimensions.X + dimensions.Width;
            Color           color = _data.IsValid ? Color.White : Color.Red;

            Utils.DrawBorderString(spriteBatch, _data.Name, new Vector2(x1 + 6f, dimensions.Y - 2f), color, 1f, 0.0f, 0.0f, -1);
            spriteBatch.Draw(_dividerTexture, new Vector2(x1, innerDimensions.Y + 21f), new Rectangle?(), Color.White, 0.0f, Vector2.Zero,
                             new Vector2((float)((GetDimensions().X + GetDimensions().Width - x1) / 8.0), 1f), SpriteEffects.None, 0.0f);
            Vector2 position = new Vector2(x1 + 6f, innerDimensions.Y + 29f);
            float   width1   = 80f;

            DrawPanel(spriteBatch, position, width1);
            string text1 = _data.IsExpertMode ? "Expert" : "Normal";
            float  num1  = Main.fontMouseText.MeasureString(text1).X;
            float  x2    = (float)(width1 * 0.5 - num1 * 0.5);

            Utils.DrawBorderString(spriteBatch, text1, position + new Vector2(x2, 3f), _data.IsExpertMode ? new Color(217, 143, 244) : Color.White, 1f, 0.0f, 0.0f, -1);
            position.X += width1 + 5f;
            float width2 = 140f;

            DrawPanel(spriteBatch, position, width2);
            string text2 = _data.WorldSizeName + " World";
            float  num2  = Main.fontMouseText.MeasureString(text2).X;
            float  x3    = (float)(width2 * 0.5 - num2 * 0.5);

            Utils.DrawBorderString(spriteBatch, text2, position + new Vector2(x3, 3f), Color.White, 1f, 0.0f, 0.0f, -1);
            position.X += width2 + 5f;
            float width3 = innerDimensions.X + innerDimensions.Width - position.X;

            DrawPanel(spriteBatch, position, width3);
            string text3 = "Created: " + _data.CreationTime.ToString("d MMMM yyyy");
            float  num3  = Main.fontMouseText.MeasureString(text3).X;
            float  x4    = (float)(width3 * 0.5 - num3 * 0.5);

            Utils.DrawBorderString(spriteBatch, text3, position + new Vector2(x4, 3f), Color.White, 1f, 0.0f, 0.0f, -1);
            position.X += width3 + 5f;
        }
Esempio n. 2
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            CalculatedStyle ınnerDimensions = GetInnerDimensions();
            CalculatedStyle dimensions      = _worldIcon.GetDimensions();
            float           num             = dimensions.X + dimensions.Width;
            Color           color           = _data.IsValid ? Color.White : Color.Red;

            Utils.DrawBorderString(spriteBatch, _data.Name, new Vector2(num + 6f, dimensions.Y - 2f), color);
            spriteBatch.Draw(_dividerTexture, new Vector2(num, ınnerDimensions.Y + 21f), null, Color.White, 0f, Vector2.Zero, new Vector2((GetDimensions().X + GetDimensions().Width - num) / 8f, 1f), SpriteEffects.None, 0f);
            Vector2 vector = new Vector2(num + 6f, ınnerDimensions.Y + 29f);
            float   num2   = 80f;

            DrawPanel(spriteBatch, vector, num2);
            string text = _data.IsExpertMode ? "Expert" : "Normal";
            float  x    = Main.fontMouseText.MeasureString(text).X;
            float  x2   = num2 * 0.5f - x * 0.5f;

            Utils.DrawBorderString(spriteBatch, text, vector + new Vector2(x2, 3f), _data.IsExpertMode ? new Color(217, 143, 244) : Color.White);
            vector.X += num2 + 5f;
            float num3 = 140f;

            DrawPanel(spriteBatch, vector, num3);
            string text2 = _data.WorldSizeName + " World";
            float  x3    = Main.fontMouseText.MeasureString(text2).X;
            float  x4    = num3 * 0.5f - x3 * 0.5f;

            Utils.DrawBorderString(spriteBatch, text2, vector + new Vector2(x4, 3f), Color.White);
            vector.X += num3 + 5f;
            float num4 = ınnerDimensions.X + ınnerDimensions.Width - vector.X;

            DrawPanel(spriteBatch, vector, num4);
            string text3 = "Created: " + _data.CreationTime.ToString("d MMMM yyyy");
            float  x5    = Main.fontMouseText.MeasureString(text3).X;
            float  x6    = num4 * 0.5f - x5 * 0.5f;

            Utils.DrawBorderString(spriteBatch, text3, vector + new Vector2(x6, 3f), Color.White);
            vector.X += num4 + 5f;
        }
Esempio n. 3
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            CalculatedStyle innerDimensions = GetInnerDimensions();
            CalculatedStyle dimensions      = _worldIcon.GetDimensions();
            float           num             = dimensions.X + dimensions.Width;
            Color           color           = _data.IsValid ? Color.White : Color.Red;

            Utils.DrawBorderString(spriteBatch, _data.Name, new Vector2(num + 6f, dimensions.Y - 2f), color);
            spriteBatch.Draw(_dividerTexture.get_Value(), new Vector2(num, innerDimensions.Y + 21f), null, Color.White, 0f, Vector2.Zero, new Vector2((GetDimensions().X + GetDimensions().Width - num) / 8f, 1f), SpriteEffects.None, 0f);
            Vector2 vector = new Vector2(num + 6f, innerDimensions.Y + 29f);
            float   num2   = 100f;

            DrawPanel(spriteBatch, vector, num2);
            string text   = "";
            Color  color2 = Color.White;

            switch (_data.GameMode)
            {
            case 1:
                text   = Language.GetTextValue("UI.Expert");
                color2 = Main.mcColor;
                break;

            case 2:
                text   = Language.GetTextValue("UI.Master");
                color2 = Main.hcColor;
                break;

            case 3:
                text   = Language.GetTextValue("UI.Creative");
                color2 = Main.creativeModeColor;
                break;

            default:
                text = Language.GetTextValue("UI.Normal");
                break;
            }
            float x  = FontAssets.MouseText.get_Value().MeasureString(text).X;
            float x2 = num2 * 0.5f - x * 0.5f;

            Utils.DrawBorderString(spriteBatch, text, vector + new Vector2(x2, 3f), color2);
            vector.X += num2 + 5f;
            float num3 = 150f;

            if (!GameCulture.FromCultureName(GameCulture.CultureName.English).IsActive)
            {
                num3 += 40f;
            }
            DrawPanel(spriteBatch, vector, num3);
            string textValue = Language.GetTextValue("UI.WorldSizeFormat", _data.WorldSizeName);
            float  x3        = FontAssets.MouseText.get_Value().MeasureString(textValue).X;
            float  x4        = num3 * 0.5f - x3 * 0.5f;

            Utils.DrawBorderString(spriteBatch, textValue, vector + new Vector2(x4, 3f), Color.White);
            vector.X += num3 + 5f;
            float num4 = innerDimensions.X + innerDimensions.Width - vector.X;

            DrawPanel(spriteBatch, vector, num4);
            string arg        = (!GameCulture.FromCultureName(GameCulture.CultureName.English).IsActive) ? _data.CreationTime.ToShortDateString() : _data.CreationTime.ToString("d MMMM yyyy");
            string textValue2 = Language.GetTextValue("UI.WorldCreatedFormat", arg);
            float  x5         = FontAssets.MouseText.get_Value().MeasureString(textValue2).X;
            float  x6         = num4 * 0.5f - x5 * 0.5f;

            Utils.DrawBorderString(spriteBatch, textValue2, vector + new Vector2(x6, 3f), Color.White);
            vector.X += num4 + 5f;
        }
Esempio n. 4
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            int     num   = _large.ToInt() * 6;
            Vector2 value = new Vector2(num, 0f);

            _locked = !_achievement.IsCompleted;
            UpdateIconFrame();
            CalculatedStyle          innerDimensions = GetInnerDimensions();
            CalculatedStyle          dimensions      = _achievementIconBorders.GetDimensions();
            float                    num2            = dimensions.X + dimensions.Width;
            Vector2                  value2          = new Vector2(num2 + 7f, innerDimensions.Y);
            Tuple <decimal, decimal> trackerValues   = GetTrackerValues();
            bool flag = false;

            if ((!(trackerValues.Item1 == 0m) || !(trackerValues.Item2 == 0m)) && _locked)
            {
                flag = true;
            }
            float   num3       = innerDimensions.Width - dimensions.Width + 1f - (float)(num * 2);
            Vector2 baseScale  = new Vector2(0.85f);
            Vector2 baseScale2 = new Vector2(0.92f);
            string  text       = FontAssets.ItemStack.get_Value().CreateWrappedText(_achievement.Description.Value, (num3 - 20f) * (1f / baseScale2.X), Language.ActiveCulture.CultureInfo);
            Vector2 stringSize = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), text, baseScale2, num3);

            if (!_large)
            {
                stringSize = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), _achievement.Description.Value, baseScale2, num3);
            }
            float num4 = 38f + (float)(_large ? 20 : 0);

            if (stringSize.Y > num4)
            {
                baseScale2.Y *= num4 / stringSize.Y;
            }
            Color value3 = _locked ? Color.Silver : Color.Gold;

            value3 = Color.Lerp(value3, Color.White, base.IsMouseHovering ? 0.5f : 0f);
            Color value4 = _locked ? Color.DarkGray : Color.Silver;

            value4 = Color.Lerp(value4, Color.White, base.IsMouseHovering ? 1f : 0f);
            Color   color  = base.IsMouseHovering ? Color.White : Color.Gray;
            Vector2 vector = value2 - Vector2.UnitY * 2f + value;

            DrawPanelTop(spriteBatch, vector, num3, color);
            AchievementCategory category = _achievement.Category;

            vector.Y += 2f;
            vector.X += 4f;
            spriteBatch.Draw(_categoryTexture.get_Value(), vector, _categoryTexture.Frame(4, 2, (int)category), base.IsMouseHovering ? Color.White : Color.Silver, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
            vector.X += 4f;
            vector.X += 17f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), _achievement.FriendlyName.Value, vector, value3, 0f, Vector2.Zero, baseScale, num3);
            vector.X -= 17f;
            Vector2 position = value2 + Vector2.UnitY * 27f + value;

            DrawPanelBottom(spriteBatch, position, num3, color);
            position.X += 8f;
            position.Y += 4f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), text, position, value4, 0f, Vector2.Zero, baseScale2);
            if (flag)
            {
                Vector2 vector2     = vector + Vector2.UnitX * num3 + Vector2.UnitY;
                string  text2       = (int)trackerValues.Item1 + "/" + (int)trackerValues.Item2;
                Vector2 baseScale3  = new Vector2(0.75f);
                Vector2 stringSize2 = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), text2, baseScale3);
                float   progress    = (float)(trackerValues.Item1 / trackerValues.Item2);
                float   num5        = 80f;
                Color   color2      = new Color(100, 255, 100);
                if (!base.IsMouseHovering)
                {
                    color2 = Color.Lerp(color2, Color.Black, 0.25f);
                }
                Color color3 = new Color(255, 255, 255);
                if (!base.IsMouseHovering)
                {
                    color3 = Color.Lerp(color3, Color.Black, 0.25f);
                }
                DrawProgressBar(spriteBatch, progress, vector2 - Vector2.UnitX * num5 * 0.7f, num5, color3, color2, color2.MultiplyRGBA(new Color(new Vector4(1f, 1f, 1f, 0.5f))));
                vector2.X -= num5 * 1.4f + stringSize2.X;
                ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), text2, vector2, value3, 0f, new Vector2(0f, 0f), baseScale3, 90f);
            }
        }
Esempio n. 5
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            _locked = !_achievement.IsCompleted;
            UpdateIconFrame();
            CalculatedStyle          innerDimensions = GetInnerDimensions();
            CalculatedStyle          dimensions      = _achievementIconBorders.GetDimensions();
            float                    num             = dimensions.X + dimensions.Width;
            Vector2                  value           = new Vector2(num + 7f, innerDimensions.Y);
            Tuple <decimal, decimal> trackerValues   = GetTrackerValues();
            bool flag = false;

            if ((!(trackerValues.Item1 == 0m) || !(trackerValues.Item2 == 0m)) && _locked)
            {
                flag = true;
            }
            float   num2       = innerDimensions.Width - dimensions.Width + 1f;
            Vector2 baseScale  = new Vector2(0.85f);
            Vector2 baseScale2 = new Vector2(0.92f);
            Vector2 stringSize = ChatManager.GetStringSize(Main.fontItemStack, _achievement.Description.Value, baseScale2, num2);

            if (stringSize.Y > 38f)
            {
                baseScale2.Y *= 38f / stringSize.Y;
            }
            Color value2 = _locked ? Color.Silver : Color.Gold;

            value2 = Color.Lerp(value2, Color.White, base.IsMouseHovering ? 0.5f : 0f);
            Color value3 = _locked ? Color.DarkGray : Color.Silver;

            value3 = Color.Lerp(value3, Color.White, base.IsMouseHovering ? 1f : 0f);
            Color   color  = base.IsMouseHovering ? Color.White : Color.Gray;
            Vector2 vector = value - Vector2.UnitY * 2f;

            DrawPanelTop(spriteBatch, vector, num2, color);
            AchievementCategory category = _achievement.Category;

            vector.Y += 2f;
            vector.X += 4f;
            spriteBatch.Draw(_categoryTexture, vector, _categoryTexture.Frame(4, 2, (int)category), base.IsMouseHovering ? Color.White : Color.Silver, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);
            vector.X += 4f;
            vector.X += 17f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, _achievement.FriendlyName.Value, vector, value2, 0f, Vector2.Zero, baseScale, num2);
            vector.X -= 17f;
            Vector2 position = value + Vector2.UnitY * 27f;

            DrawPanelBottom(spriteBatch, position, num2, color);
            position.X += 8f;
            position.Y += 4f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, _achievement.Description.Value, position, value3, 0f, Vector2.Zero, baseScale2, num2 - 10f);
            if (flag)
            {
                Vector2 vector2     = vector + Vector2.UnitX * num2 + Vector2.UnitY;
                string  text        = ((int)trackerValues.Item1).ToString() + "/" + ((int)trackerValues.Item2).ToString();
                Vector2 baseScale3  = new Vector2(0.75f);
                Vector2 stringSize2 = ChatManager.GetStringSize(Main.fontItemStack, text, baseScale3);
                float   progress    = (float)(trackerValues.Item1 / trackerValues.Item2);
                float   num3        = 80f;
                Color   color2      = new Color(100, 255, 100);
                if (!base.IsMouseHovering)
                {
                    color2 = Color.Lerp(color2, Color.Black, 0.25f);
                }
                Color color3 = new Color(255, 255, 255);
                if (!base.IsMouseHovering)
                {
                    color3 = Color.Lerp(color3, Color.Black, 0.25f);
                }
                DrawProgressBar(spriteBatch, progress, vector2 - Vector2.UnitX * num3 * 0.7f, num3, color3, color2, color2.MultiplyRGBA(new Color(new Vector4(1f, 1f, 1f, 0.5f))));
                vector2.X -= num3 * 1.4f + stringSize2.X;
                ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, text, vector2, value2, 0f, new Vector2(0f, 0f), baseScale3, 90f);
            }
        }
Esempio n. 6
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            base.DrawSelf(spriteBatch);
            _locked = !_achievement.IsCompleted;
            UpdateIconFrame();
            CalculatedStyle          innerDimensions = GetInnerDimensions();
            CalculatedStyle          dimensions      = _achievementIconBorders.GetDimensions();
            Vector2                  vector2         = new Vector2(dimensions.X + dimensions.Width + 7f, innerDimensions.Y);
            Tuple <Decimal, Decimal> trackerValues   = GetTrackerValues();
            bool flag = false;

            if ((!(trackerValues.Item1 == new Decimal(0)) || !(trackerValues.Item2 == new Decimal(0))) && _locked)
            {
                flag = true;
            }

            float   num         = (float)(innerDimensions.Width - dimensions.Width + 1.0);
            Vector2 baseScale1  = new Vector2(0.85f);
            Vector2 baseScale2  = new Vector2(0.92f);
            Vector2 stringSize1 = ChatManager.GetStringSize(Main.fontItemStack, _achievement.Description, baseScale2, num);

            if (stringSize1.Y > 38.0)
            {
                baseScale2.Y *= 38f / stringSize1.Y;
            }

            Color   baseColor1 = Color.Lerp(_locked ? Color.Silver : Color.Gold, Color.White, IsMouseHovering ? 0.5f : 0.0f);
            Color   baseColor2 = Color.Lerp(_locked ? Color.DarkGray : Color.Silver, Color.White, IsMouseHovering ? 1f : 0.0f);
            Color   color1     = this.IsMouseHovering ? Color.White : Color.Gray;
            Vector2 position1  = vector2 - Vector2.UnitY * 2f;

            DrawPanelTop(spriteBatch, position1, num, color1);
            AchievementCategory category = _achievement.Category;

            position1.Y += 2f;
            position1.X += 4f;
            spriteBatch.Draw(_categoryTexture, position1, new Rectangle?(Utils.Frame(_categoryTexture, 4, 2, (int)category, 0)),
                             IsMouseHovering ? Color.White : Color.Silver, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
            position1.X += 4f;
            position1.X += 17f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, _achievement.FriendlyName, position1, baseColor1, 0.0f, Vector2.Zero, baseScale1, num, 2f);
            position1.X -= 17f;
            Vector2 position2 = vector2 + Vector2.UnitY * 27f;

            this.DrawPanelBottom(spriteBatch, position2, num, color1);
            position2.X += 8f;
            position2.Y += 4f;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, _achievement.Description, position2, baseColor2, 0.0f, Vector2.Zero, baseScale2, num - 10f, 2f);
            if (!flag)
            {
                return;
            }

            Vector2 position3   = position1 + Vector2.UnitX * num + Vector2.UnitY;
            string  text        = (int)trackerValues.Item1 + "/" + (int)trackerValues.Item2;
            Vector2 baseScale3  = new Vector2(0.75f);
            Vector2 stringSize2 = ChatManager.GetStringSize(Main.fontItemStack, text, baseScale3, -1f);
            float   progress    = (float)(trackerValues.Item1 / trackerValues.Item2);
            float   Width       = 80f;
            Color   color2      = new Color(100, 255, 100);

            if (!IsMouseHovering)
            {
                color2 = Color.Lerp(color2, Color.Black, 0.25f);
            }
            Color BackColor = new Color(255, 255, 255);

            if (!IsMouseHovering)
            {
                BackColor = Color.Lerp(BackColor, Color.Black, 0.25f);
            }
            DrawProgressBar(spriteBatch, progress, position3 - Vector2.UnitX * Width * 0.7f, Width, BackColor, color2, Utils.MultiplyRGBA(color2, new Color(new Vector4(1f, 1f, 1f, 0.5f))));
            position3.X -= Width * 1.4f + stringSize2.X;
            ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontItemStack, text, position3, baseColor1, 0.0f, new Vector2(0.0f, 0.0f), baseScale3, 90f, 2f);
        }