Simplify HideSkipPromptAt code
This commit is contained in:
parent
b2f316856d
commit
686c978a2f
@ -88,15 +88,11 @@ public class SkipIntroController : ControllerBase
|
|||||||
|
|
||||||
var config = Plugin.Instance!.Configuration;
|
var config = Plugin.Instance!.Configuration;
|
||||||
segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment);
|
segment.ShowSkipPromptAt = Math.Max(0, segment.IntroStart - config.ShowPromptAdjustment);
|
||||||
segment.HideSkipPromptAt = segment.IntroStart + config.HidePromptAdjustment;
|
segment.HideSkipPromptAt = Math.Min(
|
||||||
|
segment.IntroStart + config.HidePromptAdjustment,
|
||||||
|
segment.IntroEnd);
|
||||||
segment.IntroEnd -= config.SecondsOfIntroToPlay;
|
segment.IntroEnd -= config.SecondsOfIntroToPlay;
|
||||||
|
|
||||||
// Don't show prompt after the segment has ended
|
|
||||||
if (segment.HideSkipPromptAt > segment.IntroEnd)
|
|
||||||
{
|
|
||||||
segment.HideSkipPromptAt = segment.IntroEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
return segment;
|
return segment;
|
||||||
}
|
}
|
||||||
catch (KeyNotFoundException)
|
catch (KeyNotFoundException)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user