mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 19:51:45 +02:00
Use NotifyAuthUserChanged for GameController login, this will help users become aware when their sessions expire.
This commit is contained in:
@@ -576,7 +576,7 @@ void Client::Tick()
|
|||||||
json::Boolean sessionStatus = objDocument["Session"];
|
json::Boolean sessionStatus = objDocument["Session"];
|
||||||
if(!sessionStatus.Value())
|
if(!sessionStatus.Value())
|
||||||
{
|
{
|
||||||
authUser = User(0, "");
|
SetAuthUser(User(0, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
//MOTD
|
//MOTD
|
||||||
|
@@ -28,18 +28,6 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class GameController::LoginCallback: public ControllerCallback
|
|
||||||
{
|
|
||||||
GameController * cc;
|
|
||||||
public:
|
|
||||||
LoginCallback(GameController * cc_) { cc = cc_; }
|
|
||||||
virtual void ControllerExit()
|
|
||||||
{
|
|
||||||
cc->gameModel->SetUser(cc->loginWindow->GetUser());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class GameController::SearchCallback: public ControllerCallback
|
class GameController::SearchCallback: public ControllerCallback
|
||||||
{
|
{
|
||||||
GameController * cc;
|
GameController * cc;
|
||||||
@@ -1015,7 +1003,7 @@ void GameController::OpenLocalBrowse()
|
|||||||
|
|
||||||
void GameController::OpenLogin()
|
void GameController::OpenLogin()
|
||||||
{
|
{
|
||||||
loginWindow = new LoginController(new LoginCallback(this));
|
loginWindow = new LoginController();
|
||||||
ui::Engine::Ref().ShowWindow(loginWindow->GetView());
|
ui::Engine::Ref().ShowWindow(loginWindow->GetView());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1263,6 +1251,12 @@ std::string GameController::WallName(int type)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameController::NotifyAuthUserChanged(Client * sender)
|
||||||
|
{
|
||||||
|
User newUser = sender->GetAuthUser();
|
||||||
|
gameModel->SetUser(newUser);
|
||||||
|
}
|
||||||
|
|
||||||
void GameController::NotifyUpdateAvailable(Client * sender)
|
void GameController::NotifyUpdateAvailable(Client * sender)
|
||||||
{
|
{
|
||||||
class UpdateConfirmation: public ConfirmDialogueCallback {
|
class UpdateConfirmation: public ConfirmDialogueCallback {
|
||||||
|
@@ -46,7 +46,6 @@ private:
|
|||||||
CommandInterface * commandInterface;
|
CommandInterface * commandInterface;
|
||||||
public:
|
public:
|
||||||
bool HasDone;
|
bool HasDone;
|
||||||
class LoginCallback;
|
|
||||||
class SearchCallback;
|
class SearchCallback;
|
||||||
class RenderCallback;
|
class RenderCallback;
|
||||||
class SSaveCallback;
|
class SSaveCallback;
|
||||||
@@ -142,6 +141,7 @@ public:
|
|||||||
void RemoveNotification(Notification * notification);
|
void RemoveNotification(Notification * notification);
|
||||||
|
|
||||||
virtual void NotifyUpdateAvailable(Client * sender);
|
virtual void NotifyUpdateAvailable(Client * sender);
|
||||||
|
virtual void NotifyAuthUserChanged(Client * sender);
|
||||||
void RunUpdater();
|
void RunUpdater();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -777,7 +777,7 @@ ui::Colour GameModel::GetColourSelectorColour()
|
|||||||
void GameModel::SetUser(User user)
|
void GameModel::SetUser(User user)
|
||||||
{
|
{
|
||||||
currentUser = user;
|
currentUser = user;
|
||||||
Client::Ref().SetAuthUser(user);
|
//Client::Ref().SetAuthUser(user);
|
||||||
notifyUserChanged();
|
notifyUserChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user