Exemplo n.º 1
0
        private void ChangeUserButton_Click(object sender, RoutedEventArgs e)
        {
            AuthentificationWindow authentificationWindow = new AuthentificationWindow();
            Window parentWindow = Window.GetWindow((DependencyObject)sender);

            if (parentWindow != null)
            {
                parentWindow.Close();
            }
            //------------LOADER---------------
            Thread myThread = new Thread(new ThreadStart(ShowLoader));

            myThread.SetApartmentState(ApartmentState.STA);
            myThread.Start();
            Thread.Sleep(1000);
            myThread.Abort();
            authentificationWindow.Show();
            //---------------------------------
        }
Exemplo n.º 2
0
        private void Init_GlobalWindows()
        {
            _authentificationWindow = GetComponentInChildren <AuthentificationWindow>();
            Assert.AreNotEqual(null, _authentificationWindow);

            //
            _multiplayerWindow = GetComponentInChildren <MultiplayerWindow>();
            Assert.AreNotEqual(null, _multiplayerWindow);

            _header = GetComponentInChildren <Header>();
            Assert.AreNotEqual(null, _header);

            _chooseCarWindow = GetComponentInChildren <ChooseCarWindow>();
            Assert.AreNotEqual(null, _chooseCarWindow);

            _chooseTrackWindow = GetComponentInChildren <ChooseTrackWindow>();
            Assert.AreNotEqual(null, _chooseTrackWindow);

            _treeWindow = GetComponentInChildren <TreeWindow>();
            Assert.AreNotEqual(null, _treeWindow);

            _settingsWindow = GetComponentInChildren <SettingsWindow>();
            Assert.AreNotEqual(null, _settingsWindow);

            _statisticPanel = GetComponentInChildren <StatisticPanel>();
            Assert.AreNotEqual(null, _statisticPanel);
            //
            _splashScreen = GetComponentInChildren <SplashScreen>();
            Assert.AreNotEqual(null, _splashScreen);

            _scorePanel = GetComponentInChildren <ScorePanel>();
            Assert.AreNotEqual(null, _scorePanel);

            _eventWindow = GetComponentInChildren <EventWindow>();
            Assert.AreNotEqual(null, _eventWindow);

            _enternetWindow = GetComponentInChildren <EnternetWindow>();
            Assert.AreNotEqual(null, _enternetWindow);
        }
Exemplo n.º 3
0
        public void Enable()
        {
            //Get UI, cache ref
            if (_core == null)
            {
                _core = Core.Instance;
                _nm   = _core.GetService <NetworkManager>();


                _pm                 = _core.GetService <PlayerManager>();
                _uim                = _core.GetService <UIManager>();
                _enternetWindow     = _uim.GetWindow(UIWindowEnum.IS_ENTERNET) as EnternetWindow;
                authificationWindow = (AuthentificationWindow)_uim.GetWindow(UIWindowEnum.AUTHENTIFICATION);
            }


            //_pm.OnUserLoaded += OnUserLoaded;

            authificationWindow.OnLogin      += OnLoginSend;
            authificationWindow.OnRegistered += OnRegisterSend;

            var savedPlayerName = PlayerPrefs.GetString(PPKeys.name);
            var savedPlayerPass = PlayerPrefs.GetString(PPKeys.pass);

            if (string.IsNullOrEmpty(savedPlayerName) || string.IsNullOrEmpty(savedPlayerPass))
            {
                PlayerPrefs.SetString(PPKeys.name, "");         // ???????
                PlayerPrefs.SetString(PPKeys.pass, "");
                authificationWindow.Show();
                Debug.Log("Enable Auth");
            }
            else
            {
                _uim.ShowWindow(UIWindowEnum.SPLASH, true);
                _nm.Authentication(savedPlayerName, savedPlayerPass,
                                   (obj, error) =>
                {
                    //Core.Instance.GetService<SafePlayerPrefs>().DeleteDataForLogOut();

                    if (error != "timeout")
                    {
                        PlayerPrefs.SetString(PPKeys.name, "");        // ???????
                        PlayerPrefs.SetString(PPKeys.pass, "");        // ???????
                        Core.Instance.GetService <StatesManager>().SwitchState(StatesEnum.Auth);
                    }
                    else
                    {
                        _enternetWindow.ShowErrorEnternet(() => { Core.Instance.GetService <StatesManager>().SwitchState(StatesEnum.Auth); }, "Try Again");
                        authificationWindow.Show();
                    }

                    Debug.Log("Enable Auth");

                    _uim.ShowWindow(UIWindowEnum.SPLASH, false);
                },
                                   (obj) =>
                {
                    GoToNextState();
                }

                                   );
            }
        }