跳过所有引导
parent
4c488f645d
commit
0876f54f35
|
|
@ -59,7 +59,7 @@ namespace Framework.Condition
|
|||
|
||||
#region Fields And Properties
|
||||
|
||||
private const int INVALID_ALLOC_ID = 0;
|
||||
public const int INVALID_ALLOC_ID = 0;
|
||||
|
||||
private int _allocID = INVALID_ALLOC_ID;
|
||||
private Dictionary<EventName, List<ConditionInfo>> _dicConditionInfos = new();
|
||||
|
|
|
|||
|
|
@ -365,6 +365,11 @@
|
|||
/// </summary>
|
||||
LoadingExecutorComplete,
|
||||
|
||||
/// <summary>
|
||||
/// 进入游戏
|
||||
/// </summary>
|
||||
EnterGame,
|
||||
|
||||
#region 新手指引
|
||||
/// <summary>
|
||||
/// 新手引导退出关卡
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: adc4dd6c24b6ed54a8a27b3c6b82e608
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using Framework;
|
||||
using Framework.Condition;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 进入游戏
|
||||
/// </summary>
|
||||
public class ConditionEnterGame : ICondition
|
||||
{
|
||||
public EventManager.EventName SignalName => EventManager.EventName.EnterGame;
|
||||
|
||||
private bool isEnter;
|
||||
|
||||
public bool Check(List<float> args)
|
||||
{
|
||||
isEnter = true;
|
||||
|
||||
return isEnter;
|
||||
}
|
||||
|
||||
public string[] GetArgLocalizations(List<float> args)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b17241e19662f8546a00b79ef4a0bc92
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using cfg.GuideCfg;
|
||||
using Framework.Condition;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
using cfg.GuideCfg;
|
||||
using dnlib.DotNet;
|
||||
using Framework;
|
||||
using Framework.Condition;
|
||||
using Gameplay.Area;
|
||||
using Gameplay.Level;
|
||||
using Gameplay.Net;
|
||||
using Gameplay.Skill;
|
||||
using NLDPB;
|
||||
using NPOI.OpenXmlFormats.Vml;
|
||||
using PhxhSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -17,14 +20,6 @@ namespace Gameplay.Guide
|
|||
/// </summary>
|
||||
public class GuideManager : Singlenton<GuideManager>, IInitable, IUpdatable
|
||||
{
|
||||
/// <summary>
|
||||
/// 新手引导配置字典,key:引导组,Value:引导步骤配置链表
|
||||
/// </summary>
|
||||
private Dictionary<int, LinkedList<DataGuideCfg>> dicGuideCfg;
|
||||
/// <summary>
|
||||
/// 当前的引导组
|
||||
/// </summary>
|
||||
private GuideGroup curGroup;
|
||||
#region 兜底强制跳过引导机制
|
||||
/// <summary>
|
||||
/// 2秒内点击12次,弹出强制跳过引导
|
||||
|
|
@ -39,6 +34,18 @@ namespace Gameplay.Guide
|
|||
/// </summary>
|
||||
private const int SKIP_GUIDE_CLICK_COUNT = 15;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 新手引导配置字典,key:引导组,Value:引导步骤配置链表
|
||||
/// </summary>
|
||||
private Dictionary<int, LinkedList<DataGuideCfg>> dicGuideCfg;
|
||||
/// <summary>
|
||||
/// 当前的引导组
|
||||
/// </summary>
|
||||
private GuideGroup curGroup;
|
||||
/// <summary>
|
||||
/// 触发条件id
|
||||
/// </summary>
|
||||
private int reactionID = ConditionReactor.INVALID_ALLOC_ID;
|
||||
|
||||
/// <summary>
|
||||
/// 是否引导中
|
||||
|
|
@ -102,33 +109,24 @@ namespace Gameplay.Guide
|
|||
/// <summary>
|
||||
/// 开始引导
|
||||
/// </summary>
|
||||
public bool BeginGuide()
|
||||
public void BeginGuide()
|
||||
{
|
||||
#if GUIDE
|
||||
if (IsGuiding)
|
||||
return false;
|
||||
return;
|
||||
|
||||
int completeStepId = (int)Actor.Instance.Logic.GetCount((uint)LogicID.NewGuideProgress);
|
||||
int groupId = GetGuideGroupId(completeStepId);
|
||||
if (!dicGuideCfg.TryGetValue(groupId, out LinkedList<DataGuideCfg> linkCfg))
|
||||
return false;
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
SetGuideState();
|
||||
DebugUtil.Log($"<color=#00FA9A>已完成的引导步骤id:{completeStepId},开始引导组id:{groupId}</color>");
|
||||
curGroup = new(groupId, linkCfg);
|
||||
curGroup.BeginGuide();
|
||||
curGroup = new GuideGroup(groupId, linkCfg);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError($"跳过引导,错误信息:{e}");
|
||||
RecoverState();
|
||||
}
|
||||
if (ConditionReactor.INVALID_ALLOC_ID == reactionID)
|
||||
reactionID = ConditionReactor.Instance.AddReaction(curGroup.CurStep.Cfg.BeginCondition, OnBeginGuide);
|
||||
|
||||
ConditionReactor.Instance.ExecuteReaction(reactionID);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -201,15 +199,30 @@ namespace Gameplay.Guide
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 跳过全部引导
|
||||
/// 跳过当前引导组
|
||||
/// </summary>
|
||||
/// <param name="isReEnterMain"></param>
|
||||
public void SkipAllGuide(bool isReEnterMain)
|
||||
public void SkipCurGuideGroup()
|
||||
{
|
||||
GuideConfig guideConfig = TableManager.Instance.Tables.GuideConfig;
|
||||
DataGuideCfg cfg = guideConfig.DataList[^1];
|
||||
NetHelper.SaveGuideProgress((uint)cfg.Id);
|
||||
EndGuide(isReEnterMain);
|
||||
if (null == curGroup)
|
||||
return;
|
||||
|
||||
if (!dicGuideCfg.TryGetValue(curGroup.GroupId, out LinkedList<DataGuideCfg> linkedCfg))
|
||||
{
|
||||
DebugUtil.LogError("要完成的引导组不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
NetHelper.SaveGuideProgress((uint)linkedCfg.Last.Value.Id); // 跳过引导步骤,保存服务器
|
||||
DebugUtil.Log($"<color=#00FA9A>跳过引导组,服务器保存引导id:{linkedCfg.Last.Value.Id}</color>");
|
||||
int nextGroupId = curGroup.NextGroupId;
|
||||
if (dicGuideCfg.TryGetValue(nextGroupId, out LinkedList<DataGuideCfg> linkCfg))
|
||||
{
|
||||
curGroup = new(nextGroupId, linkCfg, true);
|
||||
curGroup.BeginGuide();
|
||||
}
|
||||
else
|
||||
EndGuide(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -350,6 +363,37 @@ namespace Gameplay.Guide
|
|||
UIManager.Instance.IsEnableBack = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始引导
|
||||
/// </summary>
|
||||
private void OnBeginGuide(bool conditionResult, object callBackParam, int reactionID)
|
||||
{
|
||||
if (this.reactionID != reactionID)
|
||||
return;
|
||||
|
||||
if (!conditionResult)
|
||||
return;
|
||||
|
||||
ConditionReactor.Instance.RemoveReaction(reactionID);
|
||||
this.reactionID = ConditionReactor.INVALID_ALLOC_ID;
|
||||
|
||||
if (IsGuiding)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
SetGuideState();
|
||||
int completeStepId = (int)Actor.Instance.Logic.GetCount((uint)LogicID.NewGuideProgress);
|
||||
DebugUtil.Log($"<color=#00FA9A>已完成的引导步骤id:{completeStepId},开始引导组id:{curGroup.GroupId}</color>");
|
||||
curGroup.BeginGuide();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError($"跳过引导,错误信息:{e}");
|
||||
RecoverState();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引导过程中的任意点击事件
|
||||
/// </summary>
|
||||
|
|
@ -375,7 +419,13 @@ namespace Gameplay.Guide
|
|||
"是否强制跳过新手引导?(选择【跳过】便不再触发新手引导)",
|
||||
"跳过",
|
||||
"否",
|
||||
() => { EndGuide(true); }); // TODO 本地化
|
||||
() =>
|
||||
{
|
||||
GuideConfig guideConfig = TableManager.Instance.Tables.GuideConfig;
|
||||
DataGuideCfg cfg = guideConfig.DataList[^1];
|
||||
NetHelper.SaveGuideProgress((uint)cfg.Id);
|
||||
EndGuide(true);
|
||||
}); // TODO 本地化
|
||||
}
|
||||
else
|
||||
DebugUtil.Log($"[引导]记录两秒内的点击次数{queueTime.Count}");
|
||||
|
|
|
|||
|
|
@ -101,12 +101,12 @@ namespace Gameplay.Guide
|
|||
/// </summary>
|
||||
public async void StartGuide()
|
||||
{
|
||||
GuideState = E_GuideState.Guiding;
|
||||
|
||||
DebugUtil.Log($"<color=#00FA9A>开始id为{Cfg.Id}的引导,延迟{Cfg.StepStartDelay}秒开始</color>"); // #00FA9A绿色
|
||||
|
||||
await DoBeforeGuide();
|
||||
|
||||
GuideState = E_GuideState.Guiding;
|
||||
|
||||
await UniTask.Delay((int)(Cfg.StepStartDelay * 1000f)); // 延迟时间开始
|
||||
|
||||
DoRealBeforeGuide();
|
||||
|
|
|
|||
|
|
@ -142,8 +142,12 @@ namespace Gameplay.Net
|
|||
{
|
||||
if (!_isReConnecting)
|
||||
{
|
||||
if (!GuideManager.Instance.BeginGuide())
|
||||
GameStateManager.Instance.ChangeState(new GameStateMainScene(true));
|
||||
GuideManager.Instance.BeginGuide();
|
||||
EventManager.Instance.Send(EventManager.EventName.EnterGame);
|
||||
if (GuideManager.Instance.IsGuiding)
|
||||
return;
|
||||
|
||||
GameStateManager.Instance.ChangeState(new GameStateMainScene(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ public class UI_GuideController : UIWindow
|
|||
|
||||
arrowItem = new ArrowItem(FindObj("Arrow"));
|
||||
|
||||
CommonUtils.BindButton(buttonSkip, OnSkipCurStep);
|
||||
CommonUtils.BindButton(buttonSkip, OnSkipCurGuideGroup);
|
||||
}
|
||||
|
||||
protected override async void OnShowWindow(object data = null)
|
||||
|
|
@ -832,16 +832,14 @@ public class UI_GuideController : UIWindow
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 跳过当前步骤
|
||||
/// 跳过当前引导组
|
||||
/// </summary>
|
||||
private void OnSkipCurStep()
|
||||
private void OnSkipCurGuideGroup()
|
||||
{
|
||||
GuideManager.Instance.SkipAllGuide(false);
|
||||
return;
|
||||
|
||||
if (E_GuideArrowType.Button == guideInfo.GuideArrowType)
|
||||
{
|
||||
guideButton?.onClick.Invoke();
|
||||
}
|
||||
UITipsManager.ShowConfirmTwo("脱离卡死",
|
||||
"是否强制跳过当前新手引导组?(选择【跳过】便不再触发当前新手引导组)",
|
||||
"跳过",
|
||||
"否",
|
||||
() => { GuideManager.Instance.SkipCurGuideGroup(); }); // TODO 本地化
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue