Compare commits

...

3 Commits

8 changed files with 334 additions and 223 deletions

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,9 @@ public class AssetsPanel : MonoBehaviour
public Image UserHead;
public Text PersonaText;
public Text PersonID;
private bool isUpdating=false;
// Start is called before the first frame update
void Start()
{
@ -58,19 +60,36 @@ public class AssetsPanel : MonoBehaviour
});
}
UpdateTaxt();
InvokeRepeating("UpDateText", 1f,1f);
}
private void UpDateText()
{
// 如果正在执行异步操作,直接返回,不进行重复调用
if (isUpdating)
return;
UpdateTaxt();
}
async void UpdateTaxt()
{
isUpdating = true;
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos();
Stone.text = _PlayerInfoData.gem.ToString();
Coin.text = _PlayerInfoData.gold.ToString();
Ore.text = _PlayerInfoData.water.ToString();
Forging.text = _PlayerInfoData.forge.ToString();
_PlayerInfoData = null;
// 异步操作完成,标记为未执行
isUpdating = false;
}
private void OnDisable()
{
CancelInvoke("UpDateText");
}

View File

@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Promotion_Rank : MonoBehaviour
{
public Text Firstlevel;
public Text FirstName;
public Text Firstcount;
public Text FitstPrize;
public Text Secondlevel;
public Text SecondName;
public Text Secondcount;
public Text SecondPrize;
public Text Thirdlevel;
public Text ThirdName;
public Text Thirdcount;
public Text ThirdPrize;
public GameObject Promotionitem;
public Transform Content;
// Start is called before the first frame update
async void Start()
{
PromotionRankResponse response = await Scene_main_jiekou.instance.PromotionRanks();
//FirstName.text = response.data.ranks[0].nickname;
//Firstcount.text = response.data.ranks[0].quantity + "/" + response.data.ranks[0].require;
//SecondName.text = response.data.ranks[1].nickname;
//Secondcount.text = response.data.ranks[1].quantity+"/" + response.data.ranks[1].require;
//ThirdName.text = response.data.ranks[2].nickname;
//Thirdcount.text = response.data.ranks[2].quantity + "/" + response.data.ranks[2].require;
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a4f1a6a83dde4f4f8d2a0dadaf48b6e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -20,7 +20,7 @@ public class Scene_main_jiekou :MonoBehaviour
FeedPet feedPet = new FeedPet();
petAdopt petAdopt = new petAdopt();
petBettles petBettles = new petBettles();
promotionRank promotionRank = new promotionRank();
public static Scene_main_jiekou instance;
//public PlayerInfoData infoData;
@ -144,4 +144,11 @@ public class Scene_main_jiekou :MonoBehaviour
{
return await petBettles.PetBettles(id);
}
public async Task<PromotionRankResponse> PromotionRanks()
{
return await promotionRank.PromotionRank();
}
}

View File

@ -16,6 +16,7 @@ public class MyGlobal : MonoBehaviour
return;
}
global = this;
DontDestroyOnLoad(gameObject);
}
// 创建请求头,使用最新的 token

View File

@ -42,7 +42,7 @@ public class login : MonoBehaviour
public async Task<string> TastLogin()
{
loginBody body = new loginBody();
/*loginBody body = new loginBody();
body.client_id = "app";
body.username = "17015306950";
body.password = "9527123";
@ -55,7 +55,9 @@ public class login : MonoBehaviour
MyGlobal.global.loginResponse.Data.access_token = apifox.Data.access_token;
//Debug.Log(MyGlobal.global.loginResponse.Data.access_token);
Debug.Log("测试登入成功,后期记得删");
return response;
return response;*/
await Task.Delay(100);
return null;
}
}
//====================

View File

@ -27,7 +27,7 @@ public class promotionRank : MonoBehaviour
Debug.Log("拉新排行榜" + response);
//bbbb
PromotionRankResponse promotionRankResponse = JsonConvert.DeserializeObject<PromotionRankResponse>(response);
Debug.Log("=========" + promotionRankResponse.data.ranks[0].nickname);
// Debug.Log("=========" + promotionRankResponse.data.ranks[0].nickname);
return promotionRankResponse;
}