Ejemplo n.º 1
0
 private void uscBattlemap_KillColoursChanged(KillDisplayColours newKillColour)
 {
     if (newKillColour == KillDisplayColours.EnemyColours)
     {
         this.tsbTeamColours.Text = this.m_clocLanguage.GetLocalized("uscMapViewer.tsbTeamColours.TeamColours");
         // Change to Team Colours image
     }
     else if (newKillColour == KillDisplayColours.TeamColours)
     {
         this.tsbTeamColours.Text = this.m_clocLanguage.GetLocalized("uscMapViewer.tsbTeamColours.EnemyColours");
         // Change to Enemy Colours image
     }
 }
Ejemplo n.º 2
0
        public TeamNamesDisplayLegend(KillDisplayColours legendType, Dictionary<int, Color> dicTeamColours, CLocalization language, CMap mapDetails)
        {
            this.TeamNamesText = new MapTextBlock();
            this.LegendType = legendType;

            if (legendType == KillDisplayColours.TeamColours) {

                foreach (CTeamName teamName in mapDetails.TeamNames) {
                    if (teamName.TeamID > 0 && dicTeamColours.ContainsKey(teamName.TeamID)) {
                        this.TeamNamesText.Strings.Add(new MapTextBlockString(language.GetLocalized(teamName.LocalizationKey), ControlPaint.LightLight(dicTeamColours[teamName.TeamID]), true));
                    }
                }
            }
            else {
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Killer", Color.LightSeaGreen, true));
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Victim", ControlPaint.Light(Color.Red), true));
            }
        }
Ejemplo n.º 3
0
        public TeamNamesDisplayLegend(KillDisplayColours legendType, Dictionary <int, Color> dicTeamColours, CLocalization language, CMap mapDetails)
        {
            this.TeamNamesText = new MapTextBlock();
            this.LegendType    = legendType;

            if (legendType == KillDisplayColours.TeamColours)
            {
                foreach (CTeamName teamName in mapDetails.TeamNames)
                {
                    if (teamName.TeamID > 0 && dicTeamColours.ContainsKey(teamName.TeamID))
                    {
                        this.TeamNamesText.Strings.Add(new MapTextBlockString(language.GetLocalized(teamName.LocalizationKey), ControlPaint.LightLight(dicTeamColours[teamName.TeamID]), true));
                    }
                }
            }
            else
            {
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Killer", Color.LightSeaGreen, true));
                this.TeamNamesText.Strings.Add(new MapTextBlockString("Victim", ControlPaint.Light(Color.Red), true));
            }
        }
