Ejemplo n.º 1
0
 public void Load(Content content)
 {
     content = (Content)((int)content & (int)(byte)((int)available_content & (int)(byte)(~(uint)loaded_content)));
     if ((content & Content.Strings) != 0 && LoadStrings())
     {
         loaded_content |= Content.Strings;
     }
     if ((content & Content.Translation) != 0 && LoadTranslations())
     {
         loaded_content |= Content.Translation;
     }
     if ((content & Content.DLL) != 0 && DLLLoader.LoadDLLs(label.install_path))
     {
         loaded_content |= Content.DLL;
     }
     if ((content & Content.LayerableFiles) != 0)
     {
         FileSystem.file_sources.Insert(0, file_source.GetFileSystem());
         loaded_content |= Content.LayerableFiles;
     }
     if ((content & Content.Animation) != 0 && LoadAnimation())
     {
         loaded_content |= Content.Animation;
     }
 }
Ejemplo n.º 2
0
        public void Load(Content content)
        {
            if ((content & Content.DLL) != 0 && load_user_mod_loader_dll)
            {
                if (!DLLLoader.LoadUserModLoaderDLL())
                {
                    Debug.Log("ModLoader.dll failed to load. Either it is not present or it encountered an error");
                }
                load_user_mod_loader_dll = false;
            }
            foreach (Mod mod in mods)
            {
                if (mod.enabled)
                {
                    mod.Load(content);
                }
            }
            bool flag  = false;
            bool flag2 = IsInDevMode();

            foreach (Mod mod2 in mods)
            {
                Content content2 = mod2.loaded_content & content;
                Content content3 = mod2.available_content & content;
                if (mod2.enabled && content2 != content3)
                {
                    mod2.Crash(!flag2);
                    if (!mod2.enabled)
                    {
                        flag = true;
                        events.Add(new Event
                        {
                            event_type = EventType.Deactivated,
                            mod        = mod2.label
                        });
                    }
                    Debug.LogFormat("Failed to load mod {0}...disabling", mod2.title);
                    events.Add(new Event
                    {
                        event_type = EventType.LoadError,
                        mod        = mod2.label
                    });
                }
            }
            if (flag)
            {
                Save();
            }
        }