using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PI_StoryData : MonoBehaviour { [SerializeField] List dialogueBG_Data; public TWS_DialogueBG_Data_UI dataUI; public float delayBetweenDialogues = 2; // public void SetStoryData(TWS_Story_Data storyData, List dialogueBG_Data) public void SetStoryData(List 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(); } }