コード例 #1
0
        private void ModChanged()
        {
            try {
                invokeOnModChanged = true;
                arenaModLoader.DisposeWatcher();
                arenaModLoader.BasePath    = modGroup.FullBasePath;
                arenaModLoader.onModLoaded = loadedMod => {
                    arenaMod = loadedMod;
                };
                arenaModLoader.LoadFile();

                modLoader.DisposeWatcher();
                modLoader.BasePath    = modGroup.FullBasePath;
                modLoader.onModLoaded = loadedMod => {
                    mod = loadedMod;
                };
                modLoader.LoadFile();
            } catch (Exception exc) {
                Debug.LogException(exc);
            }
        }
コード例 #2
0
        private void OnModGroupLoaded(ModGroup newModGroup)
        {
            try {
                Log("==================== Mod Group (Re-)loaded ====================");
                Log($"LoadActiveModConfig: Loaded '{modGroupLoader.FullFilePath}', "
                    + $"new mod: {newModGroup.pathToCurrentMod}, "
                    + $"last mod: {modGroup.pathToCurrentMod}");

                string oldMod = modGroup.pathToCurrentMod;
                modGroup = newModGroup;

                if (CheckBasePath())
                {
                    if (modGroup.isGroupActive)
                    {
                        if (initialLoad || modGroup.pathToCurrentMod != oldMod)
                        {
                            initialLoad = false;
                            ModChanged();
                        }
                        else
                        {
                            LogWarning("Current Mod was not changed!");
                        }
                    }
                    else
                    {
                        Log("Mod is not active: Restoring Default");
                        arenaMod = arenaOrig;
                        arenaModLoader.ModChanged = true;
                    }
                }
                else
                {
                    WriteErrorToFile("ActiveModConfig", $"pathToCurrentMod '{newModGroup.FullBasePath}' does not seem to exist!");
                }
            } catch (Exception exc) {
                Debug.LogException(exc);
            }
        }