表1. CheckerDrag.java

成都創(chuàng)新互聯(lián)公司總部坐落于成都市區(qū),致力網(wǎng)站建設(shè)服務(wù)有成都網(wǎng)站設(shè)計(jì)、成都做網(wǎng)站、網(wǎng)絡(luò)營(yíng)銷策劃、網(wǎng)頁設(shè)計(jì)、網(wǎng)站維護(hù)、公眾號(hào)搭建、微信小程序定制開發(fā)、軟件開發(fā)等為企業(yè)提供一整套的信息化建設(shè)解決方案。創(chuàng)造真正意義上的網(wǎng)站建設(shè),為互聯(lián)網(wǎng)品牌在互動(dòng)行銷領(lǐng)域創(chuàng)造價(jià)值而不懈努力!
// CheckerDrag.javaimport java.awt.*;import java.awt.event.*;public class CheckerDrag extends java.applet.Applet{ // Dimension of checkerboard square. // 棋盤上每個(gè)小方格的尺寸 final static int SQUAREDIM = 40; // Dimension of checkerboard -- includes black outline. // 棋盤的尺寸 – 包括黑色的輪廓線 final static int BOARDDIM = 8 * SQUAREDIM + 2; // Dimension of checker -- 3/4 the dimension of a square. // 棋子的尺寸 – 方格尺寸的3/4 final static int CHECKERDIM = 3 * SQUAREDIM / 4; // Square colors are dark green or white. // 方格的顏色為深綠色或者白色 final static Color darkGreen = new Color (0, 128, 0); // Dragging flag -- set to true when user presses mouse button over checker // and cleared to false when user releases mouse button. // 拖動(dòng)標(biāo)記 --當(dāng)用戶在棋子上按下鼠標(biāo)按鍵時(shí)設(shè)為true, // 釋放鼠標(biāo)按鍵時(shí)設(shè)為false boolean inDrag = false; // Left coordinate of checkerboard's upper-left corner. // 棋盤左上角的左方向坐標(biāo) int boardx; // Top coordinate of checkerboard's upper-left corner. //棋盤左上角的上方向坐標(biāo) int boardy; // Left coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原點(diǎn)(左上角)的左方向坐標(biāo) int ox; // Top coordinate of checker rectangle origin (upper-left corner). // 棋子矩形原點(diǎn)(左上角)的上方向坐標(biāo) int oy; // Left displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按鍵時(shí)的鼠標(biāo)坐標(biāo)與棋子矩形原點(diǎn)之間的左方向位移 int relx; // Top displacement between mouse coordinates at time of press and checker // rectangle origin. // 在按鍵時(shí)的鼠標(biāo)坐標(biāo)與棋子矩形原點(diǎn)之間的上方向位移 int rely; // Width of applet drawing area. // applet繪圖區(qū)域的寬度 int width; // Height of applet drawing area. // applet繪圖區(qū)域的高度 int height; // Image buffer. // 圖像緩沖 Image imBuffer; // Graphics context associated with image buffer. // 圖像緩沖相關(guān)聯(lián)的圖形背景 Graphics imG; public void init () { // Obtain the size of the applet's drawing area. // 獲取applet繪圖區(qū)域的尺寸 width = getSize ().width; height = getSize ().height; // Create image buffer. // 創(chuàng)建圖像緩沖 imBuffer = createImage (width, height); // Retrieve graphics context associated with image buffer. // 取出圖像緩沖相關(guān)聯(lián)的圖形背景 imG = imBuffer.getGraphics (); // Initialize checkerboard's origin, so that board is centered. // 初始化棋盤的原點(diǎn),使棋盤在屏幕上居中 boardx = (width - BOARDDIM) / 2 + 1; boardy = (height - BOARDDIM) / 2 + 1; // Initialize checker's rectangle's starting origin so that checker is // centered in the square located in the top row and second column from // the left. // 初始化棋子矩形的起始原點(diǎn),使得棋子在第一行左數(shù)第二列的方格里居中 ox = boardx + SQUAREDIM + (SQUAREDIM - CHECKERDIM) / 2 + 1; oy = boardy + (SQUAREDIM - CHECKERDIM) / 2 + 1; // Attach a mouse listener to the applet. That listener listens for // mouse-button press and mouse-button release events. // 向applet添加一個(gè)用來監(jiān)聽鼠標(biāo)按鍵的按下和釋放事件的鼠標(biāo)監(jiān)聽器 addMouseListener (new MouseAdapter () { public void mousePressed (MouseEvent e) { // Obtain mouse coordinates at time of press. // 獲取按鍵時(shí)的鼠標(biāo)坐標(biāo) int x = e.getX (); int y = e.getY (); // If mouse is over draggable checker at time // of press (i.e., contains (x, y) returns // true), save distance between current mouse // coordinates and draggable checker origin // (which will always be positive) and set drag // flag to true (to indicate drag in progress). // 在按鍵時(shí)如果鼠標(biāo)位于可拖動(dòng)的棋子上方 // (也就是contains (x, y)返回true),則保存當(dāng)前 // 鼠標(biāo)坐標(biāo)與棋子的原點(diǎn)之間的距離(始終為正值)并且 // 將拖動(dòng)標(biāo)志設(shè)為true(用來表明正處在拖動(dòng)過程中) if (contains (x, y)) { relx = x - ox; rely = y - oy; inDrag = true; } } boolean contains (int x, int y) { // Calculate center of draggable checker. // 計(jì)算棋子的中心位置 int cox = ox + CHECKERDIM / 2; int coy = oy + CHECKERDIM / 2; // Return true if (x, y) locates with bounds // of draggable checker. CHECKERDIM / 2 is the // radius. // 如果(x, y)仍處于棋子范圍內(nèi)則返回true // CHECKERDIM / 2為半徑 return (cox - x) * (cox - x) + (coy - y) * (coy - y) CHECKERDIM / 2 * CHECKERDIM / 2; } public void mouseReleased (MouseEvent e) { // When mouse is released, clear inDrag (to // indicate no drag in progress) if inDrag is // already set. // 當(dāng)鼠標(biāo)按鍵被釋放時(shí),如果inDrag已經(jīng)為true, // 則將其置為false(用來表明不在拖動(dòng)過程中) if (inDrag) inDrag = false; } }); // Attach a mouse motion listener to the applet. That listener listens // for mouse drag events. //向applet添加一個(gè)用來監(jiān)聽鼠標(biāo)拖動(dòng)事件的鼠標(biāo)運(yùn)動(dòng)監(jiān)聽器 addMouseMotionListener (new MouseMotionAdapter () { public void mouseDragged (MouseEvent e) { if (inDrag) { // Calculate draggable checker's new // origin (the upper-left corner of // the checker rectangle). // 計(jì)算棋子新的原點(diǎn)(棋子矩形的左上角) int tmpox = e.getX () - relx; int tmpoy = e.getY () - rely; // If the checker is not being moved // (at least partly) off board, // assign the previously calculated // origin (tmpox, tmpoy) as the // permanent origin (ox, oy), and // redraw the display area (with the // draggable checker at the new // coordinates). // 如果棋子(至少是棋子的一部分)沒有被 // 移出棋盤,則將之前計(jì)算的原點(diǎn) // (tmpox, tmpoy)賦值給永久性的原點(diǎn)(ox, oy), // 并且刷新顯示區(qū)域(此時(shí)的棋子已經(jīng)位于新坐標(biāo)上) if (tmpox boardx tmpoy boardy tmpox + CHECKERDIM boardx + BOARDDIM tmpoy + CHECKERDIM boardy + BOARDDIM) { ox = tmpox; oy = tmpoy; repaint (); } } } }); } public void paint (Graphics g) { // Paint the checkerboard over which the checker will be dragged. // 在棋子將要被拖動(dòng)的位置上繪制棋盤 paintCheckerBoard (imG, boardx, boardy); // Paint the checker that will be dragged. // 繪制即將被拖動(dòng)的棋子 paintChecker (imG, ox, oy); // Draw contents of image buffer. // 繪制圖像緩沖的內(nèi)容 g.drawImage (imBuffer, 0, 0, this); } void paintChecker (Graphics g, int x, int y) { // Set checker shadow color. // 設(shè)置棋子陰影的顏色 g.setColor (Color.black); // Paint checker shadow. // 繪制棋子的陰影 g.fillOval (x, y, CHECKERDIM, CHECKERDIM); // Set checker color. // 設(shè)置棋子顏色 g.setColor (Color.red); // Paint checker. // 繪制棋子 g.fillOval (x, y, CHECKERDIM - CHECKERDIM / 13, CHECKERDIM - CHECKERDIM / 13); } void paintCheckerBoard (Graphics g, int x, int y) { // Paint checkerboard outline. // 繪制棋盤輪廓線 g.setColor (Color.black); g.drawRect (x, y, 8 * SQUAREDIM + 1, 8 * SQUAREDIM + 1); // Paint checkerboard. // 繪制棋盤 for (int row = 0; row 8; row++) { g.setColor (((row 1) != 0) ? darkGreen : Color.white); for (int col = 0; col 8; col++) { g.fillRect (x + 1 + col * SQUAREDIM, y + 1 + row * SQUAREDIM, SQUAREDIM, SQUAREDIM); g.setColor ((g.getColor () == darkGreen) ? Color.white : darkGreen); } } } // The AWT invokes the update() method in response to the repaint() method // calls that are made as a checker is dragged. The default implementation // of this method, which is inherited from the Container class, clears the // applet's drawing area to the background color prior to calling paint(). // This clearing followed by drawing causes flicker. CheckerDrag overrides // update() to prevent the background from being cleared, which eliminates // the flicker. // AWT調(diào)用了update()方法來響應(yīng)拖動(dòng)棋子時(shí)所調(diào)用的repaint()方法。該方法從 // Container類繼承的默認(rèn)實(shí)現(xiàn)會(huì)在調(diào)用paint()之前,將applet的繪圖區(qū)域清除 // 為背景色,這種繪制之后的清除就導(dǎo)致了閃爍。CheckerDrag重寫了update()來 // 防止背景被清除,從而消除了閃爍。 public void update (Graphics g) { paint (g); }}
直接改,不存在的。
首先,你需要一個(gè)反編譯軟件。。Java(Android)用Java反編譯軟件(n多)
然后,你需要有Java編程基礎(chǔ)
/*找到load*logo(或者是load*)函數(shù),一般就會(huì)有解析段
然后在程序里加一段,編碼后輸出到某一文件(mp4)。*/(根據(jù)后期研究,這句話不成立)
老夫看你的好像是iPad。。。
還有,一般的大型3d/2d游戲都用過unity,所以搞個(gè)disunity可以提取部分資源(unity5用了流拆方法拆分assets文件,整合后只能用disunity 0.5拆包,只是一堆block文件(作者沒添加反序列化功能)然后低版本都不行)(網(wǎng)上流傳過unity stdio可以提取貼圖音頻文件,沒試過)
本人正在研究某一Gameloft游戲中。。
[注:本文中的*指通配符里的(任意字符)]
[注:disunity需要JavaRuntimeEnvironment環(huán)境(簡(jiǎn)稱JRE),unitystudio需要.net framework 4.0環(huán)境(畢竟用C#寫的)]
[更新于2017.11.17]禁止用反編譯軟件作非法用途!!!
[更新于2017.11.21](我沒玩過節(jié)奏大師,也沒反編譯過)
據(jù)我的猜測(cè),這種文件會(huì)在開頭顯示,但更多的是在游戲過程中。。。如果是在開頭顯示,那好辦,畢竟像節(jié)奏大師這種游戲,東西多,反編譯的時(shí)間長(zhǎng)。。而且可能還會(huì)有混淆代碼,給破解工作帶來巨大阻力。。(當(dāng)然,基本上這些都可以用simplify搞定)接下來,根據(jù)反編譯的androidManifest.XML文件可以確定源碼內(nèi)各個(gè)文件按照什么順序啟動(dòng),然后就可以在較前的啟動(dòng)順序的代碼中找到將bsprite文件解碼的程序。
.java文件的話,非項(xiàng)目那種單篇幅的源代碼需要先進(jìn)行編譯,生成.class文件可以在命令控制臺(tái)下用java 文件名 進(jìn)行運(yùn)行,編譯java文件需要javac.exe程序 應(yīng)該是jdk中的工具,所以你需要下載jdk并配置環(huán)境變量,然后在控制臺(tái)運(yùn)行javac編譯源文件所在目錄下的java文件,會(huì)在本目錄下生成一個(gè)同名的.class文件
(沒有報(bào)錯(cuò)的情況下) ,然后運(yùn)行java 文件名 即可運(yùn)行該代碼(前提是你這篇文件需要有main方法)。
只能給你第一個(gè):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JNotePadUI extends JFrame {
private JMenuItem menuOpen;
private JMenuItem menuSave;
private JMenuItem menuSaveAs;
private JMenuItem menuClose;
private JMenu editMenu;
private JMenuItem menuCut;
private JMenuItem menuCopy;
private JMenuItem menuPaste;
private JMenuItem menuAbout;
private JTextArea textArea;
private JLabel stateBar;
private JFileChooser fileChooser;
private JPopupMenu popUpMenu;
public JNotePadUI() {
super("新建文本文件");
setUpUIComponent();
setUpEventListener();
setVisible(true);
}
private void setUpUIComponent() {
setSize(640, 480);
// 菜單欄
JMenuBar menuBar = new JMenuBar();
// 設(shè)置「文件」菜單
JMenu fileMenu = new JMenu("文件");
menuOpen = new JMenuItem("打開");
// 快捷鍵設(shè)置
menuOpen.setAccelerator(
KeyStroke.getKeyStroke(
KeyEvent.VK_O,
InputEvent.CTRL_MASK));
menuSave = new JMenuItem("保存");
menuSave.setAccelerator(
KeyStroke.getKeyStroke(
KeyEvent.VK_S,
InputEvent.CTRL_MASK));
menuSaveAs = new JMenuItem("另存為");
menuClose = new JMenuItem("關(guān)閉");
menuClose.setAccelerator(
KeyStroke.getKeyStroke(
KeyEvent.VK_Q,
InputEvent.CTRL_MASK));
fileMenu.add(menuOpen);
fileMenu.addSeparator(); // 分隔線
fileMenu.add(menuSave);
fileMenu.add(menuSaveAs);
fileMenu.addSeparator(); // 分隔線
fileMenu.add(menuClose);
// 設(shè)置「編輯」菜單
JMenu editMenu = new JMenu("編輯");
menuCut = new JMenuItem("剪切");
menuCut.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_X,
InputEvent.CTRL_MASK));
menuCopy = new JMenuItem("復(fù)制");
menuCopy.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_C,
InputEvent.CTRL_MASK));
menuPaste = new JMenuItem("粘貼");
menuPaste.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_V,
InputEvent.CTRL_MASK));
editMenu.add(menuCut);
editMenu.add(menuCopy);
editMenu.add(menuPaste);
// 設(shè)置「關(guān)于」菜單
JMenu aboutMenu = new JMenu("關(guān)于");
menuAbout = new JMenuItem("關(guān)于JNotePad");
aboutMenu.add(menuAbout);
menuBar.add(fileMenu);
menuBar.add(editMenu);
menuBar.add(aboutMenu);
setJMenuBar(menuBar);
// 文字編輯區(qū)域
textArea = new JTextArea();
textArea.setFont(new Font("宋體", Font.PLAIN, 16));
textArea.setLineWrap(true);
JScrollPane panel = new JScrollPane(textArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
Container contentPane = getContentPane();
contentPane.add(panel, BorderLayout.CENTER);
// 狀態(tài)欄
stateBar = new JLabel("未修改");
stateBar.setHorizontalAlignment(SwingConstants.LEFT);
stateBar.setBorder(
BorderFactory.createEtchedBorder());
contentPane.add(stateBar, BorderLayout.SOUTH);
popUpMenu = editMenu.getPopupMenu();
fileChooser = new JFileChooser();
}
private void setUpEventListener() {
// 按下窗口關(guān)閉鈕事件處理
addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
closeFile();
}
}
);
// 菜單 - 打開
menuOpen.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
openFile();
}
}
);
// 菜單 - 保存
menuSave.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveFile();
}
}
);
// 菜單 - 另存為
menuSaveAs.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveFileAs();
}
}
);
// 菜單 - 關(guān)閉文件
menuClose.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
closeFile();
}
}
);
// 菜單 - 剪切
menuCut.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
cut();
}
}
);
// 菜單 - 復(fù)制
menuCopy.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
copy();
}
}
);
// 菜單 - 粘貼
menuPaste.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
paste();
}
}
);
// 菜單 - 關(guān)于
menuAbout.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
// 顯示對(duì)話框
JOptionPane.showOptionDialog(null,
"程序名稱:\n JNotePad \n" +
"程序設(shè)計(jì):\n ???\n" +
"簡(jiǎn)介:\n 一個(gè)簡(jiǎn)單的文字編輯器\n",
"關(guān)于JNotePad",
JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null, null, null);
}
}
);
// 編輯區(qū)鍵盤事件
textArea.addKeyListener(
new KeyAdapter() {
public void keyTyped(KeyEvent e) {
processTextArea();
}
}
);
// 編輯區(qū)鼠標(biāo)事件
textArea.addMouseListener(
new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if(e.getButton() == MouseEvent.BUTTON3)
popUpMenu.show(editMenu, e.getX(), e.getY());
}
public void mouseClicked(MouseEvent e) {
if(e.getButton() == MouseEvent.BUTTON1)
popUpMenu.setVisible(false);
}
}
);
}
private void openFile() {
if(isCurrentFileSaved()) { // 文件是否為保存狀態(tài)
open(); // 打開
}
else {
// 顯示對(duì)話框
int option = JOptionPane.showConfirmDialog(
null, "文件已修改,是否保存?",
"保存文件?", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, null);
switch(option) {
// 確認(rèn)文件保存
case JOptionPane.YES_OPTION:
saveFile(); // 保存文件
break;
// 放棄文件保存
case JOptionPane.NO_OPTION:
open();
break;
}
}
}
private boolean isCurrentFileSaved() {
if(stateBar.getText().equals("未修改")) {
return true;
}
else {
return false;
}
}
private void open() {
// fileChooser 是 JFileChooser 的實(shí)例
// 顯示文件選取的對(duì)話框
int option = fileChooser.showDialog(null, null);
// 使用者按下確認(rèn)鍵
if(option == JFileChooser.APPROVE_OPTION) {
/*
TODO: 添加讀取文件的代碼
*/
}
}
private void saveFile() {
/*
TODO: 添加保存文件的代碼
*/
}
private void saveFileAs() {
/*
TODO: 添加另存為的代碼
*/
}
private void closeFile() {
// 是否已保存文件
if(isCurrentFileSaved()) {
// 釋放窗口資源,而后關(guān)閉程序
dispose();
}
else {
int option = JOptionPane.showConfirmDialog(
null, "文件已修改,是否保存?",
"保存文件?", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE, null);
switch(option) {
case JOptionPane.YES_OPTION:
saveFile();
break;
case JOptionPane.NO_OPTION:
dispose();
}
}
}
private void cut() {
textArea.cut();
stateBar.setText("已修改");
popUpMenu.setVisible(false);
}
private void copy() {
textArea.copy();
popUpMenu.setVisible(false);
}
private void paste() {
textArea.paste();
stateBar.setText("已修改");
popUpMenu.setVisible(false);
}
private void processTextArea() {
stateBar.setText("已修改");
}
public static void main(String[] args) {
new JNotePadUI();
}
}
你說的java源代碼是指編譯成的class文件前的java文件。
當(dāng)我們運(yùn)行.java文件時(shí),它會(huì)被系統(tǒng)編譯成.class文件,例如Test.java編譯之后就是Test.class,
源文件就是指Test.java文件,
一般部署項(xiàng)目時(shí),有.class文件就可以發(fā)布運(yùn)行了,但是如果想修改這個(gè)系統(tǒng),.class是不能修改的,要有.java文件才能修改
也可以上網(wǎng)去下反編譯軟件,就是能把.class文件大部分還原成.java文件的工具,但不是100%還原,而且如果不是正版的,小心有毒啊,什么的。
Java 用來保存整數(shù)的基本類型有 byte, short, int, long
即使是 long 也是有長(zhǎng)度限制的。那對(duì)于超過 long 長(zhǎng)度的數(shù)據(jù)怎么辦呢?
BigInteger 就是為了解決這個(gè)問題的。但是相對(duì)用起來比較麻煩,需要用方法來進(jìn)行任何的計(jì)算
當(dāng)前文章:源代碼節(jié)奏大師Java,節(jié)奏大師制作版
分享地址:http://chinadenli.net/article21/dsipgcd.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、定制網(wǎng)站、網(wǎng)站排名、做網(wǎng)站、域名注冊(cè)、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)