|
@@ -12,6 +12,9 @@ namespace KairoEngine.UI
|
|
|
public class CreditsController : MonoBehaviour
|
|
|
{
|
|
|
public RectTransform textTransform;
|
|
|
+ public bool rollCreditsOnStart = true;
|
|
|
+ public bool listenForRestartEvent = true;
|
|
|
+ public string restartEventName = "RestartRollingCredits";
|
|
|
[BoxGroup("Rolling Credits")] public KeyCode cancelInput = KeyCode.Escape;
|
|
|
[BoxGroup("Rolling Credits")] public KeyCode fastForwardInput = KeyCode.DownArrow;
|
|
|
[BoxGroup("Rolling Credits")] public KeyCode revereInput = KeyCode.UpArrow;
|
|
@@ -39,10 +42,16 @@ namespace KairoEngine.UI
|
|
|
Timer.ExecuteRealTime(100, () => {
|
|
|
size = textTransform.sizeDelta;
|
|
|
desiredHeigth = (size.y * 2) + 100 + (Screen.currentResolution.height * 2);
|
|
|
- StartRollingCredits();
|
|
|
+ if(listenForRestartEvent) GenericEvents.StartListening(restartEventName, StartRollingCredits);
|
|
|
+ if(rollCreditsOnStart) StartRollingCredits();
|
|
|
} );
|
|
|
}
|
|
|
|
|
|
+ private void OnDisable()
|
|
|
+ {
|
|
|
+ if(listenForRestartEvent) GenericEvents.StopListening(restartEventName, StartRollingCredits);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private void Update()
|
|
|
{
|