스토리 자동 추가 코드 생성
This commit is contained in:
parent
a2b8c61ec0
commit
538ad3f7bd
File diff suppressed because it is too large
Load Diff
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8cb7a87c11db8b94b9bd06911b42fd98
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -7,14 +7,13 @@ public class StoryPrefab : MonoBehaviour
|
||||||
[SerializeField] TMP_Text storyText;
|
[SerializeField] TMP_Text storyText;
|
||||||
[SerializeField] Button button;
|
[SerializeField] Button button;
|
||||||
|
|
||||||
private void Awake()
|
private StoryData storyData;
|
||||||
{
|
|
||||||
//임시 작업 Set에서 정보를 처리하게 만들기
|
public void Set(StoryData storyData)
|
||||||
Set();
|
|
||||||
}
|
|
||||||
public void Set()
|
|
||||||
{
|
{
|
||||||
|
this.storyData = storyData;
|
||||||
button.onClick.AddListener(GameCtrl.Instance.StartPlay);
|
button.onClick.AddListener(GameCtrl.Instance.StartPlay);
|
||||||
|
storyText.text = storyData.name;
|
||||||
}
|
}
|
||||||
public void StoryButton()
|
public void StoryButton()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue