示例#1
0
 private void Connect(bool asGuest, string login)
 {
     if (string.IsNullOrEmpty(login))
     {
         PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
         {
             message = 98703,
             buttons = new ButtonData[1]
             {
                 new ButtonData(27169)
             },
             selectedButton = 1,
             style          = PopupStyle.Normal
         });
         return;
     }
     LockUI(value: true);
     PlayerPreferences.lastLogin = login;
     if (string.IsNullOrWhiteSpace(PlayerPreferences.lastPassword))
     {
         PlayerPreferences.lastPassword = "******";
     }
     PlayerPreferences.Save();
     ConnectionHandler.instance.Connect();
 }
示例#2
0
 public void RemoveAllStackedMessages()
 {
     for (int num = m_messageStack.Count - 1; num >= 0; num--)
     {
         PopupInfoManager.RemoveById(m_messageStack[num].popupInfoId);
     }
     m_messageStack.Clear();
 }
示例#3
0
 public static void Init(StateContext state)
 {
     if (MatchmakingPopupHandler.instance == null)
     {
         MatchmakingPopupHandler.instance = new MatchmakingPopupHandler(state);
         PopupInfoManager instance = Singleton <PopupInfoManager> .instance;
         instance.onPopupBeginClosing = (Action <int>)Delegate.Combine(instance.onPopupBeginClosing, new Action <int>(MatchmakingPopupHandler.instance.OnPopupClosing));
     }
 }
示例#4
0
 public static void Dispose()
 {
     if (MatchmakingPopupHandler.instance != null)
     {
         PopupInfoManager instance = Singleton <PopupInfoManager> .instance;
         instance.onPopupBeginClosing = (Action <int>)Delegate.Remove(instance.onPopupBeginClosing, new Action <int>(MatchmakingPopupHandler.instance.OnPopupClosing));
         MatchmakingPopupHandler.instance.RemoveAllStackedMessages();
         MatchmakingPopupHandler.instance = null;
     }
 }
示例#5
0
 private void ReleaseReconnection()
 {
     if (m_currentPopupId >= 0)
     {
         PopupInfoManager.RemoveById(m_currentPopupId);
         m_currentPopupId = -1;
     }
     m_reconnecting = false;
     m_count        = 0;
 }
 private void OnGameError()
 {
     PopupInfoManager.Show(this, new PopupInfo
     {
         message = 54306,
         buttons = new ButtonData[1]
         {
             new ButtonData(new TextData(27169))
         },
         selectedButton = 1,
         style          = PopupStyle.Error
     });
 }
示例#7
0
        public void RemoveAllMessageOfType(MessageType type)
        {
            List <Message> messageStack = m_messageStack;

            for (int num = messageStack.Count - 1; num >= 0; num--)
            {
                Message message = messageStack[num];
                if (message.type == type)
                {
                    messageStack.RemoveAt(num);
                    PopupInfoManager.RemoveById(message.popupInfoId);
                }
            }
        }
示例#8
0
        protected override void Enable()
        {
            this.Enable();
            string    formattedText = TextCollectionUtility.InitializationFailureKeys.GetFormattedText(m_cause);
            PopupInfo popupInfo     = default(PopupInfo);

            popupInfo.title   = 77080;
            popupInfo.message = formattedText;
            popupInfo.buttons = new ButtonData[1]
            {
                new ButtonData(27169, Main.Quit)
            };
            popupInfo.selectedButton = 1;
            PopupInfoManager.ShowApplicationError(popupInfo);
        }
示例#9
0
 public void DisplayQuitPopup()
 {
     PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
     {
         message = 76997,
         buttons = new ButtonData[2]
         {
             new ButtonData(9912, LeaveAndGotoMainState, closeOnClick: true, ButtonStyle.Negative),
             new ButtonData(68421, OnRefuseQuit)
         },
         selectedButton = 2,
         style          = PopupStyle.Normal,
         useBlur        = true
     });
 }
