redesign preloadcontent, add support for versus mode

This commit is contained in:
GenZmeY 2022-07-06 22:53:45 +03:00
parent 7edd65b3e0
commit 351f3a46b0
3 changed files with 81 additions and 41 deletions

View File

@ -133,11 +133,37 @@ private function PostInit()
return; return;
} }
if (UnlockDLC && KFGI.KFGFxManagerClass != class'CTI_GFxMoviePlayer_Manager') if (UnlockDLC)
{ {
if (KFGameInfo_VersusSurvival(KFGI) != None)
{
if (KFGI.KFGFxManagerClass != class'CTI_GFxMoviePlayer_Manager_Versus')
{
if (KFGI.KFGFxManagerClass != class'KFGameInfo_VersusSurvival'.default.KFGFxManagerClass)
{
`Log_Warn("Found custom 'KFGFxManagerClass' (" $ KFGI.KFGFxManagerClass $ "), there may be compatibility issues");
`Log_Warn("If you notice problems, try disabling DLC unlock");
}
KFGI.KFGFxManagerClass = class'CTI_GFxMoviePlayer_Manager_Versus';
`Log_Info("DLC unlocked");
}
}
else
{
if (KFGI.KFGFxManagerClass != class'CTI_GFxMoviePlayer_Manager')
{
if (KFGI.KFGFxManagerClass != class'KFGameInfo'.default.KFGFxManagerClass)
{
`Log_Warn("Found custom 'KFGFxManagerClass' (" $ KFGI.KFGFxManagerClass $ "), there may be compatibility issues");
`Log_Warn("If you notice problems, try disabling DLC unlock");
}
KFGI.KFGFxManagerClass = class'CTI_GFxMoviePlayer_Manager'; KFGI.KFGFxManagerClass = class'CTI_GFxMoviePlayer_Manager';
`Log_Info("DLC unlocked"); `Log_Info("DLC unlocked");
} }
}
}
if (KFGI.GameReplicationInfo == None) if (KFGI.GameReplicationInfo == None)
{ {

View File

@ -0,0 +1,8 @@
class CTI_GFxMoviePlayer_Manager_Versus extends KFGFxMoviePlayer_Manager_Versus
dependsOn(CTI_GFxMenu_Trader);
defaultproperties
{
WidgetBindings.Remove((WidgetName="traderMenu",WidgetClass=class'KFGFxMenu_Trader'))
WidgetBindings.Add((WidgetName="traderMenu",WidgetClass=class'CTI_GFxMenu_Trader'))
}

View File

@ -89,9 +89,28 @@ private simulated function bool CheckPartyInGameWidget()
return (PartyInGameWidget != None); return (PartyInGameWidget != None);
} }
private simulated function UpdateNotification(String Title, String Downloading, String Remainig, int Percent) private simulated function HideReadyButton()
{ {
if (Notification != None) if (CheckPartyInGameWidget())
{
PartyInGameWidget.SetReadyButtonVisibility(false);
}
}
private simulated function ShowReadyButton()
{
if (CheckPartyInGameWidget())
{
Notification.SetVisible(false);
PartyInGameWidget.SetReadyButtonVisibility(true);
PartyInGameWidget.UpdateReadyButtonText();
PartyInGameWidget.UpdateReadyButtonVisibility();
}
}
private reliable client function UpdateNotification(String Title, String Downloading, String Remainig, int Percent)
{
if (CheckPartyInGameWidget() && Notification != None)
{ {
Notification.SetString("itemName", Title); Notification.SetString("itemName", Title);
Notification.SetFloat("percent", Percent); Notification.SetFloat("percent", Percent);
@ -114,10 +133,7 @@ private reliable client function ClientSync(class<KFWeaponDefinition> WeapDef, o
return; return;
} }
if (CheckPartyInGameWidget()) HideReadyButton();
{
PartyInGameWidget.SetReadyButtonVisibility(false);
}
if (Remove) if (Remove)
{ {
@ -129,26 +145,12 @@ private reliable client function ClientSync(class<KFWeaponDefinition> WeapDef, o
} }
Recieved = RemoveItems.Length + AddItems.Length; Recieved = RemoveItems.Length + AddItems.Length;
if (CheckPartyInGameWidget())
{
UpdateNotification( UpdateNotification(
"Sync items, please wait...", "Sync items, please wait...",
Remove ? "-" : "+" @ Repl(String(WeapDef), "KFWeapDef_", ""), Remove ? "-" : "+" @ Repl(String(WeapDef), "KFWeapDef_", ""),
Recieved @ "/" @ SyncSize, Recieved @ "/" @ SyncSize,
(float(Recieved) / float(SyncSize)) * 100); (float(Recieved) / float(SyncSize)) * 100);
}
if (Recieved == SyncSize && (PreloadContent || ForcePreloadContent))
{
if (CheckPartyInGameWidget())
{
UpdateNotification(
"Preload Content, please wait...",
"Game isn't frozen",
"Don't panic",
0);
}
}
ServerSync(); ServerSync();
} }
@ -179,18 +181,8 @@ private simulated reliable client function SyncFinished()
{ {
Helper.static.PreloadContent(AddItems); Helper.static.PreloadContent(AddItems);
} }
if (ForcePreloadContent)
{
PreloadContentWorkaround();
}
if (CheckPartyInGameWidget()) ShowReadyButton();
{
Notification.SetVisible(false);
PartyInGameWidget.SetReadyButtonVisibility(true);
PartyInGameWidget.UpdateReadyButtonText();
PartyInGameWidget.UpdateReadyButtonVisibility();
}
SafeDestroy(); SafeDestroy();
} }
@ -205,6 +197,10 @@ public reliable server function ServerSync()
if (SyncSize <= Recieved || WorldInfo.NetMode == NM_StandAlone) if (SyncSize <= Recieved || WorldInfo.NetMode == NM_StandAlone)
{ {
if (ForcePreloadContent)
{
PreloadContentWorkaround();
}
SyncFinished(); SyncFinished();
if (!CTI.DestroyRepLink(Controller(Owner))) if (!CTI.DestroyRepLink(Controller(Owner)))
{ {
@ -224,7 +220,7 @@ public reliable server function ServerSync()
} }
} }
private simulated function PreloadContentWorkaround() private function PreloadContentWorkaround()
{ {
local PlayerController PC; local PlayerController PC;
local Pawn P; local Pawn P;
@ -264,6 +260,12 @@ private simulated function PreloadContentWorkaround()
for (Index = 0; Index < AddItems.Length; Index++) for (Index = 0; Index < AddItems.Length; Index++)
{ {
UpdateNotification(
"Game isn't frozen, Don't panic",
"Preload content:",
Index @ "/" @ AddItems.Length,
(float(Index) / float(AddItems.Length)) * 100);
CW = class<Weapon> (DynamicLoadObject(AddItems[Index].default.WeaponClassPath, class'Class')); CW = class<Weapon> (DynamicLoadObject(AddItems[Index].default.WeaponClassPath, class'Class'));
if (CW != None && Weapon(P.FindInventoryType(CW)) == None) if (CW != None && Weapon(P.FindInventoryType(CW)) == None)
{ {
@ -271,6 +273,8 @@ private simulated function PreloadContentWorkaround()
} }
} }
UpdateNotification("Cleanup", "", "", 0);
foreach KFIM.InventoryActors(class'Weapon', W) foreach KFIM.InventoryActors(class'Weapon', W)
{ {
if (W != None) if (W != None)
@ -285,6 +289,8 @@ private simulated function PreloadContentWorkaround()
} }
} }
UpdateNotification("Cleanup", "", "", 0);
foreach WorldInfo.DynamicActors(class'DroppedPickup', DP) foreach WorldInfo.DynamicActors(class'DroppedPickup', DP)
{ {
if (DP.Instigator == P && DP.CreationTime > Time) if (DP.Instigator == P && DP.CreationTime > Time)
@ -295,7 +301,7 @@ private simulated function PreloadContentWorkaround()
KFIM.bInfiniteWeight = false; KFIM.bInfiniteWeight = false;
`Log_Info("Force Preload Finished"); `Log_Info("Force Preload Finished (" $ PC.PlayerReplicationInfo.PlayerName $ ")");
} }
defaultproperties defaultproperties