internal static int GetCurrentAccSlot() { int _slotIndex = -1; foreach (Transform _child in _accMenuTree) { if (!_child.gameObject.activeSelf) { break; } Toggle _toggle = _child.GetComponent <Toggle>(); if (_toggle == null) { break; } if (_toggle.isOn) { CvsAccessory _cmp = _toggle.GetComponentInChildren <CvsAccessory>(true); if (_cmp != null) { _slotIndex = (int)_cmp.slotNo; } break; } } return(_slotIndex); }
public static void UpdateSelectAccessoryKindPostfix(CvsAccessory __instance, ref int __state) { // Only send the event if the kind actually changed if (__state != GetPartsInfo((int)__instance.slotNo).id) { OnAccessoryKindChanged(__instance, (int)__instance.slotNo); } }
private static void CvsAccessory_UpdateSelectAccessoryKind_Postfix(CvsAccessory __instance, ref int __state) { // Only send the event if the kind actually changed if (__state != Accessory.GetPartsInfo(ChaControl, (int)__instance.slotNo).id) { OnAccessoryKindChanged?.Invoke(__instance, new AccessoryKindChangedEventArgs((int)__instance.slotNo)); } }
internal static void MoreAccessories_UpdateMakerUI_Postfix() { CvsAccessory _cvsAccessory = GetCvsAccessory(CurrentAccssoryIndex); if (_cvsAccessory == null || !_cvsAccessory.transform.parent.gameObject.activeSelf) { OnSelectedMakerSlotChanged?.Invoke(null, new SelectedMakerSlotChangedEventArgs(CurrentAccssoryIndex, -1)); } }
public static void UpdateSelectAccessoryKindPostfix(CvsAccessory __instance, ref int __state) { // Only send the event if the kind actually changed if (__state != GetPartsInfo((int)__instance.slotNo).id) { OnAccessoryKindChanged(__instance, (int)__instance.slotNo); } AutomaticControlVisibility();//used to tell non-automated plugins that accessory kind has changed }
/// <summary> /// Shows the accessory color controls for the current slot /// </summary> internal static void ShowAccColors(bool showButton) { if (!MakerAPI.InsideAndLoaded) { return; } CvsAccessory cvsAccessory = AccessoriesApi.GetMakerAccessoryPageObject(AccessoriesApi.SelectedMakerAccSlot).GetComponent <CvsAccessory>(); cvsAccessory.ChangeUseColorVisible(); Traverse.Create(cvsAccessory).Field("btnInitColor").GetValue <Button>().transform.parent.gameObject.SetActive(showButton); }
internal void Init(int _topIndex) { TopIndex = _topIndex; if (TopIndex == 4) { CvsAccessory _cvsAccessory = gameObject.GetComponentInChildren <CvsAccessory>(true); if (_cvsAccessory != null) { SlotIndex = (int)_cvsAccessory.slotNo; } else { SlotIndex = -1; } } }
internal static bool CvsAccessory_UpdateCustomUI_Prefix(CvsAccessory __instance) { int _slotIndex = (int)__instance.slotNo; if (_slotIndex < 0) { return(false); } ChaFileAccessory.PartsInfo _part = CustomBase.Instance.chaCtrl.GetPartsInfo(_slotIndex); __instance.CalculateUI(); //__instance.Field<CvsDrawCtrl>("cmpDrawCtrl").UpdateAccessoryDraw(); int _value = 0; if (_part != null) { _value = _part.type - 120; } Traverse _traverse = Traverse.Create(__instance); _traverse.Field("ddAcsType").GetValue <TMP_Dropdown>().value = _value; __instance.UpdateAccessoryKindInfo(); __instance.UpdateAccessoryParentInfo(); __instance.UpdateAccessoryMoveInfo(); __instance.ChangeSettingVisible(_value != 0); _traverse.Field("separateColor").GetValue <GameObject>().SetActiveIfDifferent(false); _traverse.Field("separateCorrect").GetValue <GameObject>().SetActiveIfDifferent(false); Transform _parent = CvsScrollable ? __instance.transform.GetChild(0).GetChild(0).GetChild(0) : __instance.transform; _parent.Find("objController01/Controller/imgSeparete").gameObject.SetActiveIfDifferent(_traverse.Field("objControllerTop02").GetValue <GameObject>().activeSelf); return(false); }
/// <summary> /// Updates the specified hair accessory /// </summary> public void UpdateAccessory(int slot, bool updateCharacter = true) { if (!IsHairAccessory(slot)) { return; } var acc = ChaControl.GetAccessoryObject(slot); if (acc == null) { return; } ChaAccessoryComponent chaAccessoryComponent = acc.GetComponent <ChaAccessoryComponent>(); if (chaAccessoryComponent == null) { return; } ChaCustomHairComponent chaCustomHairComponent = chaAccessoryComponent.gameObject.GetComponent <ChaCustomHairComponent>(); if (chaCustomHairComponent.rendHair == null) { return; } if (!HairAccessories.ContainsKey(CurrentCoordinateIndex)) { return; } if (!HairAccessories[CurrentCoordinateIndex].TryGetValue(slot, out var hairAccessoryInfo)) { return; } if (chaAccessoryComponent.rendNormal == null) { return; } if (chaCustomHairComponent.rendHair == null) { return; } if (updateCharacter && hairAccessoryInfo.ColorMatch) { if (MakerAPI.InsideAndLoaded) { CvsAccessory cvsAccessory = AccessoriesApi.GetMakerAccessoryPageObject(slot).GetComponent <CvsAccessory>(); cvsAccessory.UpdateAcsColor01(ChaControl.chaFile.custom.hair.parts[0].baseColor); cvsAccessory.UpdateAcsColor02(ChaControl.chaFile.custom.hair.parts[0].startColor); cvsAccessory.UpdateAcsColor03(ChaControl.chaFile.custom.hair.parts[0].endColor); OutlineColorPicker.SetValue(slot, ChaControl.chaFile.custom.hair.parts[0].outlineColor, false); hairAccessoryInfo.OutlineColor = ChaControl.chaFile.custom.hair.parts[0].outlineColor; } else { for (var i = 0; i < chaCustomHairComponent.rendHair.Length; i++) { Renderer renderer = chaCustomHairComponent.rendHair[i]; if (renderer == null) { continue; } if (renderer.sharedMaterial.HasProperty(ChaShader._Color)) { renderer.sharedMaterial.SetColor(ChaShader._Color, ChaControl.chaFile.custom.hair.parts[0].baseColor); } if (renderer.sharedMaterial.HasProperty(ChaShader._Color2)) { renderer.sharedMaterial.SetColor(ChaShader._Color2, ChaControl.chaFile.custom.hair.parts[0].startColor); } if (renderer.sharedMaterial.HasProperty(ChaShader._Color3)) { renderer.sharedMaterial.SetColor(ChaShader._Color3, ChaControl.chaFile.custom.hair.parts[0].endColor); } } } } Texture2D texHairGloss = (Texture2D)AccessTools.Property(typeof(ChaControl), "texHairGloss").GetValue(ChaControl, null); for (var i = 0; i < chaCustomHairComponent.rendHair.Length; i++) { Renderer renderer = chaCustomHairComponent.rendHair[i]; if (renderer == null) { continue; } if (renderer.sharedMaterial.HasProperty(ChaShader._HairGloss)) { if (hairAccessoryInfo.HairGloss) { renderer.sharedMaterial.SetTexture(ChaShader._HairGloss, texHairGloss); } else { renderer.sharedMaterial.SetTexture(ChaShader._HairGloss, null); } } if (renderer.sharedMaterial.HasProperty(ChaShader._LineColor)) { if (hairAccessoryInfo.ColorMatch) { renderer.sharedMaterial.SetColor(ChaShader._LineColor, ChaControl.chaFile.custom.hair.parts[0].outlineColor); } else { renderer.sharedMaterial.SetColor(ChaShader._LineColor, hairAccessoryInfo.OutlineColor); } } } for (var i = 0; i < chaCustomHairComponent.rendAccessory.Length; i++) { Renderer renderer = chaCustomHairComponent.rendAccessory[i]; if (renderer == null) { continue; } if (renderer.sharedMaterial.HasProperty(ChaShader._Color)) { renderer.sharedMaterial.SetColor(ChaShader._Color, hairAccessoryInfo.AccessoryColor); } if (renderer.sharedMaterial.HasProperty(ChaShader._Color2)) { renderer.sharedMaterial.SetColor(ChaShader._Color2, hairAccessoryInfo.AccessoryColor); } if (renderer.sharedMaterial.HasProperty(ChaShader._Color3)) { renderer.sharedMaterial.SetColor(ChaShader._Color3, hairAccessoryInfo.AccessoryColor); } } chaCustomHairComponent.lengthRate = hairAccessoryInfo.HairLength; }
public static void UpdateSelectAccessoryKindPrefix(CvsAccessory __instance, ref int __state) { // Used to see if the kind actually changed __state = GetPartsInfo((int)__instance.slotNo).id; }
private static void CvsAccessory_UpdateSelectAccessoryParent_Postfix(CvsAccessory __instance, ref string __state) { ChaFileAccessory.PartsInfo _part = Accessory.GetPartsInfo(ChaControl, (int)__instance.slotNo); OnAccessoryParentChanged?.Invoke(__instance, new AccessoryParentChangedEventArgs((int)__instance.slotNo, __state, _part.parentKey, _part)); }
private static void CvsAccessory_UpdateSelectAccessoryParent_Prefix(CvsAccessory __instance, ref string __state) { __state = Accessory.GetPartsInfo(ChaControl, (int)__instance.slotNo).parentKey; }
private static void CvsAccessory_UpdateSelectAccessoryType_Prefix(CvsAccessory __instance, ref int __state) { __state = Accessory.GetPartsInfo(ChaControl, (int)__instance.slotNo).type; }
private static void CvsAccessory_UpdateSelectAccessoryKind_Prefix(CvsAccessory __instance, ref int __state) { // Used to see if the kind actually changed __state = Accessory.GetPartsInfo(ChaControl, (int)__instance.slotNo).id; }
public static void UpdateSelectAccessoryKindPostfix(CvsAccessory __instance) { OnAccessoryKindChanged(__instance, (int)__instance.slotNo); }