using HSVPicker; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.UI; public class UIController : MonoBehaviour { public bool KnobsVisible = false; public static UIController Instance; public GameObject LoadedCharaButton; public Dropdown BackgroundDropdown; public Dropdown BodyAnimationDropdown; public Transform MeshesListContent; public ScrollRect ServantList; public ScrollRect EnemiesList; public ScrollRect ServantCostumeList; public ScrollRect EnemyCostumeList; public Slider CutoffSlider; public Button ReloadTextureButton; public TMPro.TMP_InputField SSWidth, SSHeight, GifWidth, GifHeight; public AspectRatioFitter SSVisual, GifVisual; public GameObject CameraSettingsPanel; public GameObject ColorPickerPanel; public GameObject ColorPicker; private void Awake() { if (Instance != null) { Destroy(Instance); } Instance = this; } private void Start() { var pref = PlayerPrefs.GetString("SSWidth"); if (string.IsNullOrEmpty(pref)) pref = "0"; SSWidth.text = pref; SSWidth.onEndEdit.AddListener((str) => PlayerPrefs.SetString("SSWidth", str)); pref = PlayerPrefs.GetString("SSHeight"); if (string.IsNullOrEmpty(pref)) pref = "0"; SSHeight.text = pref; SSHeight.onEndEdit.AddListener((str) => PlayerPrefs.SetString("SSHeight", str)); pref = PlayerPrefs.GetString("GifWidth"); if (string.IsNullOrEmpty(pref)) pref = "512"; GifWidth.text = pref; GifWidth.onEndEdit.AddListener((str) => PlayerPrefs.SetString("GifWidth", str)); pref = PlayerPrefs.GetString("GifHeight"); if (string.IsNullOrEmpty(pref)) pref = "512"; GifHeight.text = pref; GifHeight.onEndEdit.AddListener((str) => PlayerPrefs.SetString("GifHeight", str)); BackgroundDropdown.onValueChanged.AddListener((value) => { OnBackgroundDropdownSelected(value); }); BodyAnimationDropdown.onValueChanged.AddListener((value) => { OnBodyAnimationDropdownSelected(value); }); ColorPicker.GetComponent().onValueChanged.AddListener((color) => SetBackgroundColor(color)); List dds = new List() { BodyAnimationDropdown, BackgroundDropdown }; foreach(Dropdown dd in dds) { foreach(Transform t in dd.transform) { if(t.name == "LeftButton") { t.gameObject.GetComponent