Cute_demon_attacks/meng_yao/Assets/script/scene_Main/FeedBtn.cs

42 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FeedBtn : MonoBehaviour
{
Button feedBtn;
// Start is called before the first frame update
void Start()
{
feedBtn = GetComponent<Button>();
feedBtn.onClick.AddListener(FeedClick);
}
async void FeedClick()
{
FeedPetResponse response = await Scene_main_jiekou.instance.feedpets();
if (response.code == 200)
{
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_petinfo(info);
}
else
{
Promptmgr.Instance.PromptBubble(response.message);
}
}
// Update is called once per frame
void Update()
{
}
}