48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
|
|
using Cysharp.Threading.Tasks;
|
|||
|
|
using System.Linq;
|
|||
|
|
using TMPro;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
using UnityEngine.InputSystem.XR;
|
|||
|
|
using UVC.UI.Modal;
|
|||
|
|
|
|||
|
|
namespace EnglewoodLAB.Modal.View
|
|||
|
|
{
|
|||
|
|
public class SettingModalView : ModalView
|
|||
|
|
{
|
|||
|
|
private RectTransform contentRect;
|
|||
|
|
|
|||
|
|
public override async UniTask OnOpen(ModalContent content)
|
|||
|
|
{
|
|||
|
|
SetUI(content);
|
|||
|
|
await base.OnOpen(content);
|
|||
|
|
gameObject.SetActive(false);
|
|||
|
|
}
|
|||
|
|
private void SetUI(ModalContent content)
|
|||
|
|
{
|
|||
|
|
var textmeshpros = GetComponentsInChildren<TextMeshProUGUI>();
|
|||
|
|
var rectItems = GetComponentsInChildren<RectTransform>();
|
|||
|
|
|
|||
|
|
if (titleText == null)
|
|||
|
|
{
|
|||
|
|
titleText = textmeshpros.FirstOrDefault(x => x.name.Equals("Text_Title"));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (contentRect == null)
|
|||
|
|
{
|
|||
|
|
contentRect = rectItems.FirstOrDefault(x => x.name.Equals("Content"));
|
|||
|
|
if(contentRect !=null)
|
|||
|
|
{
|
|||
|
|
var sprite = Resources.Load<Sprite>(content.ImagePath);
|
|||
|
|
if (sprite == null)
|
|||
|
|
Debug.Log($"{content.ImagePath}<7D><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>");
|
|||
|
|
var img = contentRect.GetComponent<Image>();
|
|||
|
|
img.sprite = sprite;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|