Dialogue System for Unity文档中文对照版(简雨原创翻译)第三篇(口型,语音同步相关)

37 篇文章 1 订阅

When the conversation uses thisdialogue entry, it will play the Voice() command in the Sequence field. Thiscommand will play the audio clip and the animation and wait until both aredone.

当会话使用对话的条目,它将序列中的领域发挥voice()命令。这个命令将播放音频剪辑,动画等都做了。

 

Usingentrytag To Simplify Sequences

In thesequencer, every dialogue entry has an associated "entrytag". This isa unique string in the format:

使用entrytag简化序列

 

在音序器,每一项都有一个相关的对话”entrytag”。这是一个独特的字符串格式:

·        (ActorName)_(ConversationID)_(EntryID)

 

 

Forexample, say an actor named Adam is assigned conversation 27, line 42. Whenthis entry's Sequence field is being played in the sequencer, the reservedkeyword entrytag will be Adam_27_42.

 

You canget a list of all entrytags by exporting a Voiceover Script as described in theExporting Dialogue Databases section. This will generate a CSV spreadsheet filethat you can give to your voice director and actors.

例如,说一个叫亚当的演员分配会话27,42号线。当这个输入序列的领域是在音序演奏,保留关键字entrytag将adam_27_42。

 

你可以得到一个列表中的所有entrytags出口解说脚本在出口对话数据库部分的描述。这将生成一个CSV表格文件,你可以给你的声音,导演和演员。


Whenyou generate your voiceover audio files and/or animation clips, name themaccording to their entrytags. If you want to organize audio files by actor, youcan create a separate folder for each actor and put them in a Resourcessubfolder inside the actor's folder.

 

Then,instead of manually specifying each filename in each dialogue entry's Sequencefield, you can use a single Default Sequence in the Dialogue Manager such as:

当你生成你的配音音频文件和/或动画剪辑,叫他们根据自己的entrytags。如果你想通过演员组织的音频文件,您可以创建每个演员一个单独的文件夹放在一个资源文件夹里面的演员的文件夹。

 

然后,而不是手动在每个对话输入的序列字段指定每个文件名,您可以在对话管理器如使用一个默认序列:

·        Default Sequence:Voice(entrytag,entrytag)

Usingthe example above, when conversation 27 gets to line 42, it will play thissequence:

使用上面的例子中,当会话27到42行,它将发挥这一序列:

·        Voice(Adam_27_42, Adam_27_42)

Thiswill play an audio file named "Adam_27_42" and an animation clip onthe speaker named "Adam_27_42".

 

You canuse the entrytag keyword in any sequencer command. For example:

 

•Voice(entrytag,entrytag) – to play legacyanimation lipsync with audio and animations named "Adam_27_42".

•Audio(entrytag) – to play an audio clip named"Adam_27_42".

•AnimatorPlay(entrytag) – to play a Mecanimstate named "Adam_27_42".

•AnimatorTrigger(entrytag) – to set a Mecanimtrigger named "Adam_27_42".

•Animation(entrytag) – to play a legacy animationnamed "Adam_27_42".

•Camera(entrytag) – to cut to a camera anglenamed "Adam_27_42".

•Delay()(entrytag) – to wait for a sequencermessage "Adam_27_42".

这将播放一个音频文件命名为“adam_27_42”和一个动画剪辑扬声器上的名为“adam_27_42”。

 

你可以在任何顺序命令使用entrytag关键词。例如:

 

?声音(entrytag,entrytag)–遗产发挥动画口型同步音频和动画名为“adam_27_42”。

 

?音频(entrytag)–播放一个音频剪辑命名为“adam_27_42”。

 

?animatorplay(entrytag)–发挥mecanim国家命名的“adam_27_42”。

 

?animatortrigger(entrytag)–设置mecanim触发“adam_27_42”。

 

?动画(entrytag)–发挥传统动画命名为“adam_27_42”。

 

?相机(entrytag)–削减到摄像机的角度命名为“adam_27_42”。

 

?delay()(entrytag)–等待一个音序器的消息”adam_27_42”。

 

SequencesOutside Conversations

You canrun sequences outside of conversations by using a Sequence Trigger or bycalling PixelCrushers.DialogueSystem.DialogueManager.PlaySequence() in yourscripts.

序列以外的对话

 

你可以运行在对话序列采用序列触发或通过调用pixelcrushers。dialoguesystem。dialoguemanager。在你的脚本playsequence()。

SequencerCamera & Angles

Thesequencer will use the camera specified in the Dialogue Manager's displaysettings. If no camera is specified, the sequencer will borrow the current maincamera and restore its position when the sequence is done. However, you maywant to use a separate camera with different post-processing effects from yourmain gameplay camera – perhaps adding a strong depth of field to focus on theconversants and blur out the background.

 

IMPORTANT:If you use a separate sequencer camera (or cameras), you must set their Tags toMainCamera.

音序器相机角度

 

音序器将使用在对话管理器的显示设置指定的相机。如果没有相机指定,音序器将借当前主要的相机和恢复其位置时的顺序是。然而,你可能想要使用一个单独的相机不同的后处理的效果,从你的主游戏摄像机–或许加强场深度关注的conversants和模糊的背景。

 

重要:如果你使用一个单独的音序器的相机(或摄像机),你必须把他们的标签maincamera。

 

CameraAngle Prefab

Thesequencer command Camera() moves the sequencer camera to angles specified in aprefab called the "camera angle prefab". This prefab is set in theDialogue Manager's Display Settings. (The camera angle prefab can actually bean object in the scene, but a prefab is usually more convenient.) If youhaven't assigned a camera angle prefab, the Dialogue Manager uses a defaultprefab located in Resources/Camera Angles.

 

Thecamera angle prefab is a hierarchy of game objects. Each child objectrepresents a camera angle. Camera angle positions are defined by the relativepositions of the child objects from the root object.

 

Forexample, the simple camera angle hierarchy described below defines three cameraangles (Closeup, Medium, and Full) progressively further from the subject.

相机角度预置

 

音序器命令camera()移动音序器相机在预制指定的角度称为“相机角度预置”。这种预制设置在对话管理器的显示设置。(照相机的角度预置实际上可以在场景中的对象,但一个预置通常是更方便。)如果你没有分配一个摄像机角度预制,对话管理器使用一个默认的预置位于资源/摄像机的角度。

 

摄像机的角度预设是一个游戏对象的层次结构。每个子对象代表一个摄像机的角度。摄像机的角度位置定义的子对象的相对位置的根对象。

 

例如,简单的摄像机角度定义了三个层次下面描述的镜头角度(特写,介质,和全)逐步从主体。

Example:

·        Camera Angles [root] (0,0,0)

o    Closeup(0,2,1)

o    Medium(0,2,2)

o    Full(0,2,3)

Whenyou use the Camera(x) command in a sequence, it first checks the camera angleprefab. If it finds a child object whose name matches x, it uses the offset ofthat child object from the camera angle prefab. It then places the camera atthe same offset from the character.

 

Example:The default camera angle prefab has a child named "Closeup" that'sapproximately 2 units up and 1 unit back. The sequence command Camera(Closeup)moves the camera approximately 2 units up and 1 unit back from the character,as shown below:

当你使用相机(x)在一个序列中的命令,它首先检查摄像机角度预置。如果发现孩子的对象的名称与X,它使用的子对象的偏移角度预置摄像机。然后将相机从字符相同的偏移。

 

例如:默认的摄像机角度预制有一个孩子起名为“特写”,大约是2单位和1单位后。序列命令相机(特写)移动摄像机约2单元和1单元从字符后,如下所示:


It has another child named "Medium" that's 2 units up and2 units back, which places the camera a little further back from the character.

To add acamera angle to point at a seated character, you might add another child objectthat's only 1 unit up and 2 units back.

If theDialogue System doesn't find a matching child in the camera angles prefab, itlooks for an object named x in the scene. If it finds one, it uses it as anabsolute camera position. You can add empty game objects to the scene thatspecify absolute camera positions. The Feature Demo uses three of these. In thedemo scene, they're organized under the Dialogue Manager object, but they canbe anywhere in your scene hierarchy.

它的另一个孩子起名为“中等”这2个单元和2单元后,将相机的远一点从性格。

 

添加一个相机角度指向一个坐的性格,你可以添加另一个孩子的对象,只有1的单位和2单位。

 

如果在摄影机角度预置的对话系统没有找到匹配的孩子,它找个对象命名为X的场景。如果找到一个,它使用它作为一个绝对的相机位置。您可以添加空的游戏对象,指定绝对摄像机位置的场景。演示使用这三个特征。在演示现场,他们的对话管理器对象的组织下,但他们可以在你的场景层次结构中的任何地方。

 

DefaultCamera Angles

Thedefault camera angle prefab contains these angles:

 

•Closeup: Face

•Closeup Back: Back of head

•Closeup Left: Left side of head

•Closeup Right: Right side of head

•Medium: Face and torso

•Medium Back: Back of head and torso

•Medium Left: Left side of head and torso

•Medium Right: Right side of head and torso

•Full: Front-on body

•Full Back: Back of body

•Full Left: Left side of body

•Full Right: Right side of body

•Wide: Body with space (farther than Mediumshots)

•OTS Left: Over the left shoulder

•OTS Right: Over the right shoulder

•Down: Looking down on the subject

•Up: Looking up at the subject

相机默认角度

 

默认的摄像机角度预置包含这些角度:

 

