海淀天下城电子沙盘单机版
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.

44 lines
1.2 KiB

4 years ago
using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 知情人响应双击事件
/// </summary>
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<ZhiQingRenData>(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();
}
}