public override void OnChooseGeneralReply(Room room, Interactivity client) { //该模式下玩家完成选将会立即先所有人公布 Player player = room.GetPlayers(client.ClientId)[0]; List <string> options = JsonUntity.Json2List <string>((string)player.GetTag("generals")); List <string> reply = client.ClientReply; bool success = true; string generalName = string.Empty; if (reply == null || reply.Count == 0 || string.IsNullOrEmpty(reply[0])) { success = false; } else { generalName = reply[0]; } if (!success || (!options.Contains(generalName) && room.GetClient(player).UserRight < 3) || (player.Camp == Game3v3Camp.S_CAMP_COOL && Engine.GetGeneral(generalName, room.Setting.GameMode).Kingdom[0] != General.KingdomENUM.Wei) || (player.Camp == Game3v3Camp.S_CAMP_WARM && Engine.GetGeneral(generalName, room.Setting.GameMode).Kingdom[0] != General.KingdomENUM.Qun)) { generalName = options[0]; } player.General1 = generalName; player.ActualGeneral1 = generalName; player.Kingdom = General.GetKingdom(Engine.GetGeneral(generalName, room.Setting.GameMode).Kingdom[0]); player.General1Showed = true; room.BroadcastProperty(player, "General1"); room.BroadcastProperty(player, "Kingdom"); }
public override void OnChooseGeneralReply(Room room, Client client) { Player player = room.GetPlayers(client)[0]; List <string> options = JsonUntity.Json2List <string>((string)player.GetTag("generals")); List <string> reply = client.ClientReply; bool success = true; string generalName = string.Empty; if (reply == null || reply.Count == 0 || string.IsNullOrEmpty(reply[0])) { success = false; } else { generalName = reply[0]; } if (!success || (!options.Contains(Engine.GetMainGeneral(generalName)) && client.UserRight < 3)) { generalName = options[0]; } player.General1 = generalName; player.ActualGeneral1 = generalName; player.Kingdom = Engine.GetGeneral(generalName, room.Setting.GameMode).Kingdom; player.General1Showed = true; room.NotifyProperty(room.GetClient(player), player, "General1"); room.NotifyProperty(room.GetClient(player), player, "Kingdom"); }
public override void OnChooseGeneralReply(Room room, Interactivity client) { Player player = room.GetPlayers(client.ClientId)[0]; List <string> options = JsonUntity.Json2List <string>((string)player.GetTag("generals")); List <string> reply = client.ClientReply; bool success = true; string generalName = string.Empty; if (!client.IsClientResponseReady || reply == null || reply.Count == 0 || string.IsNullOrEmpty(reply[0])) { success = false; } else { generalName = reply[0]; string[] generals = generalName.Split('+'); if (generals.Length != 2) { success = false; } else { General general1 = Engine.GetGeneral(generals[0], "Hegemony"); General general2 = Engine.GetGeneral(generals[1], "Hegemony"); if (general1 == null || general1.Hidden || general2 == null || general2.Hidden || !room.Setting.GeneralPackage.Contains(general1.Package) || !room.Setting.GeneralPackage.Contains(general2.Package) || (!options.Contains(generals[0]) && room.GetClient(player).UserRight < 3) || (!options.Contains(generals[1]) && room.GetClient(player).UserRight < 3) || !SetPlayerGeneral(room, player, generals[0], true) || !SetPlayerGeneral(room, player, generals[1], false)) { success = false; } } } if (!success) { List <string> default_generals = GeneralSelctor.GeInstance().SelectGenerals(room, options); SetPlayerGeneral(room, player, default_generals[0], true); SetPlayerGeneral(room, player, default_generals[1], false); } if (!string.IsNullOrEmpty(player.General1)) { string name = player.General1; string kingdom = General.GetKingdom(Engine.GetGeneral(name, room.Setting.GameMode).Kingdom[0]); room.NotifyProperty(room.GetClient(player), player, "ActualGeneral1", name); room.NotifyProperty(room.GetClient(player), player, "Kingdom", kingdom); } if (!string.IsNullOrEmpty(player.General2)) { room.NotifyProperty(room.GetClient(player), player, "ActualGeneral2", player.General2); } }
public override void OnChooseGeneralReply(Room room, Interactivity client) { Player player = room.GetPlayers(client.ClientId)[0]; List <string> options = JsonUntity.Json2List <string>((string)player.GetTag("generals")); List <string> reply = client.ClientReply; bool success = true; string generalName = string.Empty; if (reply == null || reply.Count == 0 || string.IsNullOrEmpty(reply[0])) { success = false; } else { generalName = reply[0]; } General general = Engine.GetGeneral(generalName, "Doudizhu"); if (!success || general == null || general.Hidden || !room.Setting.GeneralPackage.Contains(general.Package)) { generalName = options[0]; } player.General1 = generalName; player.ActualGeneral1 = generalName; player.Kingdom = Engine.GetGeneral(generalName, room.Setting.GameMode).Kingdom; player.General1Showed = true; room.NotifyProperty(room.GetClient(player), player, "General1"); room.NotifyProperty(room.GetClient(player), player, "Kingdom"); if (player.GetRoleEnum() == PlayerRole.Rebel) { foreach (Player p in room.Players) { if (p != player && p.GetRoleEnum() == player.GetRoleEnum()) { room.NotifyProperty(room.GetClient(p), player, "General1"); room.NotifyProperty(room.GetClient(p), player, "Kingdom"); } } } }