2017-10-20 02:00:49 +00:00
Class UI _UnloadInfo extends KFGUI _FloatingWindow ;
var class < Ext _PerkBase > PerkToReset ;
var KFGUI _Button YesButten ;
var KFGUI _TextField InfoLabel ;
var byte CurCallCode ;
function InitMenu ( )
{
YesButten = KFGUI _Button ( FindComponentID ( 'Yes' ) ) ;
InfoLabel = KFGUI _TextField ( FindComponentID ( 'Info' ) ) ;
Super . InitMenu ( ) ;
}
final function SetupTo ( class < Ext _PerkBase > P )
{
PerkToReset = P ;
2020-06-26 06:32:40 +00:00
WindowTitle = "NOTICE: Unload stats for " $P . Default . PerkName ; // TODO: localize
2017-10-20 02:00:49 +00:00
YesButten . SetDisabled ( true ) ;
2020-06-26 06:32:40 +00:00
InfoLabel . SetText ( "Please wait..." ) ; // TODO: localize
2017-10-20 02:00:49 +00:00
++ CurCallCode ;
ExtPlayerController ( GetPlayer ( ) ) . OnClientGetResponse = ReceivedInfo ;
ExtPlayerController ( GetPlayer ( ) ) . ServerGetUnloadInfo ( CurCallCode , PerkToReset , false ) ;
}
function ButtonClicked ( KFGUI _Button Sender )
{
switch ( Sender . ID )
{
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 ;
}
function ReceivedInfo ( byte CallID , byte Code , int DataA , int DataB )
{
if ( CurCallCode != CallID )
return ;
2020-06-26 06:32:40 +00:00
// TODO: localize
2017-10-20 02:00:49 +00:00
switch ( Code )
{
case 0 :
InfoLabel . SetText ( "ERROR: Perk unloading is disabled on this server!" ) ;
break ;
case 1 :
InfoLabel . SetText ( "ERROR: You need to be at least on level #{FFFF00}" $DataA$ "#{DEF} before you can use this feature!" ) ;
break ;
case 2 :
InfoLabel . SetText ( "#{FF0000}WARNING:#{DEF} By using this feature you will lose #{FFFF00}" $DataA$ "#{DEF} XP points, and by that you will drop down #{FF0000}" $DataB$ "#{DEF} levels!|In addition you will be forced to suicide to reset specific stats.||Are you sure you want to continue?" ) ;
YesButten . SetDisabled ( false ) ;
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
// TODO: localize
2017-10-20 02:00:49 +00:00
Begin Object Class = KFGUI _Button Name = YesButten
ID = "Yes"
ButtonText = "YES"
Tooltip = "Reset the perk (you can not undo this action!)"
XPosition = 0.2
YPosition = 0.9
XSize = 0.29
YSize = 0.07
ExtravDir = 1
OnClickLeft = ButtonClicked
OnClickRight = ButtonClicked
End Object
Begin Object Class = KFGUI _Button Name = NoButten
ID = "No"
ButtonText = "ABORT"
Tooltip = "Abort without doing anything"
XPosition = 0.5
YPosition = 0.9
XSize = 0.29
YSize = 0.07
OnClickLeft = ButtonClicked
OnClickRight = ButtonClicked
End Object
Components . Add ( WarningLabel )
Components . Add ( YesButten )
Components . Add ( NoButten )
}