using TMPro; using UnityEngine; using UnityEngine.UI; public class EventPartnerWheelPiece : MonoBehaviour { private Image _imgBg, _imgBgShow; private TMP_Text _textScore, _textScoreShow; [SerializeField] private Animation animationShow; private void Awake() { _imgBg = transform.Find("bg").GetComponent(); _textScore = transform.Find("text_beilv").GetComponent(); _imgBgShow = animationShow.transform.Find("bg").GetComponent(); _textScoreShow = animationShow.transform.Find("text_beilv").GetComponent(); } public void Init(string bgUrl, int score, EventPartnerAct.Context ctx) { // Debug.Log(bgUrl); // Debug.Log(score); // GContext.container.Resolve().SetImageSprite(_imgBg, bgUrl); _imgBg.sprite = ctx.GetSprite(bgUrl); _textScore.text = score.ToString(); _imgBgShow.sprite = ctx.GetSprite(bgUrl); _textScoreShow.text = score.ToString(); animationShow.Rewind(); } public void SetScore(int score) { _textScore.text = score.ToString(); _textScoreShow.text = score.ToString(); } public async System.Threading.Tasks.Task PlayShow() { animationShow.Play("turntable_reward"); // float time = animationShow["turntable_reward"].length; await System.Threading.Tasks.Task.Delay(System.TimeSpan.FromSeconds(48f / 60f)); } }