贺州人民医院电子沙盘
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.
 
 
 
 

89 lines
3.3 KiB

using AX.InputSystem;
using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class FireManSkillTogge : MonoBehaviour
{
public FireManSkills fireManSkills;
private GameObject chooseObj;
private GameObject lastchoose;
public bool flag = false;
void Awake()
{
GetComponent<Toggle>().onValueChanged.AddListener(RespondFun);
//MessageDispatcher.AddListener("SelectChange", SetFireManSkills);
//MessageDispatcher.AddListener("SetFireManSkills", SetFireManSkills);
}
private void SetFireManSkills(IMessage obj)
{
//chooseObj = (GameObject)obj.Data;
//Debug.Log(chooseObj.GetComponent<FireManMessage>().workType.ToString() + chooseObj.name);
//if (fireManSkills == chooseObj.GetComponent<FireManMessage>().workType)
//{
// GetComponent<Toggle>().isOn = true;
//}
//else
//{
// GetComponent<Toggle>().isOn = false;
//}
// GetComponent<Toggle>().interactable = (chooseObj.GetComponent<FireManMessage>().EnabledSkills & fireManSkills) != 0;
//lastchoose = chooseObj;
}
public void RespondFun(bool value)
{
if (FireManSkillsPanel.GetInstance.IsChange)
{
return;
}
if (SelectedObjs.selectedCharacters.Count > 0)
{
SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType = value ? fireManSkills : FireManSkills.None;
//如果技能按钮是出水
if (fireManSkills == FireManSkills.SprayWater)
{
if (value)
{//如果正在出水,不显示出水选择按钮直接根据消防员当前出水粒子发送出水消息
if (flag == true)
{
MessageDispatcher.SendMessage("CHANGE_PARTICLE_TYPE_COMMAND",
new ParticleTypeCmdArgs() { ParticleType = SelectedObjs.selectedCharacters[0].GetComponent<ControlSprayHead>().particleenum });
flag = false;
return;
}
}
}
// SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().workType = value ? fireManSkills : FireManSkills.None;
if (RecordEvent.IsRecord())
{
string json = JsonUtility.ToJson(new PowerSkillRecordEventData()
{
GameId = SelectedObjs.selectedCharacters[0].GetComponent<CloneGameObjInfo>().gameObjID,
EnabledSkills = (int)SelectedObjs.selectedCharacters[0].GetComponent<FireManMessage>().EnabledSkills,
CurrentSkill = (int)fireManSkills,
Skill = fireManSkills.ToString(),
ArgData = value
});
RecordEvent.AddEventData(SelectedObjs.selectedCharacters[0].GetComponent<CloneGameObjInfo>().gameObjType, RecordEventType.FireManSkill, json);
}
MessageDispatcher.SendMessage(SelectedObjs.selectedCharacters[0].GetComponent<CloneGameObjInfo>().gameObjID, gameObject.name, value);
}
}
private void OnDestroy()
{
//MessageDispatcher.RemoveListener("SetFireManSkills", SetFireManSkills);
}
}