54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.Story.UI
|
|
{
|
|
public class DialogBlockUI : StoryBlockUIBase
|
|
{
|
|
public string blockTitle;
|
|
public TMP_Text titleText;
|
|
|
|
public Button button;
|
|
public List<ChoiceGroupUI> choiceGroups;
|
|
|
|
public void Initialize(string blockName, Vector2 position, Vector2 positionOffset,
|
|
Vector2 size, StoryBlockState state, string blockTitle)
|
|
{
|
|
base.Initialize(blockName, position, positionOffset, size, state);
|
|
|
|
this.blockTitle = blockTitle;
|
|
titleText.text = blockTitle;
|
|
|
|
button.onClick.AddListener(() =>
|
|
{
|
|
state = this.state;
|
|
|
|
if(state == StoryBlockState.Locked) return;
|
|
|
|
StoryManager.instance.storyline.currentBlock = this;
|
|
|
|
if (state == StoryBlockState.Current)
|
|
{
|
|
DialogManager.instance.SetDialog(blockName);
|
|
DialogManager.instance.PlayNextDialogParagraph(DialogManager.instance.currentDialog);
|
|
}
|
|
else if (state == StoryBlockState.Completed)
|
|
{
|
|
DialogManager.instance.SetDialog(blockName);
|
|
DialogManager.instance.PlayNextDialogParagraph(DialogManager.instance.currentDialog, false);
|
|
DialogManager.instance.RevealDialog();
|
|
}
|
|
});
|
|
}
|
|
|
|
public override StoryBlockSave GetBlockSave()
|
|
{
|
|
return new DialogBlockSave(blockName, blockPosition, state);
|
|
}
|
|
}
|
|
}
|