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(); } ); } }