2024-12-20 10:10:19 +08:00
|
|
|
|
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>
|
|
|
|
|
// <20><><EFBFBD>ڡ<EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD>ߡ<EFBFBD><DFA1><EFBFBD>ʱ
|
|
|
|
|
public float forceOfflineDelay = 3f;
|
2024-12-23 14:46:56 +08:00
|
|
|
|
private GameObject peopleposition;
|
|
|
|
|
private List<GameObject> nameImage; // <20>洢<EFBFBD><E6B4A2><EFBFBD>н<EFBFBD>ɫ<EFBFBD><C9AB>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-20 10:10:19 +08:00
|
|
|
|
// 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);
|
2024-12-23 14:46:56 +08:00
|
|
|
|
peopleposition = GameObject.Find("peopleposition").gameObject;
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD> Button <20><><EFBFBD><EFBFBD>
|
|
|
|
|
nameImage = new List<GameObject>();
|
|
|
|
|
foreach (Transform child in peopleposition.transform)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>"bg"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Transform bgTransform = child.Find("nameImage");
|
|
|
|
|
if (bgTransform != null)
|
|
|
|
|
{
|
|
|
|
|
nameImage.Add(bgTransform.gameObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 10:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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");
|
2024-12-23 14:46:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>Toggle<6C><65>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"nameImage"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
foreach (var bgObject in nameImage)
|
|
|
|
|
{
|
|
|
|
|
bgObject.SetActive(isback); // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
2024-12-20 10:10:19 +08:00
|
|
|
|
//<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>
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|