示例#10
0
 private void OnQuitClick()
 {
     PopupInfoManager.Show(this, new PopupInfo
     {
         message = 75182,
         buttons = new ButtonData[2]
         {
             new ButtonData(9912, Main.Quit, closeOnClick: true, ButtonStyle.Negative),
             new ButtonData(68421)
         },
         selectedButton = 2,
         style          = PopupStyle.Normal,
         useBlur        = true
     });
 }
示例#11
0
        private void OnCloneRequest(int titleid, int desc)
        {
            PopupInfo  info;
            StateLayer val2 = default(StateLayer);

            if (DeckUtility.GetRemainingSlotsForWeapon(new DeckInfo(m_selectedSlot.DeckInfo).Weapon) > 0)
            {
                StateLayer val = default(StateLayer);
                if (StateManager.TryGetLayer("PlayerUI", ref val))
                {
                    ButtonData[] buttons = new ButtonData[2]
                    {
                        new ButtonData(48064, OnCloneConfirme),
                        new ButtonData(26918, OnCloneCanceld)
                    };
                    PopupInfoManager.ClearAllMessages();
                    StateContext chainEnd = val.GetChainEnd();
                    info = new PopupInfo
                    {
                        title          = titleid,
                        message        = desc,
                        buttons        = buttons,
                        selectedButton = 1,
                        style          = PopupStyle.Normal
                    };
                    PopupInfoManager.Show(chainEnd, info);
                }
            }
            else if (StateManager.TryGetLayer("PlayerUI", ref val2))
            {
                ButtonData[] buttons2 = new ButtonData[1]
                {
                    new ButtonData(27169, OnCloneCanceld)
                };
                PopupInfoManager.ClearAllMessages();
                StateContext chainEnd2 = val2.GetChainEnd();
                info = new PopupInfo
                {
                    title          = 4176,
                    message        = 52887,
                    buttons        = buttons2,
                    selectedButton = 1,
                    style          = PopupStyle.Normal
                };
                PopupInfoManager.Show(chainEnd2, info);
            }
        }
 protected override IEnumerator Update()
 {
     ButtonData[] buttons = new ButtonData[1]
     {
         new ButtonData(75192, Main.Quit)
     };
     PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
     {
         title          = 20267,
         message        = 21217,
         buttons        = buttons,
         selectedButton = 1,
         style          = PopupStyle.Error
     });
     while (true)
     {
         yield return(null);
     }
 }
示例#13
0
 private void CreateReconnectionPopup()
 {
     if (m_currentPopupId < 0)
     {
         RawTextData  message;
         ButtonData[] buttons;
         if (CredentialProvider.gameCredentialProvider.AutoConnectLevel() == AutoConnectLevel.Mandatory)
         {
             message = 34942;
             buttons = new ButtonData[1]
             {
                 new ButtonData(75192, delegate
                 {
                     CredentialProvider.gameCredentialProvider.CleanCredentials();
                     Main.Quit();
                 })
             };
         }
         else
         {
             message = 30166;
             buttons = new ButtonData[1]
             {
                 new ButtonData(59515, delegate
                 {
                     StopReconnection();
                     m_currentPopupId = -1;
                 })
             };
         }
         m_currentPopupId = PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
         {
             title          = 20267,
             message        = message,
             buttons        = buttons,
             selectedButton = 1,
             style          = PopupStyle.Error
         });
     }
 }
示例#14
0
 private void OnQuitClick()
 {
     if (FightStatus.local.isEnded)
     {
         DisplayQuitPopup();
     }
     else
     {
         PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
         {
             message = 99373,
             buttons = new ButtonData[2]
             {
                 new ButtonData(9912, OnAcceptResign, closeOnClick: true, ButtonStyle.Negative),
                 new ButtonData(68421, OnRefuseQuit)
             },
             selectedButton = 2,
             style          = PopupStyle.Normal,
             useBlur        = true
         });
     }
 }
示例#15
0
        public void RemoveInvitationMessageFrom(long playerId)
        {
            List <Message> messageStack = m_messageStack;
            int            num          = messageStack.Count - 1;
            Message        message;

            while (true)
            {
                if (num >= 0)
                {
                    message = messageStack[num];
                    if (message.type == MessageType.InvitationReceived && message.player.Uid == playerId)
                    {
                        break;
                    }
                    num--;
                    continue;
                }
                return;
            }
            messageStack.RemoveAt(num);
            PopupInfoManager.RemoveById(message.popupInfoId);
        }
