如何显示一个进度条
开启进度条:
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.
|
|