Esempio n. 1
0
        public override void DrawName()
        {
            CreateLabel(Color.Transparent, false, true);

            if (NameLabel == null)
            {
                return;
            }
            NameLabel.Location = new Point(
                DisplayRectangle.X + (DisplayRectangle.Width - NameLabel.Size.Width) / 2,
                DisplayRectangle.Y + (DisplayRectangle.Height - NameLabel.Size.Height) / 2 - 20);
            NameLabel.Draw();
        }
Esempio n. 2
0
        public override void DrawName()
        {
            CreateLabel();

            if (NameLabel == null || OwnerLabel == null)
            {
                return;
            }

            NameLabel.Location = new Point(DisplayRectangle.X + (50 - NameLabel.Size.Width) / 2, DisplayRectangle.Y - (42 - NameLabel.Size.Height / 2) + (Dead ? 35 : 8));
            NameLabel.Draw();

            OwnerLabel.Location = new Point(DisplayRectangle.X + (50 - OwnerLabel.Size.Width) / 2, NameLabel.Location.Y + NameLabel.Size.Height - 1);
            OwnerLabel.Draw();
        }
Esempio n. 3
0
        public void DrawName(Point OffSet)
        {
            if (NameLabel == null || NameLabel.IsDisposed)
            {
                CreateLabel();
            }

            NameLabel.BackColor = Color.FromArgb(100, 0, 24, 48);
            NameLabel.Border    = true;
            //NameLabel.OutLine = false;

            if (NameLabel != null)
            {
                Size S = PrimaryLibrary.GetSize(ImageIndex);
                NameLabel.Location = new Point(
                    DisplayRectangle.X + OffSet.X + (DisplayRectangle.Width - NameLabel.Size.Width) / 2,
                    DisplayRectangle.Y + OffSet.Y + (DisplayRectangle.Height - NameLabel.Size.Height) / 2 - 20);
                NameLabel.Draw();
            }
        }
Esempio n. 4
0
        public override void DrawName()
        {
            if (NameLabel == null || NameLabel.IsDisposed)
            {
                CreateLabel();
            }

            NameLabel.BackColor = Color.Transparent;
            NameLabel.Border    = false;
            NameLabel.OutLine   = true;

            if (NameLabel != null)
            {
                Size S = PrimaryLibrary.GetSize(ImageIndex);
                NameLabel.Location = new Point(
                    DisplayRectangle.X + (DisplayRectangle.Width - NameLabel.Size.Width) / 2,
                    DisplayRectangle.Y + (DisplayRectangle.Height - NameLabel.Size.Height) / 2 - 20);
                NameLabel.Draw();
            }
        }
