Merge pull request #3 from GenZmeY/waiting-gri-limit
add waiting GRI limit
This commit is contained in:
commit
05e2ca250c
@ -4,17 +4,14 @@ class LTI_LocalMessage extends Object
|
||||
var const String SyncItemsDefault;
|
||||
var private localized String SyncItems;
|
||||
|
||||
var const String SyncFinishedDefault;
|
||||
var private localized String SyncFinished;
|
||||
|
||||
var const String WaitingGRIDefault;
|
||||
var private localized String WaitingGRI;
|
||||
|
||||
var const String IncompatibleGRIDefault;
|
||||
var private localized String IncompatibleGRI;
|
||||
|
||||
var const String DisconnectDefault;
|
||||
var private localized String Disconnect;
|
||||
var const String IncompatibleGRIWarningDefault;
|
||||
var private localized String IncompatibleGRIWarning;
|
||||
|
||||
var const String SecondsShortDefault;
|
||||
var private localized String SecondsShort;
|
||||
@ -22,10 +19,9 @@ var private localized String SecondsShort;
|
||||
enum E_LTI_LocalMessageType
|
||||
{
|
||||
LTI_SyncItems,
|
||||
LTI_SyncFinished,
|
||||
LTI_WaitingGRI,
|
||||
LTI_IncompatibleGRI,
|
||||
LTI_Disconnect,
|
||||
LTI_IncompatibleGRIWarning,
|
||||
LTI_SecondsShort
|
||||
};
|
||||
|
||||
@ -43,17 +39,14 @@ public static function String GetLocalizedString(
|
||||
case LTI_SyncItems:
|
||||
return (default.SyncItems != "" ? default.SyncItems : default.SyncItemsDefault);
|
||||
|
||||
case LTI_SyncFinished:
|
||||
return (default.SyncFinished != "" ? default.SyncFinished : default.SyncFinishedDefault);
|
||||
|
||||
case LTI_WaitingGRI:
|
||||
return (default.WaitingGRI != "" ? default.WaitingGRI : default.WaitingGRIDefault);
|
||||
|
||||
case LTI_IncompatibleGRI:
|
||||
return (default.IncompatibleGRI != "" ? default.IncompatibleGRI : default.IncompatibleGRIDefault);
|
||||
return (default.IncompatibleGRI != "" ? default.IncompatibleGRI : default.IncompatibleGRIDefault) @ String1;
|
||||
|
||||
case LTI_Disconnect:
|
||||
return (default.Disconnect != "" ? default.Disconnect : default.DisconnectDefault);
|
||||
case LTI_IncompatibleGRIWarning:
|
||||
return (default.IncompatibleGRIWarning != "" ? default.IncompatibleGRIWarning : default.IncompatibleGRIWarningDefault);
|
||||
|
||||
case LTI_SecondsShort:
|
||||
return (default.SecondsShort != "" ? default.SecondsShort : default.SecondsShortDefault);
|
||||
@ -65,9 +58,8 @@ public static function String GetLocalizedString(
|
||||
defaultproperties
|
||||
{
|
||||
SyncItemsDefault = "Sync items:"
|
||||
SyncFinishedDefault = "Sync finished."
|
||||
WaitingGRIDefault = "Waiting GRI..."
|
||||
IncompatibleGRIDefault = "Incompatible GRI:"
|
||||
DisconnectDefault = "Disconnect..."
|
||||
IncompatibleGRIWarningDefault = "You can enter the game, but the trader may not work correctly.";
|
||||
SecondsShortDefault = "s"
|
||||
}
|
@ -25,6 +25,7 @@ var private String NotificationRightText;
|
||||
var private int NotificationPercent;
|
||||
|
||||
var private int WaitingGRI;
|
||||
var private int WaitingGRILimit;
|
||||
|
||||
replication
|
||||
{
|
||||
@ -74,6 +75,39 @@ private simulated function KFPlayerController GetKFPC()
|
||||
return KFPC;
|
||||
}
|
||||
|
||||
public reliable client function WriteToChatLocalized(
|
||||
E_LTI_LocalMessageType LMT,
|
||||
optional String HexColor,
|
||||
optional String String1,
|
||||
optional String String2,
|
||||
optional String String3)
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
WriteToChat(LocalMessage.static.GetLocalizedString(LogLevel, LMT, String1, String2, String3), HexColor);
|
||||
}
|
||||
|
||||
public reliable client function WriteToChat(String Message, optional String HexColor)
|
||||
{
|
||||
local KFGFxHudWrapper HUD;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (GetKFPC() == None) return;
|
||||
|
||||
if (KFPC.MyGFxManager.PartyWidget != None && KFPC.MyGFxManager.PartyWidget.PartyChatWidget != None)
|
||||
{
|
||||
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.SetVisible(true);
|
||||
KFPC.MyGFxManager.PartyWidget.PartyChatWidget.AddChatMessage(Message, HexColor);
|
||||
}
|
||||
|
||||
HUD = KFGFxHudWrapper(KFPC.myHUD);
|
||||
if (HUD != None && HUD.HUDMovie != None && HUD.HUDMovie.HudChatBox != None)
|
||||
{
|
||||
HUD.HUDMovie.HudChatBox.AddChatMessage(Message, HexColor);
|
||||
}
|
||||
}
|
||||
|
||||
private simulated function SetPartyInGameWidget()
|
||||
{
|
||||
`Log_Trace();
|
||||
@ -189,47 +223,44 @@ private simulated reliable client function ClientSyncFinished()
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
NotificationLeftText = "";
|
||||
if (WorldInfo.GRI == None && WaitingGRI++ < WaitingGRILimit)
|
||||
{
|
||||
`Log_Debug("ClientSyncFinished: Waiting GRI" @ WaitingGRI);
|
||||
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, LTI_WaitingGRI);
|
||||
NotificationLeftText = String(WaitingGRI) $ LocalMessage.static.GetLocalizedString(LogLevel, LTI_SecondsShort);
|
||||
NotificationRightText = "";
|
||||
NotificationPercent = 0;
|
||||
|
||||
if (WorldInfo.GRI == None)
|
||||
{
|
||||
`Log_Debug("ClientSyncFinished: Waiting GRI");
|
||||
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, LTI_WaitingGRI);
|
||||
NotificationLeftText = String(++WaitingGRI) $ LocalMessage.static.GetLocalizedString(LogLevel, LTI_SecondsShort);
|
||||
NotificationRightText = "";
|
||||
SetTimer(1.0f, false, nameof(ClientSyncFinished));
|
||||
return;
|
||||
}
|
||||
|
||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
||||
if (KFGRI == None)
|
||||
{
|
||||
`Log_Fatal("Incompatible Replication info:" @ String(WorldInfo.GRI));
|
||||
ClearTimer(nameof(KeepNotification));
|
||||
UpdateNotification(
|
||||
LocalMessage.static.GetLocalizedString(LogLevel, LTI_IncompatibleGRI) @ String(WorldInfo.GRI),
|
||||
LocalMessage.static.GetLocalizedString(LogLevel, LTI_Disconnect), "", 0);
|
||||
Cleanup();
|
||||
ConsoleCommand("Disconnect");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, LTI_SyncFinished);
|
||||
NotificationHeaderText = "";
|
||||
NotificationLeftText = "";
|
||||
NotificationRightText = "";
|
||||
NotificationPercent = 0;
|
||||
|
||||
Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel);
|
||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
||||
if (KFGRI != None)
|
||||
{
|
||||
`Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader");
|
||||
Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI));
|
||||
WriteToChatLocalized(
|
||||
LTI_IncompatibleGRI,
|
||||
class'KFLocalMessage'.default.InteractionColor,
|
||||
WorldInfo.GRI == None ? "None" : String(WorldInfo.GRI.class));
|
||||
WriteToChatLocalized(
|
||||
LTI_IncompatibleGRIWarning,
|
||||
class'KFLocalMessage'.default.InteractionColor);
|
||||
}
|
||||
|
||||
ClearTimer(nameof(KeepNotification));
|
||||
ShowReadyButton();
|
||||
|
||||
Cleanup();
|
||||
|
||||
SafeDestroy();
|
||||
}
|
||||
|
||||
@ -279,4 +310,5 @@ defaultproperties
|
||||
|
||||
NotificationPercent = 0
|
||||
WaitingGRI = 0
|
||||
WaitingGRILimit = 15
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user