void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
IEnumerator NestTest() { yield return(DialogSingleton.OpenModal(new Dialog.InputData <DialogMessageAndButton>() { SetContentsPrefab = PrefabManager.GetPrefab(PrefabModel.Path.DialogNormal) .GetComponent <DialogMessageAndButton>(), SetContentsInit = dialog => { dialog.Init(new List <MessageSet>() { new MessageSet() { Name = "Test", Message = "ネストで開くことも可能です。キャンセルするまで無限に開きます。", Button = new Dictionary <string, Func <bool> >() { { "Next", () => { dialog.DoNext(); return false; } }, { "Cancel", () => true }, }, }, new MessageSet() { Name = "Test", Message = "", AsyncAction = NestTest(), Action = DialogSingleton.Close } }); } })); }
IEnumerator Execute() { //ステートマシン上で動作するダイアログです。 // yield return(DialogSingleton.OpenModal(new Dialog.InputData <DialogMessageAndButton>() { SetContentsPrefab = PrefabManager.GetPrefab(PrefabModel.Path.DialogNormal).GetComponent <DialogMessageAndButton>(), SetContentsInit = dialog => { dialog.Init(new List <MessageSet>() { new MessageSet() { Name = "Test", Message = "非処理同期に対応したダイアログです。\nダイアログが閉じるまで処理を待ちます。", Button = new Dictionary <string, Func <bool> >() { { "Next", () => { dialog.DoNext(); return false; } } } }, new MessageSet() { Name = "Test", Message = "ボタン数やメッセージ速度など細かく設定できます。", Button = new Dictionary <string, Func <bool> >() { { "Next", () => { dialog.DoNext(); return false; } }, { "Cancel", () => true }, } } , new MessageSet() { Name = "Test", Message = "カスタマイズ次第では画像を載せたり、通信を待ったりできます。", Button = new Dictionary <string, Func <bool> >() { { "Ok", () => { dialog.DoNext(); return false; } }, }, AsyncAction = NestTest() } }); } })); yield return(null); _statemachine.Next(State.End); }