Example #1
0
 public static JObject GetGameData()
 {
     return(JObject.FromObject(new
     {
         creator = NetworkMatch.m_name.Split('\0')[0],
         forceModifier1 = NetworkMatch.m_force_modifier1 == 4 ? "OFF" : Player.GetMpModifierName(NetworkMatch.m_force_modifier1, true),
         forceModifier2 = NetworkMatch.m_force_modifier2 == 4 ? "OFF" : Player.GetMpModifierName(NetworkMatch.m_force_modifier2, false),
         forceMissile1 = NetworkMatch.m_force_m1.ToString()?.Replace('_', ' '),
         forceMissile2 = NetworkMatch.m_force_m2 == MissileType.NUM ? "NONE" : NetworkMatch.m_force_m2.ToString()?.Replace('_', ' '),
         forceWeapon1 = NetworkMatch.m_force_w1.ToString(),
         forceWeapon2 = NetworkMatch.m_force_w2 == WeaponType.NUM ? "NONE" : NetworkMatch.m_force_w2.ToString(),
         forceLoadout = MenuManager.GetToggleSetting(NetworkMatch.m_force_loadout),
         powerupFilterBitmask = NetworkMatch.m_powerup_filter_bitmask,
         powerupBigSpawn = GetPowerupBigSpawnString(NetworkMatch.m_powerup_big_spawn),
         powerupInitial = GetPowerupInitialString(NetworkMatch.m_powerup_initial),
         turnSpeedLimit = GetTurnSpeedLimitString(NetworkMatch.m_turn_speed_limit),
         powerupSpawn = GetPowerupSpawnString(NetworkMatch.m_powerup_spawn),
         friendlyFire = NetworkMatch.m_team_damage,
         matchMode = GetMatchModeString(NetworkMatch.GetMode()),
         maxPlayers = NetworkMatch.GetMaxPlayersForMatch(),
         showEnemyNames = NetworkMatch.m_show_enemy_names.ToString()?.Replace('_', ' '),
         timeLimit = NetworkMatch.m_match_time_limit_seconds,
         scoreLimit = NetworkMatch.m_match_score_limit,
         respawnTimeSeconds = NetworkMatch.m_respawn_time_seconds,
         respawnShieldTimeSeconds = NetworkMatch.m_respawn_shield_seconds,
         level = GetCurrentLevelName(),
         joinInProgress = MPJoinInProgress.NetworkMatchEnabled,
         rearViewAllowed = RearView.MPNetworkMatchEnabled,
         teamCount = MPTeams.NetworkMatchTeamCount,
         players = NetworkMatch.m_players.Values.Where(x => !x.m_name.StartsWith("OBSERVER")).Select(x => x.m_name),
         hasPassword = MPModPrivateData.HasPassword,
         matchNotes = MPModPrivateData.MatchNotes
                      //Overload.NetworkManager.m_Players.Where(x => !x.m_spectator).Select(x => x.m_mp_name)
     }));
 }
Example #2
0
        public static void DrawLobby(UIElement uie, Vector2 pos)
        {
            float name_offset     = -250f;
            float highlight_width = 285f;
            float org_x           = pos.x;
            int   max_row_count   = NetworkMatch.GetMaxPlayersForMatch() + MPTeams.NetworkMatchTeamCount;
            int   cur_row_count   = NetworkMatch.m_players.Count() + MPTeams.NetworkMatchTeamCount;
            bool  split           = max_row_count > 10;

            if (split)
            {
                pos.x -= 300f;
                pos.y += 50f + 24f;
            }
            float org_y        = pos.y;
            float first_y      = org_y;
            int   rows_per_col = split ? (cur_row_count + 1) / 2 : cur_row_count;
            int   row_num      = 0;

            foreach (var team in Teams)
            {
                if (row_num >= rows_per_col)
                {
                    first_y      = pos.y;
                    pos.x       += 300f * 2;
                    pos.y        = org_y;
                    rows_per_col = cur_row_count; // no more split
                    row_num      = 0;
                }
                DrawTeamHeader(uie, pos, team, 255f);
                pos.y += 24f;
                row_num++;
                int num = 0;
                foreach (var value in NetworkMatch.m_players.Values)
                {
                    if (value.m_team == team)
                    {
                        uie.DrawPlayerName(pos, value, num % 2 == 0, highlight_width, name_offset, -1f);
                        pos.y += 20f;
                        num++;
                        row_num++;
                    }
                }
                pos.y += 10f;
            }
            pos.y = Mathf.Max(first_y, pos.y) + 10f;
            pos.x = org_x;
            if (MenuManager.m_menu_micro_state != 2 && MenuManager.m_mp_private_match)
            {
                float alpha_mod = (MenuManager.m_mp_cst_timer > 0f) ? 0.2f : 1f;
                uie.DrawStringSmall(ScriptTutorialMessage.ControlString(CCInput.MENU_DELETE) + " - " + Loc.LS("CHANGE TEAMS"), pos, 0.45f, StringOffset.CENTER, UIManager.m_col_ui0, alpha_mod, -1f);
            }
        }