Esempio n. 5
0
        public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion)
        {
            if (DisplayTwoRows)
            {
                VerticalHeight = 0.9f * (g.MeasureString("A", ValueLabel.Font).Height + g.MeasureString("A", NameLabel.Font).Height);
                PaddingTop     = PaddingBottom = 0;
                DrawTwoRows(g, state, width, VerticalHeight);
            }
            else
            {
                VerticalHeight          = 31;
                NameLabel.ShadowColor   = state.LayoutSettings.ShadowsColor;
                NameLabel.OutlineColor  = state.LayoutSettings.TextOutlineColor;
                ValueLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
                ValueLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;

                var textHeight = 0.75f * Math.Max(g.MeasureString("A", ValueLabel.Font).Height, g.MeasureString("A", NameLabel.Font).Height);
                PaddingTop    = Math.Max(0, (VerticalHeight - textHeight) / 2f);
                PaddingBottom = PaddingTop;

                NameMeasureLabel.Text = LongestString;
                NameMeasureLabel.SetActualWidth(g);
                ValueLabel.SetActualWidth(g);

                NameLabel.Width  = width - ValueLabel.ActualWidth - 10;
                NameLabel.Height = VerticalHeight;
                NameLabel.X      = 5;
                NameLabel.Y      = 0;

                ValueLabel.Width  = ValueLabel.IsMonospaced ? width - 12 : width - 10;
                ValueLabel.Height = VerticalHeight;
                ValueLabel.Y      = 0;
                ValueLabel.X      = 5;

                PrepareDraw(state, LayoutMode.Vertical);

                NameLabel.Draw(g);
                ValueLabel.Draw(g);
            }
        }
        private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (NeedUpdateAll)
            {
                UpdateAll(state);
            }

            int splitIndex = state.Run.IndexOf(Split) % 7;

            if (IsActive)
            {
                switch (splitIndex)
                {
                case 0:
                    img = Properties.Resources.row_0_s;
                    break;

                case 1:
                    img = Properties.Resources.row_1_s;
                    break;

                case 2:
                    img = Properties.Resources.row_2_s;
                    break;

                case 3:
                    img = Properties.Resources.row_3_s;
                    break;

                case 4:
                    img = Properties.Resources.row_4_s;
                    break;

                case 5:
                    img = Properties.Resources.row_5_s;
                    break;

                case 6:
                    img = Properties.Resources.row_6_s;
                    break;

                default:
                    img = Properties.Resources.row_0_s;
                    break;
                }
            }
            else
            {
                switch (splitIndex)
                {
                case 0:
                    img = Properties.Resources.row_0;
                    break;

                case 1:
                    img = Properties.Resources.row_1;
                    break;

                case 2:
                    img = Properties.Resources.row_2;
                    break;

                case 3:
                    img = Properties.Resources.row_3;
                    break;

                case 4:
                    img = Properties.Resources.row_4;
                    break;

                case 5:
                    img = Properties.Resources.row_5;
                    break;

                case 6:
                    img = Properties.Resources.row_6;
                    break;

                default:
                    img = Properties.Resources.row_0;
                    break;
                }
            }

            g.DrawImage(img, 0, 0, width, height);

            MeasureTimeLabel.Text  = TimeFormatter.Format(new TimeSpan(24, 0, 0));
            MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0));

            MeasureTimeLabel.Font          = state.LayoutSettings.TimesFont;
            MeasureTimeLabel.IsMonospaced  = true;
            MeasureDeltaLabel.Font         = state.LayoutSettings.TimesFont;
            MeasureDeltaLabel.IsMonospaced = true;

            MeasureTimeLabel.SetActualWidth(g);
            MeasureDeltaLabel.SetActualWidth(g);

            NameLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
            NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
            foreach (var label in LabelsList)
            {
                label.ShadowColor  = state.LayoutSettings.ShadowsColor;
                label.OutlineColor = state.LayoutSettings.TextOutlineColor;
            }

            if (Settings.SplitTimesAccuracy != CurrentAccuracy)
            {
                TimeFormatter   = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy);
                CurrentAccuracy = Settings.SplitTimesAccuracy;
            }
            if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals)
            {
                DeltaTimeFormatter   = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals);
                CurrentDeltaAccuracy = Settings.DeltasAccuracy;
                CurrentDropDecimals  = Settings.DropDecimals;
            }

            if (Split != null)
            {
                if (mode == LayoutMode.Vertical)
                {
                    NameLabel.VerticalAlignment = StringAlignment.Center;
                    NameLabel.Y      = 0;
                    NameLabel.Height = height;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Center;
                        label.Y      = 0;
                        label.Height = height;
                    }
                }
                else
                {
                    NameLabel.VerticalAlignment = StringAlignment.Near;
                    NameLabel.Y      = 0;
                    NameLabel.Height = 50;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Far;
                        label.Y      = height - 50;
                        label.Height = 50;
                    }
                }

                if (IsActive)
                {
                    g.DrawImage(SplitCursor, 2, ((height - 24f) / 2.0f), 30f, 24f);
                }

                NameLabel.Font      = state.LayoutSettings.TextFont;
                NameLabel.X         = IsActive ? 35 : 5;
                NameLabel.HasShadow = state.LayoutSettings.DropShadows;

                if (ColumnsList.Count() == LabelsList.Count)
                {
                    var curX  = width - 12;
                    var nameX = width - 7;
                    foreach (var label in LabelsList.Reverse())
                    {
                        var column = ColumnsList.ElementAt(LabelsList.IndexOf(label));

                        var labelWidth = 0f;
                        if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime)
                        {
                            labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth);
                        }
                        else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta)
                        {
                            labelWidth = MeasureDeltaLabel.ActualWidth;
                        }
                        else
                        {
                            labelWidth = MeasureTimeLabel.ActualWidth;
                        }

                        label.Width = labelWidth + 20;
                        curX       -= labelWidth + 5;
                        label.X     = curX - 15;

                        label.Font         = state.LayoutSettings.TimesFont;
                        label.HasShadow    = state.LayoutSettings.DropShadows;
                        label.OutlineColor = state.LayoutSettings.TextOutlineColor;

                        label.IsMonospaced = true;
                        label.Draw(g);

                        if (!string.IsNullOrEmpty(label.Text))
                        {
                            nameX = curX + labelWidth + 5 - label.ActualWidth;
                        }
                    }

                    NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : width * 0.4f);
                    NameLabel.Draw(g);
                }
            }
        }
