Merge pull request #8 from GenZmeY/waiting-gri-limit
add waiting GRI limit
This commit is contained in:
commit
69162ab37b
@ -4,17 +4,14 @@ class CTI_LocalMessage extends Object
|
|||||||
var const String SyncItemsDefault;
|
var const String SyncItemsDefault;
|
||||||
var private localized String SyncItems;
|
var private localized String SyncItems;
|
||||||
|
|
||||||
var const String SyncFinishedDefault;
|
|
||||||
var private localized String SyncFinished;
|
|
||||||
|
|
||||||
var const String WaitingGRIDefault;
|
var const String WaitingGRIDefault;
|
||||||
var private localized String WaitingGRI;
|
var private localized String WaitingGRI;
|
||||||
|
|
||||||
var const String IncompatibleGRIDefault;
|
var const String IncompatibleGRIDefault;
|
||||||
var private localized String IncompatibleGRI;
|
var private localized String IncompatibleGRI;
|
||||||
|
|
||||||
var const String DisconnectDefault;
|
var const String IncompatibleGRIWarningDefault;
|
||||||
var private localized String Disconnect;
|
var private localized String IncompatibleGRIWarning;
|
||||||
|
|
||||||
var const String SecondsShortDefault;
|
var const String SecondsShortDefault;
|
||||||
var private localized String SecondsShort;
|
var private localized String SecondsShort;
|
||||||
@ -22,10 +19,9 @@ var private localized String SecondsShort;
|
|||||||
enum E_CTI_LocalMessageType
|
enum E_CTI_LocalMessageType
|
||||||
{
|
{
|
||||||
CTI_SyncItems,
|
CTI_SyncItems,
|
||||||
CTI_SyncFinished,
|
|
||||||
CTI_WaitingGRI,
|
CTI_WaitingGRI,
|
||||||
CTI_IncompatibleGRI,
|
CTI_IncompatibleGRI,
|
||||||
CTI_Disconnect,
|
CTI_IncompatibleGRIWarning,
|
||||||
CTI_SecondsShort
|
CTI_SecondsShort
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -43,17 +39,14 @@ public static function String GetLocalizedString(
|
|||||||
case CTI_SyncItems:
|
case CTI_SyncItems:
|
||||||
return (default.SyncItems != "" ? default.SyncItems : default.SyncItemsDefault);
|
return (default.SyncItems != "" ? default.SyncItems : default.SyncItemsDefault);
|
||||||
|
|
||||||
case CTI_SyncFinished:
|
|
||||||
return (default.SyncFinished != "" ? default.SyncFinished : default.SyncFinishedDefault);
|
|
||||||
|
|
||||||
case CTI_WaitingGRI:
|
case CTI_WaitingGRI:
|
||||||
return (default.WaitingGRI != "" ? default.WaitingGRI : default.WaitingGRIDefault);
|
return (default.WaitingGRI != "" ? default.WaitingGRI : default.WaitingGRIDefault);
|
||||||
|
|
||||||
case CTI_IncompatibleGRI:
|
case CTI_IncompatibleGRI:
|
||||||
return (default.IncompatibleGRI != "" ? default.IncompatibleGRI : default.IncompatibleGRIDefault);
|
return (default.IncompatibleGRI != "" ? default.IncompatibleGRI : default.IncompatibleGRIDefault) @ String1;
|
||||||
|
|
||||||
case CTI_Disconnect:
|
case CTI_IncompatibleGRIWarning:
|
||||||
return (default.Disconnect != "" ? default.Disconnect : default.DisconnectDefault);
|
return (default.IncompatibleGRIWarning != "" ? default.IncompatibleGRIWarning : default.IncompatibleGRIWarningDefault);
|
||||||
|
|
||||||
case CTI_SecondsShort:
|
case CTI_SecondsShort:
|
||||||
return (default.SecondsShort != "" ? default.SecondsShort : default.SecondsShortDefault);
|
return (default.SecondsShort != "" ? default.SecondsShort : default.SecondsShortDefault);
|
||||||
@ -65,9 +58,8 @@ public static function String GetLocalizedString(
|
|||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
SyncItemsDefault = "Sync items:"
|
SyncItemsDefault = "Sync items:"
|
||||||
SyncFinishedDefault = "Sync finished."
|
|
||||||
WaitingGRIDefault = "Waiting GRI..."
|
WaitingGRIDefault = "Waiting GRI..."
|
||||||
IncompatibleGRIDefault = "Incompatible GRI:"
|
IncompatibleGRIDefault = "Incompatible GRI:"
|
||||||
DisconnectDefault = "Disconnect..."
|
IncompatibleGRIWarningDefault = "You can enter the game, but the trader may not work correctly.";
|
||||||
SecondsShortDefault = "s"
|
SecondsShortDefault = "s"
|
||||||
}
|
}
|
@ -27,6 +27,7 @@ var private String NotificationRightText;
|
|||||||
var private int NotificationPercent;
|
var private int NotificationPercent;
|
||||||
|
|
||||||
var private int WaitingGRI;
|
var private int WaitingGRI;
|
||||||
|
var private int WaitingGRILimit;
|
||||||
|
|
||||||
replication
|
replication
|
||||||
{
|
{
|
||||||
@ -78,6 +79,39 @@ private simulated function KFPlayerController GetKFPC()
|
|||||||
return KFPC;
|
return KFPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public reliable client function WriteToChatLocalized(
|
||||||
|
E_CTI_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()
|
private simulated function SetPartyInGameWidget()
|
||||||
{
|
{
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
@ -200,47 +234,44 @@ private simulated reliable client function ClientSyncFinished()
|
|||||||
|
|
||||||
`Log_Trace();
|
`Log_Trace();
|
||||||
|
|
||||||
NotificationLeftText = "";
|
if (WorldInfo.GRI == None && WaitingGRI++ < WaitingGRILimit)
|
||||||
|
{
|
||||||
|
`Log_Debug("ClientSyncFinished: Waiting GRI" @ WaitingGRI);
|
||||||
|
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, CTI_WaitingGRI);
|
||||||
|
NotificationLeftText = String(WaitingGRI) $ LocalMessage.static.GetLocalizedString(LogLevel, CTI_SecondsShort);
|
||||||
NotificationRightText = "";
|
NotificationRightText = "";
|
||||||
NotificationPercent = 0;
|
NotificationPercent = 0;
|
||||||
|
|
||||||
if (WorldInfo.GRI == None)
|
|
||||||
{
|
|
||||||
`Log_Debug("ClientSyncFinished: Waiting GRI");
|
|
||||||
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, CTI_WaitingGRI);
|
|
||||||
NotificationLeftText = String(++WaitingGRI) $ LocalMessage.static.GetLocalizedString(LogLevel, CTI_SecondsShort);
|
|
||||||
NotificationRightText = "";
|
|
||||||
SetTimer(1.0f, false, nameof(ClientSyncFinished));
|
SetTimer(1.0f, false, nameof(ClientSyncFinished));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
NotificationHeaderText = "";
|
||||||
if (KFGRI == None)
|
|
||||||
{
|
|
||||||
`Log_Fatal("Incompatible Replication info:" @ String(WorldInfo.GRI));
|
|
||||||
ClearTimer(nameof(KeepNotification));
|
|
||||||
UpdateNotification(
|
|
||||||
LocalMessage.static.GetLocalizedString(LogLevel, CTI_IncompatibleGRI) @ String(WorldInfo.GRI),
|
|
||||||
LocalMessage.static.GetLocalizedString(LogLevel, CTI_Disconnect), "", 0);
|
|
||||||
Cleanup();
|
|
||||||
ConsoleCommand("Disconnect");
|
|
||||||
SafeDestroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NotificationHeaderText = LocalMessage.static.GetLocalizedString(LogLevel, CTI_SyncFinished);
|
|
||||||
NotificationLeftText = "";
|
NotificationLeftText = "";
|
||||||
NotificationRightText = "";
|
NotificationRightText = "";
|
||||||
NotificationPercent = 0;
|
NotificationPercent = 0;
|
||||||
|
|
||||||
Trader.static.ModifyTrader(KFGRI, RemoveItems, AddItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel);
|
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
||||||
|
if (KFGRI != None)
|
||||||
|
{
|
||||||
`Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader");
|
`Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader");
|
||||||
|
Trader.static.ModifyTrader(KFGRI, RemoveItems, AddItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
`Log_Error("Incompatible Replication info:" @ String(WorldInfo.GRI));
|
||||||
|
WriteToChatLocalized(
|
||||||
|
CTI_IncompatibleGRI,
|
||||||
|
class'KFLocalMessage'.default.InteractionColor,
|
||||||
|
WorldInfo.GRI == None ? "None" : String(WorldInfo.GRI.class));
|
||||||
|
WriteToChatLocalized(
|
||||||
|
CTI_IncompatibleGRIWarning,
|
||||||
|
class'KFLocalMessage'.default.InteractionColor);
|
||||||
|
}
|
||||||
|
|
||||||
ClearTimer(nameof(KeepNotification));
|
ClearTimer(nameof(KeepNotification));
|
||||||
ShowReadyButton();
|
ShowReadyButton();
|
||||||
|
|
||||||
Cleanup();
|
Cleanup();
|
||||||
|
|
||||||
SafeDestroy();
|
SafeDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,4 +326,5 @@ defaultproperties
|
|||||||
|
|
||||||
NotificationPercent = 0
|
NotificationPercent = 0
|
||||||
WaitingGRI = 0
|
WaitingGRI = 0
|
||||||
|
WaitingGRILimit = 15
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user