Merge pull request #8 from progtime-net/uiAddon2

fix1
This commit is contained in:
polten0 2023-08-18 17:20:20 +03:00 committed by GitHub
commit b85d0744ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 24 deletions

View file

@ -83,12 +83,7 @@ public abstract class AbstractGui : IDrawableObject
}
if (SelectedElement is TextBox)
{
TextBox box = (TextBox)SelectedElement;
box.hoverState = MonogameLibrary.UI.Enums.HoverState.Hovering;
if (isStartedPrint)
{
box.SelectIt();
}
(SelectedElement as TextBox).hoverState = MonogameLibrary.UI.Enums.HoverState.Hovering;
}
}
}
@ -118,11 +113,6 @@ public abstract class AbstractGui : IDrawableObject
Button button = SelectedElement as Button;
button.CallLeftBtnEvent();
}
else if (SelectedElement is TextBox)
{
TextBox textBox = SelectedElement as TextBox;
isStartedPrint = true;
}
}
else if (isPressed && (gamePadState.Buttons.A == ButtonState.Released &&
gamePadState.DPad.Down == ButtonState.Released &&
@ -136,13 +126,11 @@ public abstract class AbstractGui : IDrawableObject
if (keyboardState.IsKeyDown(Keys.Up) && !isPressed)
{
isPressed = true;
isStartedPrint = false;
ChangeSelectedElement(-1);
}
else if (keyboardState.IsKeyDown(Keys.Down) && !isPressed)
{
isPressed = true;
isStartedPrint = false;
ChangeSelectedElement(1);
}
else if (keyboardState.IsKeyDown(Keys.Enter) && !isPressed)
@ -153,11 +141,6 @@ public abstract class AbstractGui : IDrawableObject
Button button = SelectedElement as Button;
button.CallLeftBtnEvent();
}
else if (SelectedElement is TextBox)
{
TextBox textBox = SelectedElement as TextBox;
isStartedPrint = true;
}
}
else if (isPressed && (keyboardState.IsKeyUp(Keys.Enter) &&
keyboardState.IsKeyUp(Keys.Down) &&

View file

@ -46,7 +46,7 @@ namespace DangerousD.GameCore.GUI
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, (int)(40 * 2.4), (int)(40 * 2.4)),
fontColor = Color.Black,
fontName = "font2",
textureName = "textboxbackground1-1"
text = "<-"
};
backButton.LeftButtonPressed += () => {
AppManager.Instance.ChangeGameState(GameState.Menu);
@ -67,7 +67,6 @@ namespace DangerousD.GameCore.GUI
textureName = "textboxbackground6-1"
};
Elements.Add(loginTextBox);
loginTextBox.LoadTexture(AppManager.Instance.Content);
loginTextBox.TextChanged += input => {
if (loginTextBox.fontColor == Color.Gray)
@ -94,7 +93,6 @@ namespace DangerousD.GameCore.GUI
textAligment = TextAligment.Left,
textureName = "textboxbackground6-1"
};
Elements.Add(passwordTextBox);
passwordTextBox.LoadTexture(AppManager.Instance.Content);
passwordTextBox.TextChanged += input => {
if (passwordTextBox.fontColor == Color.Gray)
@ -122,7 +120,6 @@ namespace DangerousD.GameCore.GUI
fontName = "ButtonFont",
textureName = "textboxbackground2-1"
};
Elements.Add(logButton);
logButton.LeftButtonPressed += () => {
if (CheckUser())
{
@ -140,7 +137,6 @@ namespace DangerousD.GameCore.GUI
fontName = "ButtonFont",
textureName = "textboxbackground2-1"
};
Elements.Add(regButton);
regButton.LeftButtonPressed += GoToRegWebServer;
Elements.Add(regButton);

View file

@ -57,6 +57,7 @@ namespace DangerousD.GameCore.Managers
}
settingsContainer = JsonConvert.DeserializeObject<SettingsContainer>(File.ReadAllText("GameSettings.txt"));
if (settingsContainer == null) { settingsContainer = new SettingsContainer(); }
SetIsFullScreen(settingsContainer.IsFullScreen);
SetMainVolume(settingsContainer.MainVolume);
SetMusicVolume(settingsContainer.MusicVolume);