internal static void CreateMakerVirtualGroupToggle(string group) { Transform origin = GameObject.Find("tglSlot01/Slot01Top/tglNoShake").transform; Transform copy = Object.Instantiate(origin, GameObject.Find("04_AccessoryTop/AcsMoveWindow01/grpParent").transform, false); copy.GetComponentInChildren <TextMeshProUGUI>().text = (AccParentNames.ContainsKey(group)) ? AccParentNames[group] : group; RectTransform copyRt = copy.GetComponent <RectTransform>(); copyRt.offsetMin = new Vector2(0, AnchorOffsetMinY); copyRt.offsetMax = new Vector2(0, AnchorOffsetMinY + 40); copyRt.transform.name = "tglASS_" + group; Toggle toggle = copy.GetComponentInChildren <Toggle>(); toggle.onValueChanged.RemoveAllListeners(); toggle.image.raycastTarget = true; toggle.graphic.raycastTarget = true; ChaControl chaCtrl = MakerAPI.GetCharacterControl(); AccStateSyncController pluginCtrl = GetController(chaCtrl); pluginCtrl.VirtualGroupNames.Add("tglASS_" + group); toggle.isOn = pluginCtrl.VirtualGroupStates[group]; toggle.onValueChanged.AddListener(_ => { bool show = toggle.isOn; pluginCtrl.ToggleByVirtualGroup(group, show); }); copy.gameObject.SetActive(true); AnchorOffsetMinY -= 40; }
internal static void CreateFreeHbutton(ChaControl chaCtrl, int Heroine, string group, int i) { foreach (HSprite sprite in HSprites) { Transform parent; if (HSceneHeroine.Count() == 2) { parent = (Heroine == 0) ? sprite.lstMultipleFemaleDressButton[0].accessoryAll.transform : sprite.lstMultipleFemaleDressButton[1].accessoryAll.transform; } else { parent = sprite.categoryAccessoryAll.transform; } Transform origin = sprite.categoryAccessory.lstButton[0].transform; Transform copy = Object.Instantiate(origin.transform, parent, false); copy.GetComponentInChildren <TextMeshProUGUI>().text = (AccParentNames.ContainsKey(group)) ? AccParentNames[group] : group; RectTransform copyRt = copy.GetComponent <RectTransform>(); copyRt.offsetMin = new Vector2(0, ContainerOffsetMinY + (MenuitemHeightOffsetY * (i + 1))); // -168 copyRt.offsetMax = new Vector2(112, ContainerOffsetMinY + (MenuitemHeightOffsetY * i)); // -144 copyRt.transform.name = $"btnASS_{Heroine}_{group}"; Button button = copy.GetComponentInChildren <Button>(); button.onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.Off); button.onClick.RemoveAllListeners(); button.onClick = new Button.ButtonClickedEvent(); button.image.raycastTarget = true; button.onClick.AddListener(() => { AccStateSyncController pluginCtrl = GetController(chaCtrl); bool show = !pluginCtrl.VirtualGroupStates[group]; pluginCtrl.ToggleByVirtualGroup(group, show); Illusion.Game.Utils.Sound.Play(Illusion.Game.SystemSE.sel); }); copy.gameObject.SetActive(true); } }
internal static void UpdateStudioUI() { ClearStudioUI(); AccStateSyncController controller = CurOCIChar.charInfo.GetComponent <AccStateSyncController>(); if (controller == null) { return; } int i = 0; Dictionary <string, bool> VirtualGroupStates = controller.VirtualGroupStates; foreach (KeyValuePair <string, bool> group in VirtualGroupStates) { string label = (AccParentNames.ContainsKey(group.Key)) ? AccParentNames[group.Key] : group.Key; CreateStudioUIText(group.Key, i, label); CreateStudioUIToggle(group.Key, i, group.Value); i++; } }