1
0
KF2-Dev-Scripts/KFGame/Classes/KFGFxStartGameContainer_FindGame.uc

251 lines
10 KiB
Ucode
Raw Normal View History

2020-12-13 15:01:13 +00:00
//=============================================================================
// KFGFxStartGameContainer_FindGame
//=============================================================================
//
//=============================================================================
// Killing Floor 2
// Copyright (C) 2015 Tripwire Interactive LLC
// - Zane Gholson 1/27/2015
//=============================================================================
class KFGFxStartGameContainer_FindGame extends KFGFxObject_Container
config(UI);
var KFGFxMenu_StartGame StartMenu;
struct SWhatsNew
{
var string ImageURL;
var string TextField;
var string RedirectURL;
var string PSNProductId;
2021-03-11 19:29:08 +00:00
/** Used for those entitlements which does not have a "linked" Playfab item (like Armory Season Pass 2021)*/
var bool bPlayfabItemPairedUp;
structdefaultproperties
{
bPlayfabItemPairedUp=true
}
2020-12-13 15:01:13 +00:00
};
var array<SWhatsNew> WhatsNewItems;
var const private config array<SWhatsNew> PS4WhatsNewItems;
var const private config array<SWhatsNew> PS4WhatsNewItemsFreeTrial;
var array<SWhatsNew> PS4ActiveWhatsNewItems;
var localized string MultiplayerString;
var localized string CreateGameString;
var localized string SoloString;
var localized string TutorialString;
var bool bTrialNewsActive;
var OnlineSubsystem OnlineSub;
//==============================================================
// Initialization
//==============================================================
function Initialize( KFGFxObject_Menu NewParentMenu )
{
super.Initialize( NewParentMenu );
StartMenu = KFGFxMenu_StartGame( NewParentMenu );
OnlineSub = class'GameEngine'.static.GetOnlineSubsystem();
2020-12-13 15:09:05 +00:00
FillWhatsNew();
2020-12-13 15:01:13 +00:00
LocalizeMenu();
SetWhatsNewItems();
if( class'KFGameEngine'.static.IsSoloPlayDisabled())
{
DisableSoloButton();
}
}
function DisableSoloButton()
{
local GFxObject SoloButton;
SoloButton = GetObject("soloOfflineButton");
if(SoloButton != none)
{
SoloButton.SetBool("enabled", false);
}
}
function CheckNewsState()
{
if (Class'WorldInfo'.Static.IsConsoleBuild(CONSOLE_Orbis) && OnlineSub != none)
{
if (OnlineSub.IsGameOwned() && bTrialNewsActive)
{
SetWhatsNewItems();
}
}
}
function SetWhatsNewItems()
{
local GFxObject DataObject;
local GFxObject DataArray;
local GFxObject WhatsNewButton;
local int i, index;
local bool bLoggedIn;
WhatsNewButton = GetObject( "whatsNewButton" );
DataArray = CreateArray();
if(Class'WorldInfo'.Static.IsConsoleBuild())
{
bLoggedIn = OnlineSub.PlayerInterface.GetLoginStatus( GetLP().ControllerId ) == LS_LoggedIn;
PS4ActiveWhatsNewItems.Length = 0;
WhatsNewButton.SetVisible( bLoggedIn && OnlineSub.CanCheckFreeTrialState());
//if we don't own the game, show the buy the game news item
if (Class'WorldInfo'.Static.IsConsoleBuild(CONSOLE_Orbis) && !OnlineSub.IsGameOwned())
{
bTrialNewsActive = true;
for (i = 0; i < PS4WhatsNewItemsFreeTrial.length; i++)
{
// Only show store items if we are logged in
DataObject = CreateObject("Object");
DataObject.SetString("label", Localize("WhatsNewMessages", PS4WhatsNewItemsFreeTrial[i].TextField, "KFGame"));
DataObject.SetString("imageURL", PS4WhatsNewItemsFreeTrial[i].ImageURL);
DataObject.SetString("redirectURL", "OpenStore");
DataArray.SetElementObject(PS4ActiveWhatsNewItems.Length, DataObject);
PS4ActiveWhatsNewItems.AddItem(PS4WhatsNewItemsFreeTrial[i]);
}
}
else
{
bTrialNewsActive = false;
for (i = 0; i < PS4WhatsNewItems.length; i++)
{
// When Summer Sideshow is off, we don't want to link to the time limited SS item.
if (class'KFGameEngine'.static.GetSeasonalEventId() == 0)
{
if (PS4WhatsNewItems[i].TextField == "FeaturedEventItem")
{
continue;
}
}
// Only show store items if we are logged in
if (bLoggedIn || PS4WhatsNewItems[i].PSNProductId == "")
{
DataObject = CreateObject("Object");
DataObject.SetString("label", Localize("WhatsNewMessages", PS4WhatsNewItems[i].TextField, "KFGame"));
DataObject.SetString("imageURL", PS4WhatsNewItems[i].ImageURL);
DataObject.SetString("redirectURL", PS4WhatsNewItems[i].RedirectURL);
DataArray.SetElementObject(PS4ActiveWhatsNewItems.Length, DataObject);
PS4ActiveWhatsNewItems.AddItem(PS4WhatsNewItems[i]);
}
}
}
}
else
{
index = 0;
for (i = 0; i < WhatsNewItems.length; i++)
{
if (class'WorldInfo'.static.isEosBuild() && WhatsNewItems[i].TextField == "Jaegorhorn") continue;
if (!class'WorldInfo'.static.isEosBuild() && WhatsNewItems[i].TextField == "PS4Key") continue;
DataObject = CreateObject("Object");
DataObject.SetString("label", Localize("WhatsNewMessages",WhatsNewItems[i].TextField,"KFGame"));
2020-12-13 15:09:05 +00:00
`log("label"@WhatsNewItems[i].TextField);
2020-12-13 15:01:13 +00:00
DataObject.SetString("imageURL",WhatsNewItems[i].ImageURL);
2020-12-13 15:09:05 +00:00
`log("imageURL"@WhatsNewItems[i].ImageURL);
2020-12-13 15:01:13 +00:00
DataObject.SetString("redirectURL",WhatsNewItems[i].RedirectURL);
2020-12-13 15:09:05 +00:00
`log("redirectURL"@WhatsNewItems[i].RedirectURL);
2020-12-13 15:01:13 +00:00
DataArray.SetElementObject(index++, DataObject);
}
}
SetObject("whatsNew", DataArray);
}
function LocalizeMenu()
{
local GFxObject TextObject;
TextObject = CreateObject("Object");
// Localize static text
TextObject.SetString("home",StartMenu.FindGameString);
TextObject.SetString("multiplayer",MultiplayerString);
TextObject.SetString("createGame", CreateGameString);
TextObject.SetString("news", StartMenu.NewsPageString);
TextObject.SetString("serverBrowser",StartMenu.ServerBrowserString);
TextObject.SetString("solo",SoloString);
TextObject.SetString("tutorial",TutorialString);
SetObject("localizedText", TextObject);
}
2020-12-13 15:09:05 +00:00
function FillWhatsNew()
2020-12-13 15:01:13 +00:00
{
2020-12-13 15:09:05 +00:00
local SWhatsNew item;
WhatsNewItems.Remove(0, WhatsNewItems.Length);
2020-12-13 15:01:13 +00:00
// Latest Update
2022-05-11 15:13:25 +00:00
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_TidalTerror", "LatestUpdate", "http://www.tripwireinteractive.com/redirect/KF2LatestUpdate/");
2021-03-02 11:56:51 +00:00
WhatsNewItems.AddItem(item);
2022-06-14 15:52:40 +00:00
// Featured Ultimate Edition
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_UltimateEdition_Upgrade", "FeaturedItemBundle", "https://store.steampowered.com/app/1914560/KF2__Ultimate_Edition_Upgrade_DLC/");
WhatsNewItems.AddItem(item);
2022-05-11 15:13:25 +00:00
// KF2 Armory Season Pass 2022
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_ArmorySeasonPassII", "ArmorySeasonPass", "https://store.steampowered.com/app/1914490/KF2__Season_Pass_2022");
2020-12-13 15:09:05 +00:00
WhatsNewItems.AddItem(item);
2022-06-14 15:52:40 +00:00
// KF2 Armory Season Pass 2021
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Spring_Armory_Season_Pass", "ArmorySeasonPass", "https://store.steampowered.com/app/1524820/Killing_Floor_2__Armory_Season_Pass");
WhatsNewItems.AddItem(item);
// Featured Weapon Bundle
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_Weaponsbundle", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9369");
WhatsNewItems.AddItem(item);
// Featured Weapon
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_ReductoRay", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9367");
WhatsNewItems.AddItem(item);
// Featured Weapon
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_Sentinel","FeaturedItemBundle","https://store.steampowered.com/buyitem/232090/9368");
WhatsNewItems.AddItem(item);
// Featured Outfit Bundle
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_DeepSea_Explorer_Uniforms", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9366");
WhatsNewItems.AddItem(item);
2020-12-13 15:01:13 +00:00
// Featured Time Limited Item
2022-05-11 15:13:25 +00:00
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_SS_PremiumTicket", "FeaturedEventItem", "https://store.steampowered.com/buyitem/232090/4928");
2020-12-13 15:09:05 +00:00
WhatsNewItems.AddItem(item);
2022-06-14 15:52:40 +00:00
// Featured Weapon Skin Bundle
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_DeepSea_Weapon_Skin", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9364");
2021-03-02 11:56:51 +00:00
WhatsNewItems.AddItem(item);
2022-05-11 15:13:25 +00:00
// Featured Weapon Skin Bundle
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_NeonMKVIII_Weapon_Skin", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9362");
WhatsNewItems.AddItem(item);
// Featured Weapon Skin Bundle
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_Classic_Weapon_Skin", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9363");
2020-12-13 15:09:05 +00:00
WhatsNewItems.AddItem(item);
2021-12-09 16:33:06 +00:00
// Featured Weapon Skin Bundle
2022-05-11 15:13:25 +00:00
item = SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Summer2022_Chameleon_Weapon_Skin", "FeaturedItemBundle", "https://store.steampowered.com/buyitem/232090/9365");
WhatsNewItems.AddItem(item);
2020-12-13 15:01:13 +00:00
// Misc Community Links
2020-12-13 15:09:05 +00:00
item=SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_CommunityHub", "Jaegorhorn", "https://steamcommunity.com/app/232090");
WhatsNewItems.AddItem(item);
item=SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_CommunityForums", "Forums", "http://forums.tripwireinteractive.com/");
WhatsNewItems.AddItem(item);
item=SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Survey", "Survey", "http://www.tripwireinteractive.com/redirect/KF2Survey/");
WhatsNewItems.AddItem(item);
2021-03-02 11:56:51 +00:00
item=SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_CommunityIssue", "CommunityTracker", "http://www.killingfloor2.com/roadmap");
2020-12-13 15:09:05 +00:00
WhatsNewItems.AddItem(item);
item=SetWhatsNewItem("img://UI_WhatsNew.UI_WhatsNew_Merch", "Merch", "http://www.tripwireinteractive.com/redirect/shop/");
WhatsNewItems.AddItem(item);
item=SetWhatsNewItem("img://UI_WhatsNew_PS4.UI_WhatsNew_KFUncovered", "Uncovered", "https://www.youtube.com/watch?v=fTdfedt9B48/");
WhatsNewItems.AddItem(item);
}
function SWhatsNew SetWhatsNewItem(string image, string TextField, string URL)
{
local SWhatsNew item;
item.ImageURL = image;
item.Textfield = TextField;
item.RedirectURL = URL;
return item;
}
DefaultProperties
{
2020-12-13 15:01:13 +00:00
}