Advanced: Manual Step Calls

Calling the steps using a script / button / event trigger.

在此,我们通过 TutorialSceneReferences (TSR) 中的公共封装方法手动处理步骤调用逻辑。

  1. 在将调用步骤的脚本中,创建对 TSR 的引用。例如: [SerializeField] private TutorialSceneReferences sceneReferences;

  2. 根据所需结果使用公共方法调用:

Method in TSR
Description
Call Example

ChangeStepVisualText(int stepIndex, string textValue, TextToChange textField)

用于在运行时向所选步骤的所选提示传递自定义文本。

sceneReferences.ChangeStepVisualText(2, "Your text", TextToChange.PointerText)

StartTutorialStep(int stepIndex)

通过索引启动特定教程步骤并禁用其他步骤。

sceneReferences.StartTutorialStep(2);

AsyncStartTutorialStep(int stepIndex)

通过索引启动特定教程步骤,但不禁用其他步骤。

sceneReferences.AsyncStartTutorialStep(2);

StartTutorialStepWithTargets(int stepIndex, List targetObjects, bool stopOtherSteps)

使用自定义目标 GameObject 启动教程步骤。

sceneReferences.ForceCompleteStep(2, myGameObjectList, false);

ForceCompleteStep(int stepIndex)

将步骤状态设置为 "Done" 以结束该步骤。

sceneReferences.ForceCompleteStep(2);

ForceCompleteTutorial()

完成场景中的所有教程步骤(无例外),并将其标记为 "Done"。

sceneReferences.ForceCompleteTutorial();

ResetDisplayingTutorialSteps()

重置所有当前显示的教程步骤。

sceneReferences.ResetDisplayingTutorialSteps();

TurnOnTutorial()

在场景中启动教程。当 Autostart 设置为 false 时非常有用。

sceneReferences.TurnOnTutorial();

TurnOffTutorial()

关闭教程。在同一场景中切换不同教程时非常有用。

sceneReferences.TurnOnffTutorial();

TranslateAllTutorial(InputStringsScriptableObject.Language language)

将所有教程提示翻译为支持的语言之一。

sceneReferences.InputStringsScriptableObject.Language.Italian);

TranslateAllTutorialByString(string language)

将所有教程提示翻译为 CSV 文件中存在的任意语言(根据该字符串找到表头)。

sceneReferences.TranslateAllTutorialByString("Polish");

  1. 建议将从脚本调用的步骤的 Start Step 设置为 Manually Call,以确保对执行过程的统一控制。

  2. 任何 UI Graphic 预制件中的 Confirm Button 也可以调用该预制件中 UIGraphicAnimation 脚本的公共方法。

UIGraphicAnimation Method
Description
Call Example

InitializeByConfirm()

在按钮点击时触发,将步骤中的 BlockedByButton 设置为 false。然后,步骤将继续,直到玩家满足主要条件。

FinishStep()

也可以通过按钮触发,在点击时立即完成该步骤。

Last updated