using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class UIKF3CharacterPanel : MonoBehaviour { public KF3CharacterContainer Container; public TMPro.TMP_Dropdown AnimationSetDropdown, BodyAnimationDropdown, CostumeDropdown, EarsAnimationDropdown, TailAnimationDropdown; public ScrollRect WeaponToggle; private static KF3ModelViewerMain Main => KF3ModelViewerMain.Instance; public static UIKF3CharacterPanel Create(KF3CharacterContainer container) { var panel = Instantiate(Main.Resources.Pfb_KF3CharacterPanel, KF3ModelViewerInterface.Instance.DynamicPanels); panel.Container = container; panel.Init(); panel.UpdateSelection(); return panel; } public void Init() { if (Container as KF3FriendContainer != null) { var friend = Container as KF3FriendContainer; KF3ModelViewerInterface.SetDropdownData(CostumeDropdown, Main.Assets.GetCostumesFromId(Container.ModelId).Select(c => KF3Names.GetDressName(c.DisplayName.Split('_', '.')[2])).ToList()); KF3ModelViewerInterface.SetDropdownData(AnimationSetDropdown, Main.Assets.AnimationSets.Select(a => a.DisplayName).ToList()); KF3ModelViewerInterface.SetDropdownData(BodyAnimationDropdown, Container.BodyAnimation.prefabAnimeList.Where(anim => anim.clip != null).Select(kf => kf.name).ToList(), true, true); KF3ModelViewerInterface.SetDropdownData(EarsAnimationDropdown, friend.EarsAnimation == null ? null : friend.EarsAnimation.prefabAnimeList.Where(anim => anim.clip != null).Select(kf => kf.name).ToList(), true, true); KF3ModelViewerInterface.SetDropdownData(TailAnimationDropdown, friend.TailAnimation == null ? null : friend.TailAnimation.prefabAnimeList.Where(anim => anim.clip != null).Select(kf => kf.name).ToList(), true, true); foreach (Renderer r in friend.Renderers) { UIKF3MorphSlider go = Instantiate(Main.Resources.Pfb_KF3MorphToggle, WeaponToggle.content); go.Text.text = KF3CharacterContainerSerializable.GetRendererName(friend, r); go.Toggle.isOn = r.enabled; go.Toggle.onValueChanged.AddListener((value) => { friend.ToggleRendererVisible(r, value); friend.SetKeyframe(); }); } } else { var friend = Container as KF3CeruleanContainer; KF3ModelViewerInterface.SetDropdownData(CostumeDropdown, Main.Assets.GetCeruleans(KF3Names.GetEnemyName(friend.ModelId)).Select(m => m.FileName).ToList()); KF3ModelViewerInterface.SetDropdownData(AnimationSetDropdown, null); KF3ModelViewerInterface.SetDropdownData(BodyAnimationDropdown, friend.BodyAnimation.prefabAnimeList.Where(anim => anim.clip != null).Select(kf => kf.name).ToList(), true, true); KF3ModelViewerInterface.SetDropdownData(EarsAnimationDropdown, null); KF3ModelViewerInterface.SetDropdownData(TailAnimationDropdown, null); } foreach (var dd in new TMPro.TMP_Dropdown[] { AnimationSetDropdown, BodyAnimationDropdown, CostumeDropdown, EarsAnimationDropdown, TailAnimationDropdown }) { foreach (Transform t in dd.transform) { if (t.name == "LeftButton") { t.gameObject.GetComponent