91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 449KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-10
  • 語言: Java
  • 標簽: java??

資源簡介

該項目是java開發了一個網絡流行的網絡斗地主實例,對學習java網絡編程非常有幫助

資源截圖

代碼片段和文件信息

package?controller;

import?java.io.objectInputStream;
import?java.io.objectOutputStream;
import?java.net.Socket;
import?java.util.Collections;
import?java.util.Vector;

import?javax.swing.JOptionPane;

import?model.Poker;
import?view.EndDialog;
import?view.GamePanel;
import?view.PreParePanel;

public?class?ClientThread?extends?Thread?{
private?GamePanel?gamepanel;//游戲開始的面板
private?objectInputStream?ois;
private?objectOutputStream?oos;
private?String?playernames[]?=?new?String[3];//?記錄所有玩家的名字
private?Integer?position;//?當前玩家進入游戲的位置,即第一個進入游戲的為0,第二個加入游戲的為1,第三個加入游戲的為2
private?PreParePanel?prepare;//游戲開始前的面板
private?Boolean?stop?=?false;

public?ClientThread(Socket?socket?GamePanel?gamepanel?PreParePanel?prepare)?{
//?該類為游戲線程類,主要
this.gamepanel?=?gamepanel;
this.prepare?=?prepare;
for?(int?i?=?0;?i? playernames[i]?=?““;
}
try?{

this.oos?=?new?objectOutputStream(socket.getOutputStream());
this.ois?=?new?objectInputStream(socket.getInputStream());
oos.writeobject(this.prepare.getPlayernames()[0]);
position?=?(Integer)?ois.readobject();
this.gamepanel.setPosition(position);
this.gamepanel.setOos(this.oos);
handlePlayerName();

}?catch?(Exception?e)?{
e.printStackTrace();
}

}

//?下面的方法用于計算其他出牌玩家在當前玩家面板上的位置
private?int?countPosition(int?n)?{
if?(position?==?0)?{
if?(n?==?2)?{
return?1;
}?else?{
return?2;
}
}?else?if?(position?==?1)?{
if?(n?==?2)?{
return?2;
}?else?{
return?1;
}
}?else?{
if?(n?==?1)?{
return?1;
}?else?{
return?2;
}
}
}

private?void?handleLord()?throws?Exception?{
//?處理地主選擇
Integer?lord?=?(Integer)?ois.readobject();

while?(lord?!=?-1)?{
if?(lord?==?position)?{
gamepanel.showLordChoose(true);
}
lord?=?(Integer)?ois.readobject();
}
gamepanel.setLastpokerIDVector((Vector)?ois.readobject());
gamepanel.showLastPoker();

}

private?void?handleLordIS()?throws?Exception?{
//?如果當前玩家不是地主
Integer?lord?=?(Integer)?ois.readobject();
if?(this.countPosition(lord)?==?1)?{

this.gamepanel.getPlayer1pokerIDVector().addAll(
gamepanel.getLastpokerIDVector());
gamepanel.getLordLabels()[1].setVisible(true);
gamepanel.showsSendButton(true);
this.gamepanel.display();
}?else?{

gamepanel.getLordLabels()[2].setVisible(true);
this.gamepanel.getPlayer2pokerIDVector().addAll(
gamepanel.getLastpokerIDVector());
gamepanel.showsSendButton(true);
this.gamepanel.display();
}
}

private?void?handleNewGame()?throws?Exception?{
//?處理新建游戲時的數據傳輸
Vector?poker1IDVector?=?(Vector)?ois.readobject();
Vector?poker2IDVector?=?(Vector)?ois.readobject();
Vector?poker3IDVector?=?(Vector)?ois.readobject();
Collections.sort(poker1IDVector);
Collections.sort(poker2IDVector);
Collections.sort(poker3IDVecto

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-03-08?00:06??網絡斗地主\
?????文件?????????232??2009-11-12?02:05??網絡斗地主\.classpath
?????文件?????????391??2009-11-12?02:05??網絡斗地主\.project
?????目錄???????????0??2012-03-08?00:06??網絡斗地主\.settings\
?????文件????????4457??2009-11-12?02:05??網絡斗地主\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-04-06?00:31??網絡斗地主\bin\
?????目錄???????????0??2012-04-06?00:31??網絡斗地主\bin\controller\
?????文件????????7094??2012-04-06?00:31??網絡斗地主\bin\controller\ClientThread.class
?????文件????????5835??2012-04-06?00:31??網絡斗地主\bin\controller\ServerThread.class
?????目錄???????????0??2012-04-06?00:31??網絡斗地主\bin\model\
?????文件????????1394??2012-04-06?00:31??網絡斗地主\bin\model\Poker.class
?????文件???????13935??2012-04-06?00:31??網絡斗地主\bin\model\PokerRules.class
?????目錄???????????0??2012-04-06?00:31??網絡斗地主\bin\view\
?????文件?????????630??2012-04-06?00:31??網絡斗地主\bin\view\AddDialog$1.class
?????文件????????4476??2012-04-06?00:31??網絡斗地主\bin\view\AddDialog.class
?????文件?????????653??2012-04-06?00:31??網絡斗地主\bin\view\EndDialog$1.class
?????文件????????2879??2012-04-06?00:31??網絡斗地主\bin\view\EndDialog.class
?????文件????????1004??2012-04-06?00:31??網絡斗地主\bin\view\Gameframe$1.class
?????文件????????1660??2012-04-06?00:31??網絡斗地主\bin\view\Gameframe$2.class
?????文件????????1581??2012-04-06?00:31??網絡斗地主\bin\view\Gameframe$3.class
?????文件?????????684??2012-04-06?00:31??網絡斗地主\bin\view\Gameframe$4.class
?????文件????????4020??2012-04-06?00:31??網絡斗地主\bin\view\Gameframe.class
?????文件????????1160??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel$1.class
?????文件????????1163??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel$2.class
?????文件????????2074??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel$3.class
?????文件????????3050??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel$4.class
?????文件????????1593??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel$5.class
?????文件???????14586??2012-04-06?00:31??網絡斗地主\bin\view\GamePanel.class
?????文件????????1543??2012-04-06?00:31??網絡斗地主\bin\view\PokerLabel$1.class
?????文件????????1408??2012-04-06?00:31??網絡斗地主\bin\view\PokerLabel.class
?????文件????????2994??2012-04-06?00:31??網絡斗地主\bin\view\PreParePanel.class
............此處省略74個文件信息

評論

共有 條評論