스토리 자동 추가 코드 생성

This commit is contained in:
김판돌 2024-04-07 13:07:23 +09:00
parent a2b8c61ec0
commit 538ad3f7bd
5 changed files with 52 additions and 2174 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
using UnityEngine;
public class StoryUiCtrl : SingletonMonoBehaviour<StoryUiCtrl>
{
[SerializeField] GameObject itemPrefab;
[SerializeField] Transform itemContent;
protected override void OnStart()
{
foreach(var item in Statics.excelDatas.storyData)
{
StoryPrefab storyPrefab = Instantiate(itemPrefab, itemContent).GetComponent<StoryPrefab>();
storyPrefab.Set(item.Value);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8cb7a87c11db8b94b9bd06911b42fd98
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,14 +7,13 @@ public class StoryPrefab : MonoBehaviour
[SerializeField] TMP_Text storyText;
[SerializeField] Button button;
private void Awake()
{
//임시 작업 Set에서 정보를 처리하게 만들기
Set();
}
public void Set()
private StoryData storyData;
public void Set(StoryData storyData)
{
this.storyData = storyData;
button.onClick.AddListener(GameCtrl.Instance.StartPlay);
storyText.text = storyData.name;
}
public void StoryButton()
{

View File

@ -1,5 +1,3 @@
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;