Skip to content

Commit

Permalink
chore: reformat CreditsWindow, RegistrationWindow (#2370)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodicolo authored Aug 3, 2024
1 parent 1f1a3c0 commit a159977
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 17 deletions.
25 changes: 18 additions & 7 deletions Intersect.Client/Interface/Menu/CreditsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ public CreditsWindow(Canvas parent, MainMenu mainMenu) : base(parent, "CreditsWi
{
_mainMenu = mainMenu;

_ = new Label(this, "CreditsHeader") { Text = Strings.Credits.Title };
_ = new Label(this, "CreditsHeader")
{
Text = Strings.Credits.Title,
};

var creditsContent = new ScrollControl(this, "CreditsScrollview");
creditsContent.EnableScroll(false, true);

_richLabel = new RichLabel(creditsContent, "CreditsLabel");

var btnBack = new Button(this, "BackButton") { Text = Strings.Credits.Back };
var btnBack = new Button(this, "BackButton")
{
Text = Strings.Credits.Back,
};
btnBack.Clicked += BackBtn_Clicked;

LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer?.GetResolutionString());
Expand Down Expand Up @@ -72,10 +78,15 @@ public override void Show()
else
{
_richLabel.AddText(
text: line.Text,
color: new Color(line.TextColor?.A ?? 255, line.TextColor?.R ?? 255, line.TextColor?.G ?? 255, line.TextColor?.B ?? 255),
alignment: line.GetAlignment(),
font: GameContentManager.Current.GetFont(line.Font, line.Size)
line.Text,
new Color(
line.TextColor?.A ?? 255,
line.TextColor?.R ?? 255,
line.TextColor?.G ?? 255,
line.TextColor?.B ?? 255
),
line.GetAlignment(),
GameContentManager.Current.GetFont(line.Font, line.Size)
);

_richLabel.AddLineBreak();
Expand All @@ -84,4 +95,4 @@ public override void Show()

_ = _richLabel.SizeToChildren(false, true);
}
}
}
44 changes: 34 additions & 10 deletions Intersect.Client/Interface/Menu/RegistrationWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,52 @@ public RegistrationWindow(Canvas parent, MainMenu mainMenu) : base(parent, nameo

//Register Email Label/Textbox
var emailContainer = new ImagePanel(this, "EmailPanel");
_ = new Label(emailContainer, "EmailLabel") { Text = Strings.Registration.Email };
_textBoxEmail = new TextBox(emailContainer, "EmailField") { IsTabable = true };
_ = new Label(emailContainer, "EmailLabel")
{
Text = Strings.Registration.Email,
};
_textBoxEmail = new TextBox(emailContainer, "EmailField")
{
IsTabable = true,
};
_textBoxEmail.SubmitPressed += (s, e) => TryRegister();

//Register Password Label/Textbox
var passwordContainer = new ImagePanel(this, "Password1Panel");
_ = new Label(passwordContainer, "Password1Label") { Text = Strings.Registration.Password };
_textBoxPassword = new TextBoxPassword(passwordContainer, "Password1Field") { IsTabable = true };
_ = new Label(passwordContainer, "Password1Label")
{
Text = Strings.Registration.Password,
};
_textBoxPassword = new TextBoxPassword(passwordContainer, "Password1Field")
{
IsTabable = true,
};
_textBoxPassword.SubmitPressed += (s, e) => TryRegister();

//Register Confirm Password Label/Textbox
var confirmPasswordContainer = new ImagePanel(this, "Password2Panel");
_ = new Label(confirmPasswordContainer, "Password2Label") { Text = Strings.Registration.ConfirmPassword };
_textBoxConfirmPassword = new TextBoxPassword(confirmPasswordContainer, "Password2Field") { IsTabable = true };
_ = new Label(confirmPasswordContainer, "Password2Label")
{
Text = Strings.Registration.ConfirmPassword,
};
_textBoxConfirmPassword = new TextBoxPassword(confirmPasswordContainer, "Password2Field")
{
IsTabable = true,
};
_textBoxConfirmPassword.SubmitPressed += (s, e) => TryRegister();

//Register - Send Registration Button
_buttonRegister = new Button(this, "RegisterButton") { Text = Strings.Registration.Register };
_buttonRegister = new Button(this, "RegisterButton")
{
Text = Strings.Registration.Register,
};
_buttonRegister.Clicked += (s, e) => TryRegister();

//Register - Back Button
var buttonBack = new Button(this, "BackButton") { Text = Strings.Registration.Back };
var buttonBack = new Button(this, "BackButton")
{
Text = Strings.Registration.Back,
};
buttonBack.Clicked += (s, e) =>
{
Hide();
Expand Down Expand Up @@ -99,7 +123,7 @@ public override void Show()
_textBoxUsername.Focus();
}

void TryRegister()
private void TryRegister()
{
if (Globals.WaitingOnServer)
{
Expand Down Expand Up @@ -147,4 +171,4 @@ void TryRegister()
ChatboxMsg.ClearMessages();
Hide();
}
}
}

0 comments on commit a159977

Please sign in to comment.