Skip to content

Commit

Permalink
Improve logic and add locales
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Dec 17, 2024
1 parent 15db138 commit a823185
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Fika.Core/Coop/GameMode/CoopGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -947,14 +947,15 @@ private GameObject CreateStartButton()
//customButton.gameObject.transform.position = new(customButton.transform.position.x, customButton.transform.position.y - 20, customButton.transform.position.z);
customButton.gameObject.SetActive(true);
DefaultUIButton backButtonComponent = customButton.GetComponent<DefaultUIButton>();
backButtonComponent.SetHeaderText("Start", 32);
backButtonComponent.SetEnabledTooltip("Starts the raid.");
backButtonComponent.SetHeaderText(LocaleUtils.UI_MM_START_BUTTON.Localized(), 32);
backButtonComponent.SetEnabledTooltip(LocaleUtils.UI_START_DESCRIPTION.Localized());
UnityEngine.Events.UnityEvent newEvent = new();
newEvent.AddListener(() =>
{
if (isServer)
{
RaidStarted = true;
FikaBackendUtils.HostExpectedNumberOfPlayers = Singleton<FikaServer>.Instance.NetServer.ConnectedPeersCount;
return;
}

Expand Down Expand Up @@ -1406,13 +1407,16 @@ private async Task WaitForHostToStart()

while (!RaidStarted)
{
await Task.Delay(100);
await Task.Yield();
}

if (startButton != null)
{
Destroy(startButton);
}

SetStatusModel status = new(FikaBackendUtils.GroupId, LobbyEntry.ELobbyStatus.IN_GAME);
await FikaRequestHandler.UpdateSetStatus(status);
return;
}

Expand All @@ -1425,7 +1429,7 @@ private async Task WaitForHostToStart()
client.SendData(ref packet, DeliveryMethod.ReliableUnordered);
while (!RaidStarted)
{
await Task.Delay(100);
await Task.Delay(250);
client.SendData(ref packet, DeliveryMethod.ReliableUnordered);
}

Expand Down Expand Up @@ -1557,11 +1561,7 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I
botsController_0.EventsController.SpawnAction();

FikaPlugin.DynamicAI.SettingChanged += DynamicAI_SettingChanged;
FikaPlugin.DynamicAIRate.SettingChanged += DynamicAIRate_SettingChanged;

SetStatusModel status = new(FikaBackendUtils.GroupId, LobbyEntry.ELobbyStatus.IN_GAME);

await FikaRequestHandler.UpdateSetStatus(status);
FikaPlugin.DynamicAIRate.SettingChanged += DynamicAIRate_SettingChanged;
}

// Add FreeCamController to GameWorld GameObject
Expand Down
5 changes: 2 additions & 3 deletions Fika.Core/Networking/FikaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
using Fika.Core.Coop.Utils;
using Fika.Core.Modding;
using Fika.Core.Modding.Events;
using Fika.Core.Networking.Packets;
using Fika.Core.Utils;
using FlyingWormConsole3;
using HarmonyLib;
using LiteNetLib;
using LiteNetLib.Utils;
Expand Down Expand Up @@ -1062,7 +1060,8 @@ private void OnInformationPacketReceived(InformationPacket packet)
CoopGame coopGame = CoopHandler.LocalGameInstance;
if (coopGame != null)
{
coopGame.RaidStarted = packet.RaidStarted;
coopGame.RaidStarted = packet.RaidStarted;
FikaBackendUtils.HostExpectedNumberOfPlayers = packet.ReadyPlayers;
}
ReadyClients = packet.ReadyPlayers;
HostReady = packet.HostReady;
Expand Down
1 change: 1 addition & 0 deletions Fika.Core/Utils/LocaleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public static bool IsBoss(WildSpawnType wildSpawnType, out string name)
public const string UI_MM_LOADING_HEADER = "F_MMUI_LoadingScreenHeader";
public const string UI_MM_LOADING_DESCRIPTION = "F_MMUI_LoadingScreenDescription";
public const string UI_MM_JOIN_AS_SPECTATOR = "F_MMUI_JoinAsSpectator";
public const string UI_START_DESCRIPTION = "F_UI_StartRaidDescription";
public const string UI_CANNOT_JOIN_RAID_OTHER_MAP = "F_UI_CannotJoinRaidOtherMap";
public const string UI_CANNOT_JOIN_RAID_OTHER_TIME = "F_UI_CannotJoinRaidOtherTime";
public const string UI_CANNOT_JOIN_RAID_SCAV_AS_PMC = "F_UI_CannotJoinRaidScavAsPMC";
Expand Down

0 comments on commit a823185

Please sign in to comment.