收集了些学习资料,分享给大家 JAVA 1 链接:http://pan.baidu.com/s/1dDGgkbJ 密码:o9c0 JAVA 2 链接:http://pan.baidu.com/s/1c07uIu0 密码:gi8h ANDROID 链接:http://pan.baidu.com/s/1gdorNcn 密码:e5dm 三大框架 链接:http://pan.baidu.com/s/1eQf6uzC 密码:8k3q UNITY 3D 链接:http://pan.baidu.com/s/1i30yUDv 密码:5vwj
链接:http://pan.baidu.com/s/1hq8848O 密码:s9o5 mars 的教程 在我看来的完全0 基础系列视频教程中最好的一部 还有相关 JME 的基础知识补完 链接:http://pan.baidu.com/s/1i3LxEdR 密码:v542
import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Random; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.WindowConstants; public class MyFrame extends JFrame { //界面布置 private JButton btnRestart=new JButton("重新开局"); private JButton btnYao=new JButton("要牌"); private JButton btnBuYao=new JButton("不要"); private JLabel lblResult=new JLabel("请点击重新开局 开始游戏"); private JLabel lblComputer=new JLabel("电脑的牌:"); private JLabel lblPlayer=new JLabel("玩家的牌:"); private JLabel lblPlayerDianShu=new JLabel(""); private JLabel lblComputerDianShu=new JLabel(""); //全新的一副牌,共52张 private ArrayList<Card> allCard=new ArrayList<Card>(); //玩家手上的牌 private ArrayList<Card> playerCardList=new ArrayList<Card>(); //电脑手上的牌 private ArrayList<Card> computerCardList=new ArrayList<Card>(); //玩家牌的坐标 private int playerCard_x=220; //电脑牌的坐标 private int computerCard_x=220; public MyFrame() { //界面属性设置 this.setTitle("21点游戏"); this.setSize(800, 600); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setResizable(false); this.setLayout(null); this.setBackground(Color.LIGHT_GRAY); this.getContentPane().setBackground(Color.LIGHT_GRAY); btnRestart.setSize(100, 25); btnRestart.setLocation(150, 500); btnRestart.addActionListener(new btnResult_click()); this.add(btnRestart); btnYao.setSize(100, 25); btnYao.setLocation(350, 500); btnYao.addActionListener(new btnYao_click()); btnYao.setEnabled(false); this.add(btnYao); btnBuYao.setSize(100, 25); btnBuYao.setLocation(550, 500); btnBuYao.addActionListener(new btnBuYao_click()); btnBuYao.setEnabled(false); this.add(btnBuYao); lblResult.setSize(300, 25); lblResult.setLocation(125, 450); this.add(lblResult); lblComputer.setSize(100, 25); lblComputer.setLocation(100, 85); this.add(lblComputer); lblPlayer.setSize(100, 25); lblPlayer.setLocation(100, 285); this.add(lblPlayer); lblPlayerDianShu.setSize(100, 25); lblPlayerDianShu.setLocation(200, 375); lblPlayerDianShu.setVisible(false); this.add(lblPlayerDianShu); lblComputerDianShu.setSize(100, 25); lblComputerDianShu.setLocation(200, 175); lblComputerDianShu.setVisible(false); this.add(lblComputerDianShu); } /** * 生成一幅新的牌,共52张 */ private void createAllCard() { String[] hs={"黑","红","梅","方"}; for(int i=1;i<13;i++) { for(int k=0;k<hs.length;k++) { Card c=new Card(); c.setShuZi(i); c.setHuaSe(hs[k]); c.setZhengMain(false); //设置点数 int dianShu=i; if(dianShu>10) { dianShu=10; } c.setDianShu(dianShu); allCard.add(c); } } } /** * 重新开局 按钮的响应 * @author student */ class btnResult_click implements ActionListener { public void actionPerformed(ActionEvent e) { //初始化游戏 initGame(); //生成新的牌 createAllCard(); //发给玩家一张 sendToPlayerOneCard(); //发给电脑一张 sendToComputerOneCard(); lblComputerDianShu.setVisible(false); lblPlayerDianShu.setVisible(false); } } /** * 要牌 按钮的响应 */ class btnYao_click implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // 给玩家发一张牌 sendToPlayerOneCard(); //给电脑发一张牌 int computerDianShuHe=calculateComputerDianShu(); if(computerDianShuHe<=16) { sendToComputerOneCard(); } } } /** * 发给玩家一张牌 */ private void sendToPlayerOneCard() { Random rand=new Random(); int index=rand.nextInt(allCard.size()); Card c=allCard.get(index); playerCardList.add(c); allCard.remove(index); c.setZhengMain(true); c.loadImage(); JLabel lbl=c.getCardLabel(); lbl.setLocation(playerCard_x, 250); this.add(lbl); this.repaint(); playerCard_x+=78; } /** * 发给电脑一张牌 */ private void sendToComputerOneCard() { Random rand=new Random(); int index=rand.nextInt(allCard.size()); Card c=allCard.get(index); computerCardList.add(c); allCard.remove(index); c.setZhengMain(false); c.loadImage(); JLabel lbl=c.getCardLabel(); lbl.setLocation(computerCard_x, 50); this.add(lbl); this.repaint(); computerCard_x+=78; } /** * 翻开电脑手上的所有牌 */ private void fanKaiComputerCard() { for (int i=0;i<computerCardList.size();i++) { Card c=computerCardList.get(i); c.setZhengMain(true); c.loadImage(); } this.repaint(); } /** * 清除窗体上所有的牌的JLabel控件 */ private void initGame() { //清除电脑的牌的JLabel控件 for(int i=0;i<computerCardList.size();i++) { Card c=computerCardList.get(i); JLabel lbl=c.getCardLabel(); this.remove(lbl); } //清除玩家的牌的JLabel控件 for(int i=0;i<playerCardList.size();i++) { Card c=playerCardList.get(i); JLabel lbl=c.getCardLabel(); this.remove(lbl); } //清除各个数组中的元素 computerCardList.clear(); playerCardList.clear(); allCard.clear(); //重置牌的横坐标 computerCard_x=220; playerCard_x=220; //设置按钮的可用性 btnRestart.setEnabled(false); btnYao.setEnabled(true); btnBuYao.setEnabled(true); } /** * 计算电脑手上的牌的点数和 */ private int calculateComputerDianShu() { int sum=0;//点数和 for(int i=0;i<computerCardList.size();i++) { Card c=computerCardList.get(i); sum+=c.getDianShu(); } return sum; } /** * 计算玩家手上的牌的点数和 */ private int calculatePlayerDianShu() { int sum=0; for(int i=0;i<playerCardList.size();i++) { Card c=playerCardList.get(i); sum+=c.getDianShu(); } return sum; } /** * 不要 按钮的响应 */ class btnBuYao_click implements ActionListener { //给电脑补全牌 public void actionPerformed(ActionEvent e) { while (true) { int computerDianShuHe = calculateComputerDianShu(); if (computerDianShuHe<=16) { sendToComputerOneCard(); } else { break; } } //把电脑牌翻过来 fanKaiComputerCard(); //判断输赢 int C=calculateComputerDianShu(); int P=calculatePlayerDianShu(); if (C>P && C<=21) { lblResult.setText("很遗憾,你输了!!"); } else if (C<=21 && P>21) { lblResult.setText("你爆点了!很遗憾,你输了!!"); } else if (C==P) { lblResult.setText("平局"); } else if (C>21 && P>21) { lblResult.setText("平局"); } else if (P>C && P<=21) { lblResult.setText("恭喜你,你胜了!!"); } else if (P<=21 && C>21) { lblResult.setText("电脑爆点了!恭喜你,你胜了!!"); } //重新开始后的按钮的可用性 btnRestart.setEnabled(true); btnYao.setEnabled(false); btnBuYao.setEnabled(false); //显示玩家和电脑的点数和 lblComputerDianShu.setVisible(true); lblComputerDianShu.setText("电脑点数和:"+calculateComputerDianShu()); lblPlayerDianShu.setVisible(true); lblPlayerDianShu.setText("玩家点数和:"+calculatePlayerDianShu()); } } } #21t 求大神帮看下怎么加背景图上去,有其它美化也可以
本期目录: Editorial: 29A#3.1_1 - Introduction 29A#3.1_2 - News 29A#3.1_3 - Membership 29A#3.1_4 - Distribution 29A#3.1_5 - Our greetings 29A#3.1_6 - Policies and goals 29A#3.1_7 - Secret area 29A#3.1_8 - About the viewer 29A#3.1_9 - Mister Sandman's resignation 29A#3.1_A - Rajaat's resignation Articles: 29A#3.2_1 - Archive32 29A#3.2_2 - Billy Belceb?virus writing guide 29A#3.2_3 - Win32 PE infection tutorial 29A#3.2_4 - Pass to Ring-0 with C/C++ 29A#3.2_5 - Hooking VxDCall 29A#3.2_6 - How to get the Windoze directory 29A#3.2_7 - Cross infection part I 29A#3.2_8 - Cross infection part II 29A#3.2_9 - Heuristics for antivirus/archiving 29A#3.2_A - Polymorphism 29A#3.2_B - Preserving Novell Netware compatibility 29A#3.2_C - TbScan32 decryptor 29A#3.2_D - Nick Fitzgerald 29A#3.2_E - Antivirus pathetism 29A#3.2_F - JQwerty's compression/encryption engine 29A#3.2_G - TbMem exploit Utilities: 29A#3.3_1 - $UPD v2.2 29A#3.3_2 - Error Correction Code (ECC) 29A#3.3_3 - Adinf/AVP Inspector CRC 29A#3.3_4 - AVP Add-on 29A#3.3_5 - AVPX v1.01 29A#3.3_6 - AZCME v0.04 29A#3.3_7 - AZCME32 v0.04 29A#3.3_8 - STRC v1.0 29A#3.3_9 - JQCODING v1.0 29A#3.3_A - Tiny engines 29A#3.3_B - APME v1.04b 29A#3.3_C - RDAE v1.0 Windows: 29A#3.4_1 - Win.Bonk 29A#3.4_2 - Next Step 29A#3.4_3 - Win95.K32 29A#3.4_4 - Win95.Z0mbie-II 29A#3.4_5 - Win95.Marburg 29A#3.4_6 - Win95.HPS 29A#3.4_7 - Win95.Bonk32 29A#3.4_8 - Win95.Inca 29A#3.4_9 - Win95.Sexy 29A#3.4_A - Win95.Yabram 29A#3.4_B - Win32.Apparition 29A#3.4_C - Win32.Borges 29A#3.4_D - Win32.REDemption 29A#3.4_E - VxD infector Viruses: 29A#3.5_1 - Califax 29A#3.5_2 - RISC_OS.Simple 29A#3.5_3 - Nutcracker.7458 29A#3.5_4 - Kuarahy v1.1 29A#3.5_5 - Idea.6126 29A#3.5_6 - Dark Thoughts v1.20 29A#3.5_7 - La Diosa 29A#3.5_8 - Widowmaker v1.02 29A#3.5_9 - Soulfly 29A#3.5_A - Candyman v1.01 29A#3.5_B - Messev 29A#3.5_C - Gwar v1.10 29A#3.5_D - Squatter v1.2 29A#3.5_E - Claudia.8772 29A#3.5_F - Pusher.374 Viruses: 29A#3.6_1 - 007JB v1.01.2b 29A#3.6_2 - FIRE v1.00b 29A#3.6_3 - M1 [i286] 29A#3.6_4 - PGPMorph family 29A#3.6_5 - Zombie.667 29A#3.6_6 - Fick Nitzgerald 29A#3.6_7 - Weird Al 29A#3.6_8 - DSA2 29A#3.6_9 - Shiver 29A#3.6_A - Strange Days 29A#3.6_B - Numbless 29A#3.6_C - Ancev 29A#3.6_D - Nutmeg2 29A#3.6_E - Ithaqua 29A#3.6_F - Tiny viruses 29A#3.6_G - Ida.1490 [attach]318797[/attach] [attach]318799[/attach]
因为要使用RGSS(Ruby Game Script System)写游戏,所以接触到了Ruby语言,但是感觉好像知道并使用这个语言的人在国内不多(日本倒是很多程序员都会)。各位真的没听说过Ruby吗?