Ejemplo n.º 4
0
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, Dictionary<Kill, KillDisplayDetails> dicKills, List<BattlemapRoundChange> lstRounds, KillDisplayColours colours, Dictionary<int, Color> teamColours)
        {
            GraphicsPath gpTimelineOutline = new GraphicsPath();

            gpTimelineOutline.AddLines(new Point[] { new Point(5, 0), new Point(0, 5), new Point(0, 15), new Point((int)g.ClipBounds.Width - 280, 15), new Point((int)g.ClipBounds.Width - 280, 5), new Point((int)g.ClipBounds.Width - 275, 0) });
            //gpTimelineOutline.AddLine(new Point(this.m_mtsSeek.SeekerPosition, 15), new Point((int)g.ClipBounds.Width - 280, 15));
            //gpTimelineOutline.AddLines(new Point[] { new Point(235, (int)g.ClipBounds.Height - 55), new Point(230, (int)g.ClipBounds.Height - 50), new Point(230, (int)g.ClipBounds.Height - 40), new Point((int)g.ClipBounds.Width - 50, (int)g.ClipBounds.Height - 40), new Point((int)g.ClipBounds.Width - 50, (int)g.ClipBounds.Height - 50), new Point((int)g.ClipBounds.Width - 45, (int)g.ClipBounds.Height - 55) });
            gpTimelineOutline.Widen(this.m_pOneWidth);

            this.ObjectPath = gpTimelineOutline;
            RectangleF recBounds = gpTimelineOutline.GetBounds();
            recBounds.Height += 50.0F;
            this.HotSpot = recBounds;

            //string strMouseOverKillList = String.Empty;
            float flMouseOffsetX = 0.0F;

            bool blRoundChanged = false;

            MapTextBlock timeList = new MapTextBlock();

            foreach (BattlemapRoundChange RoundChange in new List<BattlemapRoundChange>(lstRounds)) {
                float flOffsetXs = (this.HotSpot.Width - 5.0F) - ((float)((DateTime.Now.Ticks - RoundChange.ChangeTime.Ticks) / TimeSpan.TicksPerSecond) / 3600.0F) * (this.HotSpot.Width - 5.0F);
                RectangleF recChangePosition = new RectangleF(flOffsetXs + this.m_pntDrawOffset.X - 2.0F, this.m_pntDrawOffset.Y, 4.0F, 20.0F);

                if (flOffsetXs >= 0.0F) {
                    GraphicsPath gpChangeTime = new GraphicsPath();
                    gpChangeTime.AddLine(new PointF(flOffsetXs, 5), new PointF(flOffsetXs, 12));
                    gpChangeTime.Widen(this.m_pOneWidth);

                    this.DrawBwShape(g, gpChangeTime, this.TimelineOpacity, 4.0F, Color.Black, Color.RoyalBlue);
                    gpChangeTime.Dispose();

                    if (recChangePosition.Contains(new PointF(pntMouseLocation.X, pntMouseLocation.Y)) == true) {
                        //strMouseOverKillList += String.Format("Round change {0}\r\n", RoundChange.Map.PublicLevelName);

                        timeList.Strings.Add(new MapTextBlockString(String.Format("Round change {0}", RoundChange.Map.PublicLevelName), Color.Pink, true));

                        blRoundChanged = true;
                        flMouseOffsetX = flOffsetXs;
                        //flMouseOffsetX = flOffsetXs;
                    }
                }
            }

            foreach (KeyValuePair<Kill, KillDisplayDetails> kvpKill in new Dictionary<Kill, KillDisplayDetails>(dicKills)) {

                float flOffsetXs = (this.HotSpot.Width - 5.0F) - ((float)((DateTime.Now.Ticks - kvpKill.Key.TimeOfDeath.Ticks) / TimeSpan.TicksPerSecond) / 3600.0F) * (this.HotSpot.Width - 5.0F);
                RectangleF recKillPosition = new RectangleF(flOffsetXs + this.m_pntDrawOffset.X - 2.0F, this.m_pntDrawOffset.Y, 4.0F, 20.0F);

                if (recKillPosition.Contains(new PointF(pntMouseLocation.X + 5.0F, pntMouseLocation.Y)) == true) {
                    GraphicsPath gpKillTime = new GraphicsPath();
                    gpKillTime.AddLine(new PointF(flOffsetXs, 10), new PointF(flOffsetXs, 12));
                    gpKillTime.Widen(this.m_pOneWidth);

                    this.DrawBwShape(g, gpKillTime, this.TimelineOpacity, 4.0F, Color.Black, Color.RoyalBlue);
                    gpKillTime.Dispose();

                    Color killerColour = Color.White;
                    Color victimColour = Color.White;

                    if (colours == KillDisplayColours.EnemyColours) {
                        killerColour = ControlPaint.Light(Color.SeaGreen);
                        victimColour = ControlPaint.LightLight(Color.Black);
                    }
                    else if (colours == KillDisplayColours.TeamColours) {
                        if (teamColours.ContainsKey(kvpKill.Key.Killer.TeamID) == true && teamColours.ContainsKey(kvpKill.Key.Victim.TeamID) == true) {
                            killerColour = ControlPaint.Light(teamColours[kvpKill.Key.Killer.TeamID]);
                            victimColour = ControlPaint.Light(teamColours[kvpKill.Key.Victim.TeamID]);
                        }
                    }

                    if (kvpKill.Key.Killer.ClanTag.Length > 0) {
                        timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.Killer.ClanTag), killerColour, false));
                    }

                    timeList.Strings.Add(new MapTextBlockString(kvpKill.Key.Killer.SoldierName, killerColour, false));

                    timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.DamageType), Color.WhiteSmoke, false));

                    if (kvpKill.Key.Victim.ClanTag.Length > 0) {
                        timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.Victim.ClanTag), victimColour, false));
                    }
                    timeList.Strings.Add(new MapTextBlockString(kvpKill.Key.Victim.SoldierName, victimColour, true));

                    flMouseOffsetX = flOffsetXs;
                }
            }

            if (timeList.Strings.Count > 0) {

                RectangleF recText = timeList.GetBounds();

                PointF timeListOffset = new PointF(pntDrawOffset.X + flMouseOffsetX - recText.Width / 2.0F, pntDrawOffset.Y - recText.Height);

                if (timeListOffset.X + recText.Width > g.ClipBounds.Width) {
                    timeListOffset.X = g.ClipBounds.Width - recText.Width;
                }

                timeList.Draw(g, timeListOffset, pntMouseLocation, mbButtons);
            }

            base.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);

            this.m_mtsSeek.ButtonOpacity = this.TimelineOpacity;
            this.m_mtsSeek.SeekerBounds = recBounds;
            this.m_mtsSeek.Draw(g, new PointF(pntDrawOffset.X, pntDrawOffset.Y + 13.0F), pntMouseLocation, mbButtons);

            timeList.Dispose();
        }
