本文整理汇总了C#中PlayerSquad.getCount方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerSquad.getCount方法的具体用法?C# PlayerSquad.getCount怎么用?C# PlayerSquad.getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSquad
的用法示例。
在下文中一共展示了PlayerSquad.getCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: listSquad
private void listSquad(PlayerSquad sq) {
List<PlayerProfile> members = sq.getMembers();
DebugWrite("Team(^b" + TN(sq.getTeamId()) + "^n).Squad(^b" + SQN(sq.getSquadId()) + "^n): " + sq.getCount() + " players", 3);
int count = 1;
foreach (PlayerProfile pp in members)
DebugWrite(" " + count++ + ". ^b" + pp + "^n", 3);
}
示例2: shouldSkipClanSquad
private bool shouldSkipClanSquad(PlayerSquad squad, int smaller_team, int bigger_team, Dictionary<string, int>[] clan_stats) {
int squad_sz = squad.getCount();
string tag = squad.getMajorityClanTag();
if (tag.Length > 0 && (clan_stats[bigger_team][tag] + clan_stats[smaller_team][tag]) > 1) {
if (clan_stats[bigger_team][tag] >= clan_stats[smaller_team][tag]) {
DebugWrite("Skipping clan-squad " + squad.ToString() + " because majority of clan is in same team", 3);
return true;
}
/* update clan stats */
clan_stats[bigger_team][tag] -= squad_sz;
clan_stats[smaller_team][tag] += squad_sz;
}
return false;
}
示例3: moveSquad
/* best effort to move an entire squad into another team withouth breaking up */
private int moveSquad(PlayerSquad squad, int teamId, int team_sz) {
int players_moved = 0;
if (squad == null)
return 0;
/* first move all players to the opposite team without squad (to guarantee a spot)*/
int squadId = 0;
int noSquadId = 0;
List<PlayerProfile> squad_players = squad.getMembers();
/* find a squad on teamId with enough space */
List<PlayerSquad> squads = getAllSquads(teamId);
/* find first empty squad */
foreach (PlayerSquad sq in squads) {
if (sq.getCount() == 0) {
DebugWrite("Found empty squad " + sq + ", for " + squad, 3);
while (squad.getCount() > 0) {
PlayerProfile pp = squad.removeRandomPlayer();
DebugWrite("Moving ^b" + pp + "^n to Team(" + TN(teamId) + ").Squad(" + SQN(sq.getSquadId()) + ")", 3);
if (movePlayer(pp, teamId, sq.getSquadId()))
players_moved++;
}
break;
}
}
if (squad.getCount() == 0)
return players_moved;
DebugWrite("^1^bWARNING^0^n: Could not find an empty squad on ^bTeam(" + TN(teamId) + ")^n for " + squad.ToString(), 1);
DebugWrite("Looking now for squads that are not full^n", 1);
/* sort the squads in increasing order of player count */
squads.Sort(new Comparison<PlayerSquad>(squad_count_asc_cmp));
for (int i = 0; i < squads.Count; i++) {
PlayerSquad sorted_squad = squads[i];
if (sorted_squad.getSquadId() > 8)
continue;
if (sorted_squad.getFreeSlots() > 0 && squad_players.Count > 0)
DebugWrite("Found " + sorted_squad.getFreeSlots() + " free slots on " + sorted_squad, 3);
while (sorted_squad.getFreeSlots() > 0 && squad_players.Count > 0) {
PlayerProfile squad_player = squad_players[0];
squad_players.RemoveAt(0);
DebugWrite("Moving ^b" + squad_player + "^n to Team(" + TN(teamId) + ").Squad(" + SQN(sorted_squad.getSquadId()) + ")", 3);
if (movePlayer(squad_player, teamId, sorted_squad.getSquadId()))
players_moved++;
}
}
foreach (PlayerProfile pp in squad_players) {
DebugWrite("^1^bWARNING^0^n: could not find squad on ^bTeam(" + TN(teamId) + ")^n for ^b" + pp + "^n^0", 1);
DebugWrite("Moving ^b" + pp + "^n to Team(" + TN(teamId) + ").Squad(" + SQN(noSquadId) + ")", 3);
if (movePlayer(pp, teamId, noSquadId))
players_moved++;
}
return players_moved;
}
示例4: squad_count_asc_cmp
/* squad comparison methods */
private int squad_count_asc_cmp(PlayerSquad left, PlayerSquad right) {
int lval = left.getCount();
int rval = right.getCount();
return lval.CompareTo(rval);
}