Beispiel #1
0
 private static void Postfix(List <Mission> ___m_mission_list)
 {
     if (NetworkManager.IsHeadless())
     {
         return;
     }
     try
     {
         /*
          * if (VeryClassic.LoadLibrary("VeryClassic.dll") == IntPtr.Zero)
          * {
          *  Debug.Log("Missing VeryClassic.dll");
          *  return;
          * }
          */
         Mission mission = new Mission(MissionType.BUILT_IN, VeryClassic.MissionName, ___m_mission_list.Count);
         mission.m_display_name.Populate("VERY CLASSIC MISSION");
         foreach (var name in VeryClassic.LevelNames)
         {
             mission.AddLevel(name, name, "");
         }
         List <LevelInfo> levels = (List <LevelInfo>) typeof(Mission).GetField("Levels", AccessTools.all).GetValue(mission);
         var num = 0;
         foreach (var level in levels)
         {
             typeof(LevelInfo).GetField("m_loaded_language", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(level, Loc.CurrentLanguageCode);
             typeof(LevelInfo).GetField("m_briefing", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(level, new [] { "" });
             typeof(LevelInfo).GetProperty("DisplayLevelNum", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(level, ++num, null);
             typeof(LevelInfo).GetProperty("FilePath", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SetValue(level, level.FileName, null);
         }
         ___m_mission_list.Add(mission);
     }
     catch (Exception ex)
     {
         Debug.Log(ex);
     }
 }