Files
MinFt/Client/Assets/Scripts/UI/FishingRewardSocial.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

48 lines
1.6 KiB
C#

using asap.core;
using cfg;
using GameCore;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class FishingRewardSocial : MonoBehaviour
{
List<GameObject> gameObjects = new List<GameObject>();
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<TMP_Text>();
int count = Random.Range(6, 25);
tMP_Text.text = LocalizationMgr.GetFormatTextValue("UI_FishingRewardPanel_101010", count);
var userAvatars = GContext.container.Resolve<Tables>().TbUserAvatar.DataList;
List<UserAvatar> userAvatars1 = new List<UserAvatar>(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<Image>();
IUIService uiService = GContext.container.Resolve<IUIService>();
uiService.SetImageSprite(image, userAvatar.Avatar);
}
}
}
}