// Copyright (c) Pixel Crushers. All rights reserved.
using UnityEngine;
namespace PixelCrushers.DialogueSystem
{
///
/// Abstract subtitle controls. Each GUI system implementation derives its own subclass
/// from this.
///
[System.Serializable]
public abstract class AbstractUISubtitleControls : AbstractUIControls
{
protected Subtitle currentSubtitle = null;
///
/// Gets a value indicating whether text has been assigned to the subtitle controls.
///
///
/// true if it has text; otherwise, false.
///
public abstract bool hasText { get; }
/// @cond FOR_V1_COMPATIBILITY
public bool HasText { get { return hasText; } }
/// @endcond
///
/// Sets the subtitle controls' contents.
///
///
/// Subtitle.
///
public abstract void SetSubtitle(Subtitle subtitle);
///
/// Clears the subtitle controls' contents.
///
public abstract void ClearSubtitle();
///
/// Shows the continue button.
///
public virtual void ShowContinueButton() { }
///
/// Hides the continue button.
///
public virtual void HideContinueButton() { }
///
/// Shows the subtitle controls.
///
///
/// Subtitle.
///
public virtual void ShowSubtitle(Subtitle subtitle)
{
if ((subtitle != null) && !string.IsNullOrEmpty(subtitle.formattedText.text))
{
currentSubtitle = subtitle;
SetSubtitle(subtitle);
Show();
}
else
{
currentSubtitle = null;
ClearSubtitle();
Hide();
}
}
///
/// Sets the portrait sprite to use in the subtitle if the named actor is the speaker.
///
/// Actor name in database.
/// Portrait sprite.
public virtual void SetActorPortraitSprite(string actorName, Sprite sprite)
{
}
[System.Obsolete("Use SetActorPortraitSprite instead.")]
public virtual void SetActorPortraitTexture(string actorName, Texture2D texture)
{
}
}
}