示例#16
0
 private void OnSave()
 {
     if (m_inAnimation)
     {
         return;
     }
     if (!m_selectedSlot.DeckInfo.IsValid() && m_wasValid)
     {
         ButtonData[] buttons = new ButtonData[2]
         {
             new ButtonData(75192, OnSaveConfirm),
             new ButtonData(38763)
         };
         StateLayer val = default(StateLayer);
         if (StateManager.TryGetLayer("PlayerUI", ref val))
         {
             PopupInfoManager.ClearAllMessages();
             PopupInfoManager.Show(val.GetChainEnd(), new PopupInfo
             {
                 title          = 56031,
                 message        = 57158,
                 buttons        = buttons,
                 selectedButton = 1,
                 style          = PopupStyle.Error
             });
         }
     }
     else if (!DeckUtility.DecksAreEqual(m_previousSlot?.DeckInfo, m_selectedSlot?.DeckInfo))
     {
         OnSaveConfirm();
     }
     else
     {
         OnExit();
     }
 }
示例#17
0
 private IEnumerator CheckServerStatus()
 {
     ServerStatus.StatusCode code = ApplicationConfig.serverStatus.code;
     if (ApplicationConfig.serverStatus.code == ServerStatus.StatusCode.Error)
     {
         yield return(GoToInitializationFailedState(InitializationFailure.ServerStatusError));
     }
     else if (ApplicationConfig.serverStatus.code == ServerStatus.StatusCode.Maintenance)
     {
         yield return(GoToInitializationFailedState(InitializationFailure.ServerStatusMaintenance));
     }
     else if (ApplicationConfig.serverStatus.code == ServerStatus.StatusCode.MaintenanceExpected)
     {
         m_serverStatusChecked = false;
         string text  = ApplicationConfig.serverStatus.maintenanceStartTimeUtc.ToLocalTime().ToShortTimeString();
         string text2 = ApplicationConfig.serverStatus.maintenanceEstimatedEndTimeUtc.ToLocalTime().ToShortTimeString();
         PopupInfoManager.Show(StateManager.GetDefaultLayer().GetChainEnd(), new PopupInfo
         {
             title   = 75142,
             message = new RawTextData(85153, text, text2),
             buttons = new ButtonData[1]
             {
                 new ButtonData(27169, delegate
                 {
                     m_serverStatusChecked = true;
                 })
             },
             selectedButton = 1,
             style          = PopupStyle.Warning
         });
     }
     else
     {
         m_serverStatusChecked = true;
     }
 }
示例#18
0
 private void OnRemoveRequest()
 {
     if (!m_selectedSlot.Preconstructed)
     {
         ButtonData[] buttons = new ButtonData[2]
         {
             new ButtonData(9912, OnRemoveConfirm),
             new ButtonData(68421)
         };
         StateLayer val = default(StateLayer);
         if (StateManager.TryGetLayer("PlayerUI", ref val))
         {
             PopupInfoManager.ClearAllMessages();
             PopupInfoManager.Show(val.GetChainEnd(), new PopupInfo
             {
                 title          = 52822,
                 message        = 76361,
                 buttons        = buttons,
                 selectedButton = 1,
                 style          = PopupStyle.Error
             });
         }
     }
 }
