using TMPro; using UnityEngine; using UnityEngine.UI; namespace BulletHellTemplate { /// /// Manages the icon selection and application process in the UI. /// public class IconsEntry : MonoBehaviour { [Header("UI Components")] [Tooltip("Displays the icon image.")] public Image icon; [Tooltip("Highlights the selected icon.")] public Image selected; [Tooltip("Displays the name of the icon.")] public TextMeshProUGUI iconName; private string iconId; /// /// Sets the icon information for this entry. /// /// The ID of the icon to set. public void SetIconInfo(string _iconId) { iconId = _iconId; } /// /// Applies the icon locally when clicked. /// public async void OnClickChangeIcon() { RequestResult res = await BackendManager.Service.ChangePlayerIconAsync(iconId); if (res.Success) { UIProfileMenu.Singleton.LoadProfile(); UIMainMenu.Singleton.LoadPlayerInfo(); UIProfileMenu.Singleton.OnChangeIcon.Invoke(); } else { Debug.LogWarning(res.Reason == "0" ? "Icon not owned!" : "Icon not found!"); } } } }