2017-10-20 02:00:49 +00:00
|
|
|
Class UIP_News extends KFGUI_MultiComponent;
|
|
|
|
|
|
|
|
var KFGUI_TextField NewsField;
|
|
|
|
var string WebsiteURL;
|
|
|
|
var KFGUI_Button WebsiteButton;
|
|
|
|
|
2020-08-12 15:31:04 +00:00
|
|
|
var localized string WebSiteButtonText;
|
|
|
|
var localized string WebsiteButtonToolTip;
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
Super.InitMenu();
|
|
|
|
|
|
|
|
// Client settings
|
|
|
|
NewsField = KFGUI_TextField(FindComponentID('News'));
|
|
|
|
WebsiteButton = KFGUI_Button(FindComponentID('Website'));
|
2020-08-12 15:31:04 +00:00
|
|
|
|
|
|
|
WebsiteButton.ButtonText=WebSiteButtonText;
|
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
Timer();
|
|
|
|
}
|
|
|
|
function ShowMenu()
|
|
|
|
{
|
|
|
|
local KFGameReplicationInfo GRI;
|
|
|
|
|
|
|
|
Super.ShowMenu();
|
|
|
|
GRI = KFGameReplicationInfo(GetPlayer().WorldInfo.GRI);
|
|
|
|
WebsiteButton.SetDisabled(GRI==None || GRI.ServerAdInfo.WebsiteLink=="");
|
|
|
|
if( !WebsiteButton.bDisabled )
|
|
|
|
{
|
|
|
|
WebsiteURL = GRI.ServerAdInfo.WebsiteLink;
|
2020-08-12 15:31:04 +00:00
|
|
|
WebsiteButton.ChangeToolTip(WebsiteButtonToolTip$" "$WebsiteURL);
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
function Timer()
|
|
|
|
{
|
|
|
|
if( !ExtPlayerController(GetPlayer()).bMOTDReceived )
|
|
|
|
SetTimer(0.2,false);
|
|
|
|
else NewsField.SetText(ExtPlayerController(GetPlayer()).ServerMOTD);
|
|
|
|
}
|
|
|
|
function ButtonClicked( KFGUI_Button Sender )
|
|
|
|
{
|
|
|
|
switch( Sender.ID )
|
|
|
|
{
|
|
|
|
case 'Website':
|
|
|
|
class'GameEngine'.static.GetOnlineSubsystem().OpenURL(WebsiteURL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
|
|
|
Begin Object Class=KFGUI_TextField Name=NewsText
|
|
|
|
ID="News"
|
|
|
|
XPosition=0.025
|
|
|
|
YPosition=0.025
|
|
|
|
XSize=0.95
|
|
|
|
YSize=0.893
|
|
|
|
End Object
|
|
|
|
Begin Object Class=KFGUI_Button Name=WebSiteButton
|
|
|
|
ID="Website"
|
|
|
|
XPosition=0.44
|
|
|
|
YPosition=0.92
|
|
|
|
XSize=0.12
|
|
|
|
YSize=0.06
|
|
|
|
OnClickLeft=ButtonClicked
|
|
|
|
OnClickRight=ButtonClicked
|
|
|
|
End Object
|
|
|
|
|
|
|
|
Components.Add(NewsText)
|
|
|
|
Components.Add(WebSiteButton)
|
|
|
|
}
|