网演高层钦州
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.
 
 
 

67 lines
2.1 KiB

using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TransferPersonItemOne : BaseToggle {
public Toggle toggle;
public ToggleGroup toggleGroup;
public UserData data;
public CloneGameObjInfo info;
public Text userName;
public void SetPersonInfo(CloneGameObjInfo userInfo, UserData userData)
{
info = userInfo;
data = userData;
userName = transform.Find("Label").GetComponent<Text>();
userName.text = data.UserInfo.RealName + "(外)"; //判断室内室外
toggle = GetComponent<Toggle>();
toggleGroup = transform.parent.GetComponent<ToggleGroup>();
toggle.group = toggleGroup; //只能单选
}
public override void RespondFun(bool value)
{
PersonSelected(value);
}
void PersonSelected(bool isON)
{
//如果没有人员被选中,就取消地图相机跟随
if (!toggleGroup.AnyTogglesOn())
{
//取消相机跟随 FourthGCamCtrl.NobodySelected()
//清空LookOver的selectedInfo FourthGLookOver.ClearSelectedPerson()
MessageDispatcher.SendMessage("4GNobodySelected");
}
MapSelectedPair pair = new MapSelectedPair()
{
gameObjID = info.gameObjID,
isOn = isON
};
MessageDispatcher.SendMessage("4GPersonSelected", pair);
if (isON == true)
{
//查看按钮设置对象 FourthGLookOver.SetSelectedPerson()
MessageDispatcher.SendMessage("FourthGLookOver", info);
}
}
public override void OnDestroy()
{
base.OnDestroy();
//如果被选中,则删除前先执行取消选中的逻辑
if (toggle.isOn == true)
{
toggle.isOn = false;
MessageDispatcher.SendMessage("4GNobodySelected");
MapSelectedPair pair = new MapSelectedPair()
{
gameObjID = info.gameObjID,
isOn = false
};
MessageDispatcher.SendMessage("4GPersonSelected", pair);
}
}
}