LobbyWindow.cs
//窗口控件初始化
protected override void InitWidget()
{
mHomepage = mRoot.FindChild("StartMenuManager/StartMenuBtn/Homepage").GetComponent<UIToggle>();
UIGuideCtrl.Instance.AddUiGuideEventBtn(mHomepage.gameObject);
mBattle = mRoot.FindChild("StartMenuManager/StartMenuBtn/Battle").GetComponent<UIToggle>();
UIGuideCtrl.Instance.AddUiGuideEventBtn(mBattle.gameObject);
UIGuideCtrl.cs
public void AddUiGuideEventBtn(GameObject gobj)
{
if (gobj == null || UIGuideModel.Instance.UiGuideButtonGameObjectList.Contains(gobj))
{
return;
}
UIGuideModel.Instance.UiGuideButtonGameObjectList.Add(gobj);
EventCenter.Broadcast(EGameEvent.eGameEvent_UIGuideEvent, gobj);
}
UIGuideModel.cs
public List<GameObject> UiGuideButtonGameObjectList = new List<GameObject>();
任务封装类中:GuideForceClick.cs
public override void EnterTask()
{
EventCenter.AddListener<GameObject>(EGameEvent.eGameEvent_UIGuideEvent, OnUiGuideAddButtonEvent); //事件注册
DeltTask();
}
/// <summary>
/// 界面打开需要表现引导
/// </summary>
/// <param name="gobj"></param>
private void OnUiGuideAddButtonEvent(GameObject gobj)
{
if (gobj.name == mTaskInfo.BtnName) {
DeltTask ();
}
}
FR:海涛高软(hunk Xu) QQ技术交流群:386476712