Example #1
0
        private async Task <InstallInfo> UpdateModConfiguration(ModInstallationData mod, bool install)
        {
            if (!CheckSteamPathSettings())
            {
                throw new System.Exception("Cannot apply mods if the steam installation path has not been set");
            }

            var configuration = new Configuration()
            {
                SteamInstallationPath = Settings.SteamInstallationPath
            };
            var allMods = new List <ModInstallationData>(Settings.InstalledMods);

            if (install)
            {
                allMods.Add(mod);
            }
            else
            {
                allMods.Remove(mod);
            }

            var gameModifications = allMods.Select(i => new GameModification()
            {
                Config     = GetMod(i.ModID),
                Parameters = i.Parameters
            }).ToArray();

            var modUtility = new ModUtility(configuration);
            var result     = await modUtility.ApplyChanges(gameModifications, false);

            switch (result)
            {
            case InstallationStatus.Success:
                Settings.InstalledMods = allMods;
                break;

            case InstallationStatus.FatalError:
                // We remove all installed mods in this instance (something really bad has happened)
                Settings.InstalledMods.Clear();
                break;
            }

            Settings.FileModifications.Clear();
            Settings.FileModifications.AddRange(modUtility.modifications);

            SaveSettings();

            return(new InstallInfo(result, modUtility.conflicts));
        }
Example #2
0
 void InitFont()
 {
     windowId = ModUtility.GetWindowId();
     uiRect   = new Rect(Screen.width - 750, Screen.height - 800, 0f, 0f);
     // load console font
     textStyle          = new GUIStyle(GUI.skin.textArea);
     textStyle.wordWrap = false;
     //textStyle.richText = true;
     try
     {
         var text = GameObject.Find(@"_PERSISTENT/Canvas/ConsoleView/ConsoleViewContainer/Content/Scroll View/Viewport/Content/LogText")?.GetComponent <UnityEngine.UI.Text>();
         textStyle.font = text.font;
     }
     catch (Exception e)
     {
         Debug.LogWarning("Load console font failed: " + e);
     }
 }
        private async Task UpdateModConfiguration()
        {
            if (!CheckSteamPathSettings())
            {
                throw new System.Exception("Cannot apply mods if the steam installation path has not been set");
            }

            var configuration = new Configuration()
            {
                SteamInstallationPath = Settings.SteamInstallationPath
            };
            var characterModifications = Settings.InstalledCharacterMods.Select(i => new CharacterModification()
            {
                Config = AvailableCharacterMods.First(c => c.ModID == i.ModID),
                ReplacementCharacter = i.ReplacementCharacterID
            }).ToArray();

            await ModUtility.ApplyChanges(configuration, characterModifications);
        }
Example #4
0
 // メソッド
 public void Awake()
 {
     // 他のmodのGUIと競合しないwindow IDを生成する(呪文だと思ってOK)
     windowId = ModUtility.GetWindowId();
 }
        public void Setup(Camera source, Portal portal, Portal otherPortal, int[] remove, int[] add, PortalCameraControl par = null, float nearclipoffset = 0f, bool ignoreFog = false)
        {
            if (par)
            {
                hasParent    = true;
                parentCamera = par;
            }
            setUp               = true;
            this.source         = source;
            this.portal         = portal;
            this.otherPortal    = otherPortal;
            this.nearClipOffset = nearclipoffset;

            if (portalDummy == null)
            {
                portalDummy        = new GameObject(portal.name + " Dummy").transform;
                portalDummy.parent = portal.transform;
            }
            if (otherDummy == null)
            {
                otherDummy        = new GameObject(otherPortal.name + " Dummy").transform;
                otherDummy.parent = otherPortal.transform;
            }

            camera = gameObject.AddComponent <Camera>();
            camera.CopyFrom(Camera.main);
            int i;

            for (i = 0; i < remove.Length; i++)
            {
                camera.cullingMask = VidyaMod.RemoveFromLayerMask(camera.cullingMask, remove[i]);
                //camera.cullingMask = camera.cullingMask & ~(1 << remove[i]);//remove layer
            }
            for (i = 0; i < add.Length; i++)
            {
                camera.cullingMask = VidyaMod.AddToLayerMask(camera.cullingMask, add[i]);
                //camera.cullingMask = camera.cullingMask | (1 << add[i]);//add
            }
            camera.depth = -2;

            sourceBloom = Camera.main.GetComponent <BloomAndLensFlares>();
            sourceSsao  = Camera.main.GetComponent <SSAOPro>();
            sourceAa    = Camera.main.GetComponent <AntialiasingAsPostEffect>();
            sourceFog   = Camera.main.GetComponent <ColorfulFog>();

            bloom = ModUtility.CopyComponent <BloomAndLensFlares>(sourceBloom, gameObject);
            ssao  = ModUtility.CopyComponent <SSAOPro>(sourceSsao, gameObject);
            aa    = ModUtility.CopyComponent <AntialiasingAsPostEffect>(sourceAa, gameObject);
            fog   = ModUtility.CopyComponent <ColorfulFog>(sourceFog, gameObject);

            bloom.enabled = false;
            ssao.enabled  = sourceSsao.enabled;
            aa.enabled    = sourceAa.enabled;
            fog.enabled   = sourceFog.enabled;

            layer   = add[0];
            ignored = ignoreFog;
            ProcessFog();

            UpdateFOV();
            ReferenceMaster.onFOVChanged += UpdateFOV;
        }