public Dialog AttachDialog(Int32 dialogId, Dialog.WindowStyle style, Int32 textId, PosObj po, Dialog.DialogIntDelegate listener, Dialog.CaptionType captionType) { Dialog dialogFromPool = this.GetDialogFromPool(); if (dialogFromPool != null) { dialogFromPool.Reset(); dialogFromPool.Id = dialogId; dialogFromPool.Style = style; dialogFromPool.Po = po; dialogFromPool.TextId = textId; dialogFromPool.Caption = FF9TextTool.GetDialogCaptionText(captionType); dialogFromPool.CapType = captionType; if (PersistenSingleton <UIManager> .Instance.UnityScene == UIManager.Scene.Battle) { if (FF9TextTool.IsBattleTextLoaded) { dialogFromPool.Phrase = FF9TextTool.BattleText(textId); } else { dialogFromPool.Phrase = String.Empty; dialogFromPool.Style = Dialog.WindowStyle.WindowStyleTransparent; } } else if (PersistenSingleton <UIManager> .Instance.UnityScene == UIManager.Scene.Field || PersistenSingleton <UIManager> .Instance.UnityScene == UIManager.Scene.World) { dialogFromPool.Phrase = FF9TextTool.FieldText(textId); // Subscribe Action onFieldTextUpdated = () => { dialogFromPool.Phrase = FF9TextTool.FieldText(textId); dialogFromPool.Show(); }; FF9TextTool.FieldTextUpdated += onFieldTextUpdated; // Unsubscribe Dialog.DialogIntDelegate unsubscribe = (c) => FF9TextTool.FieldTextUpdated -= onFieldTextUpdated; listener = (Dialog.DialogIntDelegate)Delegate.Combine(unsubscribe, listener); } dialogFromPool.Show(); dialogFromPool.AfterDialogHidden = listener; if (!this.isActivate) { this.ActivateDialogScene(); } } return(dialogFromPool); }