高频刷新接口的替换

This commit is contained in:
liuliang 2025-01-08 14:12:05 +08:00
parent feee22154b
commit 59f00059a1
9 changed files with 236 additions and 218 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,16 +60,25 @@ public class WaterPanel : MonoBehaviour
} }
InvokeRepeating("Updated_water", 1f, 1f);
} }
private void OnDisable()
{
CancelInvoke("Updated_water");
}
// Start is called before the first frame update // Start is called before the first frame update
async void Start() async void Start()
{ {
instance = this; instance = this;
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
Updated_interface(info); Updated_interface(info);
Updated_water(info);
petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos(); petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos();
Updated_petinfo(petinfo); Updated_petinfo(petinfo);
PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos(); PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos();
@ -141,9 +150,10 @@ public class WaterPanel : MonoBehaviour
Treelist[4].SetActive(false); Treelist[4].SetActive(false);
} }
public void Updated_water(TreeInfo info)//更新水滴数据 public async void Updated_water()//更新水滴数据
{ {
waterCountText.text = info.Data.Water.ToString("F2"); CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
waterCountText.text = CapitalbalanceData.data.water.ToString("F2");
} }

View File

@ -107,7 +107,7 @@ public class Lottery : MonoBehaviour
Update_itemClick(); Update_itemClick();
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
WaterText.text = info.Data.Water.ToString(); WaterText.text = info.Data.Water.ToString();
WaterPanel.instance.Updated_water(info); WaterPanel.instance.Updated_water();
Debug.Log(response); Debug.Log(response);
} }
else else

View File

@ -21,7 +21,7 @@ public class FeedBtn : MonoBehaviour
Promptmgr.Instance.PromptBubble(response.message); Promptmgr.Instance.PromptBubble(response.message);
petBettleInfoResponse info = await Scene_main_jiekou.instance.getPetBettleInfos(); petBettleInfoResponse info = await Scene_main_jiekou.instance.getPetBettleInfos();
TreeInfo treeinfo = await Scene_main_jiekou.instance.TreeInfoS(); TreeInfo treeinfo = await Scene_main_jiekou.instance.TreeInfoS();
WaterPanel.instance.Updated_water(treeinfo); WaterPanel.instance.Updated_water();
WaterPanel.instance.Updated_petinfo(info); WaterPanel.instance.Updated_petinfo(info);
} }

View File

@ -44,7 +44,7 @@ public class WaterDrop : MonoBehaviour
transform.DOScale(new Vector3(0.5f, 0.5f, 0.5f), 0.5f).OnComplete(() => transform.DOScale(new Vector3(0.5f, 0.5f, 0.5f), 0.5f).OnComplete(() =>
{ {
transform.DOScale(Vector3.one, 0.5f); transform.DOScale(Vector3.one, 0.5f);
WaterPanel.instance.Updated_water(info); WaterPanel.instance.Updated_water();
Destroy(this.gameObject); Destroy(this.gameObject);
}); });
}); });

View File

@ -20,7 +20,7 @@ public class WateringBtn : MonoBehaviour
Debug.Log("浇水成功"); Debug.Log("浇水成功");
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS(); TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
WaterPanel.instance. Updated_interface(info); WaterPanel.instance. Updated_interface(info);
WaterPanel.instance.Updated_water(info); WaterPanel.instance.Updated_water();
} }
else else
{ {

View File

@ -21,7 +21,7 @@ public class IllustrationsAssetDetails : MonoBehaviour
void Start() void Start()
{ {
UpDateText(); UpDateText();
Updatatasset();
if (Genbtn != null) if (Genbtn != null)
{ {
Genbtn.onClick.AddListener(() => Genbtn.onClick.AddListener(() =>
@ -46,13 +46,17 @@ public class IllustrationsAssetDetails : MonoBehaviour
UpdateTaxt(); UpdateTaxt();
} }
async void Updatatasset()
{
CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
GemText.text = CapitalbalanceData.data.gem.ToString("F2");
WaterText.text = CapitalbalanceData.data.water.ToString("F2");
}
async void UpdateTaxt() async void UpdateTaxt()
{ {
isUpdating = true; isUpdating = true;
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos();
GemText.text = _PlayerInfoData.gem.ToString("F2");
WaterText.text = _PlayerInfoData.water.ToString("F2");
UserName.text = _PlayerInfoData.nickname.ToString(); UserName.text = _PlayerInfoData.nickname.ToString();
UserID.text = _PlayerInfoData.uid.ToString(); UserID.text = _PlayerInfoData.uid.ToString();
UserHead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url); UserHead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url);
@ -63,12 +67,14 @@ public class IllustrationsAssetDetails : MonoBehaviour
private void OnEnable() private void OnEnable()
{ {
InvokeRepeating("UpDateText", 1f, 1f); InvokeRepeating("UpDateText", 5f, 1f);
InvokeRepeating("Updatatasset", 1f, 1f);
} }
private void OnDisable() private void OnDisable()
{ {
CancelInvoke("UpDateText"); CancelInvoke("UpDateText");
InvokeRepeating("Updatatasset", 1f, 1f);
} }

View File

@ -48,10 +48,10 @@ public class ShopAssetDetails : MonoBehaviour
{ {
isUpdating = true; isUpdating = true;
PlayerInfoData _PlayerInfoData = await Scene_main_jiekou.instance.PlayerInfos(); CapitalbalanceIndefo CapitalbalanceData = await Scene_main_jiekou.instance.CapitalbalanceInfos();
GemText .text = _PlayerInfoData.gem.ToString("F2"); GemText .text = CapitalbalanceData.data.gem.ToString("F2");
OreText.text = _PlayerInfoData.forge.ToString("F2"); OreText.text = CapitalbalanceData.data.forge.ToString("F2");
_PlayerInfoData = null; CapitalbalanceData = null;
// 异步操作完成,标记为未执行 // 异步操作完成,标记为未执行
isUpdating = false; isUpdating = false;
} }

View File

@ -57,5 +57,7 @@ public class TreeInfoReward
public class TreeInfoChart public class TreeInfoChart
{ {
public string Name { get; set; } public string Name { get; set; }
public int status;
public string Reward { get; set; } public string Reward { get; set; }
} }