This commit is contained in:
wulongxiao 2024-12-17 15:31:37 +08:00
parent 98539732b6
commit e552d26617
5 changed files with 38 additions and 53 deletions

View File

@ -13500,6 +13500,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 163049996} - component: {fileID: 163049996}
- component: {fileID: 163049997} - component: {fileID: 163049997}
- component: {fileID: 163049998}
m_Layer: 0 m_Layer: 0
m_Name: jiekou m_Name: jiekou
m_TagString: Untagged m_TagString: Untagged
@ -13534,6 +13535,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 768ed40e69788184b804035df928dc51, type: 3} m_Script: {fileID: 11500000, guid: 768ed40e69788184b804035df928dc51, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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 --- !u!1 &163450907
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -51,7 +51,7 @@ public class PlayerManager
return; return;
} }
Stones += num; Stones += num;
Promptmgr.assestPanel.SetStoneText(Stones); // Promptmgr.assestPanel.SetStoneText(Stones);
break; break;
case MoneyType.Forging: case MoneyType.Forging:
if((Forging + num) < 0) if((Forging + num) < 0)
@ -60,7 +60,7 @@ public class PlayerManager
return; return;
} }
Forging += num; Forging += num;
Promptmgr.assestPanel.SetForgingText(Forging); // Promptmgr.assestPanel.SetForgingText(Forging);
break; break;
case MoneyType.Coins: case MoneyType.Coins:
if ((Coins + num) < 0) if ((Coins + num) < 0)
@ -69,7 +69,7 @@ public class PlayerManager
return; return;
} }
Coins += num; Coins += num;
Promptmgr.assestPanel.SetCoinText(Coins); // Promptmgr.assestPanel.SetCoinText(Coins);
break; break;
case MoneyType.Ore: case MoneyType.Ore:
if ((Ore + num) < 0) if ((Ore + num) < 0)
@ -78,7 +78,7 @@ public class PlayerManager
return; return;
} }
Ore += num; Ore += num;
Promptmgr.assestPanel.SetOreText(Ore); // Promptmgr.assestPanel.SetOreText(Ore);
break; break;
} }
} }

View File

@ -22,17 +22,6 @@ public class AssetsPanel : MonoBehaviour
// Start is called before the first frame update // Start is called before the first frame update
void Start() 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) if (but1 != null)
{ {
but1.onClick.AddListener(() => { but1.onClick.AddListener(() => {
@ -60,46 +49,21 @@ public class AssetsPanel : MonoBehaviour
mygameObject.SetActive(true); mygameObject.SetActive(true);
}); });
} }
UpdateTaxt();
} }
public void SetStoneText(float num)
async void UpdateTaxt()
{ {
if (Stone != null) PlayerInfoData info=await Scene_main_jiekou.instance.PlayerInfos();
{ Stone.text = info.gem.ToString();
Stone.text = num.ToString(); Coin.text = info.gold.ToString();
Ore.text = info.water.ToString();
Forging.text = info.forge.ToString();
} }
}
public void SetCoinText(float num)
{
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();
}
}
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();
}
} }

View File

@ -7,16 +7,23 @@ using UnityEngine;
public class Scene_main_jiekou :MonoBehaviour public class Scene_main_jiekou :MonoBehaviour
{ {
login _Login = new login(); login _Login = new login();
public static Scene_main_jiekou instance;
void Awake()
{
instance=this;
}
public async void Start() public async void Start()
{ {
await _Login.TastLogin();
await PlayerInfos(); //await PlayerInfos();
} }
public async Task<PlayerInfoData> PlayerInfos() public async Task<PlayerInfoData> PlayerInfos()
{ {
await _Login.TastLogin();
playerInfo playerInfo=new playerInfo(); playerInfo playerInfo=new playerInfo();
PlayerIndfo _PlayerIndfo = await playerInfo.PalyerInfo(); PlayerIndfo _PlayerIndfo = await playerInfo.PalyerInfo();
return _PlayerIndfo.Data; return _PlayerIndfo.Data;

View File

@ -52,6 +52,7 @@ public class login : MonoBehaviour
//Debug.Log(MyGlobal.global.loginResponse.Data); //Debug.Log(MyGlobal.global.loginResponse.Data);
MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token; MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
//Debug.Log(MyGlobal.global.loginResponse.Data.access_token); //Debug.Log(MyGlobal.global.loginResponse.Data.access_token);
Debug.Log("测试登入成功,后期记得删");
return response; return response;
} }
} }