You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB
C#

3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PI_StoryData : MonoBehaviour
{
[SerializeField] List<TWS_DialogueBG_Data> dialogueBG_Data;
public TWS_DialogueBG_Data_UI dataUI;
public float delayBetweenDialogues = 2;
// public void SetStoryData(TWS_Story_Data storyData, List<TWS_DialogueBG_Data> dialogueBG_Data)
public void SetStoryData(List<TWS_DialogueBG_Data> dialogueBG_Data)
{
// storyMetaData = storyData;
this.dialogueBG_Data = dialogueBG_Data;
}
public void LaunchStory()
{
StartCoroutine(RunDialogues());
}
IEnumerator RunDialogues()
{
for(int i=0; i < dialogueBG_Data.Count; i++)
{
dataUI.dialogue_text.text = dialogueBG_Data[i].dialogueData.splashMessage;
if (dialogueBG_Data[i].dialogueBG)
{
dataUI.dialogueBG.sprite = dialogueBG_Data[i].dialogueBG;
//dataUI.dialogueBG.SetNativeSize();
}
yield return new WaitForSeconds(delayBetweenDialogues);
}
TWS_Delegates.TriggerAllGameDataLoaded();
}
}