using System;
using UnityEngine;
using UnityEngine.UI;
using Framework.Services;
namespace Framework.Dialogue2 {
/// Dialogue canvas based on UGUI (Unity's new 3D-capable UI system)
public class UGuiDialogueCanvas : ScriptComponent, IDialogueCanvas {
/// Whether this canvas should auto-destruct when it is closed
public bool DestroyWhenClosed = false;
/// UGui canvas holding the dialogue controls
///
/// If this is not set, the game object this component is attached to will be
/// searched for a canvas object.
///
public Canvas Canvas;
/// Triggered when the user confirms speech dialogue or picks a choice
public event Action Selected;
/// Current visibility state of the canvas
public IDialogueCanvasVisibility Visibility {
get { return null; }
}
/// Current placement of the canvas within the scene
public IDialogueCanvasPlacement Placement {
get { return null; }
}
/// Displays text spoken or thought by a character
/// Text that will be displayed
public void ShowSpeech(IDialogueText speech) {
}
/// Lets the player make a choice
/// Choices the player can select from
public void ShowChoices(ArraySegment choices) {
}
///
/// Displays text spoken or thought by a character (or the player) and lets
/// the player make a choice.
///
/// Text that will be displayed
/// Choices the player can select from
public void ShowSpeechAndChoices(IDialogueText speech, ArraySegment choices) {
}
/// Hides the dialogue and choice
public void Hide() {
}
/// Picks a choice as if the user had clicked on a choice button
/// Index of the choice that has been selected
///
/// Use this to make the dialogue canvas act as if the user had made
/// a choice or clicked the speech panel. The main purpose of this method is to
/// support input outside of the UI panel - i.e. keyboard shortcuts or even
/// interactions with the game world.
///
public void Select(int choiceIndex) {
}
/// Called when the script component gets loaded into a game object
protected override void Awake() {
base.Awake();
this.dialogueWidgets = CreateWidgetController();
this.dialogueWidgets.Initialize();
}
///
/// Creates the widget controller the dialogue canvas will use to manage its widgets
///
/// A new widget controller for the dialogue canvas' widgets
///
/// The widgets
///
protected virtual UGuiDialogueWidgets CreateWidgetController() {
if(this.Canvas == null) {
this.Canvas = GetComponentInChildren