Beispiel #1
0
 public String GetPossibleTimeSave()
 {
     if (this.split.SegmentHasPossibleTimeSave())
     {
         Double possibleTimeSave       = this.split.GetPossibleTimeSave();
         String possibleTimeSaveString = FaceSplitUtils.TimeFormat(possibleTimeSave);
         possibleTimeSaveString = FaceSplitUtils.CutDecimals(possibleTimeSaveString, 2);
         return(possibleTimeSaveString);
     }
     return("-");
 }
Beispiel #2
0
        public String GetSOB()
        {
            Double sob       = this.split.GetSOB();
            String sobString = "-";

            if (sob != 0.0)
            {
                sobString = FaceSplitUtils.TimeFormat(sob);
            }
            sobString = FaceSplitUtils.CutDecimals(sobString, 2);
            return(sobString);
        }
Beispiel #3
0
        public String GetPredictedTime()
        {
            Double predictedTime       = this.split.GetPredictedTime();
            String predictedTimeString = "-";

            if (predictedTime != 0.0)
            {
                predictedTimeString = FaceSplitUtils.TimeFormat(predictedTime);
            }
            predictedTimeString = FaceSplitUtils.CutDecimals(predictedTimeString, 2);
            return(predictedTimeString);
        }
Beispiel #4
0
        /// <summary>
        /// Draw the list of segments.
        /// </summary>
        /// <param name="graphics"></param>
        private void DrawSegments(Graphics graphics)
        {
            string segmentName;
            string segmentSplitTime;
            string runDeltaString = "";
            Bitmap segmentIcon;

            TextFormatFlags nameFlags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter |
                                        TextFormatFlags.WordEllipsis;
            TextFormatFlags splitTimeFlags = TextFormatFlags.Right | TextFormatFlags.VerticalCenter |
                                             TextFormatFlags.WordBreak;
            TextFormatFlags runDeltaFlags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter |
                                            TextFormatFlags.WordBreak;

            Rectangle segmentIconRectangle;
            Rectangle segmentNameRectangle;
            Rectangle segmentSplitTimeRectangle;

            Color rectangleColor = SettingsLayout.Default.SplitsBackgroundColor;

            for (int i = 0; i < segmentsRectangles.Count; ++i)
            {
                rectangleColor                   = (i == split.LiveIndex) ? SettingsLayout.Default.CurrentSegmentColor : SettingsLayout.Default.SplitsBackgroundColor;
                segmentName                      = split.Segments.ElementAt(i).SegmentName;
                segmentSplitTime                 = (split.Segments.ElementAt(i).SplitTime == 0) ? "-" : FaceSplitUtils.TimeFormat(split.Segments.ElementAt(i).SplitTime);
                segmentSplitTime                 = FaceSplitUtils.CutDecimals(segmentSplitTime, 2);
                segmentIcon                      = split.Segments.ElementAt(i).Icon;
                runDeltaString                   = GetRunDeltaString(i);
                runDeltaString                   = FaceSplitUtils.CutDecimals(runDeltaString, 2);
                segmentNameRectangle             = segmentsRectangles.ElementAt(i);
                segmentNameRectangle.Width      /= 2;
                segmentNameRectangle.X           = 17;
                segmentSplitTimeRectangle        = segmentsRectangles.ElementAt(i);
                segmentSplitTimeRectangle.Width /= 2;
                segmentSplitTimeRectangle.X      = segmentNameRectangle.Width;
                segmentIconRectangle             = new Rectangle(0, segmentNameRectangle.Y, 16, 16);
                graphics.FillRectangle(new SolidBrush(rectangleColor), segmentsRectangles.ElementAt(i));
                graphics.DrawImage(segmentIcon, segmentIconRectangle);
                TextRenderer.DrawText(graphics, segmentName, SettingsLayout.Default.SplitNamesFont,
                                      segmentNameRectangle, SettingsLayout.Default.SplitNamesColor, nameFlags);
                TextRenderer.DrawText(graphics, segmentSplitTime, SettingsLayout.Default.SplitTimesFont,
                                      segmentSplitTimeRectangle, SettingsLayout.Default.SplitTimesColor, splitTimeFlags);
                if (!string.IsNullOrEmpty(runDeltaString.Trim()))
                {
                    TextRenderer.DrawText(graphics, runDeltaString, SettingsLayout.Default.SplitDeltasFont,
                                          segmentSplitTimeRectangle, split.GetSegmentColor(i), runDeltaFlags);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Draw the list of segments.
        /// </summary>
        /// <param name="graphics"></param>
        private void DrawSegments(Graphics graphics)
        {
            String segmentName;
            String segmentSplitTime;
            String runDeltaString = "";

            TextFormatFlags nameFlags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter |
                                        TextFormatFlags.WordEllipsis;
            TextFormatFlags splitTimeFlags = TextFormatFlags.Right | TextFormatFlags.VerticalCenter |
                                             TextFormatFlags.WordBreak;
            TextFormatFlags runDeltaFlags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter |
                                            TextFormatFlags.WordBreak;

            Rectangle segmentNameRectangle;
            Rectangle segmentSplitTimeRectangle;
            Color     rectangleColor = Settings.Default.SplitsBackgroundColor;

            for (int i = 0; i < segmentsRectangles.Count; ++i)
            {
                rectangleColor   = (i == this.split.LiveIndex) ? Settings.Default.CurrentSegmentColor : Settings.Default.SplitsBackgroundColor;
                segmentName      = this.split.Segments.ElementAt(i).SegmentName;
                segmentSplitTime = (this.split.Segments.ElementAt(i).SplitTime == 0) ? "-" : FaceSplitUtils.TimeFormat(this.split.Segments.ElementAt(i).SplitTime);
                segmentSplitTime = FaceSplitUtils.CutDecimals(segmentSplitTime, 2);
                runDeltaString   = GetRunDeltaString(i);
                //if (i == this.split.LiveIndex && (runDeltaString.IndexOf("+") == -1 && runDeltaString.IndexOf("-") == -1))
                //{
                //    runDeltaString = "";
                //}
                runDeltaString                   = FaceSplitUtils.CutDecimals(runDeltaString, 2);
                segmentNameRectangle             = segmentsRectangles.ElementAt(i);
                segmentNameRectangle.Width      /= 2;
                segmentSplitTimeRectangle        = segmentsRectangles.ElementAt(i);
                segmentSplitTimeRectangle.Width /= 2;
                segmentSplitTimeRectangle.X      = segmentNameRectangle.Width;
                graphics.FillRectangle(new SolidBrush(rectangleColor), segmentsRectangles.ElementAt(i));
                TextRenderer.DrawText(graphics, segmentName, Settings.Default.SplitNamesFont,
                                      segmentNameRectangle, Settings.Default.SplitNamesColor, nameFlags);
                TextRenderer.DrawText(graphics, segmentSplitTime, Settings.Default.SplitTimesFont,
                                      segmentSplitTimeRectangle, Settings.Default.SplitTimesColor, splitTimeFlags);
                if (!String.IsNullOrEmpty(runDeltaString.Trim()))
                {
                    TextRenderer.DrawText(graphics, runDeltaString, Settings.Default.SplitDeltasFont,
                                          segmentSplitTimeRectangle, this.split.GetSegmentColor(i), runDeltaFlags);
                }
            }
        }
Beispiel #6
0
        private String GetPreviousSegmentDeltaString()
        {
            String  segmentDeltaString;
            double  segmentDelta;
            Boolean lostTime;
            Boolean bestSegment = false;
            double  timeElapsed = (Math.Truncate(this.segmentWatch.Elapsed.TotalSeconds * 100) / 100) + this.timeElapsedSinceSplit;

            if (this.split.LiveIndex > 0)
            {
                bestSegment = this.split.PreviousSegmentIsBestSegment();
            }
            if (this.split.CurrentSegmentHasLiveDelta(timeElapsed))
            {
                this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText = "Live segment: ";
                segmentDelta       = this.split.GetLiveSegmentDelta(timeElapsed);
                segmentDeltaString = FaceSplitUtils.TimeFormat(Math.Abs(segmentDelta));
                lostTime           = (segmentDelta > 0);
                if (lostTime)
                {
                    this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaLostColor;
                    segmentDeltaString     = segmentDeltaString.Insert(0, "+");
                    this.segmentWatchColor = Settings.Default.SegmentTimerLosingTimeColor;
                }
                else
                {
                    this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaSavedColor;
                    segmentDeltaString = segmentDeltaString.Insert(0, "-");
                }
            }
            else if (this.split.PreviousSegmentHasSegmentDelta())
            {
                this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText = "Previous segment: ";
                segmentDelta       = this.split.GetPreviousSegmentDelta();
                segmentDeltaString = FaceSplitUtils.TimeFormat(Math.Abs(segmentDelta));
                lostTime           = (segmentDelta > 0);
                if (bestSegment)
                {
                    this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaBestSegmentColor;
                    segmentDeltaString = segmentDeltaString.Insert(0, "-");
                }
                else
                {
                    if (lostTime)
                    {
                        this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaLostColor;
                        segmentDeltaString = segmentDeltaString.Insert(0, "+");
                    }
                    else
                    {
                        this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaSavedColor;
                        segmentDeltaString = segmentDeltaString.Insert(0, "-");
                    }
                }
                this.split.SetPreviousSegmentColor(bestSegment, lostTime);
            }
            else
            {
                this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].PrimaryText        = "Previous segment: ";
                this.informations[(int)InformationIndexs.PREVIOUS_SEGMENT].SecondaryTextColor = Settings.Default.PreviousSegmentDeltaNoDeltaColor;
                segmentDeltaString = "-";
            }
            segmentDeltaString = FaceSplitUtils.CutDecimals(segmentDeltaString, 2);
            return(segmentDeltaString);
        }