using asap.core; using cfg; using GameCore; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class FishingRewardSocial : MonoBehaviour { List gameObjects = new List(); int childCount; private void Awake() { childCount = transform.childCount; for (int i = 0; i < childCount; i++) { gameObjects.Add(transform.GetChild(i).gameObject); } } public void ShowSocial(bool isSocial) { if (isSocial) { int index = Random.Range(0, childCount); GameObject go = gameObjects[index]; go.SetActive(true); TMP_Text tMP_Text = go.transform.Find("info/text_name").GetComponent(); int count = Random.Range(6, 25); tMP_Text.text = LocalizationMgr.GetFormatTextValue("UI_FishingRewardPanel_101010", count); var userAvatars = GContext.container.Resolve().TbUserAvatar.DataList; List userAvatars1 = new List(userAvatars); UserAvatar userAvatar; Image image; for (int i = 1; i <= 4; i++) { userAvatar = userAvatars1[UnityEngine.Random.Range(0, userAvatars1.Count)]; userAvatars1.Remove(userAvatar); image = go.transform.Find($"player{i}/icon").GetComponent(); IUIService uiService = GContext.container.Resolve(); uiService.SetImageSprite(image, userAvatar.Avatar); } } } }