作者karta031736 (猪)
看板C_Sharp
标题[问题] 可以帮我看看这段程式码吗?
时间Thu May 19 01:57:33 2011
我现在在写一段连线游戏的小程式
书上的例子有一段不是很清楚她在干嘛
private void Listen(){
byte[] byteReceieve = new byte[1024];
byte[] byteSend = new byte[1024];
EndPoint oldEP = ClientSocket.RemoteEndPoint;
Thread tempthread = _thread1;
int ii, six = 0, c_conn = 0, disconnect = 0, Disconnect = 0, Show = 0,
update = 0;
string strAll;
while (true){
try{
ii = ClientSocket.ReceiveFrom(byteReceieve, 0, byteReceieve.Length,
SocketFlags.None, ref oldEP);
strAll = Encoding.Unicode.GetString(byteReceieve, 0, ii);
if (strAll == "c_conn") c_conn = 1;
else if (strAll == "Show") Show = 1;
else if (strAll == "disconnect") disconnect = 1;
else if (strAll == "Disconnect") Disconnect = 1;
else if (strAll == "six") six = 1;
if ((c_conn == 1) && (strAll != "") && (strAll != "c_conn") &&
(strAll != "Show") && (strAll != "Disconnect") &&
(strAll != "disconnect") && (strAll != "score")){
c_conn = 0;
Show_listBox_3();
Show_label4(strAll);
}
if ((Show == 1) && (strAll != "") && (strAll != "Show") &&
(strAll != "disconnect") && (strAll != "Disconnect") &&
(strAll != "c_conn") && (strAll != "score")){
Show = 0;
Show_listBox_1(strAll);
}
if ((disconnect == 1) && (strAll != "") && (strAll != "disconnect") &&
(strAll != "Disconnect") && (strAll != "Show") &&
(strAll != "c_conn") && (strAll != "score")){
disconnect = 0;
Show_label4(strAll);
}
if ((Disconnect == 1) && (strAll != "") && (strAll != "Disconnect") &&
(strAll != "score") && (strAll != "disconnect") &&
(strAll != "Show") && (strAll != "c_conn") ){
Disconnect = 0;
Show_listBox_2(strAll);
}
if ((six == 1) && (strAll != "") && (strAll != "disconnect") &&
(strAll != "Disconnect") && (strAll != "Show") &&
(strAll != "c_conn") && (strAll != "six")){
six = 0;
f2.NAMESCORE = strAll;
}
}
catch{
;
}
}
}
烦请各位教教我><"
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.251.196.73
1F:→ james732:你贴了很大一段,很难从头到尾全部都讲解 05/19 02:05
2F:→ sosokill:简单来说 就是接收传过来的资料 从资料中判断 05/19 02:58
3F:→ sosokill:然後去执行相对应的动做~ 05/19 02:59
4F:推 tomex:问题是什麽呢? 05/19 04:44