質問編集履歴
1
コードの誤りの部分の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -244,13 +244,57 @@
|
|
244
244
|
|
245
245
|
}
|
246
246
|
|
247
|
-
|
247
|
+
}
|
248
|
+
|
248
|
-
|
249
|
+
```
|
250
|
+
|
251
|
+
```ここに言語を入力
|
252
|
+
|
253
|
+
php
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
$name = $_REQUEST['name'];
|
258
|
+
|
259
|
+
$score = $_REQUEST['score'];
|
260
|
+
|
261
|
+
$screen = $_REQUEST['screen'];
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
print($screen);
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
$sql = "INSERT INTO Score(name, score, screen) VALUES('$name', '$score', 'screen')";
|
270
|
+
|
271
|
+
$result_flag = mysql_query($sql);
|
272
|
+
|
249
|
-
|
273
|
+
//クエリ文の実行
|
274
|
+
|
250
|
-
|
275
|
+
if(!$result_flag)
|
276
|
+
|
251
|
-
|
277
|
+
{
|
278
|
+
|
252
|
-
|
279
|
+
die('INSERTクエリーが失敗しました。'.mysql_error());
|
280
|
+
|
281
|
+
}
|
282
|
+
|
283
|
+
```
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
```ここに言語を入力
|
288
|
+
|
289
|
+
受信部分
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
IEnumerator GetScore()
|
294
|
+
|
295
|
+
{
|
296
|
+
|
253
|
-
WWW result = new WWW(
|
297
|
+
WWW result = new WWW(url);
|
254
298
|
|
255
299
|
yield return result;
|
256
300
|
|
@@ -260,7 +304,7 @@
|
|
260
304
|
|
261
305
|
{
|
262
306
|
|
263
|
-
|
307
|
+
rdbUserGet = new JSONObject(result.text);
|
264
308
|
|
265
309
|
for (int ii = 0; ii < rdbUserGet.Count; ii++)
|
266
310
|
|
@@ -272,11 +316,49 @@
|
|
272
316
|
|
273
317
|
JSONObject jsonScore = jsonPos.GetField("score");
|
274
318
|
|
275
|
-
|
319
|
+
PlayerName = jsonName.str;
|
276
|
-
|
320
|
+
|
277
|
-
|
321
|
+
Score = jsonScore.str;
|
322
|
+
|
278
|
-
|
323
|
+
if (PlayerName == "" || Score == "")
|
324
|
+
|
325
|
+
continue;
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
top = new GameObject("name_" + ii);
|
330
|
+
|
331
|
+
score = new GameObject("score_" + ii);
|
332
|
+
|
333
|
+
GUIText Text = top.AddComponent<GUIText>();
|
334
|
+
|
335
|
+
GUIText Text2 = score.AddComponent<GUIText>();
|
336
|
+
|
337
|
+
Text.fontSize = 20;
|
338
|
+
|
339
|
+
Text2.fontSize = 20;
|
340
|
+
|
341
|
+
Text.text = Rank + ":" + PlayerName;
|
342
|
+
|
343
|
+
Text2.text = Score;
|
344
|
+
|
345
|
+
top.transform.position = new Vector3(0.1f, 0.6f + move, 0);
|
346
|
+
|
347
|
+
score.transform.position = new Vector3(0.5f, 0.6f + move, 0);
|
348
|
+
|
349
|
+
a = top.GetComponent<GUIText>().color;
|
350
|
+
|
351
|
+
a.a = 0.0f;
|
352
|
+
|
353
|
+
top.GetComponent<GUIText>().color = a;
|
354
|
+
|
355
|
+
score.GetComponent<GUIText>().color = a;
|
356
|
+
|
357
|
+
move -= 0.05f;
|
358
|
+
|
359
|
+
Rank += 1;
|
360
|
+
|
279
|
-
Debug.Log("名前:" +
|
361
|
+
Debug.Log("名前:" + PlayerName + "スコア:" + Score);
|
280
362
|
|
281
363
|
}
|
282
364
|
|
@@ -292,236 +374,82 @@
|
|
292
374
|
|
293
375
|
}
|
294
376
|
|
377
|
+
}
|
378
|
+
|
295
|
-
|
379
|
+
```
|
380
|
+
|
381
|
+
|
382
|
+
|
296
|
-
|
383
|
+
```
|
384
|
+
|
385
|
+
|
386
|
+
|
297
|
-
|
387
|
+
php
|
388
|
+
|
389
|
+
|
390
|
+
|
298
|
-
|
391
|
+
$query = "SELECT name, score FROM Score Order by score desc";
|
392
|
+
|
393
|
+
|
394
|
+
|
299
|
-
|
395
|
+
if($result = mysql_query($query))
|
300
|
-
|
396
|
+
|
301
|
-
|
397
|
+
{
|
398
|
+
|
302
|
-
|
399
|
+
$user = array();
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
// 結果をオブジェク形式で出力.
|
404
|
+
|
303
|
-
|
405
|
+
while($row = mysql_fetch_assoc($result))
|
304
|
-
|
406
|
+
|
305
|
-
|
407
|
+
{
|
306
|
-
|
408
|
+
|
307
|
-
|
409
|
+
//print($row['name']);
|
308
|
-
|
410
|
+
|
309
|
-
|
411
|
+
//print($row['score']);
|
310
|
-
|
412
|
+
|
311
|
-
|
413
|
+
//$user[] = array('name'=> $row->name, 'score'=> $row->score);
|
312
|
-
|
414
|
+
|
313
|
-
|
415
|
+
$user[] = $row;
|
416
|
+
|
314
|
-
|
417
|
+
//var_dump($user);
|
418
|
+
|
315
|
-
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
|
316
|
-
|
423
|
+
// 出力結果が空の時は、nullを出し、JSON形式で変換.
|
424
|
+
|
425
|
+
if(empty($user))
|
426
|
+
|
427
|
+
{
|
428
|
+
|
429
|
+
$user = null;
|
430
|
+
|
431
|
+
echo json_encode( $user );
|
432
|
+
|
433
|
+
}
|
434
|
+
|
435
|
+
else
|
436
|
+
|
437
|
+
{
|
438
|
+
|
439
|
+
echo json_encode( $user );
|
440
|
+
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
|
317
|
-
|
445
|
+
// 結果を解放
|
446
|
+
|
447
|
+
//$result->close();
|
318
448
|
|
319
449
|
}
|
320
450
|
|
321
451
|
```
|
322
452
|
|
323
|
-
```ここに言語を入力
|
324
|
-
|
325
|
-
php
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
$name = $_REQUEST['name'];
|
330
|
-
|
331
|
-
$score = $_REQUEST['score'];
|
332
|
-
|
333
|
-
$screen = $_REQUEST['screen'];
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
print($screen);
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
$sql = "INSERT INTO Score(name, score, screen) VALUES('$name', '$score', 'screen')";
|
342
|
-
|
343
|
-
$result_flag = mysql_query($sql);
|
344
|
-
|
345
|
-
//クエリ文の実行
|
346
|
-
|
347
|
-
if(!$result_flag)
|
348
|
-
|
349
|
-
{
|
350
|
-
|
351
|
-
die('INSERTクエリーが失敗しました。'.mysql_error());
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
```
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
```ここに言語を入力
|
360
|
-
|
361
|
-
受信部分
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
IEnumerator GetScore()
|
366
|
-
|
367
|
-
{
|
368
|
-
|
369
|
-
WWW result = new WWW(url);
|
370
|
-
|
371
|
-
yield return result;
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
if (result.error == null)
|
376
|
-
|
377
|
-
{
|
378
|
-
|
379
|
-
rdbUserGet = new JSONObject(result.text);
|
380
|
-
|
381
|
-
for (int ii = 0; ii < rdbUserGet.Count; ii++)
|
382
|
-
|
383
|
-
{
|
384
|
-
|
385
|
-
JSONObject jsonPos = rdbUserGet[ii];
|
386
|
-
|
387
|
-
JSONObject jsonName = jsonPos.GetField("name");
|
388
|
-
|
389
|
-
JSONObject jsonScore = jsonPos.GetField("score");
|
390
|
-
|
391
|
-
PlayerName = jsonName.str;
|
392
|
-
|
393
|
-
Score = jsonScore.str;
|
394
|
-
|
395
|
-
if (PlayerName == "" || Score == "")
|
396
|
-
|
397
|
-
continue;
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
top = new GameObject("name_" + ii);
|
402
|
-
|
403
|
-
score = new GameObject("score_" + ii);
|
404
|
-
|
405
|
-
GUIText Text = top.AddComponent<GUIText>();
|
406
|
-
|
407
|
-
GUIText Text2 = score.AddComponent<GUIText>();
|
408
|
-
|
409
|
-
Text.fontSize = 20;
|
410
|
-
|
411
|
-
Text2.fontSize = 20;
|
412
|
-
|
413
|
-
Text.text = Rank + ":" + PlayerName;
|
414
|
-
|
415
|
-
Text2.text = Score;
|
416
|
-
|
417
|
-
top.transform.position = new Vector3(0.1f, 0.6f + move, 0);
|
418
|
-
|
419
|
-
score.transform.position = new Vector3(0.5f, 0.6f + move, 0);
|
420
|
-
|
421
|
-
a = top.GetComponent<GUIText>().color;
|
422
|
-
|
423
|
-
a.a = 0.0f;
|
424
|
-
|
425
|
-
top.GetComponent<GUIText>().color = a;
|
426
|
-
|
427
|
-
score.GetComponent<GUIText>().color = a;
|
428
|
-
|
429
|
-
move -= 0.05f;
|
430
|
-
|
431
|
-
Rank += 1;
|
432
|
-
|
433
|
-
Debug.Log("名前:" + PlayerName + "スコア:" + Score);
|
434
|
-
|
435
|
-
}
|
436
|
-
|
437
|
-
}
|
438
|
-
|
439
|
-
else
|
440
|
-
|
441
|
-
{
|
442
|
-
|
443
|
-
string error = result.error;
|
444
|
-
|
445
|
-
Debug.LogError("www Error:" + result.error);
|
446
|
-
|
447
|
-
}
|
448
|
-
|
449
|
-
}
|
450
|
-
|
451
|
-
```
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
```
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
php
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
$query = "SELECT name, score FROM Score Order by score desc";
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
if($result = mysql_query($query))
|
468
|
-
|
469
|
-
{
|
470
|
-
|
471
|
-
$user = array();
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
// 結果をオブジェク形式で出力.
|
476
|
-
|
477
|
-
while($row = mysql_fetch_assoc($result))
|
478
|
-
|
479
|
-
{
|
480
|
-
|
481
|
-
//print($row['name']);
|
482
|
-
|
483
|
-
//print($row['score']);
|
484
|
-
|
485
|
-
//$user[] = array('name'=> $row->name, 'score'=> $row->score);
|
486
|
-
|
487
|
-
$user[] = $row;
|
488
|
-
|
489
|
-
//var_dump($user);
|
490
|
-
|
491
|
-
}
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
// 出力結果が空の時は、nullを出し、JSON形式で変換.
|
496
|
-
|
497
|
-
if(empty($user))
|
498
|
-
|
499
|
-
{
|
500
|
-
|
501
|
-
$user = null;
|
502
|
-
|
503
|
-
echo json_encode( $user );
|
504
|
-
|
505
|
-
}
|
506
|
-
|
507
|
-
else
|
508
|
-
|
509
|
-
{
|
510
|
-
|
511
|
-
echo json_encode( $user );
|
512
|
-
|
513
|
-
}
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
// 結果を解放
|
518
|
-
|
519
|
-
//$result->close();
|
520
|
-
|
521
|
-
}
|
522
|
-
|
523
|
-
```
|
524
|
-
|
525
453
|
|
526
454
|
|
527
455
|
###補足情報(言語/FW/ツール等のバージョンなど)
|