Skip to content

Beginner's guide

高凯 edited this page Apr 3, 2018 · 2 revisions

Editor tool

Tools -> 新手引导(Beginner's guide) -> 初始化(initialization)
Tools -> 新手引导(Beginner's guide) -> 创建新手引导预设(Create Beginner's guide Perfab)

The role of these two steps is:

  • Create a guide data table GuideData
  • Create a guide window script
  • Create a guide system script
  • Add a Guide layer to sortLayer
  • Add a guide switch in the configuration
  • Create a GuideWindow Perfab

Instructions

  1. Add the fields you want in the generated GuideData
    The default fields are:
    StartPoint bool marks whether it is the starting point
    EndPoint bool mark is the end point
    ClosePoint bool mark is the Close point
    Premise string Prerequisite guide ID
    NextGuide string Next guide ID, the default is the next guide if empty
    CallToNext bool Whether to accept the call to the next step
    ClickToNext bool Click to accept the next step
    GuideWindowName string The name of the interface to boot
    GuideObjectName StringArray The interface object to highlight
    GuideItemName StringArray Item name to highlight (dynamically created)
    TipContent string guide hint text
    TipContentPos Vector3 The location of the hint text
    MaskAlpha Float Alpha mask

  2. Rewritten in the generated GuideSystem
    OnStart () guideSystem start called
    GetGuideRecord () request guide record, depending on the circumstances choose to read from the local server or request, the default is written in persistent data
    SaveGuideRecord () Save the guide record, according to the situation to choose whether to save the local or sent to the server, the default is saved locally
    GuideStartCondition () to determine whether to meet the guide start condition, the default judgment is not the starting point
    GuideEndCondition () guide exit conditions, the default judgment is not the end point
    GuideNextCondition () to determine whether the guide to meet the next condition, the default is true
    GuideBehave () Guide the performance of each step (non-UI operation)
    GuideBehaveByUI (UIWindowBase ui) guide performance (the operation of the UI)
    ClearGuideBehave () Clear guide performance, generally should be the opposite of GuideBehave ()
    ClearGuideBehaveByUI (UIWindowBase ui) Clear the operation of the UI, generally should be the opposite of GuideBehaveByUI ()
    GuideClickFilter (InputUIOnClickEvent e) Click filter, return true passed
    GuideCallFilter () Call the filter, return true passed

  3. Add the features you need in the generated GuideWindow
    The default features are:
    ShowTips (string content, Vector3 pos) Show the hint text
    SetMaskAlpha (float alpha) Modify mask alpha
    ShowGuideUIByItem (string uiName, UIWindowBase ui, string itemName, Vector3 offset, bool isFollow)
    ShowGuideUIByObject (string uiName, UIWindowBase ui, string objName, Vector3 offset, bool isFollow)
    ShowGuideUI (RectTransform guideUI, GameObject aimUI, Vector3 offset, bool isFollow) Navigate an object of the navigation interface to a sub-object of the specified UI, such as a gesture arrow
    HideGuideUI (string uiName) Hide hint icon
    HideAllGuideUI () hide all the hint icons

Principle

  • Create a novice boot mask, the default TopBar layer, blocking the normal UI If any UI needs to be highlighted, set its SortLayer to Guide so that the UI will be displayed above the mask
  • Need to maintain the Guide layer is your highest SortLayer

Process

  • After a GuideSystem starts,The GuideSystem listens for UI open events
  • If it is the one required by the current guide and passes the guide judgment condition (rewritable) function, a guide mask is popped up, a guide operation is performed, the target object is highlighted, and other custom content,
  • When the player clicks or calls, the end of the guide and the next step to judge, if the corresponding conditions are satisfied, then empty the step of the operation before the implementation of the next step or exit

Tips

If you need the highlighted object to be active == false during novice boot execution, it may cause the canvas.overrideSorting setting to fail

Clone this wiki locally