using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 知情人响应双击事件
///
public class InsiderControl : ObjDoubleClick
{
public void Start()
{
MessageDispatcher.AddListener("ReplayEvent", ReplayEventAskZhiQingRen);
}
private void ReplayEventAskZhiQingRen(IMessage obj)
{
var eventData = (EventData)obj.Data;
if (eventData.eventType == RecordEventType.AskZhiQingRen)
{
ZhiQingRenData data = JsonUtility.FromJson(eventData.json);
ZhiQingRenPanel.GetActiveInstance.AskZhiQingRen(data);
StartCoroutine(AskZhiQingRen(data.answer));
}
}
private IEnumerator AskZhiQingRen(string answer)
{
yield return new WaitForSeconds(0.5f);
ZhiQingRenPanel.GetInstance.gameObject.SetActive(false);
ResourceLoadWindow.Instance.LoadTextHintWindow(answer, 1f);
}
private void OnDestroy()
{
MessageDispatcher.RemoveListener("ReplayEvent", ReplayEventAskZhiQingRen);
}
public override void ClickFunc()
{
base.ClickFunc();
ZhiQingRenPanel.GetActiveInstance.AskZhiQingRen();
}
}