Esempio n. 1
0
 private static void ProcessLevel(string path, LevelLocation location)
 {
     try
     {
         Main.SpecialCode = "Loading Level " + path != null ? path : "null";
         if (!path.EndsWith(".lev"))
         {
             return;
         }
         path = path.Replace('\\', '/');
         LevelData dat = location != LevelLocation.Content ? DuckFile.LoadLevel(path) : DuckFile.LoadLevel(DuckFile.ReadEntireStream(TitleContainer.OpenStream(path)));
         if (dat != null)
         {
             dat.SetPath(path);
             path = path.Substring(0, path.Length - 4);
             path.Substring(path.IndexOf("/levels/") + 8);
             if (dat.metaData.guid != null)
             {
                 DuckGame.Content.MapLevel(dat.metaData.guid, dat, location);
             }
         }
         ++MonoMain.loadyBits;
     }
     catch (Exception ex)
     {
         DuckGame.Content.LogLevelFailure(ex.ToString());
     }
 }
Esempio n. 2
0
        private static void ProcessLevel(string path, LevelLocation location)
        {
            Main.SpecialCode = "Loading Level " + path != null ? path : "null";
            if (!path.EndsWith(".lev"))
            {
                return;
            }
            path = path.Replace('\\', '/');
            LevelData levelData = DuckFile.LoadLevel(path);

            levelData.SetPath(path);
            path = path.Substring(0, path.Length - 4);
            path.Substring(path.IndexOf("/levels/") + 8);
            bool flag1 = true;

            if (levelData.modData.workshopIDs.Count != 0)
            {
                foreach (ulong workshopId in levelData.modData.workshopIDs)
                {
                    bool flag2 = false;
                    foreach (Mod accessibleMod in (IEnumerable <Mod>)ModLoader.accessibleMods)
                    {
                        if (accessibleMod.configuration != null && (long)accessibleMod.configuration.workshopID == (long)workshopId)
                        {
                            flag2 = true;
                            break;
                        }
                    }
                    if (!flag2)
                    {
                        flag1 = false;
                        break;
                    }
                }
            }
            if (flag1 && !levelData.modData.hasLocalMods)
            {
                RandomLevelDownloader._readyLevels.Add(levelData);
                DevConsole.Log(DCSection.Steam, "Downloaded random level " + RandomLevelDownloader._readyLevels.Count.ToString() + "/" + RandomLevelDownloader.numToHaveReady.ToString());
            }
            else
            {
                DevConsole.Log(DCSection.Steam, "Downloaded level had mods, and was ignored!");
            }
        }