?特写:面

 

?特写:头后部

 

?特写左:头部左侧

 

?特写:头部右侧

 

?介质:面部和躯干

 

?介质:头部和躯干背

 

?左:介质的头部和躯干的左侧

 

?介质:头部和躯干右侧

 

?全:前体

 

?后卫:人体背面

 

?左满:身体左侧

?充分的权利:身体右侧

?宽:身体与空间(比中击球更远)

?OTS左:在左肩

?OTS的权利:在右肩

?下:俯视主题

?:仰望主题

 

CameraAngle Editor

You canuse the Camera Angle Editor to create camera angle prefabs.

摄像机的角度编辑

你可以使用相机角度编辑器来创建摄影机的角度问题。


To usethe Camera Angle Editor:

 

1.Selectthe menu item Window > Dialogue System > Tools > Camera Angle Editor.

2.Subject:Assign a character in the scene. The editor will show camera angles relative tothis character in the Game View.

3.CameraAngle Collection: Assign a game object. You could start with a copy of thedefault angle prefab in Prefabs/Camera Angles/Resources or create your own fromscratch. If you assign a prefab, you can only edit existing angles. To add newangles, you'll have to click the button to instantiate a scene object of the prefab.

4.CameraAngle: Select camera angles from the drop-down. The Game View will move to theposition of the selected camera angle. To add a new camera angle, click the"+" next to the drop-down.

Rememberto save your new camera angle collection (as a prefab or scene object) so youcan assign it to your Dialogue Manager's display settings.

使用照相机的角度编辑:

1。选择菜单项窗口>对话系统>工具>相机角度编辑。

主题:2。在场景中指定一个字符。编辑器将显示相机的角度来看这个角色在游戏中的相对。

3。镜头角度收集:指定一个游戏对象。你可以先在预设/摄像机的角度/资源或创建您自己的从零开始的一份默认角度预置。如果你指定一个预设,你只能编辑现有的角度。添加新的角度,你必须点击按钮来实例化一个预置的场景对象。

4:选择拍摄角度。拍摄角度从下拉。游戏视图将移动到选中的相机角度位置。添加一个新的视角,点击“+”旁边的下拉。

记得要保存您的新相机角度采集(作为一种预制或现场对象)所以你可以分配给您的对话管理器的显示设置。

Customizingthe Sequencer

SequencerDisplay Settings

You cancustomize the Sequencer's behaviour through the Dialogue Manager's displaysettings:

 

•Set Camera Angle Prefab to change the cameraangles that the sequencer uses.

•Set Subtitle Chars Per Second and Min SubtitleSeconds to specify how long to wait in the default sequence that's constructedwhen a dialogue entry isn't assigned a sequence.

•Set Default Sequence to specify the sequenceto use when a dialogue entry isn't assigned a sequence. The keyword"{{end}}" is automatically replaced with the duration determined by SubtitleChars Per Second.

定制的音序器

测序显示设置

你可以定制的音序器的行为,通过对话管理器的显示设置:

?设置相机角度预制改变相机角度,音序器的用途。

?设置字幕字符每秒和民字幕秒指定多少等在默认序列构造的对话时进入不分配一个序列。

 

?设置默认的顺序指定序列时使用的对话进入不分配一个序列。关键词“{ } { }结束“自动更换时间由字幕字符每秒。

CustomSequencer Commands

Tocreate your own sequence commands:

 

1.Copythe template found in Scripts/Templates/SequencerCommandTemplate.cs.

2.Deletethe lines containing the text [REMOVE THIS LINE].

3.Renamethe class from SequencerCommandTemplate to SequencerCommandFoo, where Foo isthe name of your command. In your sequences, you'll use the command Foo().

4.Addyour code to the Start(), Update(), and/or OnDestroy() methods.

◦Start():Initialize the command. You can use GetParameter() to read the arguments to thecommand.

◦Update():(Optional) Progress the command forward one frame. For example, if the commandsmoothly moves an object over time, you can update the transform byTime.deltaTime.

◦OnDestroy():Finish the command. For example, move the object to its final position.

◦Ineither Start() or Update() (wherever appropriate), call Stop(); to indicatethat the command is done.

To seeexamples, you can browse the source code to the built-in commands inScripts/Core/Model-View-Controller/View/Sequencer/SequencerCommands.

自定义程序的命令

 

创建你自己的命令序列:

 

1。复制模板脚本/模板/ sequencercommandtemplate.cs发现。

 

2。删除含有文本[线删除线]。

 

3。重命名类从sequencercommandtemplate到sequencercommandfoo,其中foo是你的命令的名称。在你的序列,你可以使用命令foo()。

 

4。添加代码来start(),update(),和/或ondestroy()方法。

 

?start():初始化命令。你可以使用getparameter()读的命令参数。

 

?update():(可选)进步的命令前一帧。例如,如果命令移动平稳随时间变化的对象,你可以更新改造的改变。

 

?ondestroy():完成指令。例如,对象移动到其最终位置。

 

?在start()或update()(在适当的地方),称stop();表明命令了。

 

看到的例子,你可以浏览源代码到内置在脚本中的指令/核心/模型视图控制器/视图/音序器/ sequencercommands。

Example:LoadLevel()

