Exemplo n.º 1
0
        private bool CheckAndOpenPopupStates(List <DialogStateWrapper> dialogStates = null)
        {
            bool opened = false;

            if (dialogStates.Count > 0)
            {
                this.OnActionExecuting = true;
                DialogStateWrapper removeDialogStateWrapper = null;
                for (int i = 0; i < dialogStates.Count; i++)
                {
                    DialogStateWrapper dialogStateWrapper = dialogStates[i];
                    BaseDialogState    dialogState        = dialogStateWrapper.DialogState;
                    if (!dialogState.CanOpen())
                    {
                        continue;
                    }
                    if (!this.OpenDialog(dialogState, dialogStateWrapper.Data))
                    {
                        continue;
                    }
                    if (dialogState.AutoClear())
                    {
                        removeDialogStateWrapper = dialogStateWrapper;
                    }
                    opened = true;
                    break;
                }
                this.OnActionExecuting = false;
                if (removeDialogStateWrapper != null)
                {
                    dialogStates.Remove(removeDialogStateWrapper);
                }
            }
            return(opened);
        }
Exemplo n.º 2
0
        //public static void PopupState(List<RewardData> rewards)
        //{
        //    for (int i = 0; i < rewards.length; i++)
        //    {
        //        var popup:RewardPopupState = new RewardPopupState(Main.Instance.PopupStateManager);
        //        Main.Instance.PopupStateManager.AutoPopup(popup, rewards[i]);
        //    }
        //}

        public void AutoPopup(BaseDialogState dialogState, object data = null)
        {
            if (this.ExistPopup(dialogState))
            {
                return;
            }
            AllPopupStates.Add(new DialogStateWrapper(dialogState, data));
        }
 public override void OnEnter(BaseDialogState previousState, object data)
 {
     previousS = previousState;
     LoadGui();
     if (DialogController != null)
     {
         DialogController.OnDialogStateEnter(this, previousState, data);
     }
 }
Exemplo n.º 4
0
 public override void OnStateEnter(object data = null)
 {
     BaseDialogState.InitRoot();
     LoadGui();
     if (DialogController != null)
     {
         DialogController.OnDialogStateEnter(this, null, data);
     }
 }
 public override void OnExit(BaseDialogState nextState = null, object data = null)
 {
     if (DialogController != null)
     {
         DialogController.OnDialogStateExit();
     }
     DialogController = null;
     if (UnloadGuiOnExit)
     {
         UnloadGuiOnExit = false;
         UnloadGui();
     }
 }
Exemplo n.º 6
0
 public bool ExistPopup(BaseDialogState dialogState)
 {
     for (int i = 0; i < this.AllPopupStates.Count; i++)
     {
         if (this.AllPopupStates[i].DialogState == dialogState)
         {
             return(true);
         }
     }
     if (this.CurrentState == dialogState)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 7
0
 public DialogStateWrapper(BaseDialogState dialogState, object data)
 {
     DialogState = dialogState;
     Data        = data;
 }
 public override void OnPreExit(BaseDialogState nextState = null, object data = null)
 {
     base.OnPreExit(nextState, data);
     //MainUI.Instance.NguiCollider.enabled = false;
     //MainSceneGuiController.Instance.OnDialogExit();
 }