Ejemplo n.º 5
0
        // Move to KillDisplayKillCircles : MapObject once completed.
        private LinearGradientBrush GetKillColour(KillDisplayColours colours, Kill kKill, KillDisplayDetails killDetails) {

            LinearGradientBrush returnBrush = null;

            double angle = Math.Atan2((double)kKill.KillerLocation.X - (double)kKill.VictimLocation.X, (double)kKill.KillerLocation.Y - (double)kKill.VictimLocation.Y);
            double adjext = Math.Cos(angle) * 14.4F;
            double oppext = Math.Sin(angle) * 14.4F;

            PointF pntStart = new PointF((float)kKill.KillerLocation.X + (float)oppext, (float)kKill.KillerLocation.Y + (float)adjext);
            PointF pntEnd = new PointF((float)kKill.VictimLocation.X - (float)oppext, (float)kKill.VictimLocation.Y - (float)adjext);

            if (colours == KillDisplayColours.EnemyColours) {
                returnBrush = new LinearGradientBrush(pntStart, pntEnd, Color.FromArgb((int)(192.0F * killDetails.Opacity), Color.LightSeaGreen), Color.FromArgb((int)(192.0F * killDetails.Opacity), Color.Red));
            }
            else if (colours == KillDisplayColours.TeamColours) {
                if (this.m_dicTeamColours.ContainsKey(kKill.Killer.TeamID) == true && this.m_dicTeamColours.ContainsKey(kKill.Victim.TeamID) == true) {
                    returnBrush = new LinearGradientBrush(pntStart, pntEnd, Color.FromArgb((int)(192.0F * killDetails.Opacity), this.m_dicTeamColours[kKill.Killer.TeamID]), Color.FromArgb((int)(192.0F * killDetails.Opacity), this.m_dicTeamColours[kKill.Victim.TeamID]));
                }
            }

            return returnBrush;
        }
