private void CleanupMakerControls(object sender, EventArgs args) { MakerControlsRegistered = false; AccessoriesApi.SelectedMakerAccSlotChanged -= UpdateUI; AccessoriesApi.SelectedMakerAccSlotChanged -= RefreshAdvancedParents; AdditionalAccessoryUI.Hide(); }
private void Awake() { Instance = this; enabled = false; #if DEBUG Log.LogInfo("UI AWAKE"); #endif }
// Open/Close the Visibility Rules UI private void VisibilityRulesListener() { if (!MakerAPI.InsideAndLoaded) { return; } if (AdditionalAccessoryUI.Instance.enabled) { AdditionalAccessoryUI.Hide(); return; } int currentSlot = AccessoriesApi.SelectedMakerAccSlot; if (currentSlot != -1) { AdditionalAccessoryControlsController aacController = MakerAPI.GetCharacterControl().gameObject.GetComponent <AdditionalAccessoryControlsController>(); if (currentSlot >= aacController.SlotData.Length) { #if DEBUG Log.LogInfo("Invalid Slot (Beyond current length)"); #endif AdditionalAccessoryUI.Hide(); } else if (aacController.SlotData[currentSlot] != null && !aacController.SlotData[currentSlot].IsEmpty) { #if DEBUG Log.LogInfo($"Showing Rules for {MakerAPI.GetCharacterControl()?.chaFile?.parameter?.fullname}"); #endif AdditionalAccessoryUI.Show(aacController.SlotData[currentSlot], MakerAPI.GetCharacterControl()); } else { #if DEBUG Log.LogInfo("No Acc Slot Data and/or Empty"); #endif AdditionalAccessoryUI.Hide(); } } else { #if DEBUG Log.LogInfo("No Slot Selected"); #endif AdditionalAccessoryUI.Hide(); } }
// Handle Maker Acc Slot Change private void UpdateUI(object sender, AccessorySlotEventArgs args) { if (args.SlotIndex >= 0) { #if DEBUG Log.LogInfo($"Changing Displayed Slot to {args.SlotIndex}"); #endif AdditionalAccessoryControlsController aacController = MakerAPI.GetCharacterControl().gameObject.GetComponent <AdditionalAccessoryControlsController>(); if (args.SlotIndex >= aacController.SlotData.Length) { #if DEBUG Log.LogInfo($"New Slot Added: {args.SlotIndex}"); #endif aacController.AddOrUpdateSlot(args.SlotIndex, AdditionalAccessorySlotData.EmptySlot(args.SlotIndex)); } if (aacController.SlotData[args.SlotIndex] != null && !aacController.SlotData[args.SlotIndex].IsEmpty) { #if DEBUG Log.LogInfo($"New Slot Set: {aacController.SlotData[args.SlotIndex]}"); #endif AdditionalAccessoryUI.Change(aacController.SlotData[args.SlotIndex], aacController.ChaControl); advancedParentLabel.Text = $"Adv Parent: {aacController.SlotData[args.SlotIndex].AdvancedParentShort}"; AdditionalAccessoryAdvancedParentUI.Change(aacController.SlotData[args.SlotIndex], aacController.ChaControl); } else { #if DEBUG Log.LogInfo("No Slot Data or Slot Empty."); #endif advancedParentLabel.Text = "Adv Parent: None"; AdditionalAccessoryUI.Hide(); AdditionalAccessoryAdvancedParentUI.Hide(); } } }