mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-30 20:27:02 +00:00
Launching the game now possible. Feature parity with master branch
This commit is contained in:
@@ -145,6 +145,17 @@ QJsonObject MojangAccount::saveToJson() const
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MojangAccount::setLoginType(const QString &loginType)
|
||||||
|
{
|
||||||
|
// TODO: Implement a cleaner validity check
|
||||||
|
if (loginType == "mojang" or loginType == "dummy")
|
||||||
|
{
|
||||||
|
m_loginType = loginType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool MojangAccount::setCurrentProfile(const QString &profileId)
|
bool MojangAccount::setCurrentProfile(const QString &profileId)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_profiles.length(); i++)
|
for (int i = 0; i < m_profiles.length(); i++)
|
||||||
@@ -180,9 +191,12 @@ std::shared_ptr<YggdrasilTask> MojangAccount::login(AuthSessionPtr session, QStr
|
|||||||
// Handling alternative account types
|
// Handling alternative account types
|
||||||
if (m_loginType == "dummy")
|
if (m_loginType == "dummy")
|
||||||
{
|
{
|
||||||
session->status = AuthSession::PlayableOffline;
|
if (session)
|
||||||
session->auth_server_online = false;
|
{
|
||||||
fillSession(session);
|
session->status = AuthSession::PlayableOnline;
|
||||||
|
session->auth_server_online = false;
|
||||||
|
fillSession(session);
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +306,7 @@ void MojangAccount::fillSession(AuthSessionPtr session)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
session->player_name = "Player";
|
session->player_name = m_username;
|
||||||
session->session = "-";
|
session->session = "-";
|
||||||
}
|
}
|
||||||
session->u = user();
|
session->u = user();
|
||||||
|
|||||||
@@ -85,6 +85,12 @@ public: /* construction */
|
|||||||
|
|
||||||
public: /* manipulation */
|
public: /* manipulation */
|
||||||
/**
|
/**
|
||||||
|
* Overrides the login type on the account.
|
||||||
|
* Accepts "mojang" and "dummy". Returns false if other.
|
||||||
|
*/
|
||||||
|
bool setLoginType(const QString &loginType);
|
||||||
|
|
||||||
|
/**
|
||||||
* Sets the currently selected profile to the profile with the given ID string.
|
* Sets the currently selected profile to the profile with the given ID string.
|
||||||
* If profileId is not in the list of available profiles, the function will simply return
|
* If profileId is not in the list of available profiles, the function will simply return
|
||||||
* false.
|
* false.
|
||||||
|
|||||||
@@ -43,13 +43,19 @@ void LoginDialog::accept()
|
|||||||
|
|
||||||
// Setup the login task and start it
|
// Setup the login task and start it
|
||||||
m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
|
m_account = MojangAccount::createFromUsername(ui->userTextBox->text());
|
||||||
|
m_account->setLoginType("dummy"); // TODO: Add the login type selector
|
||||||
m_loginTask = m_account->login(nullptr, ui->passTextBox->text());
|
m_loginTask = m_account->login(nullptr, ui->passTextBox->text());
|
||||||
connect(m_loginTask.get(), &Task::failed, this, &LoginDialog::onTaskFailed);
|
connect(m_loginTask.get(), &Task::failed, this, &LoginDialog::onTaskFailed);
|
||||||
connect(m_loginTask.get(), &Task::succeeded, this,
|
connect(m_loginTask.get(), &Task::succeeded, this,
|
||||||
&LoginDialog::onTaskSucceeded);
|
&LoginDialog::onTaskSucceeded);
|
||||||
connect(m_loginTask.get(), &Task::status, this, &LoginDialog::onTaskStatus);
|
connect(m_loginTask.get(), &Task::status, this, &LoginDialog::onTaskStatus);
|
||||||
connect(m_loginTask.get(), &Task::progress, this, &LoginDialog::onTaskProgress);
|
connect(m_loginTask.get(), &Task::progress, this, &LoginDialog::onTaskProgress);
|
||||||
m_loginTask->start();
|
if (true)
|
||||||
|
{
|
||||||
|
onTaskSucceeded();
|
||||||
|
} else {
|
||||||
|
m_loginTask->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginDialog::setUserInputsEnabled(bool enable)
|
void LoginDialog::setUserInputsEnabled(bool enable)
|
||||||
|
|||||||
Reference in New Issue
Block a user