Ejemplo n.º 6
0
        // MapObject is only used in this class as a reference point, nothing in it is really used per se.
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, Kill kMouseOveredKill, KillDisplayDetails kddDisplayDetails, Image imgDamageType, string strLocalizedDamageType, KillDisplayColours colours, Dictionary <int, Color> teamColours)
        {
            //string killerName = kMouseOveredKill.Killer.ClanTag.Length > 0 ? String.Format("[{0}] {1}", kMouseOveredKill.Killer.ClanTag, kMouseOveredKill.Killer.SoldierName) : kMouseOveredKill.Killer.SoldierName;
            //string victimName = kMouseOveredKill.Victim.ClanTag.Length > 0 ? String.Format("[{0}] {1}", kMouseOveredKill.Victim.ClanTag, kMouseOveredKill.Victim.SoldierName) : kMouseOveredKill.Victim.SoldierName;

            GraphicsPath gpBackground = new GraphicsPath();
            RectangleF   recBackground;

            MapTextBlock textBlock = new MapTextBlock();

            Color killerColour = Color.White;
            Color victimColour = Color.White;

            if (colours == KillDisplayColours.EnemyColours)
            {
                killerColour = ControlPaint.LightLight(Color.SeaGreen);
                victimColour = ControlPaint.LightLight(Color.Red);
            }
            else if (colours == KillDisplayColours.TeamColours)
            {
                if (teamColours.ContainsKey(kMouseOveredKill.Killer.TeamID) == true && teamColours.ContainsKey(kMouseOveredKill.Victim.TeamID) == true)
                {
                    killerColour = ControlPaint.LightLight(teamColours[kMouseOveredKill.Killer.TeamID]);
                    victimColour = ControlPaint.LightLight(teamColours[kMouseOveredKill.Victim.TeamID]);
                }
            }

            if (kMouseOveredKill.Killer.ClanTag.Length > 0)
            {
                textBlock.Strings.Add(new MapTextBlockString(String.Format("Killer: [{0}] ", kMouseOveredKill.Killer.ClanTag), Color.WhiteSmoke, false));
            }
            else
            {
                textBlock.Strings.Add(new MapTextBlockString("Killer: ", Color.WhiteSmoke, false));
            }
            textBlock.Strings.Add(new MapTextBlockString(kMouseOveredKill.Killer.SoldierName, killerColour, true));

            if (kMouseOveredKill.Victim.ClanTag.Length > 0)
            {
                textBlock.Strings.Add(new MapTextBlockString(String.Format("Victim: [{0}] ", kMouseOveredKill.Victim.ClanTag), Color.WhiteSmoke, false));
            }
            else
            {
                textBlock.Strings.Add(new MapTextBlockString("Victim: ", Color.WhiteSmoke, false));
            }
            textBlock.Strings.Add(new MapTextBlockString(kMouseOveredKill.Victim.SoldierName, victimColour, true));

            textBlock.Strings.Add(new MapTextBlockString(String.Format("Weapon: {0}", strLocalizedDamageType), Color.WhiteSmoke, true));
            textBlock.Strings.Add(new MapTextBlockString(String.Format("Distance: {0:0.0} m, {1:0.0} yd", kMouseOveredKill.Distance, kMouseOveredKill.Distance * 1.0936133D), Color.WhiteSmoke, true));

            if (kMouseOveredKill.Headshot == true)
            {
                textBlock.Strings.Add(new MapTextBlockString("... HEADSHOT ...", killerColour, true));
            }

            RectangleF recTextSize = textBlock.GetBounds();

            if (imgDamageType != null)
            {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - (imgDamageType.Height + recTextSize.Height)), new SizeF(Math.Max(imgDamageType.Width, recTextSize.Width) + 10.0F, imgDamageType.Height + recTextSize.Height));
                gpBackground.AddRectangle(recBackground);

                // DRAWBLOCK: new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height)

                //gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100 + imgDamageType.Height), 12, 1.0F);
            }
            else
            {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - recTextSize.Height), new SizeF(recTextSize.Width + 10.0F, recTextSize.Height));

                gpBackground.AddRectangle(recBackground);

                // DRAW BLOCK : new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F)

                //gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100), 12, 1.0F);
            }

            // Give it a little bit of a border.

            if (pntDrawOffset.X + recBackground.Width > g.ClipBounds.Width)
            {
                this.m_pntDrawOffset.X = -1 * ((pntDrawOffset.X + recBackground.Width) - g.ClipBounds.Width);
            }

            if (pntDrawOffset.Y - recBackground.Height < 0)
            {
                this.m_pntDrawOffset.Y = -1 * (pntDrawOffset.Y - recBackground.Height);
            }

            this.DrawBwShape(g, gpBackground, 0.8F, 4.0F, Color.Black, Color.White);
            //this.DrawBwShape(g, gpKillPopupText, 1.0F, 4.0F, Color.Black, Color.White);
            textBlock.Draw(g, new PointF(this.m_pntDrawOffset.X + recBackground.X + 5.0F, this.m_pntDrawOffset.Y + recBackground.Y + 10.0F + (imgDamageType != null ? imgDamageType.Height : 0)), pntMouseLocation, mbButtons);
            //textBlock.Draw(g, new PointF(pntDrawOffset.X + 5.0F, pntDrawOffset.Y - recTextSize.Height + 10.0F), pntMouseLocation, mbButtons);

            if (imgDamageType != null)
            {
                g.DrawImage(imgDamageType, new RectangleF((recBackground.X + recBackground.Width / 2) - imgDamageType.Width / 2 + this.m_pntDrawOffset.X, recBackground.Y + this.m_pntDrawOffset.Y + 5.0F, imgDamageType.Width, imgDamageType.Height));
            }

            textBlock.Dispose();
            gpBackground.Dispose();

            /*
             *
             * string strText = String.Format("Killer: {0}\nVictim: {1}\nWeapon: {2}\nDistance: {3:0.0} m, {4:0.0} yd", killerName, victimName, strLocalizedDamageType, kMouseOveredKill.Distance, kMouseOveredKill.Distance * 1.0936133D);
             * SizeF szTextSize = g.MeasureString(strText, new Font("Arial", 10));
             *
             * GraphicsPath gpBackground = new GraphicsPath();
             * GraphicsPath gpKillPopupText = new GraphicsPath();
             * RectangleF recBackground;
             *
             * if (imgDamageType != null) {
             *  recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - (imgDamageType.Height + szTextSize.Height)), new SizeF(Math.Max(imgDamageType.Width, szTextSize.Width), imgDamageType.Height + szTextSize.Height));
             *  gpBackground.AddRectangle(recBackground);
             *
             *  gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height), StringFormat.GenericTypographic);
             *  //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100 + imgDamageType.Height), 12, 1.0F);
             * }
             * else {
             *  recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - szTextSize.Height), new SizeF(szTextSize.Width, szTextSize.Height));
             *
             *  gpBackground.AddRectangle(recBackground);
             *
             *  gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F), StringFormat.GenericTypographic);
             *  //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100), 12, 1.0F);
             * }
             *
             * //gpBackground.Widen(this.m_pOneWidth);
             * //gpKillPopupText.Widen(this.m_pOneWidth);
             *
             * if (pntDrawOffset.X + recBackground.Width > g.ClipBounds.Width) {
             *  this.m_pntDrawOffset.X = -1 * ((pntDrawOffset.X + recBackground.Width) - g.ClipBounds.Width);
             * }
             *
             * if (pntDrawOffset.Y - recBackground.Height < 0) {
             *  this.m_pntDrawOffset.Y = -1 * (pntDrawOffset.Y - recBackground.Height);
             * }
             *
             * this.DrawBwShape(g, gpBackground, 0.8F, 4.0F, Color.Black, Color.White);
             * this.DrawBwShape(g, gpKillPopupText, 1.0F, 4.0F, Color.Black, Color.White);
             *
             * if (imgDamageType != null) {
             *  g.DrawImage(imgDamageType, new PointF((recBackground.X + recBackground.Width / 2) - imgDamageType.Width / 2 + this.m_pntDrawOffset.X, recBackground.Y + this.m_pntDrawOffset.Y));
             * }
             *
             * gpBackground.Dispose();
             * gpKillPopupText.Dispose();
             */
        }
