结束引导
parent
1322908247
commit
8f1cb1b190
|
|
@ -32,7 +32,7 @@ public class GuideGroup
|
|||
/// </summary>
|
||||
public bool IsGuiding
|
||||
{
|
||||
get{ return curStep != null && curStep.Value.GuideState == E_GuideState.Guiding; }
|
||||
get{ return curStep != null && curStep.Value.IsGuiding; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -103,8 +103,9 @@ public class GuideGroup
|
|||
/// 结束引导
|
||||
/// </summary>
|
||||
public void EndGuide()
|
||||
{
|
||||
|
||||
{
|
||||
if (IsGuiding)
|
||||
curStep.Value.EndGuide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
using cfg.GuideCfg;
|
||||
using Framework;
|
||||
using Gameplay.SubSystems;
|
||||
using Gameplay;
|
||||
using PhxhSDK;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// 新手引导管理器
|
||||
|
|
@ -82,7 +85,9 @@ public class GuideManager : Singlenton<GuideManager>, IInitable
|
|||
|
||||
if (step != curGroup.CurStep)
|
||||
{
|
||||
// 异常处理
|
||||
DebugUtil.LogError("要完成的引导步骤不是当前步骤");
|
||||
EndGuide(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -98,17 +103,28 @@ public class GuideManager : Singlenton<GuideManager>, IInitable
|
|||
curGroup.BeginGuide();
|
||||
}
|
||||
else
|
||||
{
|
||||
curGroup = null;
|
||||
UIManager.Instance.CloseWindow(UINameConst.UI_Guide);
|
||||
UIManager.Instance.CloseWindow(UINameConst.UI_GuideTip);
|
||||
// 引导结束
|
||||
}
|
||||
EndGuide(false);
|
||||
}
|
||||
else
|
||||
curGroup.BeginNextStep();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束引导
|
||||
/// </summary>
|
||||
private void EndGuide(bool isReEnterMain)
|
||||
{
|
||||
if (IsGuiding)
|
||||
curGroup.EndGuide();
|
||||
|
||||
curGroup = null;
|
||||
UIManager.Instance.CloseWindow(UINameConst.UI_Guide);
|
||||
UIManager.Instance.CloseWindow(UINameConst.UI_GuideTip);
|
||||
|
||||
if (isReEnterMain)
|
||||
LoadingExecutorManager.Instance.ExecuteLoading(new MainSceneLoadingExecutor()).Forget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化数据
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ public abstract class GuideStepBase
|
|||
/// </summary>
|
||||
public E_GuideState GuideState { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否引导中
|
||||
/// </summary>
|
||||
public bool IsGuiding
|
||||
{
|
||||
get { return E_GuideState.Guiding == GuideState; }
|
||||
}
|
||||
|
||||
public GuideStepBase(DataGuideCfg cfg)
|
||||
{
|
||||
Cfg = cfg;
|
||||
|
|
@ -109,6 +117,18 @@ public abstract class GuideStepBase
|
|||
DoBeforeComplete();
|
||||
GuideManager.Instance.CompleteStep(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束引导
|
||||
/// </summary>
|
||||
public void EndGuide()
|
||||
{
|
||||
if (!IsGuiding)
|
||||
return;
|
||||
|
||||
GuideState = E_GuideState.Idle;
|
||||
completeBase.RemoveListener();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -219,6 +219,8 @@ public class UI_GuideController : UIWindow
|
|||
|
||||
protected override void OnShowWindow(object data = null)
|
||||
{
|
||||
base.OnShowWindow(data);
|
||||
|
||||
CommonUtils.DestoryAllChildGameObject(goButtonRoot); // 先卸载该节点下所有物体
|
||||
|
||||
if (null == data)
|
||||
|
|
@ -233,22 +235,16 @@ public class UI_GuideController : UIWindow
|
|||
if (null != ts)
|
||||
{
|
||||
Button oldButton = ts.GetComponent<Button>();
|
||||
Transform tsNewButton = Object.Instantiate(ts, goButtonRoot.transform, true);
|
||||
Transform tsNewButton = Object.Instantiate(ts, goButtonRoot.transform, true); // 克隆要引导点击的按钮
|
||||
Button newButton = tsNewButton.GetComponent<Button>();
|
||||
|
||||
arrowItem.SetInfo(tsNewButton, guideButtonInfo.Cfg);
|
||||
arrowItem.SetInfo(tsNewButton, guideButtonInfo.Cfg); // 设置引导箭头位置
|
||||
|
||||
newButton.onClick.AddListener(() =>
|
||||
{
|
||||
imageBg.color = BG_IDLE_COLOR;
|
||||
oldButton?.onClick.Invoke();
|
||||
oldButton.onClick.Invoke();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHideWindow()
|
||||
{
|
||||
CommonUtils.DestoryAllChildGameObject(goButtonRoot); // 先卸载该节点下所有物体
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue