[問題] 可以幫我看看這段程式碼嗎?

看板C_Sharp (C#)作者 (豬)時間14年前 (2011/05/19 01:57), 編輯推噓1(103)
留言4則, 3人參與, 最新討論串1/1
我現在在寫一段連線遊戲的小程式 書上的例子有一段不是很清楚她在幹嘛 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

05/19 02:05, , 1F
你貼了很大一段,很難從頭到尾全部都講解
05/19 02:05, 1F

05/19 02:58, , 2F
簡單來說 就是接收傳過來的資料 從資料中判斷
05/19 02:58, 2F

05/19 02:59, , 3F
然後去執行相對應的動做~
05/19 02:59, 3F

05/19 04:44, , 4F
問題是什麼呢?
05/19 04:44, 4F
文章代碼(AID): #1Dr0YGJr (C_Sharp)
文章代碼(AID): #1Dr0YGJr (C_Sharp)