Ejemplo n.º 7
0
 private void uscBattlemap_KillColoursChanged(KillDisplayColours newKillColour)
 {
     if (newKillColour == KillDisplayColours.EnemyColours) {
         this.tsbTeamColours.Text = this.m_clocLanguage.GetLocalized("uscMapViewer.tsbTeamColours.TeamColours");
         // Change to Team Colours image
     }
     else if (newKillColour == KillDisplayColours.TeamColours) {
         this.tsbTeamColours.Text = this.m_clocLanguage.GetLocalized("uscMapViewer.tsbTeamColours.EnemyColours");
         // Change to Enemy Colours image
     }
 }
Ejemplo n.º 8
0
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, Dictionary <Kill, KillDisplayDetails> dicKills, List <BattlemapRoundChange> lstRounds, KillDisplayColours colours, Dictionary <int, Color> teamColours)
        {
            GraphicsPath gpTimelineOutline = new GraphicsPath();

            gpTimelineOutline.AddLines(new Point[] { new Point(5, 0), new Point(0, 5), new Point(0, 15), new Point((int)g.ClipBounds.Width - 280, 15), new Point((int)g.ClipBounds.Width - 280, 5), new Point((int)g.ClipBounds.Width - 275, 0) });
            //gpTimelineOutline.AddLine(new Point(this.m_mtsSeek.SeekerPosition, 15), new Point((int)g.ClipBounds.Width - 280, 15));
            //gpTimelineOutline.AddLines(new Point[] { new Point(235, (int)g.ClipBounds.Height - 55), new Point(230, (int)g.ClipBounds.Height - 50), new Point(230, (int)g.ClipBounds.Height - 40), new Point((int)g.ClipBounds.Width - 50, (int)g.ClipBounds.Height - 40), new Point((int)g.ClipBounds.Width - 50, (int)g.ClipBounds.Height - 50), new Point((int)g.ClipBounds.Width - 45, (int)g.ClipBounds.Height - 55) });
            gpTimelineOutline.Widen(this.m_pOneWidth);

            this.ObjectPath = gpTimelineOutline;
            RectangleF recBounds = gpTimelineOutline.GetBounds();

            recBounds.Height += 50.0F;
            this.HotSpot      = recBounds;

            //string strMouseOverKillList = String.Empty;
            float flMouseOffsetX = 0.0F;

            bool blRoundChanged = false;

            MapTextBlock timeList = new MapTextBlock();

            foreach (BattlemapRoundChange RoundChange in new List <BattlemapRoundChange>(lstRounds))
            {
                float      flOffsetXs        = (this.HotSpot.Width - 5.0F) - ((float)((DateTime.Now.Ticks - RoundChange.ChangeTime.Ticks) / TimeSpan.TicksPerSecond) / 3600.0F) * (this.HotSpot.Width - 5.0F);
                RectangleF recChangePosition = new RectangleF(flOffsetXs + this.m_pntDrawOffset.X - 2.0F, this.m_pntDrawOffset.Y, 4.0F, 20.0F);

                if (flOffsetXs >= 0.0F)
                {
                    GraphicsPath gpChangeTime = new GraphicsPath();
                    gpChangeTime.AddLine(new PointF(flOffsetXs, 5), new PointF(flOffsetXs, 12));
                    gpChangeTime.Widen(this.m_pOneWidth);

                    this.DrawBwShape(g, gpChangeTime, this.TimelineOpacity, 4.0F, Color.Black, Color.RoyalBlue);
                    gpChangeTime.Dispose();

                    if (recChangePosition.Contains(new PointF(pntMouseLocation.X, pntMouseLocation.Y)) == true)
                    {
                        //strMouseOverKillList += String.Format("Round change {0}\r\n", RoundChange.Map.PublicLevelName);

                        timeList.Strings.Add(new MapTextBlockString(String.Format("Round change {0}", RoundChange.Map.PublicLevelName), Color.Pink, true));

                        blRoundChanged = true;
                        flMouseOffsetX = flOffsetXs;
                        //flMouseOffsetX = flOffsetXs;
                    }
                }
            }

            foreach (KeyValuePair <Kill, KillDisplayDetails> kvpKill in new Dictionary <Kill, KillDisplayDetails>(dicKills))
            {
                float      flOffsetXs      = (this.HotSpot.Width - 5.0F) - ((float)((DateTime.Now.Ticks - kvpKill.Key.TimeOfDeath.Ticks) / TimeSpan.TicksPerSecond) / 3600.0F) * (this.HotSpot.Width - 5.0F);
                RectangleF recKillPosition = new RectangleF(flOffsetXs + this.m_pntDrawOffset.X - 2.0F, this.m_pntDrawOffset.Y, 4.0F, 20.0F);

                if (recKillPosition.Contains(new PointF(pntMouseLocation.X + 5.0F, pntMouseLocation.Y)) == true)
                {
                    GraphicsPath gpKillTime = new GraphicsPath();
                    gpKillTime.AddLine(new PointF(flOffsetXs, 10), new PointF(flOffsetXs, 12));
                    gpKillTime.Widen(this.m_pOneWidth);

                    this.DrawBwShape(g, gpKillTime, this.TimelineOpacity, 4.0F, Color.Black, Color.RoyalBlue);
                    gpKillTime.Dispose();

                    Color killerColour = Color.White;
                    Color victimColour = Color.White;

                    if (colours == KillDisplayColours.EnemyColours)
                    {
                        killerColour = ControlPaint.Light(Color.SeaGreen);
                        victimColour = ControlPaint.LightLight(Color.Black);
                    }
                    else if (colours == KillDisplayColours.TeamColours)
                    {
                        if (teamColours.ContainsKey(kvpKill.Key.Killer.TeamID) == true && teamColours.ContainsKey(kvpKill.Key.Victim.TeamID) == true)
                        {
                            killerColour = ControlPaint.Light(teamColours[kvpKill.Key.Killer.TeamID]);
                            victimColour = ControlPaint.Light(teamColours[kvpKill.Key.Victim.TeamID]);
                        }
                    }

                    if (kvpKill.Key.Killer.ClanTag.Length > 0)
                    {
                        timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.Killer.ClanTag), killerColour, false));
                    }

                    timeList.Strings.Add(new MapTextBlockString(kvpKill.Key.Killer.SoldierName, killerColour, false));

                    timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.DamageType), Color.WhiteSmoke, false));

                    if (kvpKill.Key.Victim.ClanTag.Length > 0)
                    {
                        timeList.Strings.Add(new MapTextBlockString(String.Format("[{0}] ", kvpKill.Key.Victim.ClanTag), victimColour, false));
                    }
                    timeList.Strings.Add(new MapTextBlockString(kvpKill.Key.Victim.SoldierName, victimColour, true));

                    flMouseOffsetX = flOffsetXs;
                }
            }

            if (timeList.Strings.Count > 0)
            {
                RectangleF recText = timeList.GetBounds();

                PointF timeListOffset = new PointF(pntDrawOffset.X + flMouseOffsetX - recText.Width / 2.0F, pntDrawOffset.Y - recText.Height);

                if (timeListOffset.X + recText.Width > g.ClipBounds.Width)
                {
                    timeListOffset.X = g.ClipBounds.Width - recText.Width;
                }

                timeList.Draw(g, timeListOffset, pntMouseLocation, mbButtons);
            }

            base.Draw(g, pntDrawOffset, pntMouseLocation, mbButtons);

            this.m_mtsSeek.ButtonOpacity = this.TimelineOpacity;
            this.m_mtsSeek.SeekerBounds  = recBounds;
            this.m_mtsSeek.Draw(g, new PointF(pntDrawOffset.X, pntDrawOffset.Y + 13.0F), pntMouseLocation, mbButtons);

            timeList.Dispose();
        }