Esempio n. 7
0
        private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (NeedUpdateAll)
            {
                UpdateAll(state);
            }

            if (Settings.BackgroundGradient == ExtendedGradientType.Alternating)
            {
                g.FillRectangle(new SolidBrush(
                                    state.Run.IndexOf(Split) % 2 + (Settings.ShowColumnLabels ? 1 : 0) == 1
                    ? Settings.BackgroundColor2
                    : Settings.BackgroundColor
                                    ), 0, 0, width, height);
            }

            MeasureTimeLabel.Text  = TimeFormatter.Format(new TimeSpan(24, 0, 0));
            MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0));

            MeasureTimeLabel.Font          = state.LayoutSettings.TimesFont;
            MeasureTimeLabel.IsMonospaced  = true;
            MeasureDeltaLabel.Font         = state.LayoutSettings.TimesFont;
            MeasureDeltaLabel.IsMonospaced = true;

            MeasureTimeLabel.SetActualWidth(g);
            MeasureDeltaLabel.SetActualWidth(g);

            NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor;
            foreach (var label in LabelsList)
            {
                label.SetActualWidth(g);
                label.ShadowColor = state.LayoutSettings.ShadowsColor;
            }
            MinimumWidth  = CalculateLabelsWidth() + IconWidth + 10;
            MinimumHeight = 0.85f * (g.MeasureString("A", state.LayoutSettings.TimesFont).Height + g.MeasureString("A", state.LayoutSettings.TextFont).Height);

            if (Settings.SplitTimesAccuracy != CurrentAccuracy)
            {
                TimeFormatter   = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy);
                CurrentAccuracy = Settings.SplitTimesAccuracy;
            }
            if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals)
            {
                DeltaTimeFormatter   = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals);
                CurrentDeltaAccuracy = Settings.DeltasAccuracy;
                CurrentDropDecimals  = Settings.DropDecimals;
            }

            if (Split != null)
            {
                if (mode == LayoutMode.Vertical)
                {
                    NameLabel.VerticalAlignment = StringAlignment.Center;
                    NameLabel.Y      = 0;
                    NameLabel.Height = height;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Center;
                        label.Y      = 0;
                        label.Height = height;
                    }
                }
                else
                {
                    NameLabel.VerticalAlignment = StringAlignment.Near;
                    NameLabel.Y      = 0;
                    NameLabel.Height = 50;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Far;
                        label.Y      = height - 50;
                        label.Height = 50;
                    }
                }

                if (IsActive)
                {
                    var currentSplitBrush = new LinearGradientBrush(
                        new PointF(0, 0),
                        Settings.CurrentSplitGradient == GradientType.Horizontal
                        ? new PointF(width, 0)
                        : new PointF(0, height),
                        Settings.CurrentSplitTopColor,
                        Settings.CurrentSplitGradient == GradientType.Plain
                        ? Settings.CurrentSplitTopColor
                        : Settings.CurrentSplitBottomColor);
                    g.FillRectangle(currentSplitBrush, 0, 0, width, height);
                }

                if (DisplayIcon)
                {
                    var icon   = Split.Icon ?? NoIconImage;
                    var shadow = (Split.Icon != null) ? ShadowImage : NoIconShadow;

                    /*if (DateTime.Now.Date.Month == 4 && DateTime.Now.Date.Day == 1)
                     * {
                     *  icon = LiveSplit.Web.Share.TwitchEmoteResolver.Resolve("Kappa", true, false, false);
                     *  shadow = null;
                     * }*/

                    if (OldImage != icon)
                    {
                        ImageAnimator.Animate(icon, (s, o) => { });
                        ImageAnimator.Animate(shadow, (s, o) => { });
                        OldImage = icon;
                    }

                    var drawWidth    = Settings.IconSize;
                    var drawHeight   = Settings.IconSize;
                    var shadowWidth  = Settings.IconSize * (5 / 4f);
                    var shadowHeight = Settings.IconSize * (5 / 4f);
                    if (icon.Width > icon.Height)
                    {
                        var ratio = icon.Height / (float)icon.Width;
                        drawHeight   *= ratio;
                        shadowHeight *= ratio;
                    }
                    else
                    {
                        var ratio = icon.Width / (float)icon.Height;
                        drawWidth   *= ratio;
                        shadowWidth *= ratio;
                    }

                    ImageAnimator.UpdateFrames(shadow);
                    if (Settings.IconShadows && shadow != null)
                    {
                        g.DrawImage(
                            shadow,
                            7 + (Settings.IconSize * (5 / 4f) - shadowWidth) / 2 - 0.7f,
                            (height - Settings.IconSize) / 2.0f + (Settings.IconSize * (5 / 4f) - shadowHeight) / 2 - 0.7f,
                            shadowWidth,
                            shadowHeight);
                    }

                    ImageAnimator.UpdateFrames(icon);

                    g.DrawImage(
                        icon,
                        7 + (Settings.IconSize - drawWidth) / 2,
                        (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2,
                        drawWidth,
                        drawHeight);
                }

                NameLabel.Font      = state.LayoutSettings.TextFont;
                NameLabel.X         = 5 + IconWidth;
                NameLabel.HasShadow = state.LayoutSettings.DropShadows;

                if (ColumnsList.Count() == LabelsList.Count)
                {
                    var curX  = width - 7;
                    var nameX = width - 7;
                    foreach (var label in LabelsList.Reverse())
                    {
                        var column = ColumnsList.ElementAt(LabelsList.IndexOf(label));

                        var labelWidth = 0f;
                        if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime)
                        {
                            labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth);
                        }
                        else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta)
                        {
                            labelWidth = MeasureDeltaLabel.ActualWidth;
                        }
                        else
                        {
                            labelWidth = MeasureTimeLabel.ActualWidth;
                        }
                        label.Width = labelWidth + 20;
                        curX       -= labelWidth + 5;
                        label.X     = curX - 15;

                        label.Font         = state.LayoutSettings.TimesFont;
                        label.HasShadow    = state.LayoutSettings.DropShadows;
                        label.IsMonospaced = true;
                        label.Draw(g);

                        if (!String.IsNullOrEmpty(label.Text))
                        {
                            nameX = curX + labelWidth + 5 - label.ActualWidth;
                        }
                    }
                    NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : nameX) - IconWidth;
                    NameLabel.Draw(g);
                }
            }
            else
            {
                DisplayIcon = Settings.DisplayIcons;
            }
        }
