using System; using System.Collections.Generic; using UnityEngine; namespace Wizard; public class DeckIntroductionPeriodSelectDialog : MonoBehaviour { public DeckIntroductionTask DeckIntroductionDeta { get; private set; } private Action OnSelectEvent { get; set; } public static DialogBase Create(int defaultSelectId, DeckIntroductionTask task, Action onSelect) { List resultDeckSeriesNameList = task.ResultDeckSeriesNameList; int defaultIndex = 0; for (int i = 0; i < task.ResultDeckSeriesIdList.Count; i++) { if (task.ResultDeckSeriesIdList[i] == defaultSelectId) { defaultIndex = i; } } GameObject obj = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/MyPage/DeckIntroductionPeriodSelectDialog")) as GameObject; DeckIntroductionPeriodSelectDialog componentInChildren = obj.GetComponentInChildren(); componentInChildren.DeckIntroductionDeta = task; componentInChildren.OnSelectEvent = onSelect; return DrumrollDialog.Create(obj.GetComponent(), resultDeckSeriesNameList, defaultIndex, componentInChildren.OnSelect); } private void OnSelect(int index) { OnSelectEvent(DeckIntroductionDeta.ResultDeckSeriesIdList[index]); } }