//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, November 27, 2017
|
//--------------------------------------------------------
|
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using UnityEngine.UI;
|
|
|
namespace vnxbqy.UI
|
{
|
|
public class FunctionalGuideWin : Window
|
{
|
|
Dictionary<int, FunctionalGuideBehaviour> behaviours = new Dictionary<int, FunctionalGuideBehaviour>();
|
|
#region Built-in
|
protected override void BindController()
|
{
|
}
|
|
protected override void AddListeners()
|
{
|
}
|
|
protected override void OnPreOpen()
|
{
|
|
}
|
|
protected override void OnAfterOpen()
|
{
|
FunctionalGuideCenter.Instance.beginGuideEvent += BeginFunctionalGuide;
|
}
|
|
protected override void OnPreClose()
|
{
|
foreach (var behaviour in behaviours.Values)
|
{
|
if (behaviour != null)
|
{
|
FunctionalGuideBehaviourPool.Recycle(behaviour.gameObject);
|
}
|
}
|
|
behaviours.Clear();
|
FunctionalGuideCenter.Instance.beginGuideEvent -= BeginFunctionalGuide;
|
}
|
|
protected override void OnAfterClose()
|
{
|
}
|
|
protected override void OnActived()
|
{
|
base.OnActived();
|
var guides = FunctionalGuideCenter.Instance.GetUnderwayGuides();
|
for (int i = 0; i < guides.Count; i++)
|
{
|
var guideId = guides[i];
|
BeginFunctionalGuide(guideId);
|
}
|
}
|
|
#endregion
|
|
private void BeginFunctionalGuide(int _guide)
|
{
|
var behaviour = FunctionalGuideBehaviourPool.Require();
|
var behaviourRectTransform = (RectTransform)behaviour.transform;
|
behaviourRectTransform.MatchWhith(this.transform as RectTransform);
|
behaviour.SetActive(true);
|
behaviour.BeginGuide(_guide);
|
|
behaviours[_guide] = behaviour;
|
}
|
|
}
|
|
}
|