高频刷新接口的替换

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
async void Start()
{
instance = this;
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
Updated_interface(info);
Updated_water(info);
petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos();
Updated_petinfo(petinfo);
PlayerInfoData playerinfo = await Scene_main_jiekou.instance.PlayerInfos();
@ -141,9 +150,10 @@ public class WaterPanel : MonoBehaviour
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();
TreeInfo info = await Scene_main_jiekou.instance.TreeInfoS();
WaterText.text = info.Data.Water.ToString();
WaterPanel.instance.Updated_water(info);
WaterPanel.instance.Updated_water();
Debug.Log(response);
}
else

View File

@ -21,7 +21,7 @@ public class FeedBtn : MonoBehaviour
Promptmgr.Instance.PromptBubble(response.message);
petBettleInfoResponse info = await Scene_main_jiekou.instance.getPetBettleInfos();
TreeInfo treeinfo = await Scene_main_jiekou.instance.TreeInfoS();
WaterPanel.instance.Updated_water(treeinfo);
WaterPanel.instance.Updated_water();
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(Vector3.one, 0.5f);
WaterPanel.instance.Updated_water(info);
WaterPanel.instance.Updated_water();
Destroy(this.gameObject);
});
});

View File

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

View File

@ -21,7 +21,7 @@ public class IllustrationsAssetDetails : MonoBehaviour
void Start()
{
UpDateText();
Updatatasset();
if (Genbtn != null)
{
Genbtn.onClick.AddListener(() =>
@ -46,13 +46,17 @@ public class IllustrationsAssetDetails : MonoBehaviour
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()
{
isUpdating = true;
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();
UserID.text = _PlayerInfoData.uid.ToString();
UserHead.sprite = await Scene_main_jiekou.instance.ImageLoaderSprite(_PlayerInfoData.avatar_url);
@ -63,12 +67,14 @@ public class IllustrationsAssetDetails : MonoBehaviour
private void OnEnable()
{
InvokeRepeating("UpDateText", 1f, 1f);
InvokeRepeating("UpDateText", 5f, 1f);
InvokeRepeating("Updatatasset", 1f, 1f);
}
private void OnDisable()
{
CancelInvoke("UpDateText");
InvokeRepeating("Updatatasset", 1f, 1f);
}

View File

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

View File

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