private void ApplyOverlays(ChaClothesComponent clothesCtrl) { if (CurrentOverlayTextures == null) { return; } var clothesName = clothesCtrl.name; var rendererArrs = GetRendererArrays(clothesCtrl); if (_dumpCallback != null && _dumpClothesId == clothesName) { DumpBaseTextureImpl(rendererArrs); } if (CurrentOverlayTextures.Count == 0) { return; } if (!CurrentOverlayTextures.TryGetValue(clothesName, out var overlay) || overlay == null) { return; } var applicableRenderers = GetApplicableRenderers(rendererArrs).ToList(); if (applicableRenderers.Count == 0) { Logger.Log(MakerAPI.InsideMaker ? LogLevel.Warning | LogLevel.Message : LogLevel.Debug, $"[KCOX] Removing unused overlay for {clothesName}"); Destroy(overlay.Texture); CurrentOverlayTextures.Remove(clothesName); return; } foreach (var renderer in applicableRenderers) { var mat = renderer.material; var mainTexture = (RenderTexture)mat.mainTexture; if (mainTexture == null) { return; } if (overlay.Override) { var rta = RenderTexture.active; RenderTexture.active = mainTexture; GL.Clear(false, true, Color.clear); RenderTexture.active = rta; } if (overlay.Texture != null) { KoiSkinOverlayController.ApplyOverlay(mainTexture, overlay.Texture); } } }
protected override void OnReload(GameMode currentGameMode, bool maintainState) { KSOXController = CharacterApi.GetRegisteredBehaviour(typeof(KoiSkinOverlayController)).Instances.Where(x => x.ChaControl == base.ChaControl).Single() as KoiSkinOverlayController; BackCoordinateType = CurrentCoordinate.Value; //Maker沒有打勾就不載入 if (!CheckLoad(true)) { return; } LoadingLock = true; UpdateOldGUIDSaveData((ChaFile)ChaFileControl); OverlayTable.Clear(); IrisDisplaySide = new int[] { 0, 0, 0, 0, 0, 0, 0 }; PluginData data = GetExtendedData(); if (null != data && data.version != 3) { UpdateOldVersionSaveData(data); } else { ReadPluginData(data); } Logger.LogDebug($"{ChaFileControl.parameter.fullname} Load Extended Data"); OverwriteOverlay(); LoadingLock = false; UpdateInterface(); }
private void SetupEyeInterface(RegisterSubCategoriesEvent e, KK_CharaOverlaysBasedOnCoordinate owner) { CharaOverlaysBasedOnCoordinateController controller = MakerAPI.GetCharacterControl().gameObject.GetComponent <CharaOverlaysBasedOnCoordinateController>(); KoiSkinOverlayController KSOXController = MakerAPI.GetCharacterControl().gameObject.GetComponent <KoiSkinOverlayController>(); MakerCategory irisCategory = MakerConstants.Face.Iris; MakerCategory eyeCategory = new MakerCategory(irisCategory.CategoryName, "tglEyeOverlayKSOX", irisCategory.Position + 5, "Iris Overlays"); e.AddSubCategory(eyeCategory); e.AddControl(new MakerButton("Copy iris overlay to all outfits", eyeCategory, owner)) .OnClick.AddListener(delegate() { controller.CopyOverlayToAllOutfits(TexType.EyeOver); controller.CopyOverlayToAllOutfits(TexType.EyeUnder); Logger.LogMessage("[Chara Overlays Based On Coordinate] Successfully copied iris overlay"); } ); IrisSideRadioBtn = new MakerRadioButtons(eyeCategory, owner, "Side to display", "Both", "Left", "Right"); e.AddControl(IrisSideRadioBtn) .ValueChanged.Subscribe(side => { controller.ChangeIrisDisplayside(side); //Logger.LogDebug("Changed RadioBtn: " + side); } ); }
public void ChangeOutfit(bool reset = false) { if (!_initialized) { ChaControl chaCtrl = ChaCtrl; kkabmx = chaCtrl.GetComponent <BoneController>(); kcox = chaCtrl.GetComponent <KoiClothesOverlayController>(); ksox = chaCtrl.GetComponent <KoiSkinOverlayController>(); _initialized = true; } _lastRedressLocation = CharaBase.mapNo; ChangeOutfit_Internal(reset); }
protected override void Start() { _ksox = GetComponent <KoiSkinOverlayController>(); base.Start(); }
private void ApplyOverlays(CmpClothes clothesCtrl) { if (CurrentOverlayTextures == null) { return; } var clothesName = clothesCtrl.name; var rendererArrs = GetRendererArrays(clothesCtrl); if (_dumpCallback != null && _dumpClothesId == clothesName) { DumpBaseTextureImpl(rendererArrs); } if (CurrentOverlayTextures.Count == 0) { return; } if (!CurrentOverlayTextures.TryGetValue(clothesName, out var overlay)) { return; } if (overlay == null || overlay.IsEmpty()) { return; } var applicableRenderers = GetApplicableRenderers(rendererArrs).ToList(); if (applicableRenderers.Count == 0) { if (MakerAPI.InsideMaker) { KoiSkinOverlayMgr.Logger.LogMessage($"Removing unused overlay for {clothesName}"); } else { KoiSkinOverlayMgr.Logger.LogDebug($"Removing unused overlay for {clothesName}"); } overlay.Dispose(); CurrentOverlayTextures.Remove(clothesName); return; } foreach (var renderer in applicableRenderers) { var mat = renderer.material; var mainTexture = mat.mainTexture as RenderTexture; if (mainTexture == null) { return; } if (overlay.Override) { var rta = RenderTexture.active; RenderTexture.active = mainTexture; GL.Clear(false, true, Color.clear); RenderTexture.active = rta; } if (overlay.Texture != null) { KoiSkinOverlayController.ApplyOverlay(mainTexture, overlay.Texture); } } }