Esempio n. 1
0
        public static void LoadModEndings()
        {
            DirectoryInfo[] directories = new DirectoryInfo(ModConstants.MODS_LOCATION).GetDirectories();
            List <CSecretEndingConditions> modEndingConditions = new List <CSecretEndingConditions>();

            finalScenes.Clear();
            modEndings.Clear();

            foreach (DirectoryInfo directory in directories)
            {
                FileInfo modInfo = directory.GetFiles("*.xml").FirstOrDefault();
                if (modInfo == null)
                {
                    continue;
                }
                CustomEventMod mod = CustomEventMod.Load(modInfo.FullName);
                if (!EventLoader.EventLoader.EventModLoaded(mod))
                {
                    continue;
                }
                string[] files = Directory.GetFiles(directory.FullName + "/EndingConditions", "*.xml");
                foreach (string file in files)
                {
                    GeneralManager.Instance.LogToFileOrConsole("[PromDate] Loading ending conditions from " + file);
                    EndingContainer endingContainer = EndingContainer.Load(file);
                    foreach (Ending ending in endingContainer.Endings)
                    {
                        GeneralManager.Instance.LogToFileOrConsole("\t[PromDate] Loading ending " + ending.SecretEndingName);
                        EventManager.CSecretEndingConditions endCond = EndingContainer.convertEndingConditions(ending, mod);
                        modEndingConditions.Add(endCond);
                        EndingHelper.modEndings.Add(EventManager.Instance.Events[endCond.cSecretEndingIndex]);
                        FinalSceneInfo sceneInfo = new FinalSceneInfo()
                        {
                            FromPromScene = endCond.cSecretEndingIndex, SceneId = endCond.cSecretEndingIndex + 1
                        };
                        if (EventManager.Instance.Events[endCond.cSecretEndingIndex].ArgumentTags.Any(arg => arg.Contains("SFX")))
                        {
                            sceneInfo.AudioClip = EventManager.Instance.Events[endCond.cSecretEndingIndex].ArgumentTags.First(arg => arg.Contains("SFX")).Split('_')[1];
                        }
                        EndingHelper.finalScenes.Add(sceneInfo);
                    }
                }
            }
            EventManager.Instance.SecretEndingsConditions = EventManager.Instance.SecretEndingsConditions.Concat(modEndingConditions.ToArray()).ToArray();
        }
Esempio n. 2
0
 private void InitCustomEvents()
 {
     DirectoryInfo[] modDirectories = (new DirectoryInfo(ModConstants.MODS_LOCATION)).GetDirectories();
     foreach (DirectoryInfo dir in modDirectories)
     {
         string modPath = dir.GetFiles("*.xml").FirstOrDefault().FullName;
         if (String.IsNullOrEmpty(modPath))
         {
             continue;
         }
         CustomEventMod customEvent = CustomEventMod.Load(modPath);
         AudioHelper.Instance.LoadAudio(dir);
         SpriteHelper.LoadSprites(dir);
         EventLoader.LoadNewEvents(dir, customEvent);
         ShopHelper.LoadItemsFromFile(dir, customEvent);
         ProgressTracker.SaveEventModStarted(customEvent);
         EventLoader.CustomEvents.Add(customEvent);
     }
 }