2020-07-26 03:01:41 +00:00
|
|
|
using System;
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
|
|
namespace ConformalDecals.Text {
|
|
|
|
public class TextRenderJob {
|
|
|
|
public DecalText OldText { get; }
|
|
|
|
public DecalText NewText { get; }
|
|
|
|
public bool Needed { get; private set; }
|
|
|
|
public bool IsStarted { get; private set; }
|
|
|
|
public bool IsDone { get; private set; }
|
|
|
|
|
|
|
|
public readonly TextRenderer.TextRenderEvent onRenderFinished = new TextRenderer.TextRenderEvent();
|
2020-07-27 02:32:58 +00:00
|
|
|
|
|
|
|
public TextRenderJob(DecalText oldText, DecalText newText, UnityAction<TextRenderOutput> renderFinishedCallback) {
|
2020-08-07 05:54:51 +00:00
|
|
|
OldText = oldText;
|
2020-07-26 03:01:41 +00:00
|
|
|
NewText = newText ?? throw new ArgumentNullException(nameof(newText));
|
|
|
|
Needed = true;
|
2020-07-27 02:32:58 +00:00
|
|
|
|
2020-07-26 03:01:41 +00:00
|
|
|
if (renderFinishedCallback != null) onRenderFinished.AddListener(renderFinishedCallback);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Cancel() {
|
|
|
|
Needed = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Start() {
|
|
|
|
IsStarted = true;
|
|
|
|
}
|
|
|
|
|
2020-07-27 02:32:58 +00:00
|
|
|
public void Finish(TextRenderOutput output) {
|
2020-07-26 03:01:41 +00:00
|
|
|
IsDone = true;
|
|
|
|
onRenderFinished.Invoke(output);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|