mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
code cleanup
This commit is contained in:
parent
a76c14b243
commit
1067055bb5
4 changed files with 10 additions and 15 deletions
|
@ -14,7 +14,7 @@ Improvements
|
||||||
- Improved NinePatch memory performance
|
- Improved NinePatch memory performance
|
||||||
- Moved sound-related classes into Sound namespace
|
- Moved sound-related classes into Sound namespace
|
||||||
- Added customizable overloads for Keybind, Combination and GenericInput ToString methods
|
- Added customizable overloads for Keybind, Combination and GenericInput ToString methods
|
||||||
- Added ColorExtensions.Invert and made ColorHelper.Invert obsolete
|
- Moved ColorHelper.Invert to ColorExtensions.Invert
|
||||||
- Removed LINQ Any and All usage in various methods to improve memory usage
|
- Removed LINQ Any and All usage in various methods to improve memory usage
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
@ -184,12 +183,8 @@ namespace MLEM.Ui.Elements {
|
||||||
this.SetText(text, true);
|
this.SetText(text, true);
|
||||||
|
|
||||||
MlemPlatform.EnsureExists();
|
MlemPlatform.EnsureExists();
|
||||||
this.OnPressed += async e => {
|
|
||||||
var title = this.MobileTitle ?? this.PlaceholderText;
|
this.OnPressed += OnPressed;
|
||||||
var result = await MlemPlatform.Current.OpenOnScreenKeyboard(title, this.MobileDescription, this.Text, false);
|
|
||||||
if (result != null)
|
|
||||||
this.SetText(result.Replace('\n', ' '), true);
|
|
||||||
};
|
|
||||||
this.OnTextInput += (element, key, character) => {
|
this.OnTextInput += (element, key, character) => {
|
||||||
if (!this.IsSelected || this.IsHidden)
|
if (!this.IsSelected || this.IsHidden)
|
||||||
return;
|
return;
|
||||||
|
@ -206,6 +201,13 @@ namespace MLEM.Ui.Elements {
|
||||||
};
|
};
|
||||||
this.OnDeselected += e => this.CaretPos = 0;
|
this.OnDeselected += e => this.CaretPos = 0;
|
||||||
this.OnSelected += e => this.CaretPos = this.text.Length;
|
this.OnSelected += e => this.CaretPos = this.text.Length;
|
||||||
|
|
||||||
|
async void OnPressed(Element e) {
|
||||||
|
var title = this.MobileTitle ?? this.PlaceholderText;
|
||||||
|
var result = await MlemPlatform.Current.OpenOnScreenKeyboard(title, this.MobileDescription, this.Text, false);
|
||||||
|
if (result != null)
|
||||||
|
this.SetText(result.Replace('\n', ' '), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleTextChange(bool textChanged = true) {
|
private void HandleTextChange(bool textChanged = true) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using MLEM.Ui.Style;
|
using MLEM.Ui.Style;
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,6 @@ namespace MLEM.Extensions {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ColorHelper {
|
public static class ColorHelper {
|
||||||
|
|
||||||
/// <inheritdoc cref="ColorExtensions.Invert"/>
|
|
||||||
[Obsolete("This method has been moved to ColorExtensions.Invert in 5.1.0")]
|
|
||||||
public static Color Invert(this Color color) {
|
|
||||||
return ColorExtensions.Invert(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses a hexadecimal number into an rgba color.
|
/// Parses a hexadecimal number into an rgba color.
|
||||||
/// The number should be in the format <c>0xaarrggbb</c>.
|
/// The number should be in the format <c>0xaarrggbb</c>.
|
||||||
|
|
Loading…
Reference in a new issue