Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    public Dialog AttachDialog(String phrase, Int32 width, Int32 lineCount, Dialog.TailPosition tailPos, Dialog.WindowStyle style, Vector2 pos, Dialog.CaptionType captionType = Dialog.CaptionType.None)
    {
        Dialog dialogFromPool = this.GetDialogFromPool();

        if (dialogFromPool != (UnityEngine.Object)null)
        {
            dialogFromPool.Reset();
            dialogFromPool.Width      = (Single)width;
            dialogFromPool.LineNumber = (Single)lineCount;
            dialogFromPool.Style      = style;
            dialogFromPool.Tail       = tailPos;
            dialogFromPool.Position   = pos;
            dialogFromPool.Id         = DialogManager.UIDialogId;
            dialogFromPool.Caption    = FF9TextTool.GetDialogCaptionText(captionType);
            dialogFromPool.Phrase     = phrase;
            dialogFromPool.Show();
            if (!this.isActivate)
            {
                this.ActivateDialogScene();
            }
        }
        return(dialogFromPool);
    }