📄 unit1.pas
字号:
end else begin
SendSelChr(uname);
end;
end;
procedure Tform1.ClientGetReceiveChrs1 (body: string);
var
fstr, uname, sjob, shair, slevel, ssex: string;
begin
fstr := DecodeString (body);
fstr := GetValidStr3 (fstr, uname, ['/']);
fstr := GetValidStr3 (fstr, sjob, ['/']);
fstr := GetValidStr3 (fstr, shair, ['/']);
fstr := GetValidStr3 (fstr, slevel, ['/']);
fstr := GetValidStr3 (fstr, ssex, ['/']);
if uname = '' then begin
tmr9.Enabled := True;
end else begin
SendSelChr1(uname1);
end;
end;
procedure Tform1.ClientGetReceiveChrs2 (body: string);
var
fstr1, uname, sjob, shair, slevel, ssex: string;
begin
fstr1 := DecodeString (body);
fstr1 := GetValidStr3 (fstr1, uname, ['/']);
fstr1 := GetValidStr3 (fstr1, sjob, ['/']);
fstr1 := GetValidStr3 (fstr1, shair, ['/']);
fstr1 := GetValidStr3 (fstr1, slevel, ['/']);
fstr1 := GetValidStr3 (fstr1, ssex, ['/']);
if uname = '' then begin
tmr10.Enabled := True;
end else begin
SendSelChr2(uname2);
end;
end;
procedure Tform1.ClientGetReceiveChrs3 (body: string);
var
fstr2, uname, sjob, shair, slevel, ssex: string;
begin
fstr2 := DecodeString (body);
fstr2 := GetValidStr3 (fstr2, uname, ['/']);
fstr2 := GetValidStr3 (fstr2, sjob, ['/']);
fstr2 := GetValidStr3 (fstr2, shair, ['/']);
fstr2 := GetValidStr3 (fstr2, slevel, ['/']);
fstr2 := GetValidStr3 (fstr2, ssex, ['/']);
if uname = '' then begin
tmr11.Enabled := True;
end else begin
SendSelChr3(uname3);
end;
end;
procedure Tform1.ClientGetReceiveChrs4 (body: string);
var
fstr3, uname, sjob, shair, slevel, ssex: string;
begin
fstr3 := DecodeString (body);
fstr3 := GetValidStr3 (fstr3, uname, ['/']);
fstr3 := GetValidStr3 (fstr3, sjob, ['/']);
fstr3 := GetValidStr3 (fstr3, shair, ['/']);
fstr3 := GetValidStr3 (fstr3, slevel, ['/']);
fstr3 := GetValidStr3 (fstr3, ssex, ['/']);
if uname = '' then begin
tmr12.Enabled := True;
end else begin
SendSelChr4(uname4);
end;
end;
procedure Tform1.SendSay (str: string);
var
msg: TDefaultMessage;
begin
msg := MakeDefaultMsg (CM_SAY, 0, 0, 0, 0);
SendCSocket (EncodeMessage (msg) + EncodeString(str));
end;
procedure Tform1.SendSay1 (str: string);
var
msg: TDefaultMessage;
begin
msg := MakeDefaultMsg (CM_SAY, 0, 0, 0, 0);
SendCSocket1 (EncodeMessage (msg) + EncodeString(str));
end;
procedure Tform1.SendSay2 (str: string);
var
msg: TDefaultMessage;
begin
msg := MakeDefaultMsg (CM_SAY, 0, 0, 0, 0);
SendCSocket2 (EncodeMessage (msg) + EncodeString(str));
end;
procedure Tform1.SendSay3 (str: string);
var
msg: TDefaultMessage;
begin
msg := MakeDefaultMsg (CM_SAY, 0, 0, 0, 0);
SendCSocket3 (EncodeMessage (msg) + EncodeString(str));
end;
procedure Tform1.SendSay4 (str: string);
var
msg: TDefaultMessage;
begin
msg := MakeDefaultMsg (CM_SAY, 0, 0, 0, 0);
SendCSocket4 (EncodeMessage (msg) + EncodeString(str));
end;
procedure Tform1.DecodeMessagePacket (datablock: string);
var
head, body, tagstr, data: String;
msg: TDefaultMessage;
begin
if datablock[1] = '+' then begin
data := Copy (datablock, 2, Length(datablock)-1);
data := GetValidStr3 (data, tagstr, ['/']);
end;
head := Copy (datablock, 1, DEFBLOCKSIZE);
body := Copy (datablock, DEFBLOCKSIZE+1, Length(datablock)-DEFBLOCKSIZE);
msg := DecodeMessage (head);
case msg.Ident of
SM_NEWID_SUCCESS: begin
tmr7.Interval := StrToInt(sss.Strings[14]);
tmr7.Enabled := True;
end;
SM_NEWID_FAIL: begin
case msg.Recog of
0: begin
end;
-2:
else
end;
end;
SM_PASSOK_SELECTSERVER: begin
ClientGetPasswordOK(msg,body);
SendSelectServer(sss.Strings[0]);
end;
SM_SELECTSERVER_OK: begin
ClientGetPasswdSuccess (body);
end;
SM_QUERYCHR: begin
ClientGetReceiveChrs (body);
end;
SM_NEWCHR_SUCCESS: begin
SendQueryChr;
SendSelChr(uname);
end;
SM_STARTPLAY: begin
ClientGetStartPlay (body);
exit;
end;
SM_RECONNECT: begin
end;
SM_SENDNOTICE: begin
SendClientMessage (CM_LOGINNOTICEOK, 0, 0, 0, 99);
end;
SM_LOGON: begin
tmr2.Interval := StrToInt(sss.Strings[12]);
tmr2.Enabled := True;
end;
{ SM_DEATH,
SM_NOWDEATH: begin
AppLogout;
end; }
end;
end;
procedure Tform1.DecodeMessagePacket1 (datablock: string);
var
head, body, tagstr, data: String;
msg: TDefaultMessage;
begin
if datablock[1] = '+' then begin
data := Copy (datablock, 2, Length(datablock)-1);
data := GetValidStr3 (data, tagstr, ['/']);
end;
head := Copy (datablock, 1, DEFBLOCKSIZE);
body := Copy (datablock, DEFBLOCKSIZE+1, Length(datablock)-DEFBLOCKSIZE);
msg := DecodeMessage (head);
case msg.Ident of
SM_NEWID_SUCCESS: begin
tmr17.Interval := StrToInt(sss.Strings[14]);
tmr17.Enabled := True;
end;
SM_NEWID_FAIL: begin
case msg.Recog of
0: begin
end;
-2:
else
end;
end;
SM_PASSOK_SELECTSERVER: begin
ClientGetPasswordOK1(msg,body);
SendSelectServer1(sss.Strings[2]);
end;
SM_SELECTSERVER_OK: begin
ClientGetPasswdSuccess1 (body);
end;
SM_QUERYCHR: begin
ClientGetReceiveChrs1 (body);
end;
SM_NEWCHR_SUCCESS: begin
SendQueryChr1;
SendSelChr1(uname1);
end;
SM_STARTPLAY: begin
ClientGetStartPlay1 (body);
exit;
end;
SM_RECONNECT: begin
end;
SM_SENDNOTICE: begin
SendClientMessage1 (CM_LOGINNOTICEOK, 0, 0, 0, 99);
end;
SM_LOGON: begin
tmr21.Interval := StrToInt(sss.Strings[12]);
tmr21.Enabled := True;
end;
{ SM_DEATH,
SM_NOWDEATH: begin
AppLogout1;
end; }
end;
end;
procedure Tform1.DecodeMessagePacket2 (datablock: string);
var
head, body, tagstr, data: String;
msg: TDefaultMessage;
begin
if datablock[1] = '+' then begin
data := Copy (datablock, 2, Length(datablock)-1);
data := GetValidStr3 (data, tagstr, ['/']);
end;
head := Copy (datablock, 1, DEFBLOCKSIZE);
body := Copy (datablock, DEFBLOCKSIZE+1, Length(datablock)-DEFBLOCKSIZE);
msg := DecodeMessage (head);
case msg.Ident of
SM_NEWID_SUCCESS: begin
tmr18.Interval := StrToInt(sss.Strings[14]);
tmr18.Enabled := True;
end;
SM_NEWID_FAIL: begin
case msg.Recog of
0: begin
end;
-2:
else
end;
end;
SM_PASSOK_SELECTSERVER: begin
ClientGetPasswordOK2(msg,body);
SendSelectServer2(sss.Strings[4]);
end;
SM_SELECTSERVER_OK: begin
ClientGetPasswdSuccess2 (body);
end;
SM_QUERYCHR: begin
ClientGetReceiveChrs2 (body);
end;
SM_NEWCHR_SUCCESS: begin
SendQueryChr2;
SendSelChr2(uname2);
end;
SM_STARTPLAY: begin
ClientGetStartPlay2 (body);
exit;
end;
SM_RECONNECT: begin
end;
SM_SENDNOTICE: begin
SendClientMessage2 (CM_LOGINNOTICEOK, 0, 0, 0, 99);
end;
SM_LOGON: begin
tmr22.Interval := StrToInt(sss.Strings[12]);
tmr22.Enabled := True;
end;
{ SM_DEATH,
SM_NOWDEATH: begin
AppLogout2;
end; }
end;
end;
procedure Tform1.DecodeMessagePacket3 (datablock: string);
var
head, body, tagstr, data: String;
msg: TDefaultMessage;
begin
if datablock[1] = '+' then begin
data := Copy (datablock, 2, Length(datablock)-1);
data := GetValidStr3 (data, tagstr, ['/']);
end;
head := Copy (datablock, 1, DEFBLOCKSIZE);
body := Copy (datablock, DEFBLOCKSIZE+1, Length(datablock)-DEFBLOCKSIZE);
msg := DecodeMessage (head);
case msg.Ident of
SM_NEWID_SUCCESS: begin
tmr19.Interval := StrToInt(sss.Strings[14]);
tmr19.Enabled := True;
end;
SM_NEWID_FAIL: begin
case msg.Recog of
0: begin
end;
-2:
else
end;
end;
SM_PASSOK_SELECTSERVER: begin
ClientGetPasswordOK3(msg,body);
SendSelectServer3(sss.Strings[6]);
end;
SM_SELECTSERVER_OK: begin
ClientGetPasswdSuccess3 (body);
end;
SM_QUERYCHR: begin
ClientGetReceiveChrs3 (body);
end;
SM_NEWCHR_SUCCESS: begin
SendQueryChr3;
SendSelChr3(uname3);
end;
SM_STARTPLAY: begin
ClientGetStartPlay3 (body);
exit;
end;
SM_RECONNECT: begin
end;
SM_SENDNOTICE: begin
SendClientMessage3 (CM_LOGINNOTICEOK, 0, 0, 0, 99);
end;
SM_LOGON: begin
tmr23.Interval := StrToInt(sss.Strings[12]);
tmr23.Enabled := True;
end;
{ SM_DEATH,
SM_NOWDEATH: begin
AppLogout3;
end; }
end;
end;
procedure Tform1.DecodeMessagePacket4 (datablock: string);
var
head, body, tagstr, data: String;
msg: TDefaultMessage;
begin
if datablock[1] = '+' then begin
data := Copy (datablock, 2, Length(datablock)-1);
data := GetValidStr3 (data, tagstr, ['/']);
end;
head := Copy (datablock, 1, DEFBLOCKSIZE);
body := Copy (datablock, DEFBLOCKSIZE+1, Length(datablock)-DEFBLOCKSIZE);
msg := DecodeMessage (head);
case msg.Ident of
SM_NEWID_SUCCESS: begin
tmr20.Interval := StrToInt(sss.Strings[14]);
tmr20.Enabled := True;
end;
SM_NEWID_FAIL: begin
case msg.Recog of
0: begin
end;
-2:
else
end;
end;
SM_PASSOK_SELECTSERVER: begin
ClientGetPasswordOK4(msg,body);
SendSelectServer4(sss.Strings[8]);
end;
SM_SELECTSERVER_OK: begin
ClientGetPasswdSuccess4 (body);
end;
SM_QUERYCHR: begin
ClientGetReceiveChrs4 (body);
end;
SM_NEWCHR_SUCCESS: begin
SendQueryChr4;
SendSelChr4(uname4);
end;
SM_STARTPLAY: begin
ClientGetStartPlay4 (body);
exit;
end;
SM_RECONNECT: begin
end;
SM_SENDNOTICE: begin
SendClientMessage4 (CM_LOGINNOTICEOK, 0, 0, 0, 99);
end;
SM_LOGON: begin
tmr24.Interval := StrToInt(sss.Strings[12]);
tmr24.Enabled := True;
end;
{ SM_DEATH,
SM_NOWDEATH: begin
AppLogout4;
end; }
end;
end;
procedure Tform1.ClientGetStartPlay (body: string);
begin
str := DecodeString (body);
sport := GetValidStr3 (str, addr, ['/']);
lport:=Str_ToInt (sport, 0);
ClientSocket1.Active := False;
clientsocket1.Address := '';
clientsocket1.Port := 0;
// with ClientSocket1 do begin
tmr25.Enabled := True;
// end;
end;
procedure Tform1.ClientGetStartPlay1 (body: string);
begin
str1 := DecodeString (body);
sport1 := GetValidStr3 (str1, addr1, ['/']);
lport1:=Str_ToInt (sport1, 0);
csocket1.Active := False;
csocket1.Address := '';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -