2017-10-20 02:00:49 +00:00
|
|
|
Class UIP_Settings extends KFGUI_MultiComponent;
|
|
|
|
|
|
|
|
var KFGUI_ComponentList SettingsBox;
|
|
|
|
var KFGUI_Button KeyBindButton;
|
|
|
|
var KFGUI_TextLable KeyBindLabel;
|
|
|
|
var name CurKeybind;
|
|
|
|
var bool bSetKeybind,bDelayedSet;
|
|
|
|
|
2020-09-01 03:52:58 +00:00
|
|
|
var localized string FirstPersonLegsText;
|
|
|
|
var localized string FirstPersonLegsToolTip;
|
|
|
|
var localized string HideNameBeaconsText;
|
|
|
|
var localized string HideNameBeaconsToolTip;
|
|
|
|
var localized string HideKillMessagesText;
|
|
|
|
var localized string HideKillMessagesToolTip;
|
|
|
|
var localized string HideDamageMessagesText;
|
|
|
|
var localized string HideDamageMessagesToolTip;
|
|
|
|
var localized string HideDamagePopupText;
|
|
|
|
var localized string HideDamagePopupToolTip;
|
|
|
|
var localized string UseKf2DeathMessagesText;
|
|
|
|
var localized string UseKf2DeathMessagesToolTip;
|
|
|
|
var localized string UseKf2KillMessagesText;
|
|
|
|
var localized string UseKf2KillMessagesToolTip;
|
|
|
|
var localized string DontBecomeZombieText;
|
|
|
|
var localized string DontBecomeZombieToolTip;
|
|
|
|
var localized string NoScreenShakeText;
|
|
|
|
var localized string NoScreenShakeToolTip;
|
|
|
|
var localized string ButtonToggleBehindviewKeybindText;
|
|
|
|
var localized string ButtonToggleBehindviewKeybindToolTip;
|
|
|
|
var localized string ButtonPressButtonText;
|
|
|
|
var localized string NotSetText;
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
Super.InitMenu();
|
|
|
|
|
|
|
|
// Client settings
|
|
|
|
SettingsBox = KFGUI_ComponentList(FindComponentID('SettingsBox'));
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
//AddCheckBox("Text-To-Speech:","Enable Text-to-Speech talk for player chat messages",'TTS', bool bDefault);
|
2020-09-01 03:52:58 +00:00
|
|
|
AddCheckBox(FirstPersonLegsText,FirstPersonLegsToolTip,'FP',class'ExtPlayerController'.Default.bShowFPLegs);
|
2020-11-28 20:12:58 +00:00
|
|
|
if (class'ExtPlayerController'.Default.bShowFPLegs)
|
2017-10-20 02:00:49 +00:00
|
|
|
ExtPlayerController(GetPlayer()).ToggleFPBody(false);
|
2020-09-01 03:52:58 +00:00
|
|
|
AddCheckBox(HideNameBeaconsText,HideNameBeaconsToolTip,'NB',class'ExtPlayerController'.Default.bHideNameBeacons);
|
|
|
|
AddCheckBox(HideKillMessagesText,HideKillMessagesToolTip,'KM',class'ExtPlayerController'.Default.bHideKillMsg);
|
|
|
|
AddCheckBox(HideDamageMessagesText,HideDamageMessagesToolTip,'DM',class'ExtPlayerController'.Default.bHideDamageMsg);
|
|
|
|
AddCheckBox(HideDamagePopupText,HideDamagePopupToolTip,'PP',class'ExtPlayerController'.Default.bHideNumberMsg);
|
|
|
|
AddCheckBox(UseKf2DeathMessagesText,UseKf2DeathMessagesToolTip,'K2DM',class'ExtPlayerController'.Default.bUseKF2DeathMessages);
|
|
|
|
AddCheckBox(UseKf2KillMessagesText,UseKf2KillMessagesToolTip,'K2KM',class'ExtPlayerController'.Default.bUseKF2KillMessages);
|
|
|
|
KeyBindButton = AddButton("",ButtonToggleBehindviewKeybindText,ButtonToggleBehindviewKeybindToolTip,'KB',KeyBindLabel);
|
|
|
|
AddCheckBox(DontBecomeZombieText,DontBecomeZombieToolTip,'ZP',class'ExtPlayerController'.Default.bNoMonsterPlayer);
|
|
|
|
AddCheckBox(NoScreenShakeText,NoScreenShakeToolTip,'NS',class'ExtPlayerController'.Default.bNoScreenShake);
|
2017-10-20 02:00:49 +00:00
|
|
|
InitBehindviewKey();
|
|
|
|
}
|
2020-09-01 03:52:58 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
final function InitBehindviewKey()
|
|
|
|
{
|
|
|
|
local PlayerInput IN;
|
|
|
|
local int i;
|
|
|
|
|
|
|
|
CurKeybind = '';
|
|
|
|
|
|
|
|
// Check what keys now using!
|
|
|
|
IN = Owner.BackupInput;
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<IN.Bindings.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (IN.Bindings[i].Command~="Camera FirstPerson")
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
CurKeybind = IN.Bindings[i].Name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-09-01 03:52:58 +00:00
|
|
|
KeyBindButton.ButtonText = (CurKeybind!='' ? string(CurKeybind) : NotSetText);
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function KFGUI_CheckBox AddCheckBox(string Cap, string TT, name IDN, bool bDefault)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local KFGUI_CheckBox CB;
|
|
|
|
|
|
|
|
CB = KFGUI_CheckBox(SettingsBox.AddListComponent(class'KFGUI_CheckBox'));
|
|
|
|
CB.LableString = Cap;
|
|
|
|
CB.ToolTip = TT;
|
|
|
|
CB.bChecked = bDefault;
|
|
|
|
CB.InitMenu();
|
|
|
|
CB.ID = IDN;
|
|
|
|
CB.OnCheckChange = CheckChange;
|
|
|
|
return CB;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function KFGUI_Button AddButton(string ButtonText, string Cap, string TT, name IDN, out KFGUI_TextLable Label)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local KFGUI_Button CB;
|
|
|
|
local KFGUI_MultiComponent MC;
|
|
|
|
|
|
|
|
MC = KFGUI_MultiComponent(SettingsBox.AddListComponent(class'KFGUI_MultiComponent'));
|
|
|
|
MC.InitMenu();
|
|
|
|
Label = new(MC) class'KFGUI_TextLable';
|
|
|
|
Label.SetText(Cap);
|
|
|
|
Label.XSize = 0.75;
|
|
|
|
Label.FontScale = 0;
|
|
|
|
Label.AlignY = 1;
|
|
|
|
MC.AddComponent(Label);
|
|
|
|
CB = new(MC) class'KFGUI_Button';
|
|
|
|
CB.XPosition = 0.77;
|
|
|
|
CB.XSize = 0.22;
|
|
|
|
CB.ButtonText = ButtonText;
|
|
|
|
CB.ToolTip = TT;
|
|
|
|
CB.ID = IDN;
|
|
|
|
CB.OnClickLeft = ButtonClicked;
|
|
|
|
CB.OnClickRight = ButtonClicked;
|
|
|
|
MC.AddComponent(CB);
|
|
|
|
return CB;
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function CheckChange(KFGUI_CheckBox Sender)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local ExtPlayerController PC;
|
|
|
|
|
|
|
|
PC = ExtPlayerController(GetPlayer());
|
2020-11-28 20:12:58 +00:00
|
|
|
switch (Sender.ID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 'FP':
|
|
|
|
PC.ToggleFPBody(Sender.bChecked);
|
|
|
|
break;
|
|
|
|
case 'NB':
|
|
|
|
PC.bHideNameBeacons = Sender.bChecked;
|
|
|
|
break;
|
|
|
|
case 'KM':
|
|
|
|
PC.bHideKillMsg = Sender.bChecked;
|
|
|
|
PC.SendServerSettings();
|
|
|
|
break;
|
|
|
|
case 'DM':
|
|
|
|
PC.bHideDamageMsg = Sender.bChecked;
|
|
|
|
PC.SendServerSettings();
|
|
|
|
break;
|
|
|
|
case 'PP':
|
|
|
|
PC.bHideNumberMsg = Sender.bChecked;
|
|
|
|
PC.SendServerSettings();
|
|
|
|
break;
|
|
|
|
case 'ZP':
|
|
|
|
PC.bNoMonsterPlayer = Sender.bChecked;
|
|
|
|
PC.SendServerSettings();
|
|
|
|
break;
|
|
|
|
case 'NS':
|
|
|
|
PC.bNoScreenShake = Sender.bChecked;
|
|
|
|
break;
|
|
|
|
case 'K2DM':
|
|
|
|
PC.bUseKF2DeathMessages = Sender.bChecked;
|
|
|
|
break;
|
|
|
|
case 'K2KM':
|
|
|
|
PC.bUseKF2KillMessages = Sender.bChecked;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
PC.SaveConfig();
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function ButtonClicked(KFGUI_Button Sender)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
switch (Sender.ID)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
case 'KB':
|
2020-09-01 03:52:58 +00:00
|
|
|
KeyBindButton.ButtonText = ButtonPressButtonText;
|
2017-10-20 02:00:49 +00:00
|
|
|
KeyBindButton.SetDisabled(true);
|
|
|
|
GrabKeyFocus();
|
|
|
|
bSetKeybind = true;
|
|
|
|
bDelayedSet = false;
|
|
|
|
SetTimer(0.4,false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function Timer()
|
|
|
|
{
|
|
|
|
bDelayedSet = false;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function bool NotifyInputKey(int ControllerId, name Key, EInputEvent Event, float AmountDepressed, bool bGamepad)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Event==IE_Pressed && !bDelayedSet && InStr(Caps(string(Key)),"MOUSE")==-1)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (Key!='Escape')
|
2017-10-20 02:00:49 +00:00
|
|
|
BindNewKey(Key,"Camera FirstPerson");
|
|
|
|
ReleaseKeyFocus();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function LostKeyFocus()
|
|
|
|
{
|
|
|
|
KeyBindButton.SetDisabled(false);
|
|
|
|
bSetKeybind = false;
|
|
|
|
InitBehindviewKey();
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
final function BindNewKey(name Key, string Cmd)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
local int i;
|
|
|
|
local PlayerInput IN;
|
|
|
|
|
|
|
|
// First unbind old key.
|
|
|
|
IN = Owner.BackupInput;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (CurKeybind!='')
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<IN.Bindings.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (IN.Bindings[i].Name==CurKeybind)
|
2017-10-20 02:00:49 +00:00
|
|
|
IN.Bindings.Remove(i,1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then bind a new key.
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=0; i<IN.Bindings.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (IN.Bindings[i].Name==Key)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
IN.Bindings[i].Command = Cmd;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 20:12:58 +00:00
|
|
|
if (i==IN.Bindings.Length)
|
2017-10-20 02:00:49 +00:00
|
|
|
IN.Bindings.Length = i+1;
|
|
|
|
IN.Bindings[i].Name = Key;
|
|
|
|
IN.Bindings[i].Command = Cmd;
|
|
|
|
IN.Bindings[i].Control = false;
|
|
|
|
IN.Bindings[i].Shift = false;
|
|
|
|
IN.Bindings[i].Alt = false;
|
|
|
|
IN.Bindings[i].bIgnoreCtrl = false;
|
|
|
|
IN.Bindings[i].bIgnoreShift = (Key=='F1'); // Hack, fix Steam overlay commands.
|
|
|
|
IN.Bindings[i].bIgnoreAlt = (Key=='F7');
|
|
|
|
|
|
|
|
// Check for any other duplicates of same key.
|
2020-11-28 20:12:58 +00:00
|
|
|
for (i=(i+1); i<IN.Bindings.Length; ++i)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (IN.Bindings[i].Name==Key)
|
2017-10-20 02:00:49 +00:00
|
|
|
IN.Bindings.Remove(i,1);
|
|
|
|
}
|
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (IN.Class!=Class'KFPlayerInput')
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
Class'KFPlayerInput'.Default.Bindings = IN.Bindings; // Hack!
|
|
|
|
Class'KFPlayerInput'.Static.StaticSaveConfig();
|
|
|
|
}
|
|
|
|
else IN.SaveConfig();
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
Begin Object Class=KFGUI_ComponentList Name=ClientSettingsBox
|
|
|
|
XPosition=0.025
|
|
|
|
YPosition=0.025
|
|
|
|
XSize=0.95
|
|
|
|
YSize=0.95
|
|
|
|
ID="SettingsBox"
|
|
|
|
ListItemsPerPage=14
|
|
|
|
End Object
|
|
|
|
|
|
|
|
Components.Add(ClientSettingsBox)
|
|
|
|
}
|