网演高层钦州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.7 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class BackController : MonoBehaviour
{
public GameObject BackBtns;
public Button ToPrevBtn;
public Button ToMenuBtn;
public Button ToLoginBtn;
public Action ToPrevAction;
public Action ToMenuAction;
public Action ToLoginAction;
public Toggle MyToggle;
void Awake()
{
MyToggle = GetComponentInChildren<Toggle>();
MyToggle.onValueChanged.AddListener(BackToggleClick);
ToPrevBtn.onClick.AddListener(ToPrevBtnClick);
ToMenuBtn.onClick.AddListener(ToMenuBtnClick);
ToLoginBtn.onClick.AddListener(ToLoginBtnClick);
}
private void ToLoginBtnClick()
{
if (ToLoginAction != null)
ToLoginAction.Invoke();
BackBtns.gameObject.SetActive(false);
MyToggle.isOn = false;
}
private void ToMenuBtnClick()
{
if (ToMenuAction != null)
ToMenuAction.Invoke();
BackBtns.gameObject.SetActive(false);
MyToggle.isOn = false;
}
private void ToPrevBtnClick()
{
if (ToPrevAction != null)
ToPrevAction.Invoke();
BackBtns.gameObject.SetActive(false);
MyToggle.isOn = false;
}
private void BackToggleClick(bool ok)
{
if (CurrentUserInfo.room!=null&&CurrentUserInfo.room.IsDrillStart)
{
LoadPromptWin.Instance.LoadTextPromptWindow("房间已锁定,不能进行返回操作!",1f);
BackBtns.gameObject.SetActive(false);
return;
}
BackBtns.gameObject.SetActive(ok);
}
}