alt: show authlib injector server name in main screen.
This commit is contained in:
@@ -18,12 +18,12 @@
|
|||||||
package org.jackhuang.hmcl.ui.account;
|
package org.jackhuang.hmcl.ui.account;
|
||||||
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.*;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
import org.jackhuang.hmcl.auth.Account;
|
import org.jackhuang.hmcl.auth.Account;
|
||||||
import org.jackhuang.hmcl.auth.offline.OfflineAccount;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
||||||
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorServer;
|
||||||
import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount;
|
import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount;
|
||||||
import org.jackhuang.hmcl.game.TexturesLoader;
|
import org.jackhuang.hmcl.game.TexturesLoader;
|
||||||
import org.jackhuang.hmcl.setting.Accounts;
|
import org.jackhuang.hmcl.setting.Accounts;
|
||||||
@@ -54,7 +54,7 @@ public class AccountAdvancedListItem extends AdvancedListItem {
|
|||||||
titleProperty().bind(Bindings.createStringBinding(account::getCharacter, account));
|
titleProperty().bind(Bindings.createStringBinding(account::getCharacter, account));
|
||||||
setSubtitle(accountSubtitle(account));
|
setSubtitle(accountSubtitle(account));
|
||||||
imageProperty().bind(TexturesLoader.fxAvatarBinding(account, 32));
|
imageProperty().bind(TexturesLoader.fxAvatarBinding(account, 32));
|
||||||
tooltip.setText(account.getCharacter() + " " + accountSubtitle(account));
|
tooltip.setText(account.getCharacter() + " " + accountTooltip(account));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -83,11 +83,22 @@ public class AccountAdvancedListItem extends AdvancedListItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String accountSubtitle(Account account) {
|
private static String accountSubtitle(Account account) {
|
||||||
if (account instanceof OfflineAccount)
|
String loginTypeName = Accounts.getLocalizedLoginTypeName(Accounts.getAccountFactory(account));
|
||||||
return i18n("account.methods.offline");
|
if (account instanceof AuthlibInjectorAccount) {
|
||||||
else if (account instanceof YggdrasilAccount)
|
return ((AuthlibInjectorAccount) account).getServer().getName();
|
||||||
|
} else {
|
||||||
|
return loginTypeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String accountTooltip(Account account) {
|
||||||
|
if (account instanceof AuthlibInjectorAccount) {
|
||||||
|
AuthlibInjectorServer server = ((AuthlibInjectorAccount) account).getServer();
|
||||||
|
return account.getUsername() + ", " + i18n("account.injector.server") + ": " + server.getName();
|
||||||
|
} else if (account instanceof YggdrasilAccount) {
|
||||||
return account.getUsername();
|
return account.getUsername();
|
||||||
else
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user