From e552d26617bd0db976983d34ac948d9af55aa7b2 Mon Sep 17 00:00:00 2001 From: wulongxiao <2545507770@qq.com> Date: Tue, 17 Dec 2024 15:31:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- meng_yao/Assets/Scenes/scene_Main.unity | 13 +++++ .../Assets/script/Player/PlayerManager.cs | 8 +-- .../Assets/script/scene_Main/AssetsPanel.cs | 52 +++---------------- .../script/scene_Main/Scene_main_jiekou.cs | 17 ++++-- .../serveTestScript/loginModule/login.cs | 1 + 5 files changed, 38 insertions(+), 53 deletions(-) diff --git a/meng_yao/Assets/Scenes/scene_Main.unity b/meng_yao/Assets/Scenes/scene_Main.unity index e3f25aed9..740af8602 100644 --- a/meng_yao/Assets/Scenes/scene_Main.unity +++ b/meng_yao/Assets/Scenes/scene_Main.unity @@ -13500,6 +13500,7 @@ GameObject: m_Component: - component: {fileID: 163049996} - component: {fileID: 163049997} + - component: {fileID: 163049998} m_Layer: 0 m_Name: jiekou m_TagString: Untagged @@ -13534,6 +13535,18 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 768ed40e69788184b804035df928dc51, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &163049998 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 163049995} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59ff8dcd92c3dd54e92e6e06ff63654d, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &163450907 GameObject: m_ObjectHideFlags: 0 diff --git a/meng_yao/Assets/script/Player/PlayerManager.cs b/meng_yao/Assets/script/Player/PlayerManager.cs index 6d5aab805..20f5d6918 100644 --- a/meng_yao/Assets/script/Player/PlayerManager.cs +++ b/meng_yao/Assets/script/Player/PlayerManager.cs @@ -51,7 +51,7 @@ public class PlayerManager return; } Stones += num; - Promptmgr.assestPanel.SetStoneText(Stones); + // Promptmgr.assestPanel.SetStoneText(Stones); break; case MoneyType.Forging: if((Forging + num) < 0) @@ -60,7 +60,7 @@ public class PlayerManager return; } Forging += num; - Promptmgr.assestPanel.SetForgingText(Forging); + // Promptmgr.assestPanel.SetForgingText(Forging); break; case MoneyType.Coins: if ((Coins + num) < 0) @@ -69,7 +69,7 @@ public class PlayerManager return; } Coins += num; - Promptmgr.assestPanel.SetCoinText(Coins); + // Promptmgr.assestPanel.SetCoinText(Coins); break; case MoneyType.Ore: if ((Ore + num) < 0) @@ -78,7 +78,7 @@ public class PlayerManager return; } Ore += num; - Promptmgr.assestPanel.SetOreText(Ore); + // Promptmgr.assestPanel.SetOreText(Ore); break; } } diff --git a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs index 4a4fade6e..95037fb5f 100644 --- a/meng_yao/Assets/script/scene_Main/AssetsPanel.cs +++ b/meng_yao/Assets/script/scene_Main/AssetsPanel.cs @@ -22,17 +22,6 @@ public class AssetsPanel : MonoBehaviour // Start is called before the first frame update void Start() { - if (Promptmgr.assestPanel == null) - { - Promptmgr.assestPanel = this; - Stone.text = PlayerManager.Instance.Stones.ToString(); - Forging.text = PlayerManager.Instance.Forging.ToString(); - Coin.text = PlayerManager.Instance.Coins.ToString(); - Ore.text = PlayerManager.Instance.Ore.ToString(); - Promptmgr.assestPanel.is_one = true; - } - - if (but1 != null) { but1.onClick.AddListener(() => { @@ -60,46 +49,21 @@ public class AssetsPanel : MonoBehaviour mygameObject.SetActive(true); }); } + + UpdateTaxt(); } - public void SetStoneText(float num) - { - if (Stone != null) - { - Stone.text = num.ToString(); - } - } - public void SetCoinText(float num) + async void UpdateTaxt() { - if (Coin != null) - { - Coin.text = num.ToString(); - } - } - public void SetOreText(float num) - { - if (Ore != null) - { - Ore.text = num.ToString(); - } - } - public void SetForgingText(float num) - { - if (Forging != null) - { - Forging.text = num.ToString(); - } + PlayerInfoData info=await Scene_main_jiekou.instance.PlayerInfos(); + Stone.text = info.gem.ToString(); + Coin.text = info.gold.ToString(); + Ore.text = info.water.ToString(); + Forging.text = info.forge.ToString(); } - private void Update() - { - Stone.text = PlayerManager.Instance.Stones.ToString(); - Coin.text = PlayerManager.Instance.Coins.ToString(); - Ore.text = PlayerManager.Instance.Ore.ToString(); - Forging.text = PlayerManager.Instance.Forging.ToString(); - } } 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 95fd5aff4..2c40b1d69 100644 --- a/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs +++ b/meng_yao/Assets/script/scene_Main/Scene_main_jiekou.cs @@ -7,16 +7,23 @@ using UnityEngine; public class Scene_main_jiekou :MonoBehaviour { login _Login = new login(); - public async void Start() - { - await _Login.TastLogin(); - await PlayerInfos(); - } + public static Scene_main_jiekou instance; + void Awake() + { + instance=this; + } + public async void Start() + { + + //await PlayerInfos(); + } public async Task PlayerInfos() { + await _Login.TastLogin(); + playerInfo playerInfo=new playerInfo(); PlayerIndfo _PlayerIndfo = await playerInfo.PalyerInfo(); return _PlayerIndfo.Data; diff --git a/meng_yao/Assets/script/serveTestScript/loginModule/login.cs b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs index 9749455f2..0ff3e53c5 100644 --- a/meng_yao/Assets/script/serveTestScript/loginModule/login.cs +++ b/meng_yao/Assets/script/serveTestScript/loginModule/login.cs @@ -52,6 +52,7 @@ public class login : MonoBehaviour //Debug.Log(MyGlobal.global.loginResponse.Data); MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token; //Debug.Log(MyGlobal.global.loginResponse.Data.access_token); + Debug.Log("测试登入成功,后期记得删"); return response; } }