Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTUITabPage_News


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 *
 * Tab page for downloaded news.
 */
class UTUITabPage_News extends UTTabPage
	placeable;

/**  Reference to the news label. */
var transient UILabel	NewsLabel;

/** Reference to the news interface. */
var transient OnlineNewsInterface NewsInterface;

/** Post initialization event - Setup widget delegates.*/
event PostInitialize()
{
	local OnlineSubsystem OnlineSub;

	Super.PostInitialize();

	// Set the button tab caption.
	SetDataStoreBinding("<Strings:UTGameUI.Community.News>");

	// Find a news label
	NewsLabel = UILabel(FindChild('lblNews', true));

	// Figure out if we have an online subsystem registered
	OnlineSub = class'GameEngine'.static.GetOnlineSubsystem();
	if (OnlineSub != None)
	{
		// Grab the news interface to verify the subsystem supports it
		NewsInterface = OnlineSub.NewsInterface;
		if (NewsInterface == None)
		{
			LogInternal("UTUITabPage_News::PostInitialize() - Couldn't find news interface!");
		}
	}

	// Start a news read
	ReadNews();
}

/** Starts reading the latest news. */
function ReadNews()
{
	LogInternal("UTUITabPage_News::ReadNews() - Reading news from the web...");

	// Set placeholder label
	NewsLabel.SetDataStoreBinding("<Strings:UTGameUI.Generic.Loading>");

	// Start news read
	NewsInterface.AddReadGameNewsCompletedDelegate(OnReadGameNewsCompleted);
	if(NewsInterface.ReadGameNews(GetPlayerOwner().ControllerId)==false)
	{
		OnReadGameNewsCompleted(false);
	}
}

/**
 * Delegate used in notifying the UI/game that the news read operation completed
 *
 * @param bWasSuccessful true if the read completed ok, false otherwise
 */
function OnReadGameNewsCompleted(bool bWasSuccessful)
{
	LogInternal("UTUITabPage_News::OnReadGameNewsCompleted() - bWasSuccessful: "$bWasSuccessful);

	NewsInterface.ClearReadGameNewsCompletedDelegate(OnReadGameNewsCompleted);

	if(bWasSuccessful)
	{
		NewsLabel.SetDataStoreBinding(NewsInterface.GetGameNews(GetPlayerOwner().ControllerId));
	}
	else
	{
		NewsLabel.SetDataStoreBinding("<Strings:UTGameUI.Errors.FailedToReadNews>");
	}
}

defaultproperties
{
   Begin Object Class=UIComp_Event Name=WidgetEventComponent ObjName=WidgetEventComponent Archetype=UIComp_Event'UTGame.Default__UTTabPage:WidgetEventComponent'
      ObjectArchetype=UIComp_Event'UTGame.Default__UTTabPage:WidgetEventComponent'
   End Object
   EventProvider=WidgetEventComponent
   Name="Default__UTUITabPage_News"
   ObjectArchetype=UTTabPage'UTGame.Default__UTTabPage'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:50.000 - Creation time: sk 18-3-2018 10:01:27.752 - Created with UnCodeX