ict.xunfei/Assets/Scripts/ROBOT/RecordPanel.cs

36 lines
1.0 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class RecordPanel : MonoBehaviour
{
public Button startRecordBtn;
public Button closeBtn;
int number;
public void Init(int number,Action<bool,string> callback)
{
this.number = number;
startRecordBtn.onClick.AddListener(()=> { StartRedord(callback); });
closeBtn.onClick.AddListener(()=>
{
callback(false, "用户主动关闭");
RobotUI.Instance.ClosePanel(RobotePanelEnum.RecordPanel.ToString());
});
}
private void StartRedord(Action<bool,string> callback)
{
RobotUI.Instance.OpenPanel(RobotePanelEnum.RecordKingPanel.ToString()).GetComponent<RecordKingPanel>().Init(number,callback);
RobotUI.Instance.ClosePanel(RobotePanelEnum.RecordPanel.ToString());
}
private void OnDisable()
{
startRecordBtn.onClick.RemoveAllListeners();
closeBtn.onClick.RemoveAllListeners();
}
}