Skip to content

Commit

Permalink
fix: loginFrame compatibility update
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluefissure committed Jan 2, 2024
1 parent d046230 commit 1140d4e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
34 changes: 25 additions & 9 deletions src/XIVLauncher.Core/Components/MainPage/LoginFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class LoginFrame : Component

private readonly Input loginInput;
private readonly Combo areaCombo;
// private readonly Input passwordInput;
private bool showPasswordInput = false;
private readonly Input passwordInput;
// private readonly Checkbox oneTimePasswordCheckbox;
// private readonly Checkbox useSteamServiceCheckbox;
private readonly Checkbox fastLoginCheckbox;
Expand Down Expand Up @@ -65,8 +66,8 @@ public LoginFrame(MainPage mainPage)
{
this.mainPage = mainPage;
this.areaCombo = new Combo("大区", SdoAreas.Select(area => area.AreaName).ToArray());
this.loginInput = new Input("盛趣账号", "请输入盛趣账号", new Vector2(12f, 0f), 128);
// this.passwordInput = new Input("Password", "Enter your password", new Vector2(12f, 0f), 128, flags: ImGuiInputTextFlags.Password | ImGuiInputTextFlags.NoUndoRedo);
this.loginInput = new Input("账号", "请输入账号", new Vector2(12f, 0f), 128);
this.passwordInput = new Input("密码", "请输入密码", new Vector2(12f, 0f), 1280, flags: ImGuiInputTextFlags.Password | ImGuiInputTextFlags.NoUndoRedo);

// this.loginInput = new Input("Username", "Enter your Username", new Vector2(12f, 0f), 128);
// this.passwordInput = new Input("Password", "Enter your password", new Vector2(12f, 0f), 128, flags: ImGuiInputTextFlags.Password | ImGuiInputTextFlags.NoUndoRedo);
Expand Down Expand Up @@ -109,14 +110,22 @@ private Vector2 GetSize()
return new Vector2(-1, vp.Y - 128f);
}

private void TogglePasswordInput()
{
this.showPasswordInput = !this.showPasswordInput;
}

public override void Draw()
{
if (ImGui.BeginChild("###loginFrame", this.GetSize()))
{
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(32f, 32f));
this.areaCombo.Draw();
this.loginInput.Draw();
// this.passwordInput.Draw();
if (this.showPasswordInput)
{
this.passwordInput.Draw();
}

// this.oneTimePasswordCheckbox.Draw();
// this.useSteamServiceCheckbox.Draw();
Expand All @@ -136,39 +145,46 @@ public override void Draw()

if (ImGui.BeginPopupContextItem(POPUP_ID_LOGINACTION))
{
if (ImGui.MenuItem("Launch without Dalamud"))
if (ImGui.MenuItem("关闭 Dalamud 启动"))
{
this.OnLogin?.Invoke(LoginAction.GameNoDalamud);
}

ImGui.Separator();

if (ImGui.MenuItem("Launch without custom repo plugins"))
if (ImGui.MenuItem("停用自定义库插件启动"))
{
this.OnLogin?.Invoke(LoginAction.GameNoThirdparty);
}

ImGui.Separator();

if (ImGui.MenuItem("Patch without launching"))
if (ImGui.MenuItem("更新游戏,不启动"))
{
this.OnLogin?.Invoke(LoginAction.GameNoLaunch);
}

ImGui.Separator();

if (ImGui.MenuItem("Repair game files"))
if (ImGui.MenuItem("修复游戏"))
{
this.OnLogin?.Invoke(LoginAction.Repair);
}

ImGui.Separator();

if (ImGui.MenuItem("Force QR"))
if (ImGui.MenuItem("强制扫码"))
{
this.OnLogin?.Invoke(LoginAction.ForceQR);
}

ImGui.Separator();

if (ImGui.MenuItem("显示密码输入框"))
{
this.TogglePasswordInput();
}

if (LauncherApp.IsDebug)
{
ImGui.Separator();
Expand Down
7 changes: 4 additions & 3 deletions src/XIVLauncher.Core/Components/MainPage/NewsFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ public void ReloadNews()
{
this.newsLoaded = false;
await Headlines.GetWorlds(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English);
// await Headlines.GetWorlds(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English);
bannerList = await Headlines.GetBanners(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false);
// bannerList = await Headlines.GetBanners(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false);
await Headlines.GetMessage(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English);
// await Headlines.GetMessage(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English);
headlines = await Headlines.GetNews(this.app.Launcher, this.app.Settings.ClientLanguage ?? ClientLanguage.English).ConfigureAwait(false);
bannerList = headlines.Banner;
this.banners = new TextureWrap[bannerList.Count];
Expand Down

0 comments on commit 1140d4e

Please sign in to comment.