return me;
}
+bool nameinputbox_changed;
+void NameInputBox_Change(entity box, entity me)
+{
+ nameinputbox_changed = true;
+}
+
bool autocvar__menu_profile_apply_button_command_executed;
void XonoticProfileTab_draw(entity me)
{
// when this cvar is set to 1 we are sure the apply button command has really taken effect
// we can't assume that it gets executed in one frame due to how cmd works
- if (autocvar__menu_profile_apply_button_command_executed == -1) // set to -1 on menu init
- {
- cvar_set("_menu_profile_apply_button_command_executed", "0");
- // initialize the input name box text
- string inputName = cvar_string(MENU_CVAR_NAME);
- if (name != inputName)
- {
- cvar_set(MENU_CVAR_NAME, name);
- me.nameInput.loadCvars(me.nameInput);
- }
- }
- else if (autocvar__menu_profile_apply_button_command_executed == 1) // set to 1 by the apply button command
+ if (autocvar__menu_profile_apply_button_command_executed) // set by the apply button command
{
cvar_set("_menu_profile_apply_button_command_executed", "0");
+ nameinputbox_changed = false;
// color buttons
string color = cvar_string("_cl_color");
me.playerModelSelector.go(me.playerModelSelector, 0);
}
}
+ else if (!nameinputbox_changed)
+ {
+ // check if _cl_name has changed in console
+ string inputName = cvar_string(MENU_CVAR_NAME);
+ if (name != inputName)
+ {
+ cvar_set(MENU_CVAR_NAME, name);
+ me.nameInput.loadCvars(me.nameInput);
+ }
+ }
SUPER(XonoticProfileTab).draw(me);
}
me.nameInput.saveImmediately = 0; // Sorry, can't do this, it spams "name" commands.
me.nameInput.enableClearButton = 0;
me.nameInput.applyButton = me.applyButton;
+ me.nameInput.onChange = NameInputBox_Change;
+ me.nameInput.onChangeEntity = me;
label.textEntity = me.nameInput;
me.TR(me);
me.TD(me, 5, 1, e = makeXonoticColorpicker(me.nameInput));