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

49 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PetFightingBtn : MonoBehaviour
{
Button figntBtn;
public int id;
2024-12-25 21:48:50 +08:00
public Lottery lottery;
public Button showBtn;
void Start()
{
figntBtn = GetComponent<Button>();
figntBtn.onClick.AddListener(fightClick);
2024-12-25 21:48:50 +08:00
showBtn.onClick.AddListener(showbtnClick);
figntBtn.gameObject.SetActive(false);
}
void showbtnClick()
{
lottery.CloseBtnClick();
figntBtn.gameObject.SetActive(true);
}
async void fightClick()
{
bool issuccefful = await Scene_main_jiekou.instance.PetBettless(id);
if (issuccefful)
{
petBettleInfoResponse petinfo = await Scene_main_jiekou.instance.getPetBettleInfos();
WaterPanel.instance.Updated_petinfo(petinfo);
this.gameObject.SetActive(false);
2024-12-25 21:48:50 +08:00
}
else
{
Promptmgr.Instance.PromptBubble("<22><>սʧ<D5BD><CAA7>");
this.gameObject.SetActive(false);
}
}
// Update is called once per frame
void Update()
{
}
}