From 98fe6514160959df3b7d21f56a63e22bb79e420e Mon Sep 17 00:00:00 2001 From: liuliang <597380732@qq.com> Date: Sat, 4 Jan 2025 16:21:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=A4=B4=E5=83=8F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meng_yao/Assets/Scenes/scene_Main.unity | 7 +++++-- .../Assets/script/TanChuang/HeadTanchuang.cs | 2 +- .../Assets/script/scene_Main/Promotion_Rank.cs | 17 +++++++++++++---- meng_yao/Assets/script/scene_Main/ReviseName.cs | 2 ++ .../script/scene_Main/Scene_main_jiekou.cs | 7 ++++++- .../script/scene_Main/ui/GiveawayPanel.cs | 2 +- .../scene_Main/ui/IllustrationsAssetDetails.cs | 2 +- .../script/scene_Main/ui/QuanwangPanel.cs | 12 ++++++++++-- 8 files changed, 39 insertions(+), 12 deletions(-) diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index 053c722e..5ba54939 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -15143,7 +15143,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 768ed40e69788184b804035df928dc51, type: 3} m_Name: m_EditorClassIdentifier: - ImageLoader: {fileID: 0} IsTaskLoging: 0 --- !u!114 &163050000 MonoBehaviour: @@ -29374,14 +29373,17 @@ MonoBehaviour: FirstName: {fileID: 431895116} Firstcount: {fileID: 1946594467} FitstPrize: {fileID: 887733216} + Fitsthead: {fileID: 1548491210} Secondlevel: {fileID: 2124241022} SecondName: {fileID: 1999305026} Secondcount: {fileID: 956425077} SecondPrize: {fileID: 768282640} + Secondhead: {fileID: 2033015612} Thirdlevel: {fileID: 1987729151} ThirdName: {fileID: 95657181} Thirdcount: {fileID: 1312713360} ThirdPrize: {fileID: 1784087689} + Thirdhead: {fileID: 187716042} Promotionitem: {fileID: 1908348284012044747, guid: b3cee309124aad94bb7e7397124dc142, type: 3} Content: {fileID: 1439471775} countdown: {fileID: 688128787} @@ -64266,7 +64268,7 @@ GameObject: - component: {fileID: 729618846} - component: {fileID: 729618845} m_Layer: 5 - m_Name: Image + m_Name: head m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -150965,6 +150967,7 @@ MonoBehaviour: NameText: {fileID: 852761426} IdText: {fileID: 1380548575} island: {fileID: 1852295288} + head: {fileID: 729618845} headTanchuang: {fileID: 136090572} --- !u!1 &1744156003 GameObject: diff --git a/meng_yao/Assets/script/TanChuang/HeadTanchuang.cs b/meng_yao/Assets/script/TanChuang/HeadTanchuang.cs index 793e760a..baee1b48 100644 --- a/meng_yao/Assets/script/TanChuang/HeadTanchuang.cs +++ b/meng_yao/Assets/script/TanChuang/HeadTanchuang.cs @@ -45,6 +45,6 @@ public class HeadTanchuang : MonoBehaviour PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); this.Name.text =_PlayerInfoData.nickname.ToString(); this.Id.text = _PlayerInfoData.uid.ToString(); - this.head.sprite = await Scene_main_jiekou.instance.ImageLoader.LoadImageAsync(_PlayerInfoData.avatar_url); + this.head.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url); } } diff --git a/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs b/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs index f6c5f124..714d62a0 100644 --- a/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs +++ b/meng_yao/Assets/script/scene_Main/Promotion_Rank.cs @@ -10,17 +10,19 @@ public class Promotion_Rank : MonoBehaviour public Text FirstName; public Text Firstcount; public Text FitstPrize; + public Image Fitsthead; public Text Secondlevel; public Text SecondName; public Text Secondcount; public Text SecondPrize; - + public Image Secondhead; public Text Thirdlevel; public Text ThirdName; public Text Thirdcount; public Text ThirdPrize; + public Image Thirdhead; public GameObject Promotionitem; public Transform Content; @@ -50,8 +52,9 @@ public class Promotion_Rank : MonoBehaviour FirstName.text = response.data.ranks[0].nickname; Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; FitstPrize.text = response.data.ranks[0].reward.ToString(); + Fitsthead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); - Secondlevel.text ="2"; + Secondlevel.text ="2"; SecondName.text = ""; Secondcount.text = ""; SecondPrize.text = ""; @@ -68,11 +71,13 @@ public class Promotion_Rank : MonoBehaviour FirstName.text = response.data.ranks[0].nickname; Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; FitstPrize.text = response.data.ranks[0].reward.ToString(); + Fitsthead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); Secondlevel.text = response.data.ranks[1].rank.ToString(); SecondName.text = response.data.ranks[1].nickname; Secondcount.text = response.data.ranks[1].quantity + "/" + response.data.ranks[1].require; SecondPrize.text = response.data.ranks[1].reward.ToString(); + Secondhead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[1].avatar_url); Thirdlevel.text = "3"; ThirdName.text = ""; @@ -85,16 +90,19 @@ public class Promotion_Rank : MonoBehaviour FirstName.text = response.data.ranks[0].nickname; Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require; FitstPrize.text = response.data.ranks[0].reward.ToString(); + Fitsthead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); - Secondlevel.text = response.data.ranks[1].rank.ToString(); + Secondlevel.text = response.data.ranks[1].rank.ToString(); SecondName.text = response.data.ranks[1].nickname; Secondcount.text = response.data.ranks[1].quantity + "/" + response.data.ranks[1].require; SecondPrize.text = response.data.ranks[1].reward.ToString(); + Secondhead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[1].avatar_url); - Thirdlevel.text = response.data.ranks[2].rank.ToString(); + Thirdlevel.text = response.data.ranks[2].rank.ToString(); ThirdName.text = response.data.ranks[2].nickname; Thirdcount.text = response.data.ranks[2].quantity + "/" + response.data.ranks[2].require; ThirdPrize.text = response.data.ranks[2].reward.ToString(); + Thirdhead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[2].avatar_url); } for (int i = 3; i < response.data.ranks.Count; i++) @@ -105,6 +113,7 @@ public class Promotion_Rank : MonoBehaviour obj.GetComponent().username.text = response.data.ranks[i].nickname; obj.GetComponent().prize.text = response.data.ranks[i].reward+"元现金奖励"; obj.GetComponent().count.text = response.data.ranks[i].quantity + "/" + response.data.ranks[i].require; + obj.GetComponent().userImage.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[i].avatar_url); } diff --git a/meng_yao/Assets/script/scene_Main/ReviseName.cs b/meng_yao/Assets/script/scene_Main/ReviseName.cs index 10472141..ec521415 100644 --- a/meng_yao/Assets/script/scene_Main/ReviseName.cs +++ b/meng_yao/Assets/script/scene_Main/ReviseName.cs @@ -10,6 +10,7 @@ public class ReviseName : mount public Text NameText; public Text IdText; public Text island; + public Image head; public GameObject headTanchuang; // Start is called before the first frame update @@ -63,6 +64,7 @@ public class ReviseName : mount this.NameText.text = info.nickname.ToString(); this.IdText.text = info.uid.ToString(); island.text = "出生地:"+info.island_name; + this.head.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(info.avatar_url); this.gameObject.SetActive(true); } } diff --git a/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs b/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs index 69ec4eb5..a62abc1d 100644 --- a/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs +++ b/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs @@ -7,7 +7,7 @@ using UnityEngine; public class Scene_main_jiekou :MonoBehaviour { - public ImageLoader ImageLoader = new ImageLoader();//解析头像类 + ImageLoader ImageLoader = new ImageLoader();//解析头像类 login _Login = new login(); logout logout = new logout(); treeInfo TreeInfoss = new treeInfo(); @@ -68,6 +68,11 @@ public class Scene_main_jiekou :MonoBehaviour IsTaskLoging = false; } + public async Task ImageLoaderSprite(string url) + { + return await ImageLoader.LoadImageAsync(url); + } + public async Task Logouts()//登录退出 { return await logout.Logout(); diff --git a/meng_yao/Assets/script/scene_Main/ui/GiveawayPanel.cs b/meng_yao/Assets/script/scene_Main/ui/GiveawayPanel.cs index 918fe731..18731399 100644 --- a/meng_yao/Assets/script/scene_Main/ui/GiveawayPanel.cs +++ b/meng_yao/Assets/script/scene_Main/ui/GiveawayPanel.cs @@ -32,7 +32,7 @@ public class GiveawayPanel : MonoBehaviour { GameObject obj = Instantiate(Giveawayitem, Connact); itemlist.Add(obj); - obj.GetComponent().head.sprite = await Scene_main_jiekou.instance.ImageLoader.LoadImageAsync(info.data.avatar_url); + obj.GetComponent().head.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(info.data.avatar_url); obj.GetComponent().username.text = info.data.name; obj.GetComponent().uid = info.data.uid; obj.GetComponent().userid.text = info.data.uid; diff --git a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs index 57af89b7..2c092a83 100644 --- a/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs +++ b/meng_yao/Assets/script/scene_Main/ui/IllustrationsAssetDetails.cs @@ -55,7 +55,7 @@ public class IllustrationsAssetDetails : MonoBehaviour WaterText.text = _PlayerInfoData.water.ToString("F2"); UserName.text = _PlayerInfoData.nickname.ToString(); UserID.text = _PlayerInfoData.uid.ToString(); - + UserHead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url); _PlayerInfoData = null; // 异步操作完成,标记为未执行 isUpdating = false; diff --git a/meng_yao/Assets/script/scene_Main/ui/QuanwangPanel.cs b/meng_yao/Assets/script/scene_Main/ui/QuanwangPanel.cs index a9eb1c28..b1f7b045 100644 --- a/meng_yao/Assets/script/scene_Main/ui/QuanwangPanel.cs +++ b/meng_yao/Assets/script/scene_Main/ui/QuanwangPanel.cs @@ -44,6 +44,7 @@ public class QuanwangPanel : MonoBehaviour quanwangListItemFirstobj.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemFirstobj.GetComponent().moneynumber.text = response.data.ranks[0].amount.ToString(); + quanwangListItemFirstobj.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); } if (response.data.ranks.Length == 2) { @@ -59,6 +60,7 @@ public class QuanwangPanel : MonoBehaviour quanwangListItemFirstobj2.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemFirstobj2.GetComponent().moneynumber.text = response.data.ranks[0].amount.ToString(); + quanwangListItemFirstobj2.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); quanwangListItemScecondobj.GetComponent().username.text = response.data.ranks[1].nickname; quanwangListItemScecondobj.GetComponent().userid.text = response.data.ranks[1].uid; @@ -67,6 +69,7 @@ public class QuanwangPanel : MonoBehaviour quanwangListItemScecondobj.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemScecondobj.GetComponent().moneynumber.text = response.data.ranks[1].amount.ToString(); + quanwangListItemScecondobj.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[1].avatar_url); } if (response.data.ranks.Length >= 3) @@ -84,22 +87,25 @@ public class QuanwangPanel : MonoBehaviour quanwangListItemFirstobj3.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemFirstobj3.GetComponent().moneynumber.text = response.data.ranks[0].amount.ToString(); + quanwangListItemFirstobj3.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[0].avatar_url); - quanwangListItemScecondobj2.GetComponent().username.text = response.data.ranks[1].nickname; + quanwangListItemScecondobj2.GetComponent().username.text = response.data.ranks[1].nickname; quanwangListItemScecondobj2.GetComponent().userid.text = response.data.ranks[1].uid; for (int i = 0; i < response.data.ranks[1].level; i++) { quanwangListItemScecondobj2.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemScecondobj2.GetComponent().moneynumber.text = response.data.ranks[1].amount.ToString(); + quanwangListItemScecondobj2.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[1].avatar_url); - quanwangListItemTirdobj.GetComponent().username.text = response.data.ranks[2].nickname; + quanwangListItemTirdobj.GetComponent().username.text = response.data.ranks[2].nickname; quanwangListItemTirdobj.GetComponent().userid.text = response.data.ranks[2].uid; for (int i = 0; i < response.data.ranks[2].level; i++) { quanwangListItemTirdobj.GetComponent().start[i].gameObject.SetActive(true); } quanwangListItemTirdobj.GetComponent().moneynumber.text = response.data.ranks[2].amount.ToString(); + quanwangListItemTirdobj.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[2].avatar_url); } @@ -115,6 +121,7 @@ public class QuanwangPanel : MonoBehaviour quanwangListItemobj.GetComponent().start[j].gameObject.SetActive(true); } quanwangListItemobj.GetComponent().moneynumber.text = response.data.ranks[i].amount.ToString(); + quanwangListItemobj.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(response.data.ranks[i].avatar_url); } if (response.data.bottom_show == 1) @@ -128,6 +135,7 @@ public class QuanwangPanel : MonoBehaviour quanwangSelfListItem.GetComponent().start[i].gameObject.SetActive(true); } quanwangSelfListItem.GetComponent().moneynumber.text = response.data.bottom_rank.amount.ToString(); + quanwangSelfListItem.GetComponent().headicon.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite( response.data.bottom_rank.avatar_url); } else {