add registration via command, password fields
This commit is contained in:
parent
e4034898b9
commit
9077451c08
11 changed files with 232 additions and 15 deletions
27
client/src/client/gui/element/PasswordBox.java
Normal file
27
client/src/client/gui/element/PasswordBox.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package client.gui.element;
|
||||
|
||||
import client.gui.Font;
|
||||
import client.renderer.Drawing;
|
||||
import common.util.Util;
|
||||
|
||||
public class PasswordBox extends Textbox {
|
||||
public PasswordBox(int x, int y, int w, int h, int cap, Callback callback, String text) {
|
||||
super(x, y, w, h, cap, true, callback, text);
|
||||
}
|
||||
|
||||
protected void drawForeground(int x1, int y1, int x2, int y2) {
|
||||
Drawing.txt_draw(x1 + this.text_x, y1 + this.text_y,
|
||||
x1 + this.text_x, y1 + this.text_y,
|
||||
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.text.isEmpty() ? "" : "****");
|
||||
}
|
||||
|
||||
public void drawOverlay() {
|
||||
if(Util.ftime() % 1.0f < 0.5f) {
|
||||
int x1 = this.pos_x + this.margin_x1;
|
||||
int y1 = this.pos_y + this.margin_y1;
|
||||
int x2 = this.size_x - (this.margin_x1 + this.margin_x2);
|
||||
int y2 = this.size_y - (this.margin_y1 + this.margin_y2);
|
||||
Drawing.drawRect(x1, y1 + (y2 - Font.YGLYPH) / 2, 1, Font.YGLYPH, 0xff000000 | (~Util.mixColor(this.gm.style.field_top, this.gm.style.field_btm)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import client.gui.element.ActButton.Mode;
|
|||
import client.gui.element.Element;
|
||||
import client.gui.element.Label;
|
||||
import client.gui.element.NavButton;
|
||||
import client.gui.element.PasswordBox;
|
||||
import client.gui.element.Switch;
|
||||
import client.gui.element.Textbox;
|
||||
import client.gui.element.Textbox.Action;
|
||||
|
@ -56,12 +57,14 @@ public class GuiForm extends Gui implements ActButton.Callback {
|
|||
}
|
||||
else {
|
||||
this.labels[z] = this.add(new Label(0, 50 * z - 20, 300, 20, name, true));
|
||||
this.inputs[z] = this.add(new Textbox(0, 50 * z, 300, 24, Math.min(param & 0xffff, 256), true, new Textbox.Callback() {
|
||||
Textbox.Callback callback = new Textbox.Callback() {
|
||||
public void use(Textbox elem, Action value) {
|
||||
if(value == Action.FOCUS)
|
||||
GuiForm.this.labels[index].setText(name);
|
||||
}
|
||||
}, (String)obj));
|
||||
};
|
||||
this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordBox(0, 50 * z, 300, 24, Math.min(param & 0xffff, 256), callback, (String)obj) :
|
||||
new Textbox(0, 50 * z, 300, 24, Math.min(param & 0xffff, 256), true, callback, (String)obj));
|
||||
}
|
||||
}
|
||||
this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 24, null, "Abbrechen"));
|
||||
|
@ -98,7 +101,7 @@ public class GuiForm extends Gui implements ActButton.Callback {
|
|||
public void use(ActButton elem, Mode action) {
|
||||
for(int z = 0; z < this.inputs.length; z++) {
|
||||
if(this.inputs[z] instanceof Textbox) {
|
||||
int min = this.inputData[z].third >> 16;
|
||||
int min = (this.inputData[z].third & 0x7fffffff) >> 16;
|
||||
String text = this.inputs[z].getText();
|
||||
if(text.length() < min) {
|
||||
if(!GuiForm.this.labels[z].getText().startsWith("" + TextColor.RED))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue