質問編集履歴
1
文字数制限で書き込めなかった play\.javaの中身を記入しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -158,147 +158,403 @@
|
|
158
158
|
|
159
159
|
p_select.setOpaque(false);
|
160
160
|
|
161
|
-
|
162
|
-
|
163
|
-
ImageIcon oneshall1 = new ImageIcon("./music/onedari_shall_we/oneshall_out.png");
|
164
|
-
|
165
|
-
ImageIcon oneshall2 = new ImageIcon("./music/onedari_shall_we/oneshall_over.png");
|
166
|
-
|
167
|
-
JButton music1 = new JButton(oneshall1);
|
168
|
-
|
169
|
-
music1.setBounds(100,100,410,116);
|
170
|
-
|
171
|
-
music1.setRolloverIcon(oneshall2);
|
172
|
-
|
173
|
-
music1.setPressedIcon(oneshall2);
|
174
|
-
|
175
|
-
music1.addActionListener(this);
|
176
|
-
|
177
|
-
music1.setActionCommand("./music/onedari_shall_we/おねだり_Shall_We.wav");
|
178
|
-
|
179
161
|
|
180
162
|
|
181
|
-
ImageIcon
|
163
|
+
ImageIcon concon1 = new ImageIcon("./music/concon/concon_out.png");
|
182
|
-
|
164
|
+
|
183
|
-
ImageIcon
|
165
|
+
ImageIcon concon2 = new ImageIcon("./music/concon/concon_over.png");
|
184
|
-
|
166
|
+
|
185
|
-
JButton music
|
167
|
+
JButton music3 = new JButton(concon1);
|
186
|
-
|
168
|
+
|
187
|
-
music
|
169
|
+
music3.setBounds(100,500,410,116);
|
188
|
-
|
170
|
+
|
189
|
-
music
|
171
|
+
music3.setRolloverIcon(concon2);
|
190
|
-
|
172
|
+
|
191
|
-
music
|
173
|
+
music3.setPressedIcon(concon2);
|
192
|
-
|
174
|
+
|
193
|
-
music
|
175
|
+
music3.addActionListener(this);
|
194
|
-
|
176
|
+
|
195
|
-
music
|
177
|
+
music3.setActionCommand("./music/concon/concon");
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
p_select.add(music3);
|
196
182
|
|
197
183
|
|
198
184
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
185
|
+
|
186
|
+
|
187
|
+
Container contentPane2 = frames.getContentPane();
|
188
|
+
|
189
|
+
contentPane2.add(p_select, BorderLayout.CENTER);
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
frames.setVisible(true);
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
}else if (cmd.equals("./music/concon/concon")){
|
198
|
+
|
199
|
+
frames.setVisible(false);
|
200
|
+
|
201
|
+
startgame.game();//ここでplay.javaを呼び出す。
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
audio.stop();
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
```
|
220
|
+
|
221
|
+
```java
|
222
|
+
|
223
|
+
import 省略
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
public class play {
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
public static void game(){
|
232
|
+
|
233
|
+
vimani action = new vimani();
|
234
|
+
|
235
|
+
action.viner();
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
class vimani extends JPanel implements KeyListener{
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
private JFrame frameC;
|
248
|
+
|
249
|
+
public lanePanel violin;
|
250
|
+
|
251
|
+
public static int[] sec = new int[1000];
|
252
|
+
|
253
|
+
public static int[][] fumen = new int[1000][2];
|
254
|
+
|
255
|
+
public static long gets = 0;
|
256
|
+
|
257
|
+
static int muchmicros = 0;
|
258
|
+
|
259
|
+
static int y1ic=0;static int y2ic=0;static int y3ic=0;static int y4ic=0;
|
260
|
+
|
261
|
+
static int[] y1 = new int[300];
|
262
|
+
|
263
|
+
static int[] y2 = new int[300];
|
264
|
+
|
265
|
+
static int[] y3 = new int[300];
|
266
|
+
|
267
|
+
static int[] y4 = new int[300];
|
268
|
+
|
269
|
+
static int speed = 7;
|
270
|
+
|
271
|
+
static String filen = "concon";
|
272
|
+
|
273
|
+
static int startcounter=0;
|
274
|
+
|
275
|
+
static Sounder sounder = new Sounder();
|
276
|
+
|
277
|
+
public void viner(){
|
278
|
+
|
279
|
+
window();//ウィンドウを生成
|
280
|
+
|
281
|
+
for(int i=0;i<300;i++){
|
282
|
+
|
283
|
+
y1[i] = 0;
|
284
|
+
|
285
|
+
y2[i] = 0;
|
286
|
+
|
287
|
+
y3[i] = 0;
|
288
|
+
|
289
|
+
y4[i] = 0;
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
read_fumen(filen);
|
294
|
+
|
295
|
+
runi();
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
public void window(){
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
frameC = new JFrame();
|
306
|
+
|
307
|
+
frameC.setTitle("Violinist");
|
308
|
+
|
309
|
+
frameC.setBounds(600,10,600,1000);//x=600,y=10,横600,縦1000のフレームを準備
|
310
|
+
|
311
|
+
frameC.setLayout(null);//レイアウトマネージャ使用しない
|
312
|
+
|
313
|
+
frameC.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//一緒に消す
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
violin = new lanePanel();
|
318
|
+
|
319
|
+
violin.setOpaque(false);
|
320
|
+
|
321
|
+
violin.setLayout(null);
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
violin.setSize(600,1000);
|
326
|
+
|
327
|
+
violin.setBackground(new Color(31,38,56,255));
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
Container contentPane3 = frameC.getContentPane();
|
332
|
+
|
333
|
+
contentPane3.add(violin, BorderLayout.CENTER);
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
//frame.add(violin);
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
frameC.setVisible(true);
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
frameC.addKeyListener(this);
|
348
|
+
|
349
|
+
violin.addKeyListener(this);
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
public void runi(){//指定msでrepaint()を行うメソッド
|
358
|
+
|
359
|
+
violin.repaint();//repaintを呼び出す。
|
360
|
+
|
361
|
+
}
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
public static void fumeneed(){
|
366
|
+
|
367
|
+
//譜面データを読む処理
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
public static void musicstart(String selectMusic){
|
374
|
+
|
375
|
+
//音楽再生処理
|
376
|
+
|
377
|
+
}
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
public static void read_fumen(String fileName){
|
382
|
+
|
383
|
+
//譜面ファイルをオープンする処理
|
384
|
+
|
385
|
+
}
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
private static boolean checkBeforeReadfile(File file){
|
390
|
+
|
391
|
+
//譜面ファイルを読むのに必要な処理
|
392
|
+
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
public void keyPressed(KeyEvent e){
|
398
|
+
|
399
|
+
}
|
400
|
+
|
401
|
+
public void keyReleased(KeyEvent e){
|
402
|
+
|
403
|
+
}
|
404
|
+
|
405
|
+
public void keyTyped(KeyEvent e){
|
406
|
+
|
407
|
+
char key = e.getKeyChar();
|
408
|
+
|
409
|
+
System.out.println(key);
|
410
|
+
|
411
|
+
searchHitNotes(key);//キー判定
|
412
|
+
|
413
|
+
}
|
414
|
+
|
415
|
+
public void searchHitNotes(char hitKey){
|
416
|
+
|
417
|
+
//キーの押したタイミングで点数をつける処理
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
}
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
class Sounder implements LineListener{
|
426
|
+
|
427
|
+
//音楽再生準備、再生中かどうかの判定等をするクラス
|
428
|
+
|
429
|
+
}
|
430
|
+
|
431
|
+
class lanePanel extends JPanel{//譜面描画メソッド
|
214
432
|
|
215
433
|
|
216
434
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
Co
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
a
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
a
|
268
|
-
|
269
|
-
a
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
a
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
435
|
+
@Override
|
436
|
+
|
437
|
+
public void paintComponent(Graphics g) {
|
438
|
+
|
439
|
+
super.paintComponent(g);
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
// レーン
|
444
|
+
|
445
|
+
g.setColor(new Color(153,51,51,255));
|
446
|
+
|
447
|
+
g.fillRect(220,10, 30, 650);
|
448
|
+
|
449
|
+
g.fillRect(255,10, 30, 650);
|
450
|
+
|
451
|
+
g.fillRect(290,10, 30, 650);
|
452
|
+
|
453
|
+
g.fillRect(325,10, 30, 650);
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
g.setColor(new Color(255,255,255,255));
|
458
|
+
|
459
|
+
g.fillRect(250,10, 5, 650);
|
460
|
+
|
461
|
+
g.fillRect(285,10, 5, 650);
|
462
|
+
|
463
|
+
g.fillRect(320,10, 5, 650);
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
g.setColor(new Color(255,180,0,255));
|
468
|
+
|
469
|
+
g.fillRect(220,590,135,20);
|
470
|
+
|
471
|
+
//ノート
|
472
|
+
|
473
|
+
g.setColor(new Color(102,255,204,255));//ノーツの色
|
474
|
+
|
475
|
+
for(int i=vimani.one+1;i<vimani.y1ic;i++){
|
476
|
+
|
477
|
+
if(vimani.y1[i] <640){
|
478
|
+
|
479
|
+
g.fillRoundRect(220, vimani.y1[i], 30, 20, 5, 10);
|
480
|
+
|
481
|
+
vimani.y1[i]+=vimani.speed;
|
482
|
+
|
483
|
+
}else{
|
484
|
+
|
485
|
+
vimani.y1[i] = 990;
|
486
|
+
|
487
|
+
vimani.one = i;
|
488
|
+
|
489
|
+
}
|
490
|
+
|
491
|
+
}
|
492
|
+
|
493
|
+
for(int i=vimani.two+1;i<vimani.y2ic;i++){
|
494
|
+
|
495
|
+
if(vimani.y2[i] <640){
|
496
|
+
|
497
|
+
g.fillRoundRect(255, vimani.y2[i], 30, 20, 5, 10);
|
498
|
+
|
499
|
+
vimani.y2[i]+=vimani.speed;
|
500
|
+
|
501
|
+
}else{
|
502
|
+
|
503
|
+
vimani.y2[i] = 990;
|
504
|
+
|
505
|
+
vimani.two = i;
|
506
|
+
|
507
|
+
}
|
508
|
+
|
509
|
+
}
|
510
|
+
|
511
|
+
for(int i=vimani.three+1;i<vimani.y3ic;i++){
|
512
|
+
|
513
|
+
if(vimani.y3[i] <640){
|
514
|
+
|
515
|
+
g.fillRoundRect(290, vimani.y3[i], 30, 20, 5, 10);
|
516
|
+
|
517
|
+
vimani.y3[i]+=vimani.speed;
|
518
|
+
|
519
|
+
}else{
|
520
|
+
|
521
|
+
vimani.y3[i] = 990;
|
522
|
+
|
523
|
+
vimani.three = i;
|
524
|
+
|
525
|
+
}
|
526
|
+
|
527
|
+
}
|
528
|
+
|
529
|
+
for(int i=vimani.four+1;i<vimani.y4ic;i++){
|
530
|
+
|
531
|
+
if(vimani.y4[i] <640){
|
532
|
+
|
533
|
+
g.fillRoundRect(325, vimani.y4[i], 30, 20, 5, 10);
|
534
|
+
|
535
|
+
vimani.y4[i]+=vimani.speed;
|
536
|
+
|
537
|
+
}else{
|
538
|
+
|
539
|
+
vimani.y4[i] = 990;
|
540
|
+
|
541
|
+
vimani.four=i;
|
542
|
+
|
543
|
+
}
|
544
|
+
|
545
|
+
}
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
}
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
public void addObj(){
|
554
|
+
|
555
|
+
}
|
556
|
+
|
557
|
+
}
|
302
558
|
|
303
559
|
|
304
560
|
|