示例#19
0
        public void ShowMessage(MessageType type, FightPlayerInfo player, Action noAction = null, Action yesAction = null)
        {
            string    text = (player != null) ? player.Info.Nickname : "Player";
            PopupInfo info;
            int       popupInfoId;

            switch (type)
            {
            case MessageType.InvitationReceived:
            {
                StateContext stateContext5 = m_stateContext;
                info = new PopupInfo
                {
                    message = new RawTextData(22824, text),
                    buttons = new ButtonData[2]
                    {
                        new ButtonData(9912, yesAction),
                        new ButtonData(68421, noAction, closeOnClick: true, ButtonStyle.Negative)
                    },
                    selectedButton = 1,
                    style          = PopupStyle.Normal,
                    useBlur        = true
                };
                popupInfoId = PopupInfoManager.Show(stateContext5, info);
                break;
            }

            case MessageType.InvitationDeclined:
            {
                StateContext stateContext4 = m_stateContext;
                info = new PopupInfo
                {
                    message = new RawTextData(32703, text),
                    buttons = new ButtonData[1]
                    {
                        new ButtonData(27169)
                    },
                    selectedButton = 1,
                    style          = PopupStyle.Normal,
                    useBlur        = true
                };
                popupInfoId = PopupInfoManager.Show(stateContext4, info);
                break;
            }

            case MessageType.InvitationFail:
            {
                StateContext stateContext3 = m_stateContext;
                info = new PopupInfo
                {
                    message = new RawTextData(18236, text),
                    buttons = new ButtonData[1]
                    {
                        new ButtonData(27169)
                    },
                    style   = PopupStyle.Error,
                    useBlur = true
                };
                popupInfoId = PopupInfoManager.Show(stateContext3, info);
                break;
            }

            case MessageType.PlayerLeaveGroup:
            {
                StateContext stateContext2 = m_stateContext;
                info = new PopupInfo
                {
                    message = new RawTextData(34361, text),
                    buttons = new ButtonData[1]
                    {
                        new ButtonData(27169)
                    },
                    style   = PopupStyle.Normal,
                    useBlur = true
                };
                popupInfoId = PopupInfoManager.Show(stateContext2, info);
                break;
            }

            case MessageType.JoinGroupFail:
            {
                StateContext stateContext = m_stateContext;
                info = new PopupInfo
                {
                    message = new RawTextData(80127),
                    buttons = new ButtonData[1]
                    {
                        new ButtonData(27169)
                    },
                    style   = PopupStyle.Normal,
                    useBlur = true
                };
                popupInfoId = PopupInfoManager.Show(stateContext, info);
                break;
            }

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
            m_messageStack.Add(new Message(type, player, popupInfoId));
        }
示例#20
0
        private void CreateDisconnectedPopup(string cause, DisconnectionStrategy errorStrategy)
        {
            bool             flag             = false;
            AutoConnectLevel autoConnectLevel = CredentialProvider.gameCredentialProvider.AutoConnectLevel();
            Action           onClick;

            switch (errorStrategy)
            {
            case DisconnectionStrategy.ReturnToLogin:
                if (autoConnectLevel == AutoConnectLevel.Mandatory)
                {
                    onClick = delegate
                    {
                        CredentialProvider.gameCredentialProvider.CleanCredentials();
                        Main.Quit();
                    };
                    flag = true;
                }
                else
                {
                    onClick = delegate
                    {
                        PlayerPreferences.autoLogin = false;
                        StatesUtility.GotoLoginState();
                    };
                }
                break;

            case DisconnectionStrategy.ReturnToLoginAndChangeAccount:
                if (autoConnectLevel == AutoConnectLevel.Mandatory)
                {
                    onClick = delegate
                    {
                        CredentialProvider.gameCredentialProvider.CleanCredentials();
                        Main.Quit();
                    };
                    flag = true;
                }
                else
                {
                    onClick = delegate
                    {
                        CredentialProvider.gameCredentialProvider.CleanCredentials();
                        StatesUtility.GotoLoginState();
                    };
                }
                break;

            case DisconnectionStrategy.QuitApplication:
                onClick = Main.Quit;
                flag    = true;
                break;

            default:
                throw new ArgumentOutOfRangeException("errorStrategy", errorStrategy, null);
            }
            ButtonData[] buttons = (!flag) ? new ButtonData[2]
            {
                new ButtonData(27169, onClick),
                new ButtonData(75192, Main.Quit)
            } : new ButtonData[1]
            {
                new ButtonData(75192, onClick)
            };
            PopupInfoManager.ClearAllMessages();
            PopupInfo popupInfo = default(PopupInfo);

            popupInfo.title          = 20267;
            popupInfo.message        = cause;
            popupInfo.buttons        = buttons;
            popupInfo.selectedButton = 1;
            PopupInfoManager.ShowApplicationError(popupInfo);
        }