Example #1
0
        private static void AddConfigSettings(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner, MakerCategory makerCategory)
        {
            var tWatch = e.AddControl(new MakerToggle(makerCategory, "Watch last loaded texture file for changes", owner));

            tWatch.Value = WatchLoadedTexForChanges.Value;
            tWatch.ValueChanged.Subscribe(b => WatchLoadedTexForChanges.Value = b);
        }
        private void SetupBodyInterface(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner)
        {
            var paintCategory = MakerConstants.Body.Paint;
            var makerCategory = new MakerCategory(paintCategory.CategoryName, "tglOverlayKSOX", paintCategory.Position + 5, "Skin Overlays");

            e.AddSubCategory(makerCategory);

            e.AddControl(new MakerButton("Get face overlay template", makerCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(Resources.face));
            e.AddControl(new MakerButton("Get body overlay template", makerCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(Resources.body));

            AddConfigSettings(e, owner, makerCategory);

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.FaceOver, "Face overlay texture (On top of almost everything)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.BodyOver, "Body overlay texture (On top of almost everything)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.FaceUnder, "Face underlay texture (Under tattoos, blushes, etc.)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.BodyUnder, "Body underlay texture (Under tattoos, blushes, etc.)");
        }
        private static void AddConfigSettings(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner, MakerCategory makerCategory)
        {
            var tWatch = e.AddControl(new MakerToggle(makerCategory, "Watch last loaded texture file for changes", owner));

            tWatch.Value = WatchLoadedTexForChanges.Value;
            tWatch.ValueChanged.Subscribe(b => WatchLoadedTexForChanges.Value = b);

#if KK
            var id      = _tPerCoord[0] == null ? 0 : 1;
            var otherId = _tPerCoord[0] == null ? 1 : 0;
            _tPerCoord[id] = e.AddControl(new MakerToggle(makerCategory, "Use different overlays per outfit", owner));
            _tPerCoord[id].BindToFunctionController <KoiSkinOverlayController, bool>(c => c.OverlayStorage.IsPerCoord(),
                                                                                     (c, value) =>
            {
                if (!value)
                {
                    c.OverlayStorage.CopyToOtherCoords();
                }
                _tPerCoord[otherId].SetValue(value, false);
            });

            e.AddControl(new MakerText("When off, there is a single set of overlays for all outfits. When on, each outfit has its own set of skin overlays.", makerCategory, owner)
            {
                TextColor = MakerText.ExplanationGray
            });
#endif
        }
        private void SetupEyeInterface(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner)
        {
#if KK || EC
            var irisCategory     = MakerConstants.Face.Iris;
            var eyeCategory      = new MakerCategory(irisCategory.CategoryName, "tglEyeOverlayKSOX", irisCategory.Position + 5, "Iris Overlays");
            var irisTemplateName = "Get iris overlay template";
#else
            var eyeCategory      = new MakerCategory(MakerConstants.Face.CategoryName, "overlayModIris", 11111, "Iris Overlays");
            var irisTemplateName = "Get iris underlay template";
#endif
            e.AddSubCategory(eyeCategory);

            e.AddControl(new MakerButton(irisTemplateName, eyeCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(ResourceUtils.GetEmbeddedResource("eye.png"), "Iris template"));

            AddConfigSettings(e, owner, eyeCategory);

            e.AddControl(new MakerSeparator(eyeCategory, owner));

            SetupTexControls(e, eyeCategory, owner, TexType.EyeOver, "Iris overlay texture (On top of original iris)");

            e.AddControl(new MakerSeparator(eyeCategory, owner));

            SetupTexControls(e, eyeCategory, owner, TexType.EyeUnder, "Iris underlay texture (Before coloring and effects)");
        }
Example #5
0
        private void SetupBodyInterface(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner)
        {
            var makerCategory = new MakerCategory(MakerConstants.Body.CategoryName, "overlayMod", 11111, "Skin Overlays");

            e.AddSubCategory(makerCategory);

            e.AddControl(new MakerButton("Get face overlay template", makerCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(ResourceUtils.GetEmbeddedResource("face.png"), "Face template"));
            e.AddControl(new MakerButton("Get body overlay template", makerCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(ResourceUtils.GetEmbeddedResource("body.png"), "Body template"));

            AddConfigSettings(e, owner, makerCategory);

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.FaceOver, "Face overlay texture (On top of almost everything)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.BodyOver, "Body overlay texture (On top of almost everything)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.FaceUnder, "Face underlay texture (Under tattoos, blushes, etc.)");

            e.AddControl(new MakerSeparator(makerCategory, owner));

            SetupTexControls(e, makerCategory, owner, TexType.BodyUnder, "Body underlay texture (Under tattoos, blushes, etc.)");
        }
        private static void AddConfigSettings(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner, MakerCategory makerCategory)
        {
            var tRemove = e.AddControl(new MakerToggle(makerCategory, "Remove overlays imported from BepInEx\\KoiSkinOverlay when saving cards (they are saved inside the card now and no longer necessary)", owner));

            tRemove.Value = RemoveOldFiles.Value;
            tRemove.ValueChanged.Subscribe(b => RemoveOldFiles.Value = b);
            var tWatch = e.AddControl(new MakerToggle(makerCategory, "Watch last loaded texture file for changes", owner));

            tWatch.Value = WatchLoadedTexForChanges.Value;
            tWatch.ValueChanged.Subscribe(b => WatchLoadedTexForChanges.Value = b);
        }
        public Texture ApplyOverlayToTex(Texture bodyTexture, TexType overlayType)
        {
            if (_overlays.TryGetValue(overlayType, out var tex))
            {
                bodyTexture = ApplyOverlay(bodyTexture, KoiSkinOverlayMgr.GetOverlayRT(overlayType), tex);
            }

            foreach (var additionalTexture in AdditionalTextures)
            {
                if (additionalTexture.OverlayType == overlayType && additionalTexture.Texture != null)
                {
                    bodyTexture = ApplyOverlay(bodyTexture, KoiSkinOverlayMgr.GetOverlayRT(overlayType), additionalTexture.Texture);
                }
            }

            return(bodyTexture);
        }
        protected override void OnReload(GameMode currentGameMode)
        {
            if (!KoiSkinOverlayGui.MakerLoadFromCharas)
            {
                return;
            }

            var needsUpdate = _overlays.Any();

            _overlays.Clear();

            var data = GetExtendedData();

            foreach (TexType texType in Enum.GetValues(typeof(TexType)))
            {
                if (texType == TexType.Unknown)
                {
                    continue;
                }

                if (data != null &&
                    data.data.TryGetValue(texType.ToString(), out var texData) &&
                    texData is byte[] bytes)
                {
                    var tex = Util.TextureFromBytes(bytes);
                    if (tex != null)
                    {
                        _overlays.Add(texType, tex);
                        continue;
                    }
                }

                // Fall back to old-style overlays in a folder
                var oldTex = KoiSkinOverlayMgr.GetOldStyleOverlayTex(texType, ChaControl);
                if (oldTex != null)
                {
                    _overlays.Add(texType, oldTex);
                }
            }

            if (needsUpdate || _overlays.Any())
            {
                UpdateTexture(TexType.Unknown);
            }
        }
        private static void ExtendedSaveOnCardBeingSaved(ChaFile chaFile)
        {
            if (!MakerAPI.InsideMaker)
            {
                return;
            }

            if (RemoveOldFiles.Value)
            {
                var ctrl = GetOverlayController();
                foreach (var overlay in ctrl.Overlays)
                {
                    var path = KoiSkinOverlayMgr.GetTexFilename(chaFile.parameter.fullname, overlay.Key);
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                }
            }
        }
        private void SetupEyeInterface(RegisterSubCategoriesEvent e, KoiSkinOverlayMgr owner)
        {
            var irisCategory = MakerConstants.Face.Iris;
            var eyeCategory  = new MakerCategory(irisCategory.CategoryName, "tglEyeOverlayKSOX", irisCategory.Position + 5, "Iris Overlays");

            e.AddSubCategory(eyeCategory);

            e.AddControl(new MakerButton("Get iris overlay template", eyeCategory, owner))
            .OnClick.AddListener(() => WriteAndOpenPng(Resources.eye));

            AddConfigSettings(e, owner, eyeCategory);

            e.AddControl(new MakerSeparator(eyeCategory, owner));

            SetupTexControls(e, eyeCategory, owner, TexType.EyeOver, "Iris overlay texture (On top of original iris)");

            e.AddControl(new MakerSeparator(eyeCategory, owner));

            SetupTexControls(e, eyeCategory, owner, TexType.EyeUnder, "Iris underlay texture (Before coloring and effects)");
        }
Example #11
0
        protected override void OnReload(GameMode currentGameMode, bool maintainState)
        {
            if (maintainState)
            {
                return;
            }

            var needsUpdate = _overlays.Any();

            RemoveAllOverlays(false);

            var data = GetExtendedData();

            foreach (TexType texType in Enum.GetValues(typeof(TexType)))
            {
                if (texType == TexType.Unknown)
                {
                    continue;
                }

                if (data != null &&
                    data.data.TryGetValue(texType.ToString(), out var texData) &&
                    texData is byte[] bytes && bytes.Length > 0)
                {
                    _overlays.Add(texType, new OverlayTexture(bytes));
                    continue;
                }

                // Fall back to old-style overlays in a folder
                var oldTex = KoiSkinOverlayMgr.GetOldStyleOverlayTex(texType, ChaControl);
                if (oldTex != null)
                {
                    _overlays.Add(texType, new OverlayTexture(oldTex));
                }
            }

            if (needsUpdate || _overlays.Any())
            {
                UpdateTexture(TexType.Unknown);
            }
        }