79 lines
2.0 KiB
C#
79 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace MMO
|
|
{
|
|
public class MMOUIGuide : MMOUIBase
|
|
{
|
|
public Action DelGuideOver;
|
|
|
|
private List<MMOGuideStep> mSteps;
|
|
private int mCurrentIndex = 0;
|
|
|
|
protected override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
mSteps = MMOUIManager.GetChildList<MMOGuideStep>(transform);
|
|
for (int i = 0; i < mSteps.Count; i++)
|
|
{
|
|
mSteps[i].DelExcute = OnStepExcute;
|
|
}
|
|
}
|
|
|
|
public override void OnOpen()
|
|
{
|
|
base.OnOpen();
|
|
|
|
mSteps[0].gameObject.SetActive(true);
|
|
}
|
|
|
|
private void OnStepExcute()
|
|
{
|
|
int tExcuteIndex = mCurrentIndex;
|
|
mSteps[mCurrentIndex].gameObject.SetActive(false);
|
|
mCurrentIndex++;
|
|
if (mCurrentIndex < mSteps.Count)
|
|
{
|
|
mSteps[mCurrentIndex].gameObject.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
MMOUserData.Instance.FinishGuide();
|
|
Close();
|
|
}
|
|
|
|
ExcuteByIndex(tExcuteIndex);
|
|
}
|
|
|
|
private void ExcuteByIndex(int pIndex)
|
|
{
|
|
if (pIndex == 0)
|
|
{
|
|
MMOModule.Instance.UIMgr.OpenUI<MMOUIFill>().SetInput("");
|
|
}
|
|
else if (pIndex == 1)
|
|
{
|
|
MMOGuideInput tInput = mSteps[pIndex].GetComponent<MMOGuideInput>();
|
|
if (tInput != null)
|
|
{
|
|
MMOModule.Instance.UIMgr.GetUI<MMOUIFill>().SetInput(tInput.InputStr);
|
|
}
|
|
}
|
|
else if (pIndex == 2)
|
|
{
|
|
MMOModule.Instance.UIMgr.GetUI<MMOUIFill>().SendMessage("OnClickSubmit");
|
|
}
|
|
else if (pIndex == 3)
|
|
{
|
|
MMOModule.Instance.UIMgr.CloseUI<MMOUIMain>();
|
|
}
|
|
else if (pIndex == 4)
|
|
{
|
|
DelGuideOver?.Invoke();
|
|
}
|
|
}
|
|
}
|
|
}
|