📄 fathermdl.pas
字号:
unit FatherMdl;
interface
uses Classes, forms, SysUtils, patterns;
type
TModelFather = class(TObservable)
public
constructor Create;
destructor Destroy; override;
procedure response(cmd: string; const args: TCommand = nil);
end;
implementation
uses
commandlist, indexdef;
procedure TModelFather.response(cmd: string; const args: TCommand = nil);
var
p: PResponseInfo;
begin
//you can add very complex logic code here
new(p);
p.CMD := cmd;
if cmd = CMD_NODE_SELECT then
begin
p.response := 'I was selected!';
end
else if cmd = CMD_MOM_NEWCLOTHES then
begin
p.Response := 'yes,you look fantastic!';
p.ActualMean := 'It"s not good enough, but I don"t want you buy another one.So, yes';
end
else if cmd = CMD_MOM_LOVEME then
begin
p.Response := 'Yes.';
p.ActualMean := 'Oh,my god. Why women keep asking this silly question all the time?';
end
else if cmd = CMD_MOM_HEARD then
begin
p.Response := 'No. What''s it hony?';
p.ActualMean := 'I really don''t care,can''t you see I am very busy now? this PC Game is very excitingd!';
end
else if (cmd = CMD_BABY_CHOCOLATE) then
begin
p.Response := 'Ask your mum.';
p.ActualMean := '';
end
else if (cmd = CMD_BABY_CARTOON) then
begin
p.Response := 'No,honey,it''s too late,go to sleep.';
p.ActualMean := '';
end;
//release p when command released
self.Notify(TCommand.create(cmd, p));
end;
constructor TModelFather.Create;
begin
end;
destructor TModelFather.Destroy;
begin
inherited;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -