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); } } }
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 bool Prefix(MpTeam team, ref Color __result) { if (team < MpTeam.NUM_TEAMS) { return(true); } __result = MPTeams.TeamColor(team, 2); 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; } }
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 Color FlagColorUI(int teamIdx) { return(MPTeams.TeamColor(MPTeams.AllTeams[teamIdx], 1)); }
public static Color FlagColor(int teamIdx) { return(MPTeams.TeamColor(MPTeams.AllTeams[teamIdx], teamIdx == 1 ? 2 : 3)); // make orange a bit darker }
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"); }