Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Commit

Permalink
fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyl18 committed Feb 19, 2018
1 parent 9483ab5 commit ac19930
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 10 additions & 2 deletions CardSharp/GameComponents/Desk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GameState State
case LandlordDiscuss _:
return GameState.DiscussLandlord;
case CommandParser _:
return GameState.StartGame;
return GameState.Gaming;
}

return GameState.Unknown;
Expand Down Expand Up @@ -322,14 +322,22 @@ public override bool Equals(object obj)
{
return !(desk1 == desk2);
}

public void BoardcastDesks()
{
foreach (var pair in Desks.Where(desk => desk.Value.State == GameState.Gaming))
{
AddMessageLine($"群{pair.Key}正在游戏中");
}
}
}


public enum GameState
{
Wait,
DiscussLandlord,
StartGame,
Gaming,
Unknown
}
}
1 change: 1 addition & 0 deletions CardSharp/GameSteps/CommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public void Parse(Desk desk, Player player, string command)
{
if (ParseInternal(desk, player, command)) return;

if (!IsValidPlayer(desk, desk.CurrentPlayer)) return;
if (RunHostedCheck(desk))
return;
if (desk.CurrentRule != null)
Expand Down
5 changes: 4 additions & 1 deletion CardSharp/GameSteps/StandardParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Parse(Desk desk, Player player, string command)
desk.AddMessage($"你的积分为 {pconfig.Point}");
break;
case "重新发牌":
if (desk.State == GameState.StartGame || desk.State == GameState.DiscussLandlord)
if (desk.State == GameState.Gaming || desk.State == GameState.DiscussLandlord)
desk.SendCardsMessage();
break;
case "命令列表":
Expand Down Expand Up @@ -109,6 +109,9 @@ 带有[R]的命令 是正式功能,'一般'不会做更改
player.ForceSend = true;
player.AddMessage(string.Join(Environment.NewLine, desk.Players.Select(p => $"{p.PlayerId} {p.Cards.ToFormatString()}")));
break;
case "所有游戏":
desk.BoardcastDesks();
break;
}

if (command.StartsWith("设置积分")) {
Expand Down

0 comments on commit ac19930

Please sign in to comment.