Esempio n. 8
0
        private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            UpdateAll(state);
            g.FillRectangle(new SolidBrush(Settings.BackgroundColor), 0, 0, width, height);

            if (Item != null)
            {
                if (mode == LayoutMode.Vertical)
                {
                    NameLabel.VerticalAlignment = StringAlignment.Center;
                    NameLabel.Y      = 0;
                    NameLabel.Height = height;

                    CountLabel.VerticalAlignment = StringAlignment.Center;
                    CountLabel.Y      = 0;
                    CountLabel.Height = height;

                    GoalLabel.VerticalAlignment = StringAlignment.Far;
                    GoalLabel.Y      = 0;
                    GoalLabel.Height = height;
                }
                else
                {
                    NameLabel.VerticalAlignment = StringAlignment.Near;
                    NameLabel.Y      = 0;
                    NameLabel.Height = 50;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Far;
                        label.Y      = height - 50;
                        label.Height = 50;
                    }
                }

                if (Item.Count >= Item.Goal)
                {
                    g.FillRectangle(new SolidBrush(Settings.GoalColor), 0, 0, width, height);
                }

                var icon = Item.Icon;
                if (DisplayIcon && icon != null)
                {
                    var drawWidth  = Settings.IconSize;
                    var drawHeight = Settings.IconSize;
                    if (icon.Width > icon.Height)
                    {
                        var ratio = icon.Height / (float)icon.Width;
                        drawHeight *= ratio;
                    }
                    else
                    {
                        var ratio = icon.Width / (float)icon.Height;
                        drawWidth *= ratio;
                    }
                    VerticalHeight = 1.2f * drawHeight;

                    g.DrawImage(
                        icon,
                        7 + (Settings.IconSize - drawWidth) / 2,
                        (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2,
                        drawWidth,
                        drawHeight);
                }

                var nameHeight  = g.MeasureString("A", NameFont).Height;
                var countHeight = g.MeasureString("A", CountFont).Height;
                var goalHeight  = Settings.ShowGoal ? g.MeasureString("A", GoalFont).Height : 0;
                var textHeight  = Math.Max(nameHeight, Math.Max(countHeight, goalHeight));
                VerticalHeight = Math.Max(VerticalHeight, 1.2f * textHeight);

                PaddingTop    = Math.Max(0, ((VerticalHeight - 0.75f * VerticalHeight) / 2f) - 5);
                PaddingBottom = PaddingTop;

                float countWidth = g.MeasureString("999", CountFont).Width;
                float goalWidth  = g.MeasureString("999", GoalFont).Width;
                HorizontalWidth = (DisplayIcon ? IconWidth : 0)
                                  + NameLabel.X + NameLabel.ActualWidth
                                  + (countWidth > CountLabel.ActualWidth ? countWidth : CountLabel.ActualWidth)
                                  + (ShowGoal ? (goalWidth > GoalLabel.ActualWidth ? goalWidth : GoalLabel.ActualWidth) : 0)
                                  + 10;

                if (ShowGoal)
                {
                    var goalX = (int)width - 5;
                    goalX                 -= (int)goalWidth;
                    GoalLabel.Width        = goalWidth + 5;
                    GoalLabel.X            = width - goalWidth - 10;
                    GoalLabel.Font         = GoalFont;
                    GoalLabel.ForeColor    = state.LayoutSettings.TextColor;
                    GoalLabel.HasShadow    = state.LayoutSettings.DropShadows;
                    GoalLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
                    GoalLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
                    GoalLabel.Draw(g);

                    var countX = goalX + goalWidth + 5 - GoalLabel.ActualWidth;
                    countX          -= (int)countWidth;
                    CountLabel.Width = countWidth + 5;
                    CountLabel.X     = countX - 10;

                    var nameX = countX + countWidth + 5 - CountLabel.ActualWidth;
                    NameLabel.X     = 5 + IconWidth;
                    NameLabel.Width = nameX - IconWidth;
                }
                else
                {
                    NameLabel.X      = IconWidth + 5;
                    NameLabel.Width  = width - IconWidth - countWidth - 10;
                    CountLabel.X     = width - countWidth - 10;
                    CountLabel.Width = countWidth + 5;
                }

                CountLabel.Font         = CountFont;
                CountLabel.ForeColor    = state.LayoutSettings.TextColor;
                CountLabel.HasShadow    = state.LayoutSettings.DropShadows;
                CountLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
                CountLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
                CountLabel.Draw(g);

                NameLabel.Font         = NameFont;
                NameLabel.ForeColor    = state.LayoutSettings.TextColor;
                NameLabel.HasShadow    = state.LayoutSettings.DropShadows;
                NameLabel.ShadowColor  = state.LayoutSettings.ShadowsColor;
                NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor;
                NameLabel.Draw(g);
            }
            else
            {
                DisplayIcon = Settings.DisplayIcons;
                ShowGoal    = Settings.ShowGoal;
            }
        }