其他关卡条件log优化

main
yurui 2024-10-12 12:46:58 +08:00
parent 3688619081
commit 0966c97b66
7 changed files with 40 additions and 46 deletions

View File

@ -14,11 +14,10 @@ public class ConditionCharacter : ICondition
public bool Check(List<float> args)
{
if (args.Count < 1)
throw new ConditionException($"{nameof(ConditionCharacter)}条件参数数量错误需要1个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionCharacter)}条件(是否拥有某个角色)需要1个参数当前只有{args.Count}个参数参数1角色id");
uint id = (uint)args[0];
CharacterDataInfo character = CharacterDataInfoManager.Instance.GetCharacterInfo((uint)args[0]);
CharacterDataInfo character = CharacterDataInfoManager.Instance.GetCharacterInfo(id);
return character != null;
}

View File

@ -14,11 +14,9 @@ public class ConditionLevelPass : ICondition
public bool Check(List<float> args)
{
if (args.Count < 1)
throw new ConditionException($"{nameof(ConditionLevelPass)}条件参数数量错误需要1个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionLevelPass)}条件(关卡是否通关)需要1个参数当前只有{args.Count}个参数参数1关卡id");
int id = (int)args[0];
if (!LevelManager.Instance.TryGetLevelInfoByID(id, out LevelInfo levelInfo))
if (!LevelManager.Instance.TryGetLevelInfoByID((int)args[0], out LevelInfo levelInfo))
return false;
return levelInfo.IsPass;
@ -27,7 +25,7 @@ public class ConditionLevelPass : ICondition
public string[] GetArgLocalizations(List<float> args)
{
if (args.Count < 1)
throw new ConditionException($"{nameof(ConditionLevelPass)}条件参数数量错误需要1个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionLevelPass)}条件(关卡是否通关)需要1个参数当前只有{args.Count}个参数参数1关卡id");
int id = (int)args[0];

View File

@ -13,7 +13,7 @@ public class ConditionLevelStar : ICondition
public bool Check(List<float> args)
{
if (args.Count < 2)
throw new ConditionException($"{nameof(ConditionLevelStar)}条件参数数量错误需要2个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionLevelStar)}条件(关卡星级是否满足),需要两个参数,当前只有{args.Count}个参数参数1关卡id参数2星级数量");
int id = (int)args[0];
int star = (int)args[1];
@ -27,11 +27,8 @@ public class ConditionLevelStar : ICondition
public string[] GetArgLocalizations(List<float> args)
{
if (args.Count < 2)
throw new ConditionException($"{nameof(ConditionLevelStar)}条件参数数量错误需要2个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionLevelStar)}条件(关卡星级是否满足),需要两个参数,当前只有{args.Count}个参数参数1关卡id参数2星级数量");
int id = (int)args[0];
int star = (int)args[1];
return new string[2] { id.ToString(), star.ToString() };
return new string[2] { ((int)args[0]).ToString(), ((int)args[1]).ToString() };
}
}

View File

@ -14,7 +14,7 @@ public class ConditionPlayerSkillUpgradeLevel : ICondition
public bool Check(List<float> args)
{
if (args.Count < 1)
throw new ConditionException($"{nameof(ConditionPlayerSkillUpgradeLevel)}条件参数数量错误需要1个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionPlayerSkillUpgradeLevel)}条件(指挥官技能是否解锁)需要1个参数当前只有{args.Count}个参数参数1需要的等级");
int lv = (int)args[0];
@ -26,10 +26,8 @@ public class ConditionPlayerSkillUpgradeLevel : ICondition
public string[] GetArgLocalizations(List<float> args)
{
if (args.Count < 1)
throw new ConditionException($"{nameof(ConditionPlayerSkillUpgradeLevel)}条件参数数量错误需要1个参数只有{args.Count}参数");
throw new ConditionException($"{nameof(ConditionPlayerSkillUpgradeLevel)}条件(指挥官技能是否解锁)需要1个参数当前只有{args.Count}个参数参数1需要的等级");
int lv = (int)args[0];
return new string[1] { lv.ToString() };
return new string[1] { ((int)args[0]).ToString() };
}
}

View File

@ -101,15 +101,7 @@ namespace Gameplay.Guide
if (null == curStep)
return;
try
{
curStep.Value.StartGuide();
}
catch (Exception e)
{
DebugUtil.LogError(e);
GuideManager.Instance.OnSkipGuide();
}
curStep.Value.StartGuide();
}
/// <summary>

View File

@ -227,6 +227,30 @@ namespace Gameplay.Guide
BeginGuide(linkedCfg.Last.Value.Id);
}
/// <summary>
/// 跳过所有引导
/// </summary>
public void SkipAllGuide()
{
DebugUtil.Log("跳过所有引导");
GuideConfig guideConfig = TableManager.Instance.Tables.GuideConfig;
DataGuideCfg cfg = guideConfig.DataList[^1];
NetHelper.SaveGuideProgress((uint)cfg.Id);
EndGuide(true);
}
/// <summary>
/// 显示跳过所有引导提示
/// </summary>
public void ShowSkipAllGuide()
{
UITipsManager.ShowConfirmTwo("脱离卡死",
"是否强制跳过新手引导?(选择【跳过】便不再触发新手引导)",
"跳过",
"否",
() => { SkipAllGuide(); }); // TODO 本地化
}
/// <summary>
/// 初始化数据
/// </summary>
@ -416,25 +440,10 @@ namespace Gameplay.Guide
{
DebugUtil.Log($"{SKIP_GUIDE_CHECK_TIME}秒内连续点击{SKIP_GUIDE_CLICK_COUNT}次,弹出强制跳过新手引导提示");
queueTime.Clear();
UITipsManager.ShowConfirmTwo("脱离卡死",
"是否强制跳过新手引导?(选择【跳过】便不再触发新手引导)",
"跳过",
"否",
() =>
{
OnSkipGuide();
}); // TODO 本地化
ShowSkipAllGuide();
}
else
DebugUtil.Log($"[引导]记录两秒内的点击次数{queueTime.Count}");
}
public void OnSkipGuide()
{
GuideConfig guideConfig = TableManager.Instance.Tables.GuideConfig;
DataGuideCfg cfg = guideConfig.DataList[^1];
NetHelper.SaveGuideProgress((uint)cfg.Id);
EndGuide(true);
}
}
}

View File

@ -241,6 +241,7 @@ namespace Gameplay.Guide
catch (Exception e)
{
DebugUtil.LogError($"引导id{Cfg.Id},执行错误,异常信息:{e}");
GuideManager.Instance.SkipAllGuide();
}
}
@ -601,10 +602,10 @@ namespace Gameplay.Guide
LevelManager.Instance.TryEnterLevel(levelId, null, null, isPlay);
}
catch (Exception e)
catch (Exception e)
{
DebugUtil.LogError($"引导id{Cfg.Id},执行错误,异常信息:{e}");
GuideManager.Instance.OnSkipGuide();
GuideManager.Instance.ShowSkipAllGuide();
}
}