static bool Prefix(UIElement __instance, ref Vector2 pos) { if (MPModPrivateData.MatchMode == ExtMatchMode.RACE) { Race.DrawMpMiniScoreboard(ref pos, __instance); return(false); } if (NetworkMatch.GetMode() == MatchMode.ANARCHY || MPTeams.NetworkMatchTeamCount == 2) { return(true); } int match_time_remaining = NetworkMatch.m_match_time_remaining; int match_time = (int)NetworkMatch.m_match_elapsed_seconds; pos.y -= 15f; __instance.DrawDigitsTime(pos + Vector2.right * 95f, (float)match_time_remaining, 0.45f, (match_time <= 10 || match_time_remaining >= 10) ? UIManager.m_col_ui2 : UIManager.m_col_em5, __instance.m_alpha, false); pos.y -= 3f; MpTeam myTeam = GameManager.m_local_player.m_mp_team; foreach (var team in MPTeams.TeamsByScore) { pos.y += 28f; int score = NetworkMatch.GetTeamScore(team); MPTeams.DrawTeamScoreSmall(__instance, pos, team, score, 98f, team == myTeam); } pos.y += 6f; return(false); }
private static void DrawFlagState(UIElement uie, Vector2 pos, float m_alpha, int flag) { var state = CTF.FlagStates[flag]; if (state == FlagState.PICKEDUP) { var pickedupTeamIdx = 1 - flag; UIManager.DrawSpriteUIRotated(pos, 0.4f, 0.4f, Mathf.PI / 2f, MPTeams.TeamColor(MPTeams.AllTeams[pickedupTeamIdx], 4), m_alpha, (int)AtlasIndex0.RING_MED0); UIManager.DrawSpriteUIRotated(pos, 0.18f, 0.18f, Mathf.PI / 2f, MPTeams.TeamColor(MPTeams.AllTeams[flag], 4) * 0.5f, m_alpha, (int)AtlasIndex0.ICON_SECURITY_KEY1); } else { UIManager.DrawSpriteUIRotated(pos, 0.3f, 0.3f, Mathf.PI / 2f, MPTeams.TeamColor(MPTeams.AllTeams[flag], 4) * (state == FlagState.LOST ? 0.2f : 1f), m_alpha, (int)AtlasIndex0.ICON_SECURITY_KEY1); if (state == FlagState.LOST && CTF.ShowReturnTimer) { pos.y += 32f; pos.x += 12f; float t = CTF.FlagReturnTime[flag] - Time.time + 1f; // 'round up' if (t < 0) { t = 0; } uie.DrawDigitsTimeNoHours(pos, t, 0.45f, MPTeams.TeamColor(MPTeams.AllTeams[flag], 4), m_alpha); } } }
public static void Score(Player player) { if (NetworkMatch.m_postgame) { return; } if (!PlayerHasFlag.TryGetValue(player.netId, out int flag) || FlagStates[MPTeams.TeamNum(player.m_mp_team)] != FlagState.HOME) { return; } PlayerHasFlag.Remove(player.netId); if (!SendCTFLose(-1, player.netId, flag, FlagState.HOME, true)) { return; } if (!CTF.CarrierBoostEnabled) { player.c_player_ship.m_boost_overheat_timer = 0; player.c_player_ship.m_boost_heat = 0; } NetworkMatch.AddPointForTeam(player.m_mp_team); NotifyAll(CTFEvent.SCORE, string.Format(Loc.LS("{0} ({1}) CAPTURES THE {2} FLAG!"), player.m_mp_name, MPTeams.TeamName(player.m_mp_team), MPTeams.TeamName(MPTeams.AllTeams[flag])), player, flag); }
static int DrawScoresForTeam(UIElement uie, MpTeam team, ref Vector2 pos) { float m_alpha = (float)AccessTools.Field(typeof(UIElement), "m_alpha").GetValue(uie); List <Player> players = NetworkManager.m_PlayersForScoreboard; List <int> list = new List <int>(); for (int i = 0; i < players.Count; i++) { if (players[i].m_mp_team == team && !players[i].m_spectator) { list.Add(i); } } list.Sort((int a, int b) => players[a].m_kills != players[b].m_kills ? players[b].m_kills.CompareTo(players[a].m_kills) : (players[a].m_assists != players[b].m_assists ? players[b].m_assists.CompareTo(players[a].m_assists) : players[a].m_deaths.CompareTo(players[b].m_deaths)) ); Color color = MPTeams.TeamColor(team, team == GameManager.m_local_player.m_mp_team ? 2 : 0); for (int j = 0; j < list.Count; j++) { Player player = NetworkManager.m_PlayersForScoreboard[list[j]]; var stats = MonsterballAddon.PlayerStats[player.netId]; if (player && !player.m_spectator) { float num = (!player.gameObject.activeInHierarchy) ? 0.3f : 1f; if (j % 2 == 0) { UIManager.DrawQuadUI(pos, 400f, 13f, UIManager.m_col_ub0, m_alpha * num * 0.1f, 13); } if (player.isLocalPlayer) { UIManager.DrawQuadUI(pos, 410f, 12f, color, m_alpha * num * 0.15f, 20); UIManager.DrawQuadUI(pos - Vector2.up * 12f, 400f, 1.2f, color, m_alpha * num * 0.5f, 4); UIManager.DrawQuadUI(pos + Vector2.up * 12f, 400f, 1.2f, color, m_alpha * num * 0.5f, 4); } UIManager.DrawSpriteUI(pos + Vector2.right * (col1 - 35f), 0.11f, 0.11f, color, m_alpha * num, Player.GetMpModifierIcon(player.m_mp_mod1, true)); UIManager.DrawSpriteUI(pos + Vector2.right * (col1 - 15f), 0.11f, 0.11f, color, m_alpha * num, Player.GetMpModifierIcon(player.m_mp_mod2, false)); uie.DrawPlayerNameBasic(pos + Vector2.right * col1, player.m_mp_name, color, player.m_mp_rank_true, 0.6f, num, player.m_mp_platform, col2 - col1 - 10f); uie.DrawDigitsVariable(pos + Vector2.right * col2, stats.Goals, 0.65f, StringOffset.CENTER, color, m_alpha * num); if (MPModPrivateData.AssistScoring) { uie.DrawDigitsVariable(pos + Vector2.right * col3, stats.GoalAssists, 0.65f, StringOffset.CENTER, color, m_alpha * num); } uie.DrawDigitsVariable(pos + Vector2.right * col4, stats.Blunders, 0.65f, StringOffset.CENTER, color, m_alpha * num); uie.DrawDigitsVariable(pos + Vector2.right * col5, player.m_kills, 0.65f, StringOffset.CENTER, color, m_alpha * num); if (MPModPrivateData.AssistScoring) { uie.DrawDigitsVariable(pos + Vector2.right * col6, player.m_assists, 0.65f, StringOffset.CENTER, color, m_alpha * num); } uie.DrawDigitsVariable(pos + Vector2.right * col7, player.m_deaths, 0.65f, StringOffset.CENTER, color, m_alpha * num); uie.DrawDigitsVariable(pos + Vector2.right * col8, player.m_avg_ping_ms, 0.65f, StringOffset.CENTER, uie.GetPingColor(player.m_avg_ping_ms), m_alpha * num); pos.y += 25f; } } return(list.Count); }
static void Prefix(ref MpTeam team, ref int glow_color, ref int decal_color) { if (team == MpTeam.ANARCHY) { return; } glow_color = decal_color = MPTeams.TeamColorIdx(team); team = MpTeam.ANARCHY; // prevent original team color assignment }
static bool Prefix(MpTeam team, ref string __result) { if (team < MpTeam.NUM_TEAMS) { return(true); } __result = MPTeams.TeamName(team) + " TEAM"; return(false); }
static bool Prefix(MpTeam team, ref Color __result) { if (team < MpTeam.NUM_TEAMS) { return(true); } __result = MPTeams.TeamColor(team, 2); return(false); }
static void Postfix(CCInput cc_type) { if (MPObserver.Enabled && GameplayManager.IsMultiplayerActive) { if (cc_type == CCInput.SWITCH_WEAPON && Controls.JustPressed(CCInput.SWITCH_WEAPON)) { MPObserver.SwitchObservedPlayer(false); } if (cc_type == CCInput.PREV_WEAPON && Controls.JustPressed(CCInput.PREV_WEAPON)) { MPObserver.SwitchObservedPlayer(true); } if (cc_type == CCInput.FIRE_WEAPON && Controls.JustPressed(CCInput.FIRE_WEAPON) && MPObserver.ObservedPlayer != null) { MPObserver.SetObservedPlayer(null); } if (cc_type == CCInput.FIRE_MISSILE && Controls.JustPressed(CCInput.FIRE_MISSILE) && MPObserver.ObservedPlayer != null) { MPObserver.ThirdPerson = !MPObserver.ThirdPerson; MPObserver.SetPlayerVisibility(MPObserver.ObservedPlayer, MPObserver.ThirdPerson); GameManager.m_viewer.SetDamageEffects(-999); } if (cc_type == CCInput.SWITCH_MISSILE && Controls.JustPressed(CCInput.SWITCH_MISSILE) && CTF.IsActive) { var player = (from f in CTF.PlayerHasFlag join p in Overload.NetworkManager.m_Players on f.Key equals p.netId where p.m_mp_team == MpTeam.TEAM0 select p).FirstOrDefault(); if (player == null) { GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM0)} player is carrying a flag."); } else { MPObserver.SetObservedPlayer(player); } } if (cc_type == CCInput.PREV_MISSILE && Controls.JustPressed(CCInput.PREV_MISSILE) && CTF.IsActive) { var player = (from f in CTF.PlayerHasFlag join p in Overload.NetworkManager.m_Players on f.Key equals p.netId where p.m_mp_team == MpTeam.TEAM1 select p).FirstOrDefault(); if (player == null) { GameplayManager.AddHUDMessage($"No {MPTeams.TeamName(MpTeam.TEAM1)} player is carrying a flag."); } else { MPObserver.SetObservedPlayer(player); } } } }
static bool Prefix(ref int __result) { if (NetworkMatch.GetMode() == MatchMode.ANARCHY || MPTeams.NetworkMatchTeamCount == 2) { return(true); } __result = MPTeams.HighestScore(); return(false); }
private static bool Prefix(ref int __result) { if (NetworkMatch.GetMode() != CTF.MatchModeCTF) { return(true); } __result = MPTeams.HighestScore(); return(false); }
static bool Prefix(UIElement __instance, ref Vector2 pos) { if (!GameplayManager.IsMultiplayerActive || NetworkMatch.GetMode() == MatchMode.ANARCHY || MPTeams.NetworkMatchTeamCount == 2) { return(true); } var uie = __instance; pos.x -= 4f; pos.y -= 5f; Vector2 temp_pos; temp_pos.y = pos.y; temp_pos.x = pos.x - 100f; uie.DrawStringSmall(NetworkMatch.GetModeString(MatchMode.NUM), temp_pos, 0.4f, StringOffset.LEFT, UIManager.m_col_ub0, 1f, 130f); temp_pos.x = pos.x + 95f; int match_time_remaining = NetworkMatch.m_match_time_remaining; int num3 = (int)NetworkMatch.m_match_elapsed_seconds; uie.DrawDigitsTime(temp_pos, (float)match_time_remaining, 0.45f, (num3 <= 10 || match_time_remaining >= 10) ? UIManager.m_col_ui2 : UIManager.m_col_em5, uie.m_alpha, false); temp_pos.x = pos.x - 100f; temp_pos.y = temp_pos.y - 20f; uie.DrawPing(temp_pos); pos.y += 24f; MpTeam myTeam = GameManager.m_local_player.m_mp_team; foreach (var team in MPTeams.TeamsByScore) { MPTeams.DrawTeamScoreSmall(__instance, pos, team, NetworkMatch.GetTeamScore(team), 98f, team == myTeam); pos.y += 28f; } pos.y += 6f - 28f; pos.y += 22f; pos.x += 100f; uie.DrawRecentKillsMP(pos); if (GameManager.m_player_ship.m_wheel_select_state == WheelSelectState.QUICK_CHAT) { pos.y = UIManager.UI_TOP + 128f; pos.x = -448f; uie.DrawQuickChatWheel(pos); } else { pos.y = UIManager.UI_TOP + 60f; pos.x = UIManager.UI_LEFT + 5f; uie.DrawQuickChatMP(pos); } return(false); }
// pickup of flag item public static bool Pickup(Player player, int flag) { if (flag < 0 || flag >= FlagObjs.Count) { return(false); } var ownFlag = MPTeams.AllTeams[flag] == player.m_mp_team; if (ownFlag && FlagStates[flag] == FlagState.HOME) { if (CTF.PlayerHasFlag.ContainsKey(player.netId)) { CTF.Score(player); } return(false); } if (!ownFlag && (PlayerHasFlag.ContainsKey(player.netId) || PlayerHasFlag.ContainsValue(flag))) { return(false); } // this also sends to 'client 0' so it'll get processed on the server as well CTFEvent evt; if (ownFlag) { SendCTFFlagUpdate(-1, player.netId, flag, FlagState.HOME); SpawnAtHome(flag); evt = CTFEvent.RETURN; } else { SendCTFPickup(-1, player.netId, flag, FlagState.PICKEDUP); if (!CTF.CarrierBoostEnabled) { player.c_player_ship.m_boosting = false; player.c_player_ship.m_boost_overheat_timer = float.MaxValue; } evt = CTFEvent.PICKUP; } var msg = evt == CTFEvent.RETURN ? "{0} RETURNS THE {2} FLAG!" : FlagStates[flag] == FlagState.HOME ? "{0} ({1}) PICKS UP THE {2} FLAG!" : "{0} ({1}) FINDS THE {2} FLAG AMONG SOME DEBRIS!"; CTF.NotifyAll(evt, string.Format(Loc.LS(msg), player.m_mp_name, MPTeams.TeamName(player.m_mp_team), MPTeams.TeamName(MPTeams.AllTeams[flag])), player, flag); if (FlagReturnTimer[flag] != null) { GameManager.m_gm.StopCoroutine(FlagReturnTimer[flag]); FlagReturnTimer[flag] = null; } return(true); }
static bool Prefix(UIElement __instance, Vector2 pos) { if (!MenuManager.mp_display_player_list || ((!NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) || MPTeams.NetworkMatchTeamCount == 2))) // && //NetworkMatch.GetMaxPlayersForMatch() <= 8)) { return(true); } MPTeams.DrawLobby(__instance, pos); return(false); }
static bool Prefix(UIElement __instance, ref Vector2 pos) { var mode = NetworkMatch.GetMode(); var fitSingle = MPTeams.NetworkMatchTeamCount == 2 && NetworkMatch.m_players.Count <= 8; if (MPModPrivateData.MatchMode == ExtMatchMode.RACE) { return(true); } if (mode == MatchMode.ANARCHY || ((mode == MatchMode.TEAM_ANARCHY || mode == MatchMode.MONSTERBALL) && fitSingle)) { return(true); } float colReduce = fitSingle ? 0 : 50f; float col1 = fitSingle ? -330f : -250f; float col2 = 100f - colReduce; float col3 = 190f - colReduce; float col4 = 280f - colReduce; float col5 = 350f - colReduce; MpTeam myTeam = GameManager.m_local_player.m_mp_team; int col = 0; float x = pos.x; float y = pos.y; float[] ys = new float[2] { pos.y, pos.y }; foreach (var team in MPTeams.TeamsByScore) { pos.x = x + (fitSingle ? 0 : col == 0 ? -325f : 325f); pos.y = ys[col]; MPTeams.DrawTeamScore(__instance, pos, team, NetworkMatch.GetTeamScore(team), col5, team == myTeam); pos.y += 35f; if (ys[col] == y || fitSingle) // only draw header for first team in column { MPTeams.DrawScoreHeader(__instance, pos, col1, col2, col3, col4, col5, false); pos.y += 15f; __instance.DrawVariableSeparator(pos, 350f); pos.y += 20f; } int num = MPTeams.DrawScoresForTeam(__instance, team, pos, col1, col2, col3, col4, col5); pos.y += (float)num * 25f + 35f; ys[col] = pos.y; if (!fitSingle) { col = 1 - col; } } pos.y = Mathf.Max(ys[0], ys[1]); return(false); }
static bool Prefix(UIElement __instance) { if (!NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) || (MPTeams.NetworkMatchTeamCount == 2 && NetworkMatch.m_players.Count <= 8)) { return(true); } if (GameManager.m_local_player.m_hitpoints < 0f) { MPTeams.DrawPostgame(__instance); } return(false); }
static void DrawTeamScore(UIElement uie, ref Vector2 pos, MpTeam team, int score, float w = 350f, bool my_team = false) { Color c = MPTeams.TeamColor(team, my_team ? 2 : 0); Color color = MPTeams.TeamColor(team, my_team ? 4 : 2); c.a = uie.m_alpha; if (my_team) { UIManager.DrawQuadBarHorizontal(pos, 18f, 18f, w * 2f, c, 7); } UIManager.DrawQuadBarHorizontal(pos, 15f, 15f, w * 2f, c, 7); uie.DrawDigitsVariable(pos + Vector2.right * w, score, 0.7f, StringOffset.RIGHT, color, uie.m_alpha); uie.DrawStringSmall(NetworkMatch.GetTeamName(team), pos - Vector2.right * (w + 9f), 0.6f, StringOffset.LEFT, color, 1f, -1f); }
private static void SetupMat() { mats = new Material[CTF.TeamCount]; var org_mat = UIManager.gm.m_pull_material; //UIManager.gm.m_damage_material; //UIManager.gm.m_pull_material; for (int i = 0; i < CTF.TeamCount; i++) { var team = MPTeams.AllTeams[i]; var mat = new Material(org_mat.shader); mat.CopyPropertiesFromMaterial(org_mat); mat.SetColor("_EdgeColor", MPTeams.TeamColor(team, 0)); //mat.SetColor("_GlowColor", MPTeams.TeamColor(team, 0)); mats[i] = mat; } }
public static void Score(Player player) { if (NetworkMatch.m_postgame) { return; } if (!PlayerHasFlag.TryGetValue(player.netId, out int flag) || FlagStates[MPTeams.TeamNum(player.m_mp_team)] != FlagState.HOME) { return; } PlayerHasFlag.Remove(player.netId); SendCTFLose(-1, player.netId, flag, FlagState.HOME); SpawnAtHome(flag); NetworkMatch.AddPointForTeam(player.m_mp_team); NotifyAll(CTFEvent.SCORE, string.Format(Loc.LS("{0} ({1}) CAPTURES THE {2} FLAG!"), player.m_mp_name, MPTeams.TeamName(player.m_mp_team), MPTeams.TeamName(MPTeams.AllTeams[flag])), player, flag); }
private static void Postfix() { // for some reason using entity_item_security_key directly doesn't work well in MP, // so take the relatively simple cloak powerup and give it the appearance and type of a security key GameObject prefab = PrefabManager.item_prefabs[(int)ItemPrefab.entity_item_cloak]; var prefabkeyA2 = PrefabManager.item_prefabs[(int)ItemPrefab.entity_item_security_key].GetChildByName("keyA2"); for (int i = 0; i < CTF.TeamCount; i++) { GameObject flag = UnityEngine.Object.Instantiate(prefab, Vector3.zero, Quaternion.identity); UnityEngine.Object.Destroy(flag.GetChildByName("cloak_ball (1)")); var color = CTF.FlagColor(i); var lightColor = MPTeams.TeamColor(MPTeams.AllTeams[i], 5); Material newMat = null; var keyA2 = UnityEngine.Object.Instantiate(prefabkeyA2, flag.transform); foreach (var rend in keyA2.GetComponentsInChildren <MeshRenderer>()) { if (newMat == null) { newMat = new Material(rend.sharedMaterial.shader); newMat.CopyPropertiesFromMaterial(rend.sharedMaterial); newMat.SetColor("_Color", color); newMat.SetColor("_EmissionColor", color); } rend.sharedMaterial = newMat; } var light = flag.GetChildByName("_light").GetComponent <Light>(); light.color = lightColor; //light.intensity = 4.455539f; light.intensity = 2f; light.range = 4f; light.bounceIntensity = 0f; keyA2.GetChildByName("inner_ring001").GetComponent <HighlighterConstant>().color = color; var partRend = keyA2.GetChildByName("outer_ring_004").GetChildByName("_particle1").GetComponent <ParticleSystemRenderer>(); var newPartMat = new Material(partRend.sharedMaterial.shader); newPartMat.CopyPropertiesFromMaterial(partRend.sharedMaterial); newPartMat.SetColor("_CoreColor", color); newPartMat.SetColor("_TintColor", color); partRend.sharedMaterial = newPartMat; if (flag == null) { Debug.LogWarningFormat("CTF: Failed to instantiate prefab: {0} in RegisterSpawnHandlers", prefab.name); return; } var assetId = CTF.FlagAssetId(i); var netId = flag.GetComponent <NetworkIdentity>(); netId.GetType().GetField("m_AssetId", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(netId, assetId); UnityEngine.Object.DontDestroyOnLoad(flag); flag.SetActive(false); var item = flag.GetComponent <Item>(); //item.m_current_segment = -1; //item.m_stationary = false; item.m_index = i; //item.m_light_flicker = 0; item.m_type = ItemType.KEY_SECURITY; item.m_rotate_speed = 180f; item.m_light_flicker = 0.2f; //flag.tag = "Item"; //flag.GetComponent<NetworkIdentity>().a CTF.FlagObjs.Add(flag); //Debug.Log("Flag " + i + " color " + color + " assetid " + flag.GetComponent<NetworkIdentity>().assetId); m_registered_prefabs.Add(assetId, flag); ClientScene.RegisterSpawnHandler(assetId, NetworkSpawnItemHandler, NetworkUnspawnItemHandler); } Debug.Log("CTF: Created " + CTF.FlagObjs.Count + " flag prefabs"); }
public static IEnumerator CreateReturnTimer(int flag) { yield return(new WaitForSeconds(CTF.ReturnTimeAmount)); if (!IsActiveServer || NetworkMatch.m_match_state != MatchState.PLAYING || CTF.FlagStates[flag] != FlagState.LOST) { yield break; } SendCTFLose(-1, default(NetworkInstanceId), flag, FlagState.HOME); foreach (var item in GameObject.FindObjectsOfType <Item>()) { if (item.m_type == ItemType.KEY_SECURITY && item.m_index == flag) { UnityEngine.Object.Destroy(item.gameObject); } } SpawnAtHome(flag); NotifyAll(CTFEvent.RETURN, string.Format(Loc.LS("LOST {0} FLAG RETURNED AFTER TIMER EXPIRED!"), MPTeams.TeamName(MPTeams.AllTeams[flag])), null, flag); FlagReturnTimer[flag] = null; }
public static Color FlagColor(int teamIdx) { return(MPTeams.TeamColor(MPTeams.AllTeams[teamIdx], teamIdx == 1 ? 2 : 3)); // make orange a bit darker }
public static Color FlagColorUI(int teamIdx) { return(MPTeams.TeamColor(MPTeams.AllTeams[teamIdx], 1)); }
public static IEnumerator CreateReturnTimer(int flag) { yield return(new WaitForSeconds(CTF.ReturnTimeAmount)); if (!IsActiveServer || NetworkMatch.m_match_state != MatchState.PLAYING || CTF.FlagStates[flag] != FlagState.LOST) { yield break; } if (!SendCTFLose(-1, default(NetworkInstanceId), flag, FlagState.HOME, true, true)) { yield break; } NotifyAll(CTFEvent.RETURN, string.Format(Loc.LS("LOST {0} FLAG RETURNED AFTER TIMER EXPIRED!"), MPTeams.TeamName(MPTeams.AllTeams[flag])), null, flag); FlagReturnTimer[flag] = null; }
static void DrawDeathSummary(UIElement uie) { Vector2 pos; if (MPDeathReview.stickyDeathReview) { pos = new Vector2(UIManager.UI_LEFT + 160f, UIManager.UI_TOP + 250f); } else { pos = new Vector2((UIManager.UI_LEFT + UIManager.UI_RIGHT) / 2f, UIManager.UI_TOP + 180f); } var killer = Overload.NetworkManager.m_Players.FirstOrDefault(x => x.netId == MPDeathReview.lastDeathReview.m_killer_id); var assister = Overload.NetworkManager.m_Players.FirstOrDefault(x => x.netId == MPDeathReview.lastDeathReview.m_assister_id); var c = UIManager.m_col_red; var alpha_mod = 1f; var w = 120f; if ((!MPDeathReview.stickyDeathReview || MPDeathReview.showDeathReviewDetails) && killer && killer != GameManager.m_local_player) { UIManager.DrawQuadBarHorizontal(pos - Vector2.down * 24f, 103f, 36f, 36f, 0.3f * UIManager.m_col_black, 199); c = NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) ? MPTeams.TeamColor(killer.m_mp_team, 0) : UIManager.m_col_red; var damages = MPDeathReview.lastDeathReview.players.FirstOrDefault(x => x.Key == killer.netId).Value; DrawHeader(uie, pos, $"KILLER: {killer.m_mp_name}", $"[{(damages.Sum(x => x.damage) / MPDeathReview.lastDeathReview.players.SelectMany(x => x.Value).Sum(x => x.damage)):P0}]", w, c, 0.35f); pos.y += 32f; DrawDamageSummary(uie, pos, c, 0.45f, alpha_mod, damages); pos.y += 40f; } if (MPDeathReview.showDeathReviewDetails && assister != null && assister.netId != killer.netId) { UIManager.DrawQuadBarHorizontal(pos - Vector2.down * 24f, 103f, 36f, 36f, 0.3f * UIManager.m_col_black, 199); c = NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) ? MPTeams.TeamColor(assister.m_mp_team, 0) : UIManager.m_col_white; var damages = MPDeathReview.lastDeathReview.players.FirstOrDefault(x => x.Key == assister.netId).Value; DrawHeader(uie, pos, $"ASSIST: {assister.m_mp_name}", $"[{(damages.Sum(x => x.damage) / MPDeathReview.lastDeathReview.players.SelectMany(x => x.Value).Sum(x => x.damage)):P0}]", w, c, 0.35f); pos.y += 32f; DrawDamageSummary(uie, pos, c, 0.45f, alpha_mod, damages); pos.y += 40f; } // Other enemy damage not contributed by killer/assister var otherIds = Overload.NetworkManager.m_Players.Where(x => x.netId != GameManager.m_local_player.netId && x != killer && x != assister && (x.m_mp_team == MpTeam.ANARCHY || x.m_mp_team != GameManager.m_local_player.m_mp_team)).Select(x => x.netId); if (MPDeathReview.showDeathReviewDetails && MPDeathReview.lastDeathReview.players.Any(x => otherIds.Contains(x.Key))) { UIManager.DrawQuadBarHorizontal(pos - Vector2.down * 24f, 103f, 36f, 36f, 0.3f * UIManager.m_col_black, 199); var otherDamages = MPDeathReview.lastDeathReview.players.Where(x => otherIds.Contains(x.Key)).SelectMany(x => x.Value); c = NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) ? MPTeams.TeamColor(GameManager.m_local_player.m_mp_team, 0) : UIManager.m_col_white; DrawHeader(uie, pos, "OTHER", $"[{(otherDamages.Sum(x => x.damage) / MPDeathReview.lastDeathReview.players.SelectMany(x => x.Value).Sum(x => x.damage)):P0}]", w, c, 0.35f); pos.y += 32f; DrawDamageSummary(uie, pos, c, 0.45f, alpha_mod, otherDamages); pos.y += 40f; } // Self and misc damage var selfIds = Overload.NetworkManager.m_Players.Where(x => x.netId == GameManager.m_local_player.netId || (NetworkMatch.GetMode() == MatchMode.TEAM_ANARCHY && x.m_mp_team == GameManager.m_local_player.m_mp_team)).Select(x => x.netId); if ((MPDeathReview.showDeathReviewDetails || killer == GameManager.m_local_player && !MPDeathReview.stickyDeathReview) && MPDeathReview.lastDeathReview.players.Any(x => selfIds.Contains(x.Key))) { UIManager.DrawQuadBarHorizontal(pos - Vector2.down * 24f, 103f, 36f, 36f, 0.3f * UIManager.m_col_black, 199); var selfDamages = MPDeathReview.lastDeathReview.players.Where(x => selfIds.Contains(x.Key)).SelectMany(x => x.Value); c = NetworkMatch.IsTeamMode(NetworkMatch.GetMode()) ? MPTeams.TeamColor(GameManager.m_local_player.m_mp_team, 0) : UIManager.m_col_white; DrawHeader(uie, pos, "SELF/MISC", $"[{(selfDamages.Sum(x => x.damage) / MPDeathReview.lastDeathReview.players.SelectMany(x => x.Value).Sum(x => x.damage)):P0}]", w, c, 0.35f); pos.y += 32f; DrawDamageSummary(uie, pos, c, 0.45f, alpha_mod, selfDamages); pos.y += 40f; } if (MPDeathReview.stickyDeathReview || (!MPDeathReview.showDeathReviewDetails && ((assister != null && assister.netId != killer.netId) || MPDeathReview.lastDeathReview.players.Any(x => otherIds.Contains(x.Key)) || (killer != GameManager.m_local_player && MPDeathReview.lastDeathReview.players.Any(x => selfIds.Contains(x.Key)))))) { if (MPDeathReview.stickyDeathReview && !MPDeathReview.showDeathReviewDetails) { pos.y = 100f; } uie.DrawStringSmall(ScriptTutorialMessage.ControlString(CCInput.USE_BOOST) + " - SHOW MORE DETAILS", pos + Vector2.down * 18f, 0.3f, StringOffset.CENTER, UIManager.m_col_ui5 * 0.7f, alpha_mod, -1f); } }
public static void Drop(Player player) { if (!PlayerHasFlag.TryGetValue(player.netId, out int flag)) { return; } SendCTFLose(-1, player.netId, flag, FlagState.LOST); if (!CTF.CarrierBoostEnabled) { player.c_player_ship.m_boost_overheat_timer = 0; player.c_player_ship.m_boost_heat = 0; } NotifyAll(CTFEvent.DROP, string.Format(Loc.LS("{0} ({1}) DROPPED THE {2} FLAG!"), player.m_mp_name, MPTeams.TeamName(player.m_mp_team), MPTeams.TeamName(MPTeams.AllTeams[flag])), player, flag); if (FlagReturnTimer[flag] != null) { GameManager.m_gm.StopCoroutine(FlagReturnTimer[flag]); } GameManager.m_gm.StartCoroutine(FlagReturnTimer[flag] = CreateReturnTimer(flag)); }
private static string TeamName(MpTeam?team) { return(team == null || team == MpTeam.ANARCHY || team == (MpTeam)(-1) ? null : MPTeams.TeamName((MpTeam)team)); }
static bool Prefix(MpTeam team, ref string __result) { __result = MPTeams.TeamName(team); return(false); }