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
新增两个快捷键
  • Loading branch information
Night-GUA committed Jun 23, 2024
1 parent 6731476 commit c488800
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
27 changes: 16 additions & 11 deletions .idea/.idea.YuAntiCheat/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion YuAntiCheat/BC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static class ChatBubblePatch
public static void SetText_Prefix(ChatBubble __instance, ref string chatText)
{
var sr = __instance.transform.FindChild("Background").GetComponent<SpriteRenderer>();
sr.color = new Color(255, 255, 255,255);// : new Color(1, 1, 1);
sr.color = new Color(0, 0, 0,255);// : new Color(1, 1, 1);
//if (modded)
//{
chatText = ColorString(Color.white, chatText.TrimEnd('\0'));
Expand Down
1 change: 1 addition & 0 deletions YuAntiCheat/GetPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static PlayerControl GetPlayerById(int PlayerId)
public static bool IsInGame => InGame;
public static bool IsMeeting => InGame && MeetingHud.Instance;
public static bool IsLobby => AmongUsClient.Instance.GameState == AmongUsClient.GameStates.Joined;
public static bool IsCountDown => GameStartManager.InstanceExists && GameStartManager.Instance.startState == GameStartManager.StartingStates.Countdown;
public static string GetRealName(this PlayerControl player, bool isMeeting = false)
{
return isMeeting ? player?.Data?.PlayerName : player?.name;
Expand Down
13 changes: 13 additions & 0 deletions YuAntiCheat/Keys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,20 @@ public static void Postfix(ControllerManager __instance)

//-- 下面是主机专用的命令--//
if (!AmongUsClient.Instance.AmHost) return;
//立即开始
if (Input.GetKeyDown(KeyCode.LeftShift) && GetPlayer.IsCountDown)
{
Main.Logger.LogInfo("倒计时修改为0");
GameStartManager.Instance.countDownTimer = 0;
}

//倒计时取消
if (Input.GetKeyDown(KeyCode.C) && GetPlayer.IsCountDown)
{
Main.Logger.LogInfo("重置倒计时");
GameStartManager.Instance.ResetStartState();
SendInGamePatch.SendInGame("取消倒计时");
}
}
public static void DumpLog()
{
Expand Down
2 changes: 1 addition & 1 deletion YuAntiCheat/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte ca
Main.Logger.LogInfo("Host Try murder " + __instance.GetRealName());
MurderHacker.murderHacker(__instance,MurderResultFlags.Succeeded);
}
if(GetPlayer.IsInGame)
if(!GetPlayer.IsLobby)
{
GameManager.Instance.LogicFlow.CheckEndCriteria();
GameManager.Instance.RpcEndGame(GameOverReason.ImpostorDisconnect, false);
Expand Down

0 comments on commit c488800

Please sign in to comment.