예제 #1
0
        public static List <MyObjectBuilder_Checkpoint.ModItem> GetLobbyMods(IMyLobby lobby)
        {
            int lobbyModCount = GetLobbyModCount(lobby);
            List <MyObjectBuilder_Checkpoint.ModItem> list = new List <MyObjectBuilder_Checkpoint.ModItem>(lobbyModCount);

            for (int i = 0; i < lobbyModCount; i++)
            {
                string data  = lobby.GetData("mod" + i);
                int    index = data.IndexOf("_");
                if (index == -1)
                {
                    MySandboxGame.Log.WriteLineAndConsole($"Failed to parse mod details from LobbyData. '{data}'");
                }
                else
                {
                    ulong num4;
                    ulong.TryParse(data.Substring(0, index), out num4);
                    string name = data.Substring(index + 1);
                    list.Add(new MyObjectBuilder_Checkpoint.ModItem(name, num4, name));
                }
            }
            return(list);
        }
예제 #2
0
        public static ulong GetLobbyWorldSize(IMyLobby lobby)
        {
            string data = lobby.GetData("worldSize");

            return(string.IsNullOrEmpty(data) ? 0UL : Convert.ToUInt64(data));
        }
예제 #3
0
 public static string GetLobbyWorldName(IMyLobby lobby) =>
 lobby.GetData("world");
예제 #4
0
        public static ulong GetLobbyULong(string key, IMyLobby lobby, ulong defValue)
        {
            ulong num;

            return(!ulong.TryParse(lobby.GetData(key), out num) ? defValue : num);
        }
예제 #5
0
 public static string GetLobbyScenarioBriefing(IMyLobby lobby) =>
 lobby.GetData("scenarioBriefing");
예제 #6
0
        public static int GetLobbyInt(string key, IMyLobby lobby, int defValue)
        {
            int num;

            return(!int.TryParse(lobby.GetData(key), NumberStyles.Integer, CultureInfo.InvariantCulture, out num) ? defValue : num);
        }
예제 #7
0
        public static MyGameModeEnum GetLobbyGameMode(IMyLobby lobby)
        {
            int num;

            return(!int.TryParse(lobby.GetData("gameMode"), out num) ? MyGameModeEnum.Creative : ((MyGameModeEnum)num));
        }
예제 #8
0
 public static string GetLobbyHostName(IMyLobby lobby) =>
 lobby.GetData("host");
예제 #9
0
        public static float GetLobbyFloat(string key, IMyLobby lobby, float defValue)
        {
            float num;

            return(!float.TryParse(lobby.GetData(key), NumberStyles.Float, CultureInfo.InvariantCulture, out num) ? defValue : num);
        }
예제 #10
0
        public static DateTime GetLobbyDateTime(string key, IMyLobby lobby, DateTime defValue)
        {
            DateTime time;

            return(!DateTime.TryParse(lobby.GetData(key), CultureInfo.InvariantCulture, DateTimeStyles.None, out time) ? defValue : time);
        }
예제 #11
0
        public static bool GetLobbyBool(string key, IMyLobby lobby, bool defValue)
        {
            bool flag;

            return(!bool.TryParse(lobby.GetData(key), out flag) ? defValue : flag);
        }
예제 #12
0
        public static int GetLobbyAppVersion(IMyLobby lobby)
        {
            int num;

            return(int.TryParse(lobby.GetData("appVersion"), out num) ? num : 0);
        }
예제 #13
0
 public static string GetDataHash(IMyLobby lobby) =>
 lobby.GetData("dataHash");