看代码(Typescript):
import { AnalyzeJSON } from "./AnalyzeJSON";
const {ccclass, property} = cc._decorator;
@ccclass
export class Dialog extends cc.Component {
@property({type:cc.Float, tooltip:"播放速度"})
playSpeed:number = 0;
_speed:number;
_dialogLabel:cc.Label = null; //文本框
_contentStr:string = ""; //当前播放的内容
_currTextIndex:number = 0; //当前播放内容的索引
_currDialogIndex:number = 0; //当前对话列表的索引
_isPlaying:boolean = false; //是否正在播放
_contentList:Array<string> = null; //谈话内容
_endEvent:Function = null; //结束处理事件
onLoad () {
this._dialogLabel = this.node.getComponentInChildren(cc.Label);
this.node.on(cc.Node.EventType.TOUCH_END, this._onClickBox, this);
}
/**点击跳过打字机效果 */
_onClickBox():void{
if(this._isPlaying){
this._dialogLabel.string = this._contentStr;
this._reset();
}else{