private string GetCountDownTime(int frame) { // Adjusts countdown value depending on if countdown to end of effect or user defined. int countDownNumber; switch (CountDownType) { case CountDownType.CountDown: countDownNumber = (int)Math.Ceiling((Convert.ToInt16(CountDownTime) * 1000 - (double)(frame * FrameTime)) / 1000); if (CountDownFade == CountDownFade.In) { countDownNumber -= 1; } break; case CountDownType.CountUp: countDownNumber = (int)Math.Floor((Convert.ToInt16(CountDownTime) * 1000 + (double)(frame * FrameTime)) / 1000); if (CountDownFade == CountDownFade.In) { countDownNumber += 1; } break; default: countDownNumber = (int)Math.Ceiling(GetRemainingTime(frame) / 1000); break; } if (_previousCountDownNumber != countDownNumber) { _previousCountDownNumber = countDownNumber; _countDownNumberIteration++; if (Direction == CountDownDirection.Random) { _direction = (CountDownDirection)Rand(0, 6); } _sizeAdjust = 0; } if (countDownNumber > 60 && TimeFormat == TimeFormat.Minutes) { return(ConvertMinutesToString(countDownNumber)); } return(countDownNumber.ToString()); }
protected override void SetupRender() { _countDownNumberIteration = -1; _direction = Direction; _sizeAdjust = 0; if (TargetPositioning == TargetPositioningType.Locations) { // Adjust the font size for Location support, default will ensure when swicthing between string and location that the Font will be the same visual size. // Font is further adjusted using the scale text slider. double newFontSize = ((StringCount - ((StringCount - Font.Size) / 100) * 100)) * ((double)BufferHt / StringCount); _font = new Font(Font.FontFamily.Name, (int)newFontSize, Font.Style); _newFontSize = _font.Size; return; } double scaleFactor = ScalingTools.GetScaleFactor(); _font = new Font(Font.FontFamily, Font.Size / (float)scaleFactor, Font.Style); _newFontSize = _font.Size; }