KF2-Server-Extension/ServerExt/Classes/UI_UnloadInfo.uc

125 lines
3.0 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class UI_UnloadInfo extends KFGUI_FloatingWindow;
var class<Ext_PerkBase> PerkToReset;
2020-08-12 11:16:23 +00:00
var KFGUI_Button UnloadPerkYesButton, UnloadPerkNoButton;
2017-10-20 02:00:49 +00:00
var KFGUI_TextField InfoLabel;
var byte CurCallCode;
2020-08-12 11:16:23 +00:00
var localized string ResetPerkNotice;
var localized string PleaseWait;
var localized string ResetDisabledWarn;
var localized string ResetMinLevelWarnPart1;
var localized string ResetMinLevelWarnPart2;
var localized string ResetAttentionPart1;
var localized string ResetAttentionPart2;
var localized string ResetAttentionPart3;
var localized string ButtonYesText;
var localized string ButtonNoText;
var localized string ButtonYesToolTip;
var localized string ButtonNoToolTip;
2017-10-20 02:00:49 +00:00
function InitMenu()
{
2020-08-12 11:16:23 +00:00
UnloadPerkYesButton = KFGUI_Button(FindComponentID('Yes'));
UnloadPerkNoButton = KFGUI_Button(FindComponentID('No'));
UnloadPerkYesButton.ButtonText=ButtonYesText;
UnloadPerkNoButton.ButtonText=ButtonNoText;
UnloadPerkYesButton.ToolTip=ButtonYesToolTip;
UnloadPerkNoButton.ToolTip=ButtonNoToolTip;
2017-10-20 02:00:49 +00:00
InfoLabel = KFGUI_TextField(FindComponentID('Info'));
Super.InitMenu();
}
2020-11-28 20:04:55 +00:00
final function SetupTo(class<Ext_PerkBase> P)
2017-10-20 02:00:49 +00:00
{
PerkToReset = P;
2020-08-12 11:16:23 +00:00
WindowTitle = ResetPerkNotice$" "$P.Default.PerkName;
UnloadPerkYesButton.SetDisabled(true);
InfoLabel.SetText(PleaseWait);
2017-10-20 02:00:49 +00:00
++CurCallCode;
ExtPlayerController(GetPlayer()).OnClientGetResponse = ReceivedInfo;
ExtPlayerController(GetPlayer()).ServerGetUnloadInfo(CurCallCode,PerkToReset,false);
}
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:04:55 +00:00
switch(Sender.ID)
2017-10-20 02:00:49 +00:00
{
case 'Yes':
ExtPlayerController(GetPlayer()).ServerGetUnloadInfo(0,PerkToReset,true);
DoClose();
break;
case 'No':
DoClose();
break;
}
}
function CloseMenu()
{
Super.CloseMenu();
PerkToReset = None;
ExtPlayerController(GetPlayer()).OnClientGetResponse = ExtPlayerController(GetPlayer()).DefClientResponse;
}
2020-11-28 20:04:55 +00:00
function ReceivedInfo(byte CallID, byte Code, int DataA, int DataB)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:04:55 +00:00
if(CurCallCode!=CallID)
2017-10-20 02:00:49 +00:00
return;
2020-08-12 11:16:23 +00:00
2020-11-28 20:04:55 +00:00
switch(Code)
2017-10-20 02:00:49 +00:00
{
case 0:
2020-08-12 11:16:23 +00:00
InfoLabel.SetText(ResetDisabledWarn);
2017-10-20 02:00:49 +00:00
break;
case 1:
2020-08-12 11:16:23 +00:00
InfoLabel.SetText(ResetMinLevelWarnPart1$DataA$ResetMinLevelWarnPart2);
2017-10-20 02:00:49 +00:00
break;
case 2:
2020-08-12 11:16:23 +00:00
InfoLabel.SetText(ResetAttentionPart1$DataA$ResetAttentionPart2$DataB$ResetAttentionPart3);
UnloadPerkYesButton.SetDisabled(false);
2017-10-20 02:00:49 +00:00
break;
}
}
defaultproperties
{
XPosition=0.35
YPosition=0.2
XSize=0.3
YSize=0.45
bAlwaysTop=true
bOnlyThisFocus=true
Begin Object Class=KFGUI_TextField Name=WarningLabel
ID="Info"
XPosition=0.01
YPosition=0.12
XSize=0.98
YSize=0.775
End Object
2020-06-26 06:32:40 +00:00
2020-08-12 11:16:23 +00:00
Begin Object Class=KFGUI_Button Name=UnloadPerkYesButton
2017-10-20 02:00:49 +00:00
ID="Yes"
XPosition=0.2
YPosition=0.9
XSize=0.29
YSize=0.07
ExtravDir=1
OnClickLeft=ButtonClicked
OnClickRight=ButtonClicked
End Object
2020-08-12 11:16:23 +00:00
Begin Object Class=KFGUI_Button Name=UnloadPerkNoButton
2017-10-20 02:00:49 +00:00
ID="No"
XPosition=0.5
YPosition=0.9
XSize=0.29
YSize=0.07
OnClickLeft=ButtonClicked
OnClickRight=ButtonClicked
End Object
Components.Add(WarningLabel)
2020-08-12 11:16:23 +00:00
Components.Add(UnloadPerkYesButton)
Components.Add(UnloadPerkNoButton)
2017-10-20 02:00:49 +00:00
}