PDA

View Full Version : New scaleform UC code - Is this an oversight?



GeekyPayback
08-24-2010, 08:45 AM
Hi

There may be a good reason for this, but I really cant think of it



function UpdateListDataProvider()
{
local byte i;
local GFxObject DataProvider;
local GFxObject TempObj;
local String FriendlyGameModeName;

DataProvider = Outer.CreateArray();
for (i = 0; i < GameModeList.Length; i++)
{
TempObj = CreateObject("Object");

FriendlyGameModeName = class'GFxUDKFrontEnd_LaunchGame'.static.GetGameMod eFriendlyString(GameModeList[i].GameMode);
TempObj.SetString("label", Caps(FriendlyGameModeName));




/** Helper function for Game Mode conversion to friendly String. */
static function String GetGameModeFriendlyString(String InGameMode)
{
local string RetString;
switch(InGameMode)
{
case ("UTGame.UTDeathmatch"):
RetString = "Deathmatch";
break;
case ("UTGame.UTTeamGame"):
RetString = "Team Deathmatch";
break;
case ("UTGameContent.UTVehicleCTFGame_Content"):
RetString = "Capture the Flag";
break;
default:
RetString = InGameMode;
break;
}

return RetString;
}


The above code could be written as



function UpdateListDataProvider()
{
local byte i;
local GFxObject DataProvider;
local GFxObject TempObj;

DataProvider = Outer.CreateArray();
for (i = 0; i < GameModeList.Length; i++)
{
TempObj = CreateObject("Object");
TempObj.SetString("label", Caps(GameModeList[i].FriendlyName));
TempObj.SetString("image", "img://"$GameModeList[i].PreviewImageMarkup);


Then the game modes would automatically pick up the correct name without having to subclass GFxUDKFrontEnd_LaunchGame, and would also benefit from internationalization.

Or am I missing something really obvious that prevents this?

MonsOlympus
08-24-2010, 09:21 AM
Even with the old UI the providers arnt correctly used, it should use the GameName variable in the UIGameInfoSummary class should it not?

GeekyPayback
08-24-2010, 10:05 AM
I don't think it should. I can only find one reference to UIGameInfoSummary in the code, and thats where it defines itself. UTUIDataProvider_GameModeInfo is the only provider type related to the game info that also has an int file in the UDK. I suspect UTUIDataProvider_GameModeInfo may have made UIGameInfoSummary redundant.

UTUIDataProvider_GameModeInfo is what the above code uses to determine the image but it doesn't use it to get the name of the game mode which is what I'm questioning really.

Why use the data retrieved by UTUIDataProvider_GameModeInfo to get the image, description (from the .int file), default map and prefixes, but not the name of the game mode?

MonsOlympus
08-24-2010, 11:25 AM
Oh thats right, silly me, I always forget FriendlyName is declared higher up the hierarchy. Its GameName in GameInfo that does sweet gnaff all, I knew it was along those lines. My main reason for saything that is UTUIDataProvider_GameModeInfo is a hell of a mouthful without auto-completion.

Question you should really be asking is why, GameModeList[i].FriendlyName, this array is used. Why not just use the variables in the GameInfo class like UE2 did and the settings variables rather then duplicating it all? Ask yourself how a provider knows what GameInfo.Class its associated with, then ask yourself how you check that if you have a list of providers? its not a simple matter, its easier to have the class reference available in my opinion.