Thissequencer command loads a new level. Syntax: LoadLevel(My Level Name). (Makesure you've added the scene named "My Level Name" to your buildsettings.)

 

SequencerCommandLoadLevel.cs

例如:loadlevel()

 

这个音序器命令加载一个新的水平。语法:loadlevel(我的名字)。(确保你添加场景命名为“我级别名称“生成设置。)


QuickTime Events (QTEs) are an entirely optional feature in the Dialogue System. Atauthor-specified times, the Dialogue System can display a QTE Indicator, whichis a prompt for the player to choose to hit a trigger button before theindicator disappears. If the player triggers the QTE, typically somethingcontext-specific happens.

 

Thebuilt-in dialogue UI prefabs define two QTE indicators: "QTE 0 Good"and "QTE 1 Evil". If you want to give the player the option ofperforming an "evil" action (typically during a conversation), youcan display "QTE 1 Evil" for a short time. Then your conversation cancheck if the player triggered the QTE and act accordingly.

快速时间事件(QTES)在对话系统完全可选功能。在作者指定的时间,对话系统可以显示QTE的指标,这是一个供玩家选择指示消失之前命中触发按钮的提示。如果玩家引发QTE,通常是上下文特定的发生。

 

内置的对话界面预设定义两个QTE的指标:“QTE 0好”和“QTE 1恶”。如果你想给玩家选择执行“邪恶”的行动(通常在谈话过程中),你可以显示“QTE 1恶”的时间很短。然后你的谈话可以检查如果玩家引发QTE和采取相应的行动。

 

How ToAdd QTEs

1.Inthe Dialogue Manager's Display Settings, define the QTE buttons. By default,QTE 0 is assigned the button "Fire1" and QTE 1 is assigned the button"Fire2". You can define new buttons by selecting the menu item Edit> Project Settings > Input.

2.DefineQTE indicators in your Dialogue UI. The built-in dialogue UI prefabs alreadydefine two indicators (good and evil). If you only want to change theappearance of the indicators, you can assign new textures to them.

3.Usethe QTE() command in a sequence.

◦Syntax:QTE(index, duration, luaVariable, luaValue)

◦Description:This shows a QTE indicator for the specified duration. If the player triggersthe QTE, a Lua variable is set to a specified value; otherwise it's set to ablank string.

◦Example:QTE(0, 2, Punch_NPC, yes) (Presents a two-second QTE opportunity for the playerto punch the NPC. If the player inputs the QTE trigger in time, the Luavariable Variable["Punch_NPC"] will be set to "Yes".

4.Ifthis is in a conversation, then in one or more of the links check the value ofVariable["Punch_NPC"] (using the example above). If it's set, thelinked dialogue entry can play a sequence that plays a punch animation.

Theconversation "Private Hart" in the Feature Demo contains a QTEexample.

如何添加QTES

 

1。在对话管理器的显示设置,定义QTE的按钮。默认情况下,QTE的0分配按钮“火山带”和QTE1分配按钮“fire2”。你可以定义新的按钮,选择菜单项“编辑>设置>输入项目。

 

2。你的对话界面定义QTE的指标。内置的对话UI问题已经定义了两个指标(善恶)。如果你只想改变指标的外观,您可以指定新的纹理到他们。

 

3。使用序列中qte()命令。

 

?语法:QTE(指数,时间,luavariable,luavalue)

 

?说明:这显示为指定的时间QTE指示器。如果玩家引发QTE,Lua变量设置为指定的值;否则设置为空字符串。

 

?例如:QTE(0,2,punch_npc,是的)(提供一二秒QTE的机会玩家冲人大。如果玩家投入时间引发QTE,Lua变量[“punch_npc”]将被设置为“是”。

 

4。如果这是一个会话,然后在一个或多个链接的检查变量的值[“punch_npc”](使用上面的例子)。如果设定的对话,与入口可以发挥起拳动画序列。

 

对话“私人哈特”在功能演示包含QTE的例子。

Bark System

Barksare one-off lines of dialogue, typically spoken by an NPC for atmosphere (e.g.,"Nice weather today"). Barks can also be used to give the player anidea of an NPC's internal state (e.g., "I'm reloading. Cover me!").

 

Thesource lines for barks are contained in conversations in your dialoguedatabase. (see Writing Bark Text)

 

Varioustriggers are available to make an NPC bark. (See Bark Triggers)

 

Barksare displayed through a bark UI component attached to the NPC. (See Bark UIs)

树皮是一次性的线的对话,大气NPC通常说的(例如,“今天天气很好”)。树皮(Barks,引擎的一种模式)也可以用来给玩家一个NPC的内部状态的想法(例如,“我重装。掩护我!”)。

 

为皮源线在你的数据库中包含的对话的对话。(见写作树皮文本)

 

各种触发器可以使一个NPC树皮。(见树皮触发器)

 

树皮树皮的UI组件通过连接到NPC显示。(见树皮UIS)


Writethe text of your barks in a conversation. The NPC will evaluate every dialogueentry linked from the START entry. If the conditions are true, it will add theentry to its list. Then it will choose an entry from the list based on whetherthe NPC is configured to play them in sequential or random order.

 

You canalso specify a cutscene sequence in each dialogue entry (in the Video Filefield). For example, the sequence could play a hand wave animation with a"Hello" bark. If the dialogue entry's sequence is blank, no sequencewill be played.

 

Formore information: Dialogue Creation

在谈话中写下你的皮的文本。将对每个对话进入链接从一开始进入。如果条件为真,这将增加进入名单。然后,它会选择从基于是否NPC被配置为在顺序或随机顺序播放列表中的条目。

 

你也可以指定在每个对话进入一个动画序列(视频文件中的字段)。例如,该序列可以发挥挥手动画“你好”树皮。如果对话输入的序列是空白的,没有序列将发挥。

 

更多信息:对话创造

NPCSetup Wizard - Barks

The NPCSetup Wizard (Window > Dialogue System > Tools > Wizards > NPCSetup Wizard) can step you through configuring an NPC to bark when triggeredand/or on a timed basis. The sections below provide more details on how barkswork and how they're displayed.

NPC安装向导-树皮

 

设置向导(窗口> >工具>向导对话系统> NPC安装向导)可以配置您的NPC树皮当触发和/或定时的基础。以下章节提供更多细节如何工作,他们是如何显示的树皮。

BarkTriggers

To playa bark, add a trigger to your NPC (or another game object, if you specify theNPC as the speaker). These triggers will play barks:

 

•Bark On Idle: Barks on a timed interval. Ifyou only want the NPC to bark on idle when the PC is within a certain range (orsome other condition), you can also add a Range Trigger.

•Bark Trigger: Barks on a specified trigger,such as "using" the NPC or entering its trigger area.

•Bark On Dialogue Event: Barks on a dialogueevent such as the end of another bark or the end of a conversation.

Formore information: Triggers.

 

You canchain multiple barks using Bark On Dialogue Event. However, if the chain islong, you may prefer to run it as a conversation. If you want to run theconversation using the characters' bark UIs, you can use a Bark Dialogue UI forthe conversation.

树皮触发器

 

起皮,将触发你的NPC(或另一个游戏对象,如果您指定的人大为喇叭)。这些触发器会起皮:

 

?树皮:在空闲时间间隔的树皮。如果你只想要NPC树皮上的空闲时,电脑是在一定范围内(或其他条件),你也可以添加范围触发。

 

?树皮触发:在指定触发树皮,如使用“进入其触发区。

 

?在对话事件树皮:在对话事件如其他的树皮或谈话的结束端皮。

 

更多信息:触发器。

 

你可以用树皮树皮链多重对话活动。然而,如果链长,你可能更愿意为一个会话运行它。如果你想使用字符“树皮UI运行的谈话,你可以使用一个叫对话UI的谈话。

BarkUIs

Todisplay barks, the Dialogue System uses a component that implements thePixelCrushers.DialogueSystem.IBarkUI interface, such as the Unity Bark UI andNGUI Bark UI components. The bark UI component can display floating text abovethe NPC's head, write the text to a chat window, etc., depending on theparticular implementation

树皮的用户界面

 

显示树皮,对话系统使用一个组件实现的pixelcrushers.dialoguesystem.ibarkui接口,如统一的用户界面和用户界面组件深入树皮树皮。树皮的UI组件可以显示浮动文本上方的NPC头上,写一个聊天窗口,等文字,取决于特定的实现

TextlessBark UI Component

TheTextless Bark UI component displays no text. It's an empty stub to satisfy therequirement that barkers have a bark UI. Use this component if the bark onlyuses a sequence, such as playing audio and animation.

无文字的树皮的UI组件

 

在无文字的树皮的UI组件不显示文本。这是为了满足barkers树皮UI要求有一个空的存根。如果皮只使用一个序列使用这个组件,如播放音频和动画。

 

UnityBark UI Component

TheUnity Bark UI component uses Unity GUI to display the text above the NPC'shead. To customize the appearance, you can specify a GUI Skin and GUI Style,text style (e.g., outline or shadow), and specify when bark text is shown. Youcan also tick Include Name to include the barker's name in the bark text.Ticking Wait Until Sequence Ends will keep the bark text onscreen until thebark's associated cutscene sequence (if any) is over.

 

Note:During gameplay, the Unity Bark UI adds a child component that contains theOnGUI() method that actually displays the bark text. The child component isonly active while a bark is being displayed. It's disabled at all other times,so you don't need to worry about any overhead from an OnGUI that isn't doinganything.

 

Bydefault, it positions the bark above the object's collider. If you specify aText Position transform in the bark UI, the bark will be positioned at thattransform instead. If you want to apply an offset, you can manually add aUnityBarkUIOnGUI component and set the (x,y,z) offset.

 

CheckIf Player Visible is ticked by default. When ticked, the barker runs a raycastto the main camera every frame that a bark is being displayed. If the raycasthits something, such as a wall, it hides the bark. If the raycast is clear, itshows the bark.

 

Scriptreference: PixelCrushers.DialogueSystem.UnityGUI.UnityBarkUI

统一的树皮的UI组件

 

树皮的UI组件使用统一统一的GUI文字显示在NPC的头。定制外观,您可以指定一个图形用户界面皮肤和GUI风格,文字样式(例如,轮廓或阴影),并指定文本显示在树皮。你也可以在包括名称包括巴克的名字刻在树皮的文本。在等待序列两端将树皮的文字在屏幕上直到皮的相关动画序列(如果有的话)是在。

 

注意:在游戏中,用户界面统一树皮添加一个子组件,包含ongui()方法,却表现出树皮文本。子组件是唯一的活动而树皮被显示。在其他的时候它的残疾人,所以你不需要担心从一个OnGUI,什么都没做任何开销。

 

默认情况下,将树皮对象的上述对撞机。如果你指定一个文本位置变换在树皮的UI,树皮将定位在变换代替。如果你想申请一个偏移,可以手动添加unitybarkuiongui组件和设置(x,y,z)偏移。

 

如果勾选默认玩家可见。当打勾,巴克跑的光线投射到主照相机每一帧,树皮被显示。如果光线投射击中某物,如墙,它隐藏在树皮。如果光线投射是明确的,这表明树皮。

 

脚本参考:pixelcrushers.dialoguesystem.unitygui.unitybarkui

NGUIBark UI Component

TheNGUI Bark UI component uses NGUI to display text above the NPC's head. Settingup NGUI barks requires two steps:

 

1.NGUIrequires a UI (e.g., "UI Root (2D)") to display anything. You mustadd one copy of the UI Bark Root component to a game object in an NGUI UI. Allbarking NPCs will add their NGUI UILabels as children of this object. You onlyneed one UI Bark Root, regardless of how many NPCs will use it.

2.Addan NGUI Bark UI component to each NPC that will bark. Then set the Font. Tocustomize the appearance, you can also set the color, effect, and scale of thetext.

TheNGUI Bark UI will attempt to place the label above the NPC's head based on theheight of its CharacterController or CapsuleCollider. If the NPC has neither,or if you want to use a different position, you can set the Override BarkerTransform property or create and use a label template. Add NGUIFollowTarget.csto the label template and set Override Height.

 

You canalso tick Include Name to include the barker's name in the bark text. TickingWait Until Sequence Ends will keep the bark text onscreen until the bark'sassociated cutscene sequence (if any) is over.

 

CheckIf Player Visible is ticked by default. When ticked, the barker runs a raycastto the main camera every frame that a bark is being displayed. If the raycasthits something, such as a wall, it hides the bark. If the raycast is clear, itshows the bark.

 

Scriptreference: PixelCrushers.DialogueSystem.NGUI.NGUIBarkUI

深入树皮的UI组件

 

深入树皮的UI组件使用NGUI显示文本上方的NPC的头。建立深入树皮需要两个步骤:

 

1.ngui需要一个用户界面(例如,“根(2D)”)显示任何东西。你必须添加UI树皮根组成一份在NGUIUI游戏对象。所有的NPC会增加他们的叫声深入uilabels为它的子对象。你只需要一个UI的树皮,根,不管有多少的NPC会使用它。

 

2。添加一个NGUI树皮UI组件的每个NPC将树皮。然后设置字体。定制外观,你还可以设置颜色,效果,以及文本表。

 

深入树皮的UI将试图把标签上面的NPC头上基于其charactercontroller或capsulecollider高度。如果NPC没有,或者如果你想使用一个不同的位置,你可以设置重写巴克变换属性或创建并使用一个标签模板。添加nguifollowtarget.cs的标签模板和设置覆盖高度。

 

你也可以在包括名称包括巴克的名字刻在树皮的文本。在等待序列两端将树皮的文字在屏幕上直到皮的相关动画序列(如果有的话)是在。

 

如果勾选默认玩家可见。当打勾,巴克跑的光线投射到主照相机每一帧,树皮被显示。如果光线投射击中某物,如墙,它隐藏在树皮。如果光线投射是明确的,这表明树皮。

 

脚本参考:pixelcrushers.dialoguesystem.ngui.nguibarkui

NGUIHUD Text Bark UI Component

An NGUIHUD Text version is available in the NGUI HUD Text package.

 

CheckIf Player Visible is ticked by default. When ticked, the barker runs a raycastto the main camera every frame that a bark is being displayed. If the raycasthits something, such as a wall, it hides the bark. If the raycast is clear, itshows the bark.

 

Scriptreference: PixelCrushers.DialogueSystem.NGUI.NGUIHUDTextBarkUI

NGUIHUD文本树皮的UI组件

 

一个NGUI HUD文本在NGUI HUD文本包是可用的。

 

如果勾选默认玩家可见。当打勾,巴克跑的光线投射到主照相机每一帧,树皮被显示。如果光线投射击中某物,如墙,它隐藏在树皮。如果光线投射是明确的,这表明树皮。

 

脚本参考:pixelcrushers.dialoguesystem.ngui.nguihudtextbarkui

DaikonForge Bark UI Component

TheDaikon Forge Bark UI component uses Daikon Forge GUI to display text above theNPC's head. Setting up Daikon Forge GUI barks requires two steps (and anoptional third):

 

1.DaikonForge GUI requires a UI (e.g., "UI Root") to display anything. Youmust add one copy of the Daikon Forge Bark Root component to a panel or other containerin a Daikon Forge UI. All barking NPCs will add their dfLabels as children ofthis object. You only need one bark root, regardless of how many NPCs will useit. Use a different layer for this UI (e.g., "Layer 9 - Barks") thanyour dialogue UI (e.g., "Layer 8 - GUI") to prevent their respectivecameras from trying to draw each others' controls.

2.Add aDaikon Forge Bark UI component to each NPC that will bark. Then set theappearance properties such as font, color, outline, etc. or use a template asdescribed in the optional step below.

3.(Optional)Instead of setting the properties on each bark UI, you can create a templatelabel in your bark root. Assign this to the template field of each bark UI. Thebark UI will clone the template and all of its appearance properties. You candeactivate the template object so it doesn't appear onscreen.

4.Youcan also tick Include Name to include the barker's name in the bark text.Ticking Wait Until Sequence Ends will keep the bark text onscreen until thebark's associated cutscene sequence (if any) is over.

CheckIf Player Visible is ticked by default. When ticked, the barker runs a raycastto the main camera every frame that a bark is being displayed. If the raycasthits something, such as a wall, it hides the bark. If the raycast is clear, itshows the bark.

 

Scriptreference: PixelCrushers.DialogueSystem.DaikonForgeGUI.DaikonForgeBarkUI

 

萝卜伪造树皮的UI组件

 

萝卜萝卜皮的UI组件使用伪造伪造GUI显示文本上方的NPC的头。建立大熔炉桂皮需要两个步骤(和一个可选的第三):

 

1。萝卜GUI要求铸就UI(例如,“根”)显示任何东西。你必须添加的萝卜伪造一份树皮根组件在一个大熔炉的UI面板或其他容器。所有的叫声的NPC会添加他们的dflabels为它的子对象。你只需要一个树皮,根,不管有多少的NPC会使用它。使用一个不同的层,这个用户界面(例如,“9层皮”)比你的对话界面(例如,“图层8簋”)来防止他们各自的相机试图把每个人的控制。

 

2。添加一个萝卜伪造树皮的UI组件每个NPC将树皮。然后设置外观属性如字体,颜色,轮廓,或使用模板如下可选步骤描述。

 

3。(可选)而设置的属性在每个树皮的用户界面,你可以创建你的树皮,根模板标签。指定到每个树皮UI模板字段。树皮的UI将克隆模板及其所有的外观属性。您可以停用模板对象就不会出现在屏幕上。

 

4。你也可以在包括名称包括巴克的名字刻在树皮的文本。在等待序列两端将树皮的文字在屏幕上直到皮的相关动画序列(如果有的话)是在。

 

如果勾选默认玩家可见。当打勾,巴克跑的光线投射到主照相机每一帧,树皮被显示。如果光线投射击中某物,如墙,它隐藏在树皮。如果光线投射是明确的,这表明树皮。

 

脚本参考:pixelcrushers.dialoguesystem.daikonforgegui.daikonforgebarkui

2DToolkit Bark UI Component

TheTK2D Bark UI component uses 2D Toolkit to display text above the NPC's head.Follow these instructions to set up 2D Toolkit barks:

 

1.Add atk2dTextMesh to a child object of the actor. Name it, for example, "BarkText Mesh".

◦Positionit above the actor's head [e.g., at (0,2,0)].

◦SetMax Chars to the maximum length of bark text that the actor will say.

◦Setthe Anchor to Middle Center.

◦ClickHFlip to flip the text horizontally.

◦SelectWindow > Dialogue System > Components > Example > Always FaceCamera if you want the bark text to always face the camera.

◦Optionallyadd a fader (Window > Dialogue System > Components > UI > 2DToolkit > Fader) if you want barks to fade in and out.

2.Add aTK2DBark UI to the actor (Window > Dialogue System > Components > UI> 2D Toolkit > Bark UI).

3.Optionallyassign the tk2dTextMesh to the TK2DBark UI. If you don't assign it, the bark UIwill automatically look in its children for a tk2dTextMesh; however, this runsthe risk of finding the wrong one if you have more than one under the actor'shierarchy.

4.Youcan also tick Include Name to include the barker's name in the bark text.Ticking Wait Until Sequence Ends will keep the bark text onscreen until thebark's associated cutscene sequence (if any) is over.

Scriptreference: PixelCrushers.DialogueSystem.TK2D.TK2DBarkUI

二维工具包树皮的UI组件

 

tk2d树皮的UI组件使用2D工具显示文本上方的NPC的头。遵循这些指示,建立二维工具包树皮:

 

1。添加一个tk2dtextmesh到子对象的演员。例如,名称,“树皮文本网格”。

 

?位置在演员的头[例如,在(0,2,0)]。

 

?设置最大字符的文本,树皮演员说的最大长度。

 

?设置锚中中心。

 

?单击“hflip翻转文字水平。

 

?选择窗口> > > >对话系统组件实例总是如果你想要树皮文本总是面对镜头面对摄像机。

 

?选择添加一个推子(窗口> > > >界面对话系统部件的二维工具>推子)如果你想要树皮的淡入和淡出。

 

2。添加一个tk2dbarkUI的演员(窗口> > > >界面对话系统部件的二维工具>树皮UI)。

 

3。任意地分配给tk2dtextmesh到tk2dbark UI。如果你不把它的皮,UI会自动在其看来孩子一tk2dtextmesh;然而,这是发现错误的风险,如果你有一个以上的演员在层次结构。

 

4。你也可以在包括名称包括巴克的名字刻在树皮的文本。在等待序列两端将树皮的文字在屏幕上直到皮的相关动画序列(如果有的话)是在。

 

脚本参考:pixelcrushers.dialoguesystem.tk2d.tk2dbarkui

CreatingYour Own Bark UI

Tocreate your own Bark UI:

 

1.Copythe template found in Scripts/Templates/TemplateBarkUI.cs.

2.Deletethe lines containing the text [REMOVE THIS LINE].

3.Renamethe class from TemplateBarkUI to the name of your bark UI.

4.Implementthe Bark() method and the IsPlaying property.

You canexamine the implementations for Unity GUI, NGUI, etc., for examples.

创建您自己的皮的UI

创建您自己的皮的UI:

1。复制模板脚本/模板/templatebarkui.cs发现。

2。删除含有文本[线删除线]。

3。重命名类从templatebarkui你的树皮UI的名字。

4。实现方法和性能起着bark()。

你可以检查实现统一的GUI,NGUI,等,为例。


Alertsare gameplay messages that are reported to the player. You can show alerts togive the player feedback such as updating the status of a quest.

警报是报告给玩家的游戏玩法信息。你能通知给玩家反馈如更新任务的状态。

In Lua

In Luacode, assign a string to Variable["Alert"]. Commonly this is done ina dialogue entry's User Script (see Dialogue Creation), but you can also addthe Lua code to a Lua On Dialogue Event trigger or your own scripts.

 

Example:

如何显示警报

 

在Lua中

 

在Lua代码,把一个字符串赋给变量[“警报”]。通常这是在对话输入的用户脚本完成(见对话创造),但你也可以添加LUA代码对对话事件触发或您自己的脚本版本。

 

的例子:

 

InScripts

In yourscripts, call PixelCrushers.DialogueSystem.DialogueManager.ShowAlert().

 

Example:

在脚本

 

在你的脚本,调用pixelcrushers。dialoguesystem。dialoguemanagershowalert()。

 

的例子:

 

InPlayMaker

InPlayMaker, use the "Show Alert" action. 

在中场,使用“显示警报”行动。

Alertsin the Dialogue UI

TheDialogue System uses the current Dialogue UI to display the alert. Depending onthe dialogue UI's implementation, it could flash the alert on the screen, addit to a chat window, or whatever you want.

 

Tocustomize the way alerts are displayed, you can customize the Dialogue UI. Thedefault implementations let you set up a label and an optional parent panelthat can contain any other controls that you want to show, including anoptional continue/close button.

 

Alertsthat are launched by setting Variable["Alert"] use the settings inDialogue Manager > Display Settings > Subtitle Settings. The duration isthe length of the alert divided by Subtitle Chars Per Second. For example, ifthe alert is 90 characters long and Subtitle Chars Per Second is 30, then theduration will be 3 seconds. Alerts will always be displayed at least Min SubtitleSeconds (default is 2 seconds).

 

You canalso use ShowAlert() within a cutscene sequence.

在对话UI警报

 

对话系统采用当前对话UI显示警报。根据对话界面的实现,它可以在屏幕上闪光报警,将它添加到一个聊天窗口,或任何你想要的。

 

自定义显示警报的方式,你可以自定义对话界面。默认的实现,让你建立一个标签和一个可选的母面板可以包含任何其他您想要显示的控件,包括一个可选的继续/关闭按钮。

 

警报是推出了通过设置变量[“警报”]设置对话经理>显示设置>字幕设置。持续的警觉除以字幕字符每秒的长度。例如,如果警报是90个字符长和字幕字符每秒30,那么时间为3秒。警报会至少分钟字幕秒显示(缺省为2秒)。

 

你也可以使用动画序列中的showalert()。

Questsare usually started and completed by conversing with NPCs, so it makes sense tointegrate the quest system with the dialogue system. This makes it very easy tomanage quests right inside dialogue entries. The quest system allows you todefine quests and subgoals (quest entries), update them, and query theirstates.

任务是通过对话的NPC完成,所以与对话系统的任务系统将是有意义的。这使得管理任务对话就很容易在条目。任务系统允许你定义的任务和目标(任务条目),更新,查询他们的状态。

 

QuestData

Questinformation is stored in the dialogue database and its corresponding Luaenvironment.

 

TheDialogue System utilizes the data model defined in Urban Brain Studios' ChatMapper. Chat Mapper provides built-in management for Actors, Conversations,User Variables, Locations, and Items.

 

Unityprojects generally don't make use of the Location or Item tables. The questsystem repurposes the Item table to keep track of quests. This makes itconvenient to manage quests in Chat Mapper by adding, removing, and modifyingitems in the built-in Item table.

 

Ifyou're not using Chat Mapper, you can add Items using the built-in DialogueEditor. If you're using Items as quests, tick the Use Quest System checkbox.

 

Withinthe Dialogue System, the Quest[] table is an alias for the Item[] table. Inyour Lua conditions and user scripts, you can use "Quest" instead of"Item" if you want. This alias is also defined in the Chat Mappertemplate project provided with the Dialogue System so you can use it in ChatMapper, too.

 

任务数据

 

任务信息存储在数据库及其相应的Lua环境对话。

 

对话系统利用数据在城市脑工作室的聊天映射定义的模型。聊天的映射为演员,对话,用户变量,位置提供了内置的管理,和项目。

 

统一项目一般不使用位置或项目表。新的任务系统的项目表来跟踪任务。这使得它便于管理的任务映射加入聊天,拆卸,和内置的表项修改项目。

 

如果你不使用聊天器,你可以使用内置的对话编辑器添加项目。如果你使用项目的任务,在任务系统使用复选框。

 

对话系统中,任务[ ]表是一个别名为项目[ ]表。在Lua条件和用户脚本,您可以使用“任务”而不是“项目”如果你想。这个别名也在聊天制图模板工程设置对话系统,所以你可以使用它在聊天的映射定义,太。

QuestData Fields

Thename of the item is the title of the quest. The quest system uses these fieldsin the Item record:

 

•Name: Title of the quest

•State: Valid values (case-sensitive):unassigned, active, success, failure, or done

◦(Ifusing Chat Mapper, add this custom field or use the Dialogue System templateproject)

•Description: The description of the quest

•Success Description: (optional) Thedescription to be displayed when the quest has been successfully completed

•Failure Description: (optional) Thedescription to be displayed when the quest has ended in failure

•Abandonable: (optional) A Boolean that, iftrue, specifies that the player can choose to abandon the quest in the QuestLog Window.

•Trackable: (optional) A Boolean that, if true,specifies that the player can choose to enable or disable tracking in the QuestLog Window.

•Track: (optional) A Boolean that, if true,specifies that the player wants to track the quest. The Quest Log Window allowsthe player to toggle tracking on and off. Your gameplay HUD is responsible fordisplaying tracking information. You can use the Quest Tracker HUD or writeyour own.

•Abandon Sequence: (optional) A sequence toplay if the player abandons the quest in the Quest Log Window. You must addthis field manually if you want to use it.

Note:The state done is essentially equivalent to success. In the remainder of theDialogue System's documentation, either done or success may be used inexamples, but when using the QuestLog script API, they both correspond to thesame enum state, QuestState.Success.

 

As anexample, you might define a simple quest like this:

 

•Item: "Kill 5 Rats"

◦State:"unassigned"

◦Description:"The baker asked me to bring him 5 dead rats to make a pie."

◦SuccessDescription: "I brought the baker 5 dead rats, and we ate a delicious pie!Yum!"

◦FailureDescription: "I freed the Pied Piper from jail. He took all the rats. Nopie for me...."

◦Abandonable:true

Notethat the quest log system uses a field named State inside each item, not theChat Mapper GetStatus()/SetStatus() functions.

 

Questdescriptions may contain formatted text (e.g., tags such as [lua(code)]),although response menu-related tags are discarded, and emphasis tags areignored in order to give the display a consistent look in the Unity Quest LogWindow. You're free to observe these tags, of course, in your own quest windowimplementation if you choose to write one instead of using the Unity Quest LogWindow system.

 

The[lua(code)] tag can be very useful to add dynamic text to descriptions, such asadding a counter as in the example below:

 

•Description: The baker asked me to bring him 5dead rats to make a pie. I need to collect [lua(Variable["Rats_Remaining"])]more.

 

任务数据域

 

项目的名称是追求的标题。任务系统中使用这些领域的项目记录:

 

?名称:任务的名称

 

?状态:有效值(区分大小写):未分配的,积极的,成功,失败,或做的

 

?(如果使用聊天映射,添加自定义字段或使用对话系统模板的项目)

 

?描述:任务的描述

 

?成功的描述:(可选)描述时要显示的任务已顺利完成

 

?故障描述:(可选)描述时要显示的追求已经失败了

 

?放弃:(可选)一个布尔值,如果TRUE,指定玩家可以选择放弃任务日志窗口。

 

?追踪:(可选)一个布尔值,如果TRUE,指定玩家可以选择启用或禁用日志窗口跟踪。

 

?轨道:(可选)一个布尔值,如果TRUE,指定该球员想跟踪任务。任务日志窗口允许玩家切换跟踪和关闭。你的游戏HUD负责显示跟踪信息。你可以使用任务追踪HUD或写下你自己的。

 

?放弃序列:(可选)序列发挥玩家如果放弃任务日志窗口任务。你必须把这场手动如果您想使用它。

 

注:国家做的是基本上等同于成功。在对话系统的文档的其余部分,要么做或成功可以用的例子,但当使用questlog脚本API,它们都对应于同一个枚举状态,queststate.success。

 

作为一个例子,你可以定义一个像这样的简单任务:

 

?项目:“杀死5只老鼠”

 

?状态:“未分配”

 

?描述:“贝克问我给他带来5个死老鼠做馅饼。”

 

?成功的描述:“我带来贝克5死老鼠,我们吃了美味的馅饼!味道好极了!”

 

?故障描述:“我从监狱释放的吹笛者。他把所有的老鼠。没有派我…”

 

?放弃:真实的

 

请注意,日志系统使用一个叫做状态在每个项目领域,不聊天制图getstatus() / setstatus()功能。

 

任务描述可能包含格式化文本(例如,标签,如[ lua(代码)]),虽然响应菜单相关的标签被丢弃,并强调标签被忽略,给人以显示在统一的任务日志窗口一致的外观。你可以自由地观察这些标签,当然,在你自己的任务实现,如果你选择写一个而不是使用统一的任务日志窗口系统。

 

Lua的[(代码)】标签可以添加动态文本的描述非常有用,如添加一个计数器,如下面的例子:

 

?描述:贝克问我给他带来5个死老鼠做馅饼。我需要收集[ lua(变量[“rats_remaining”])]地。

 

QuestEntries

Questscan also have subgoals, called quest entries. Quest entries are numbered anduse these fields:

 

•Entry Count: The number of quest entries.

•Entry # State: The state of the entry(unassigned, active, success, failure, or done) where '#' is the entry number,starting from 1. (Again, "done" is just essentially the same as"success".)

•Entry #: The description of the entry, where'#' is the entry number.

As anexample, you might define a quest with subgoals like this:

 

•Item: "Escape the Prison Planet"

◦State:"active"

◦Description:"I've been unjustly imprisoned on this planet, but I'll escape!"

◦EntryCount: 4

◦Entry1 State: "active"

◦Entry1: "I woke up on this prison planet, but I won't die here."

◦Entry2 State: "unassigned"

◦Entry2: "I broke out of my cell by hacking the electronic lock."

◦Entry3 State: "unassigned"

◦Entry3: "I set up a distraction to lure the guard away from his ship."

◦Entry4 State: "unassigned"

◦Entry4: "I stole the guard's ship and finally made my escape."

If youreference these fields in Lua code, please remember to replace spaces andhyphens with underscores as described in Important Note About Table Indices.For example: Item["Escape_the_Prison_Planet"].Entry_1_State ="success"

任务项

 

任务也可以有目标,称为任务词条。任务条目编号和使用这些领域:

 

?入口计数:探索项目数。

 

?进入#状态:输入的状态(未分配的,积极的,成功,失败,或做)在#”进入数量,从1开始。(再次,“做”是本质上是相同的“成功”。)

 

?进入#:条目的描述,其中“#”词条数目。

 

作为一个例子,你可以定义一个像这样的目标追求:

 

?项目:“逃离监狱星球”

 

?状态:“积极的”

 

?描述:“我被不公平地被囚禁在这个星球上,但我会逃跑!”

 

?输入数:4

 

?进入1态:“积极的”

 

?1条:“我醒来在这个监狱行星,但我不会死在这里。”

 

?2条:“未分配”

 

?2条:“我打破了我的细胞通过控制电子锁。”

 

?3条:“未分配”

 

?3条:“我建立了一个分心吸引警卫离开他的船。”

 

?4条:“未分配”

 

?4条:“是我偷的警卫船终于使我逃走。”

 

如果你参考这些领域在Lua代码,请用下划线代替空间和连字符在表指标重要说明。例如:“escape_the_prison_planet项目[”]。entry_1_state=“成功”

Localization

Descriptionand Entry fields support localization. Simply add fields such as (for French):

 

•Description FR-fr

•Success Description FR-fr

•Failure Description FR-fr

•Entry 1 FR-fr

•Entry 2 FR-fr, etc.

Rememberthat in Lua code the spaces and hyphens need to be replaced by underscores.

 

If youuse the built-in Dialogue Editor, you will almost certainly want to addlocalization fields to the template on the Dialogue Editor's Templates Foldout.This way, they will automatically be added to quests.

 

定位

 

支持本地化的描述和输入域。只需添加领域如(法国):

 

?描述fr FR

 

?成功描述fr FR

 

?故障描述fr FR

 

?进入1 FR FR

 

?进入2 FR FR,等。

 

记得在Lua代码空间和连字符,需要更换的下划线。

 

如果你使用内置的对话编辑器,你几乎肯定会想添加定位域在对话编辑模板折页模板。这样,他们将自动被添加到任务。

QuestDesign

GeneralQuest Design

At aminimum, your quest should have these elements:

 

•Quest Name

•Description (optional if you will onlyreference quests by name)

•State

任务的设计

 

一般的任务设计

 

至少,你应该有这些元素:

 

?任务名称

 

?描述(可选,如果你只会参考任务的名称)

 

?状态

QuestRewards

TheDialogue System does not lock you into any particular "reward" systemfor quests. The concept of a "reward" can mean completely differentthings depending on the type of game. If you're implementing a traditional RPG,you can add a custom field such as "XP" to record the quest's XPreward. If the player completes the quest in a conversation (for example,turning in the quest to the quest giver), then in the Script field you canwrite a short line of Lua code to apply the XP reward, such as:

任务奖励

 

对话系统不把你锁定在任何特定的“奖励”系统的任务。一个“奖励”的概念是完全不同的事情取决于游戏的类型。如果你要实现传统RPG,你可以添加一个自定义字段,如“XP”来记录任务的XP的奖励。如果玩家完成会话中的任务(例如,转向寻求任务给予者),然后在脚本领域你可以写一个短的Lua代码使用XP的奖励,如:


Or youcould use Lua.RegisterFunction() to register your own C# code with the Luaenvironment. Say you've registered a C# method named RewardXP(). Then yourScript field could be:

或者你可以使用lua。registerfunction()与Lua环境注册自己的C #代码。说你已经注册了一个C#方法命名的rewardxp()。那么你的脚本可以:


If theplayer completes the quest outside of a conversation, you can look up thequest's XP value using DialogueLua.GetItemField():

如果玩家完成任务的对话外,你可以查看任务的XP值使用dialoguelua getitemfield():


If, onthe other hand, you're implementing an adventure game, perhaps you want tounlock a door when the player turns in a quest. In this case, the reward is achange to the game's state. You have a lot of options here, such as sending amessage to a GameObject by adding a SendMessage() sequencer command to theSequence field:

如果,在另一方面,你实现的冒险游戏,也许你想打开的门的时候,玩家轮流在一个任务。在这种情况下,奖励是一个改变游戏的状态。你有很多选择,如加入一个sendmessage()音序器命令序列字段发送消息到一个游戏对象:


Assumingthere's an object named "Red Door" in the scene, it will receive themessage "Unlock".

 

Ifyou're implementing a visual novel, you might want to use the built-inSetRelationship() or IncRelationship() Lua functions to adjust arelationship/faction/status value between the player and an NPC:

假设有一个对象命名为“红门”场景中,它会收到消息“解锁”。

 

如果你实现一个视觉小说,你可能想使用内置的setrelationship()或increlationship()Lua函数调整的关系/派/状态玩家和NPC之间的值:


Workingwith Quests in Conversations

CheckingQuest State

Tocheck the state of a quest inside a conversation, you'll write a simple Luacondition. This condition will usually be a part of a dialogue entry'sCondition string.

 

Reminder:When referencing table indices in Lua code, you must replace spaces and hyphenswith underscores as described in Important Note About Table Indices.

 

Usingthe example above, say the baker has a dialogue entry asking the PC to startthe quest. You only want to show this entry if the quest isn't assigned yet.You can set up the dialogue entry like this:

会话中的工作任务

 

检查任务的状态

 

检查里面的对话任务状态,你会写的一个简单Lua状态。这种情况通常是一个对话的一部分进入状态字符串。

 

提示:当引用表的指数在Lua代码,你必须更换空间和连字符和下划线在表指标重要说明。

 

使用上面的例子,说贝克对话进入问电脑启动任务。如果你只想追求的不是分配还显示该项。您可以设置对话进入这样的:

 

 

•Dialogue Entry (Baker to PC):

◦DialogueText: "If you bring 5 dead rats, I'll bake us a pie."

◦Condition:Item["Kill_5_Rats"].State == "unassigned"

Thedialogue entry will only be shown if the condition is true – that is, if thequest's state is "unassigned".

 

Tocheck a quest entry, check its state field:

 

•Condition:Item["Escape_the_Prison_Planet"].Entry_1_State == "active"

?对话进入(贝克PC):

 

?对话的文字:“如果你把5只死老鼠,我烤了蛋糕。”

 

?条件:项目[“kill_5_rats”]状态= =“未分配”。

 

对话的条目将只显示如果条件为真–就是,如果任务的状态为“未分配”。

 

检查一个任务的入口,检查其状态字段:

 

?条件:项目[“escape_the_prison_planet”]。entry_1_state= =“主动”

SettingQuest State

To setthe state of a quest, you'll write a simple Lua statement for a dialogueentry's User Script.

 

Usingthe same example, say the PC accepts the quest. Your dialogue entry will looklike this:

 

•Dialogue Entry (PC to Baker):

◦DialogueText: "Okay. I'll return with those rats."

◦UserScript: Item["Kill_5_Rats"].State = "active"

Whenthe player selects this dialogue entry, the PC will say this line, and thequest state will be set to "active".

 

To seta quest entry's state:

 

•User Script:Item["Escape_the_Prison_Planet"].Entry_1_State == "success"

Sincethe Item[] table is a normal table in Lua, you can use any Lua commands on it –for example, to add new quests, remove quests, change descriptions, etc. Youcan even add new quest entries by increasing Entry_Count and adding theadditional entry fields.

 

设置任务的状态

 

设置一个任务的状态,你会写一个对话输入的用户脚本简单Lua语句。

 

使用相同的例子,说PC接受任务。你的对话录将看起来像这样:

 

?对话进入(PC贝克):

 

?对话的文字:“好。我会回报那些老鼠。”

 

?用户脚本:项目[“kill_5_rats”] =“活跃”状态。

 

当玩家选择加入这个对话,电脑会说这条线,和任务的状态将被设为“积极的”。

 

设定一个任务项的状态:

 

?用户脚本:项目[“escape_the_prison_planet”]。entry_1_state= =“成功”

 

由于项目[ ]表是在Lua中正常的表,你可以使用任何Lua命令–例如,添加新的任务,删除任务,变化的描述,等你甚至可以通过增加entry_count并增加额外的输入域添加新任务条目。

Questsin Lua

You canalso update quests in Lua code elsewhere, for example using the Lua On DialogueEvent trigger or in your own scripts. Most often you'll set the State like thisexample Lua code: State["Kill_5_Rats"] = "success".

 

Reminder:When referencing table indices in Lua code, you must replace spaces and hyphenswith underscores as described in Important Note About Table Indices.

在Lua中的任务

 

你也可以在Lua代码更新其他任务,例如使用Lua的对话事件触发或您自己的脚本。通常你会把这样的状态例如Lua代码:状态[“kill_5_rats”] =“成功”。

 

提示:当引用表的指数在Lua代码,你必须更换空间和连字符和下划线在表指标重要说明。

QuestTriggers

You canalso modify quest states by adding these trigger components to your scene:

•Quest Trigger

•Set Quest State On Dialogue Event

任务触发

你也可以通过添加这些触发器组件到你的场景修改任务状态:

?任务触发

?设置任务的状态对对话的事件

Workingwith Quests in Scripts

Scriptreference: PixelCrushers.DialogueSystem.QuestLog

TheQuestLog class provides methods to add and remove quests, get and set theirstate, and get their descriptions. This is a static class, so you can call itsmethods without having to create a QuestLog object.

Notethat quest states are usually updated during conversations. In most cases, youwill probably set quest states in Lua code during conversations, so you maynever need to use many of the methods in this class.

If youdo use these methods, converting spaces and hyphens to underscores (asdescribed in Important Note About Table Indices) is optional, since theQuestLog class will automatically do this for you.

Fordescriptions of each method, see the PixelCrushers.DialogueSystem.QuestLogreference page.

在脚本中的工作任务

脚本参考:pixelcrushers.dialoguesystem.questlog

该questlog类提供添加和删除任务的方法,获取和设置自己的状态,并得到他们的描述。这是一个静态类,所以你可以调用它的方法而无需创建一个questlog对象。

请注意,通常在谈话中,任务状态更新。在大多数情况下,你可能会把任务状态在Lua代码的谈话中,你可能不需要使用许多这类的方法。

 

如果你使用这些方法,将空间和连字符为下划线(如表指标的重要注意事项的描述)是可选的,因为questlog类将自动为你做这个。

 

为每一种方法的描述,看到pixelcrushers.dialoguesystem.questlog参考页。

SettingQuest State Observers

You canset watches on quest states using these methods:

 

QuestLog.AddQuestStateObserver():Adds a watch on a quest that will be checked on a specified frequency. Thefrequency can be EveryUpdate, EveryDialogueEntry, or EndOfConversation. If theexpression changes, the quest log system will invoke a delegate that takes theform:

设置任务的状态观测器

 

你可以设置手表上的任务状态使用这些方法:

 

questlog。addqueststateobserver():加上一个任务将在指定的频率检查表。频率可以everyupdate,everydialogueentry,或endofconversation。如果表达的变化,任务日志系统会调用一个委托的形式:


You canremove watches using QuestLog.RemoveQuestStateObserver() orQuestLog.RemoveAllQuestStateObservers().

 

Note:For best performance, limit the number of watches you set, especially when thefrequency is EveryUpdate. Each watch requires an extra Lua call to evaluate thecurrent quest state.

你可以使用questlog删除表。removequeststateobserver()或questlogremoveallqueststateobservers()。

 

注:为了获得最佳性能,极限的手表你设置的数量,特别是当频率everyupdate。每个手表需要一个额外的luacall评估当前任务的状态。

QuestLog Window

Note:The Unity Quest Log Window (Old) has been replaced by a GUI-independent questlog window system. This section describes the new quest log window system ingeneral. Subsequent sections describe how to set up quest log windows inspecific GUI systems.

任务日志窗口

 

注:统一的任务日志窗口(旧)已经由一个独立的任务日志窗口GUI系统取代。本节描述了一般的新任务日志窗口系统。随后的部分描述如何在特定的GUI系统设置的任务日志窗口。


A questlog window displays the current state of active and completed quests. It getsthe titles, descriptions, states, and other information from thePixelCrushers.DialogueSystem.QuestLog class, which in turn gets the data fromthe Item[] table. If a quest is trackable, it allows the player to toggletracking. If a quest is abandonable, it allows the player to abandon it. Allquest log windows use a structure similar to the image above, although thepositions of controls and their appearance may be different.

 

Theelements of a quest log window are:

 

•Quest Heading: The name of the quest. Theplayer can click on the heading to expand the quest and view its descriptionand options.

•Quest Description: This text includes thecurrent description based on the state of the quest as well as all entries thatare not unassigned.

•Track: This button is only shown if the questis trackable. When clicked, it broadcasts a OnQuestTrackingEnabled orOnQuestTrackingDisabled message to the Dialogue Manager. See Quest Messages formore details.

•Abandon: This button is only shown if thequest is abandonable. When clicked, it sets the state of the quest to theabandon state defined in the quest log window. It also sendsOnQuestTrackingDisabled and plays the sequence defined in the "AbandonSequence" field if it's defined.

•Active & Completed: These buttons switchbetween viewing active quests and completed quests.

•Close: This button closes the window.

任务日志窗口显示当前状态的活动完成的任务。它的标题,描述,状态,并从pixelcrushers.dialoguesystem.questlog类的其他信息,从而获取数据从项目[]表。如果一个任务是可追踪的,它允许玩家切换跟踪。如果一个任务是放弃,它允许玩家放弃它。所有的任务日志窗口使用类似于上面的图像结构,虽然控制及其出现的位置可能不同。

 

一个任务日志窗口元素:

 

?标题:探索任务的名称。玩家可以点击标题扩展任务并查看其描述和选项。

 

?任务描述:本文包括基于任务状态的描述以及所有条目不是未分配。

 

?轨道:这个按钮只显示如果任务是追踪。当点击时,它onquesttrackingenabled或onquesttrackingdisabled广播消息的对话管理器。看到任务的更多细节消息。

 

?放弃:这个按钮只显示如果追求是放弃。当点击时,它集寻求在日志窗口定义放弃状态。它也将onquesttrackingdisabled中起着“放弃序列”字段是否已定义的序列。

 

?主动完成:观看活动的任务完成的任务之间切换这些按钮。

 

?关:这个按钮关闭窗口。

How toShow a Quest Log Window

To showthe window, call the Open() method. The user can close the window by clickingthe Close button.

 

IfPause While Open is ticked, the quest log window pauses the game by settingTime.timeScale to 0. When closed, it restores the previous time scale.

 

TheFeature Demo script, FeatureDemo.cs, references a quest log window as a childobject and calls Open() when the player selects Quest Log from the main menu.

如何显示任务日志窗口

 

显示窗口,调用open()方法。用户可以通过点击“关闭”按钮关闭窗口。

 

如果暂停而开放的勾选,日志窗口暂停的游戏设置time.timescale 0。关闭时,它恢复以前的时间尺度。

 

功能演示脚本,featuredemo.cs,参考任务日志子窗口对象并调用open()当玩家选择从主菜单的任务日志。

UnityGUI Quest Log Window

TheDialogue System provides pre-built prefabs for a selection of Unity GUI QuestLog Windows using the default, JRPG, Necromancer GUI, Sci-Fi, and Wheel2styles. You can find them in the Prefabs/Unity Dialogue UIs folder.

 

To setup a quest log window, add a prefab from the Prefabs folder or create your ownGUI layout and add the Unity GUI Quest Log Window component (not the old UnityGUI Quest Log Window). The Prefabs folder contains prefabs with differentappearances.

 

Ifyou're creating your own layout, you'll need to create the following controls:

UnityGUI任务日志窗口

 

对话系统选择使用默认,JRPG,死灵法师的GUI,科幻的统一的GUI任务日志窗口提供了预建的问题,和wheel2风格。你可以找到他们在预设/团结对话UI文件夹。

 

建立一个任务日志窗口,添加从prefabs文件夹预制或创建自己的GUI布局和添加统一的GUI任务日志窗口组件(不老的统一的GUI任务日志窗口)。预制件文件夹包含具有不同形貌的问题。

 

如果你创建自己的布局,您需要创建下面的控制:


You cansee them set up in this screenshot of the Sci-Fi quest log window:

你可以看到他们建立在这张截图中的科幻的任务日志窗口:

Whichuses the object hierarchy shown below:

使用如下所示的对象层次结构:


Thenassign a Unity GUI Quest Log Window component to the containing GameObject andassign the values as described below:

然后指定一个统一的GUI任务日志窗口组件包含的游戏物体和指定值如下:


•Localized Text: (Optional) Localized text forbuttons and messages. See Localization for details.

•Quest Heading Source: Specifies whether to usethe quest's name or its description as the heading. If you've localized todifferent languages, set this to Description.

•Abandon Quest State: The state that getsassigned to abandoned quests.

•Pause While Open: Specifies whether to pausethe game while the quest log window is open.

•Gui Root: The GUIRoot object.

•Scroll View: A GUIScrollView control that willcontain the list of active or completed quests.

•Active Button: When clicked, the scroll viewis populated with the list of active quests. This button should send theClickShowActiveQuests message.

•Completed Button: When clicked, the scrollview is populated with the list of completed quests. This button should sendthe ClickShowCompletedQuests message.

•Abandon Quest Popup: A set of controls for themodal popup window used to ask the player to confirm abandonment of a quest.

 

?本地化的文本:(可选)本地化的文本按钮和消息。看看定位细节。

 

?任务标题来源:指定是否使用任务的名称或描述作为标题。如果你定位到不同的语言,这个设置的描述。

 

?放弃任务的状态:被分配到放弃的任务状态。

 

?暂停而开放:指定是否暂停游戏,日志窗口打开。

 

?根:GUI的guiroot对象。

 

?滚动视图:一个guiscrollview控制将包含活性或完成的任务列表。

 

?积极按钮:单击时,滚动视图是人口与主动任务列表。此按钮将clickshowactivequests消息。

 

?完成按钮:单击时,滚动视图是人口稠密的已完成任务的清单。此按钮将clickshowcompletedquests消息。

 

?放弃追求弹出:一组模态窗口用来让玩家确认任务放弃控制。


GuiStyle Names: GUI styles for the various elements of the window. Different GUIstyles are available for entries in the active, success, and failure states –for example to use a GUI style with a green checkmark next to successfulentries and a different GUI style with a red X for failed entries.

•Messages: Message text. If you've localized,these are the lookup fields in the localized text table.

•Padding: Pixel buffer between quests in thescroll view.

You donot need to assign the Close button. Instead, your close button (if you haveone) should send a ClickClose message to the window when clicked.

 

If youexamine any of the provided quest log prefabs, you'll see that you can addadditional controls, too, such as a containing window or other ornaments

?GUI风格的名字:GUI风格的窗口的各种元素。不同的GUI风格的活动,成功是可用的条目,和故障状态–例如使用一个GUI风格下成功的条目绿色复选标记和一个红色的X不同GUI风格的失败作品。

 

?消息:消息文本。如果你的局限性,这些都是在本地化的文本表查找域。

 

?填料:在滚动视图任务之间的像素缓冲区。

 

你不需要指定关闭按钮。相反,你的关闭按钮(如果有)应发送一个消息给窗口单击时clickclose。

 

如果你查看任何所提供的任务日志的问题,你会发现你可以添加额外的控制,太,如含窗口或其他装饰品

NGUIQuest Log Window

TheNGUI support package contains a prefab that uses NGUI's example quest logwindow as a base.

 

To setup a quest log window, add a prefab from the NGUI Support Prefabs folder orcreate your own layout and add the NGUI Quest Log Window component.

 

Ifyou're creating your own layout, you'll need to create the following controls:

深入探索日志窗口

 

在NGUI支持包中包含一个预置的实例使用NGUI任务日志窗口为基础。

 

建立一个任务日志窗口,添加从NGUI支持prefabs文件夹预制或创建自己的布局和添加NGUI任务日志窗口组件。

 

如果你创建自己的布局,您需要创建下面的控制:


Whichuses the object hierarchy shown below:

使用如下所示的对象层次结构:

Thenassign an NGUI Quest Log Window component to the containing GameObject andassign the values as described below:

然后指定一个NGUI任务日志窗口组件包含的游戏物体和指定值如下:


LocalizedText: (Optional) Localized text for buttons and messages. See Localization fordetails.

•Quest Heading Source: Specifies whether to usethe quest's name or its description as the heading. If you've localized todifferent languages, set this to Description.

•Abandon Quest State: The state that getsassigned to abandoned quests.

•Pause While Open: Specifies whether to pausethe game while the quest log window is open.

•UI Root: The UI Root object.

•Main Panel: The main panel containing thequest log window controls.

•Active Quests Button: When clicked, the questtable is populated with the list of active quests. This button should send theClickShowActiveQuestsButton message.

•Completed Quests Button: When clicked, thequest table is populated with the list of completed quests. This button shouldsend the ClickShowCompletedQuestsButton message.

•Quest Table: The UITable that will contain thequests.

•Quest Template: The template to use forquests. Set up a layout in the quest table containing the following childcontrols, assign the NGUIQuestTemplate script to it, and assign the controls. Acopy of the template will be instantiated and customized for each quest.

◦HeadingUILabel: The label for the quest heading.

◦DescriptionUILabel: The label for the quest description.

◦TrackUIButton: The button to toggle tracking. You don't need to assign an action tothis button; the window will do it automatically. This button will only beshown if the quest is trackable.

◦AbandonUIButton: The button to abandon the quest. You don't need to assign an actionto this button; the window will do it automatically. This button will only beshown if the quest is abandonable.

•Abandon Popup: The main panel for the modalpopup window used to ask the player to confirm abandonment of a quest.

•Abandon Quest Title: The label in the popupwindow that will be assigned the quest title.

 

 

?本地化的文本:(可选)本地化的文本按钮和消息。看看定位细节。

?任务标题来源:指定是否使用任务的名称或描述作为标题。如果你定位到不同的语言,这个设置的描述。

?放弃任务的状态:被分配到放弃的任务状态。

?暂停而开放:指定是否暂停游戏,日志窗口打开。

?根:根对象的用户界面。

?主面板:包含日志窗口控制主面板。

?活动任务按钮:单击时,任务表是人口与主动任务列表。此按钮将clickshowactivequestsbutton消息。

?完成任务按钮:单击时,任务表填充完成任务列表。此按钮将clickshowcompletedquestsbutton消息。

?任务表:有效的将包含任务。

?任务模板:模板使用的任务。在任务表包含以下子控件设置布局,将nguiquesttemplate脚本,并指定控件。模板的副本将被实例化和定制为每个任务。

?标题:标题UILabel追求标签。

?描述:此任务UILabel描述标签。

?轨道UIButton:按钮切换跟踪。你不需要指定一个动作按钮的窗口会自动完成。此按钮将只显示如果任务是追踪。

?放弃UIButton:按钮放弃追求。你不需要指定一个动作按钮的窗口会自动完成。此按钮将只显示如果追求是放弃。

 

?放弃的模态窗口弹出:用于要求玩家确认任务放弃主面板。

 

?标题:放弃追求的标签,在弹出的窗口中,将被分配任务的名称。


You donot need to assign the Close button. Instead, your close button (if you haveone) should send a ClickCloseButton message to the window when clicked.

你不需要指定关闭按钮。相反,你的关闭按钮(如果有)应发送一个消息给窗口单击时clickclosebutton

Daikon Forge GUI Quest Log Window

The Daikon Forge GUI support package contains a quest log window prefab.

 

To setup a quest log window, add a prefab from the Daikon Forge GUI Support Prefabsfolder or create your own layout and add the Daikon Forge Quest Log Windowcomponent.

 

Ifyou're creating your own layout, you'll need to create the following controls:

萝卜伪造GUI任务日志窗口

 

萝卜伪造的图形用户界面支持包中包含的任务日志窗口预制。

 

建立一个任务日志窗口,加萝卜GUI支持铸就prefabs文件夹预制或创建自己的布局和加入萝卜伪造的任务日志窗口组件。

 

如果你创建自己的布局,您需要创建下面的控制:


Whichuses the object hierarchy shown below:

使用如下所示的对象层次结构:

Thenassign a Daikon Forge Quest Log Window component to the containing GameObjectand assign the values as described below:

然后把一个大熔炉的任务日志窗口组件包含的游戏物体和指定值如下:

•Localized Text: (Optional) Localized text forbuttons and messages. See Localization for details.

•Quest Heading Source: Specifies whether to usethe quest's name or its description as the heading. If you've localized todifferent languages, set this to Description.

•Abandon Quest State: The state that getsassigned to abandoned quests.

•Pause While Open: Specifies whether to pausethe game while the quest log window is open.

•UI Root: The root object containing thedfGUIManager.

•Main Panel: The main panel containing thequest log window controls.

•Active Quests Button: When clicked, the questtable is populated with the list of active quests. This button should send theClickShowActiveQuestsButton message.

•Completed Quests Button: When clicked, thequest table is populated with the list of completed quests. This button shouldsend the ClickShowCompletedQuestsButton message.

•Close Button: The button to close the window.

•Scroll Panel: The dfScrollPanel that willcontain the quests.

•Quest Heading Template: The template to usefor the quest heading.

•Quest Description Template: The template foruse for the quest description.

•Track Button Template The template to use forthe track button.

•Abandon Button Template The template to usefor the abandon quest button.

•Abandon Popup: The main panel for the modalpopup window used to ask the player to confirm abandonment of a quest.

•Abandon Quest Title: The label in the popupwindow that will be assigned the quest title.

?本地化的文本:(可选)本地化的文本按钮和消息。看看定位细节。

 

?任务标题来源:指定是否使用任务的名称或描述作为标题。如果你定位到不同的语言,这个设置的描述。

 

?放弃任务的状态:被分配到放弃的任务状态。

 

?暂停而开放:指定是否暂停游戏,日志窗口打开。

 

?根:含有dfguimanager根对象。

 

?主面板:包含日志窗口控制主面板。

 

?活动任务按钮:单击时,任务表是人口与主动任务列表。此按钮将clickshowactivequestsbutton消息。

 

?完成任务按钮:单击时,任务表填充完成任务列表。此按钮将clickshowcompletedquestsbutton消息。

 

?关闭按钮:按钮关闭窗口。

 

?滚动面板:在dfscrollpanel将包含任务。

 

?任务标题模板:模板使用任务标题。

 

?任务描述模板:用于任务描述模板。

 

?跟踪按钮模板模板用于跟踪按钮。

 

?放弃按钮模板模板用于放弃任务按钮。

 

?放弃的模态窗口弹出:用于要求玩家确认任务放弃主面板。

 

?标题:放弃追求的标签,在弹出的窗口中,将被分配任务的名称。

Controlswill be instantiated from the templates as necessary to populate the scrollpanel.

控件将被实例化的模板来填充滚动面板。

UnityQuest Log Window (Old)

Thissection applies to the old Unity Quest Log Window.

 

TheUnity Quest Log Window component displays a quest log window using Unity GUI.You can use it as-is or use it as a template for implementing your own questlog window in another GUI system such as NGUI or Daikon Forge GUI. As-is, thiscomponent is already quite flexible because you can assign any GUI layout toits properties, allowing you to completely change its look and feel:

统一的任务日志窗口(旧)

 

本节适用于旧的统一的任务日志窗口。

 

统一的任务日志窗口组件显示使用Unity GUI任务日志窗口。你可以像或使用它作为另一个GUI系统如NGUI或萝卜伪造的GUI实现您自己的任务日志窗口模板使用它。例如,该组件已经相当灵活因为你可以指定任何界面布局的特性,让你彻底改变其外观和感觉:

这一篇到这里,下一篇接续。。




  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值