如何显示一个进度条

开启进度条:

unit Q2;

inte**ce

  uses Classes, SysUtils;

procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs);

implementation

procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs);

begin   

  Player.ShowProgress(‘开启中…'{进度条上显示的信息}, 30{进度条时长30秒}, 1000{进度条标记}, True{移动、攻击或被被攻击的时候取消进度条事件}); //开启进度条    

  //如果当前存在进度条则返回False

  //进度条计时结束后调用QFunctionNpc单元中的ProgressEvent函数,其中可根据EventID进行事件处理

end;

end.

处理进度条事件:

unit QFunctionNpc;

inte**ce

  uses Classes, SysUtils;

//用户执行进度条事件触发,只有脚本调用ShowProgress函数且最终执行其事件才会触发本函数

procedure ProgressEvent(Npc: TNormNpc; Player: TPlayObject; EventID: Integer);

//用户角度条执行失败触发

procedure ProgressFaild(Npc: TNormNpc; Player: TPlayObject; EventID: Integer);

implementation

procedure ProgressEvent(Npc: TNormNpc; Player: TPlayObject; EventID: Integer);

begin  

  case EventID of

    1000: Player.Messagebox(‘执行进度条事件,事件ID:’ + IntToStr(EventID));

  end;

end;

procedure ProgressFaild(Npc: TNormNpc; Player: TPlayObject; EventID: Integer);

begin

  case EventID of

    1000: Player.Messagebox(‘执行进度条事件失败,事件ID:’ + IntToStr(EventID));

  end;

end;

end.

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。