Ejemplo n.º 9
0
        // MapObject is only used in this class as a reference point, nothing in it is really used per se.
        public void Draw(Graphics g, PointF pntDrawOffset, Point pntMouseLocation, MouseButtons mbButtons, Kill kMouseOveredKill, KillDisplayDetails kddDisplayDetails, Image imgDamageType, string strLocalizedDamageType, KillDisplayColours colours, Dictionary<int, Color> teamColours)
        {
            //string killerName = kMouseOveredKill.Killer.ClanTag.Length > 0 ? String.Format("[{0}] {1}", kMouseOveredKill.Killer.ClanTag, kMouseOveredKill.Killer.SoldierName) : kMouseOveredKill.Killer.SoldierName;
            //string victimName = kMouseOveredKill.Victim.ClanTag.Length > 0 ? String.Format("[{0}] {1}", kMouseOveredKill.Victim.ClanTag, kMouseOveredKill.Victim.SoldierName) : kMouseOveredKill.Victim.SoldierName;

            GraphicsPath gpBackground = new GraphicsPath();
            RectangleF recBackground;

            MapTextBlock textBlock = new MapTextBlock();

            Color killerColour = Color.White;
            Color victimColour = Color.White;

            if (colours == KillDisplayColours.EnemyColours) {
                killerColour = ControlPaint.LightLight(Color.SeaGreen);
                victimColour = ControlPaint.LightLight(Color.Red);
            }
            else if (colours == KillDisplayColours.TeamColours) {
                if (teamColours.ContainsKey(kMouseOveredKill.Killer.TeamID) == true && teamColours.ContainsKey(kMouseOveredKill.Victim.TeamID) == true) {

                    killerColour = ControlPaint.LightLight(teamColours[kMouseOveredKill.Killer.TeamID]);
                    victimColour = ControlPaint.LightLight(teamColours[kMouseOveredKill.Victim.TeamID]);
                }
            }

            if (kMouseOveredKill.Killer.ClanTag.Length > 0) {
                textBlock.Strings.Add(new MapTextBlockString(String.Format("Killer: [{0}] ", kMouseOveredKill.Killer.ClanTag), Color.WhiteSmoke, false));
            }
            else {
                textBlock.Strings.Add(new MapTextBlockString("Killer: ", Color.WhiteSmoke, false));
            }
            textBlock.Strings.Add(new MapTextBlockString(kMouseOveredKill.Killer.SoldierName, killerColour, true));

            if (kMouseOveredKill.Victim.ClanTag.Length > 0) {
                textBlock.Strings.Add(new MapTextBlockString(String.Format("Victim: [{0}] ", kMouseOveredKill.Victim.ClanTag), Color.WhiteSmoke, false));
            }
            else {
                textBlock.Strings.Add(new MapTextBlockString("Victim: ", Color.WhiteSmoke, false));
            }
            textBlock.Strings.Add(new MapTextBlockString(kMouseOveredKill.Victim.SoldierName, victimColour, true));

            textBlock.Strings.Add(new MapTextBlockString(String.Format("Weapon: {0}", strLocalizedDamageType), Color.WhiteSmoke, true));
            textBlock.Strings.Add(new MapTextBlockString(String.Format("Distance: {0:0.0} m, {1:0.0} yd", kMouseOveredKill.Distance, kMouseOveredKill.Distance * 1.0936133D), Color.WhiteSmoke, true));

            if (kMouseOveredKill.Headshot == true)
            {
                textBlock.Strings.Add(new MapTextBlockString("... HEADSHOT ...", killerColour, true));
            }

            RectangleF recTextSize = textBlock.GetBounds();

            if (imgDamageType != null) {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - (imgDamageType.Height + recTextSize.Height)), new SizeF(Math.Max(imgDamageType.Width, recTextSize.Width) + 10.0F, imgDamageType.Height + recTextSize.Height));
                gpBackground.AddRectangle(recBackground);

                // DRAWBLOCK: new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height)

                //gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100 + imgDamageType.Height), 12, 1.0F);
            }
            else {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - recTextSize.Height), new SizeF(recTextSize.Width + 10.0F, recTextSize.Height));

                gpBackground.AddRectangle(recBackground);

                // DRAW BLOCK : new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F)

                //gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100), 12, 1.0F);
            }

            // Give it a little bit of a border.

            if (pntDrawOffset.X + recBackground.Width > g.ClipBounds.Width) {
                this.m_pntDrawOffset.X = -1 * ((pntDrawOffset.X + recBackground.Width) - g.ClipBounds.Width);
            }

            if (pntDrawOffset.Y - recBackground.Height < 0) {
                this.m_pntDrawOffset.Y = -1 * (pntDrawOffset.Y - recBackground.Height);
            }

            this.DrawBwShape(g, gpBackground, 0.8F, 4.0F, Color.Black, Color.White);
            //this.DrawBwShape(g, gpKillPopupText, 1.0F, 4.0F, Color.Black, Color.White);
            textBlock.Draw(g, new PointF(this.m_pntDrawOffset.X + recBackground.X + 5.0F, this.m_pntDrawOffset.Y + recBackground.Y + 10.0F + (imgDamageType != null ? imgDamageType.Height : 0)), pntMouseLocation, mbButtons);
            //textBlock.Draw(g, new PointF(pntDrawOffset.X + 5.0F, pntDrawOffset.Y - recTextSize.Height + 10.0F), pntMouseLocation, mbButtons);

            if (imgDamageType != null) {

                g.DrawImage(imgDamageType, new RectangleF((recBackground.X + recBackground.Width / 2) - imgDamageType.Width / 2 + this.m_pntDrawOffset.X, recBackground.Y + this.m_pntDrawOffset.Y + 5.0F, imgDamageType.Width, imgDamageType.Height));
            }

            textBlock.Dispose();
            gpBackground.Dispose();

            /*

            string strText = String.Format("Killer: {0}\nVictim: {1}\nWeapon: {2}\nDistance: {3:0.0} m, {4:0.0} yd", killerName, victimName, strLocalizedDamageType, kMouseOveredKill.Distance, kMouseOveredKill.Distance * 1.0936133D);
            SizeF szTextSize = g.MeasureString(strText, new Font("Arial", 10));

            GraphicsPath gpBackground = new GraphicsPath();
            GraphicsPath gpKillPopupText = new GraphicsPath();
            RectangleF recBackground;

            if (imgDamageType != null) {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - (imgDamageType.Height + szTextSize.Height)), new SizeF(Math.Max(imgDamageType.Width, szTextSize.Width), imgDamageType.Height + szTextSize.Height));
                gpBackground.AddRectangle(recBackground);

                gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + imgDamageType.Height), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100 + imgDamageType.Height), 12, 1.0F);
            }
            else {
                recBackground = new RectangleF(new PointF(pntDrawOffset.X, pntDrawOffset.Y - szTextSize.Height), new SizeF(szTextSize.Width, szTextSize.Height));

                gpBackground.AddRectangle(recBackground);

                gpKillPopupText.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(recBackground.X + 10.0F, recBackground.Y + 1.0F), StringFormat.GenericTypographic);
                //this.DrawText(g, strText, new Point(pntMouseLocation.X + 10, pntMouseLocation.Y - 100), 12, 1.0F);
            }

            //gpBackground.Widen(this.m_pOneWidth);
            //gpKillPopupText.Widen(this.m_pOneWidth);

            if (pntDrawOffset.X + recBackground.Width > g.ClipBounds.Width) {
                this.m_pntDrawOffset.X = -1 * ((pntDrawOffset.X + recBackground.Width) - g.ClipBounds.Width);
            }

            if (pntDrawOffset.Y - recBackground.Height < 0) {
                this.m_pntDrawOffset.Y = -1 * (pntDrawOffset.Y - recBackground.Height);
            }

            this.DrawBwShape(g, gpBackground, 0.8F, 4.0F, Color.Black, Color.White);
            this.DrawBwShape(g, gpKillPopupText, 1.0F, 4.0F, Color.Black, Color.White);

            if (imgDamageType != null) {
                g.DrawImage(imgDamageType, new PointF((recBackground.X + recBackground.Width / 2) - imgDamageType.Width / 2 + this.m_pntDrawOffset.X, recBackground.Y + this.m_pntDrawOffset.Y));
            }

            gpBackground.Dispose();
            gpKillPopupText.Dispose();
            */
        }