Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
新增:
Browse files Browse the repository at this point in the history
- 关闭/启用大厅音乐
- +25模式下向别的玩家发送倒计时:P
  • Loading branch information
Night-GUA committed Jul 30, 2024
1 parent 0d98b3a commit 429e73c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
22 changes: 22 additions & 0 deletions YuEzTools/Patches/OnPlayerJoinedPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Text.RegularExpressions;
using Epic.OnlineServices.Presence;
using InnerNet;
using Steamworks;
using UnityEngine;
using YuEzTools.Get;
using YuEzTools;
Expand Down Expand Up @@ -64,6 +65,8 @@ class InnerNetClientSpawnPatch
{
public static void Postfix([HarmonyArgument(1)] int ownerId, [HarmonyArgument(2)] SpawnFlags flags)
{
if(ServerUpdatePatch.re == 50605450) return;
if(flags != SpawnFlags.IsClientCharacter) return;
ClientData client = GetPlayer.GetClientById(ownerId);
Logger.Msg($"Spawn player data: ID {ownerId}: {client.PlayerName}", "InnerNetClientSpawn");
if (GetPlayer.IsOnlineGame)
Expand Down Expand Up @@ -91,4 +94,23 @@ public static void Postfix([HarmonyArgument(1)] int ownerId, [HarmonyArgument(2)
}, 3.1f, "Send RPC or Sync Lobby Timer");
}
}
}[HarmonyPatch(typeof(LobbyBehaviour))]
public class LobbyBehaviourPatch
{
[HarmonyPatch(nameof(LobbyBehaviour.Update)), HarmonyPostfix]
public static void Update_Postfix(LobbyBehaviour __instance)
{
System.Func<ISoundPlayer, bool> lobbybgm = x => x.Name.Equals("MapTheme");
ISoundPlayer MapThemeSound = SoundManager.Instance.soundPlayers.Find(lobbybgm);
if (!Toggles.CloseMusicOfOr)
{
if (MapThemeSound == null) return;
SoundManager.Instance.StopNamedSound("MapTheme");
}
else
{
if (MapThemeSound != null) return;
SoundManager.Instance.CrossFadeSound("MapTheme", __instance.MapTheme, 0.5f);
}
}
}
2 changes: 2 additions & 0 deletions YuEzTools/Patches/ServerMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace YuEzTools.Patches;
[HarmonyPatch(typeof(Constants), nameof(Constants.GetBroadcastVersion))]
class ServerUpdatePatch
{
public static int re = 50605450;
static void Postfix(ref int __result)
{
if (GetPlayer.IsLocalGame)
Expand All @@ -17,6 +18,7 @@ static void Postfix(ref int __result)
// Changing server version for AU mods
if (Toggles.ServerAllHostOrNoHost)
__result += 25;
re = __result;
Logger.Info($"IsOnlineGame: {__result}", "VersionServer");
}
}
Expand Down
1 change: 1 addition & 0 deletions YuEzTools/Resources/Languages/Chinese Simplified.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ MenuUI.ChangeDownTimerTo114514: "恶搞倒计时"
MenuUI.AutoStartGame: "人满14自动开始游戏"
MenuUI.AbolishDownTimer: "取消倒计时"
MenuUI.ServerAllHostOrNoHost: "+25(房主全权模式)"
MenuUI.CloseMusicOfOr: "大厅音乐"

# MenuUI.ShortcutButton.Left
MenuUI.ShortcutButton.Left: "退出游戏选项卡"
Expand Down
3 changes: 3 additions & 0 deletions YuEzTools/UI/MenuUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ private void Update(){
x => Toggles.DumpLog = x),
new ToggleInfo(Translator.GetString("MenuUI.OpenGameDic"), () => Toggles.OpenGameDic,
x => Toggles.OpenGameDic = x),
new ToggleInfo(Translator.GetString("MenuUI.CloseMusicOfOr"), () => Toggles.CloseMusicOfOr,
x => Toggles.CloseMusicOfOr = x),

}, new List<SubmenuInfo>
{
new SubmenuInfo(Translator.GetString("MenuUI.ShortcutButton.Left"), false, new List<ToggleInfo>()
Expand Down
1 change: 1 addition & 0 deletions YuEzTools/UI/Toggles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Toggles
// 快捷按钮
public static bool DumpLog;
public static bool OpenGameDic;
public static bool CloseMusicOfOr ;

//玩法性-所有人
public static bool ExitGame;
Expand Down

0 comments on commit 429e73c

Please sign in to comment.