62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Threading.Tasks;
|
|||
|
public class Alertwindow : MonoBehaviour
|
|||
|
{
|
|||
|
private Button sure;
|
|||
|
private Button cancel;
|
|||
|
private bool isback=false;
|
|||
|
public GameObject player; // ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҷ<EFBFBD><D2B6><EFBFBD>
|
|||
|
public Canvas preDrillPanel; // <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼʱ<CABC>Ľ<EFBFBD><C4BD>沼<EFBFBD><E6B2BC>
|
|||
|
// <20><><EFBFBD>ڡ<EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD><DFA1><EFBFBD>ʱ
|
|||
|
public float forceOfflineDelay = 3f;
|
|||
|
// Start is called before the first frame update
|
|||
|
void Start()
|
|||
|
{
|
|||
|
sure=transform.Find("bg/downbg/GameObject3/Sure").GetComponent<Button>();
|
|||
|
cancel=transform.Find("bg/downbg/GameObject3/Cancel").GetComponent<Button>();
|
|||
|
sure.onClick.AddListener(OnSureBtn);
|
|||
|
cancel.onClick.AddListener(OnCancelBtn);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
async void OnSureBtn()
|
|||
|
{
|
|||
|
Game.uiManager.CloseUI("PoPhost");
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|||
|
isback = true;
|
|||
|
BoolValueChanged?.Invoke(isback);
|
|||
|
Game.uiManager.CloseUI("Panel1_2");
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
await StopDrillAsync(); // ʹ<><CAB9> async/await ִ<><D6B4><EFBFBD>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void OnCancelBtn()
|
|||
|
{
|
|||
|
//<2F>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>ر<EFBFBD>
|
|||
|
Game.uiManager.CloseUI("PoPhost");
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
public delegate void BoolValueChangedDelegate(bool newBoolValue);
|
|||
|
public static event BoolValueChangedDelegate BoolValueChanged;
|
|||
|
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>δ<EFBFBD><CEB4>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
|||
|
async Task StopDrillAsync()
|
|||
|
{
|
|||
|
// 1. <20><>ʱ 3 <20><>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
await Task.Delay((int)(forceOfflineDelay * 1000)); // <20><>ʱ3<CAB1><33>
|
|||
|
isback= false;
|
|||
|
// ǿ<><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
}
|
|||
|
}
|