-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from java-women/feature/stage201
確認遅くなりすみません。 気になるところはありましたが、リファクタリングまたは、後日レビューで対応お願いします。
- Loading branch information
Showing
41 changed files
with
465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,5 @@ com_crashlytics_export_strings.xml | |
crashlytics.properties | ||
crashlytics-build.properties | ||
|
||
# Database | ||
db/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
JavajoTeachingForKids/src/main/java/javajo/entity/MapEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package javajo.entity; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
/** | ||
* Mapテーブル用Entityクラス.<br> | ||
* Created by Eriko on 2016/03/24. | ||
*/ | ||
@Entity | ||
@Table(name = "map") | ||
public class MapEntity { | ||
|
||
/** ID(自動採番). */ | ||
@Id | ||
@GeneratedValue | ||
@Column(name = "id") | ||
private Long mId; | ||
|
||
/** Mapデータ. */ | ||
@Column(name = "map_data", length = 2000) | ||
private String mMapData; | ||
|
||
/** 衝突データ */ | ||
@Column(name = "collision_data", length = 2000) | ||
private String mCollisionData; | ||
|
||
/** | ||
* コンストラクタ. | ||
*/ | ||
public MapEntity() { | ||
} | ||
|
||
/** | ||
* Gets map data. | ||
* | ||
* @return the map data | ||
*/ | ||
public String getMapData() { | ||
return mMapData; | ||
} | ||
|
||
/** | ||
* Sets map data. | ||
* | ||
* @param mapData the map data | ||
*/ | ||
public void setMapData(final String mapData) { | ||
this.mMapData = mapData; | ||
} | ||
|
||
/** | ||
* Gets collision data. | ||
* | ||
* @return the collision data | ||
*/ | ||
public String getCollisionData() { | ||
return mCollisionData; | ||
} | ||
|
||
/** | ||
* Sets collision data. | ||
* | ||
* @param collisionData the collision data | ||
*/ | ||
public void setCollisionData(String collisionData) { | ||
mCollisionData = collisionData; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "MapEntity{" + | ||
"mId=" + mId + | ||
", mMapData='" + mMapData + '\'' + | ||
", mCollisionData='" + mCollisionData + '\'' + | ||
'}'; | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
JavajoTeachingForKids/src/main/java/javajo/repository/MapRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package javajo.repository; | ||
|
||
import javajo.entity.MapEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
/** | ||
* MapテーブルにアクセスするRepositoryインタフェース.<br> | ||
* Created by Eriko on 2016/03/24. | ||
*/ | ||
public interface MapRepository extends JpaRepository<MapEntity, Long> { | ||
} |
36 changes: 36 additions & 0 deletions
36
JavajoTeachingForKids/src/main/java/javajo/service/GameService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package javajo.service; | ||
|
||
import javajo.entity.MapEntity; | ||
import javajo.repository.MapRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
/** | ||
* サービスクラス.<br> | ||
* テンプレートHTMLを返す以外の処理(DB処理なと)を行う場合はServiceクラスで行う. | ||
* Created by Eriko on 2016/03/24. | ||
*/ | ||
@Component | ||
public class GameService { | ||
|
||
/** MapRepositoryをDI. */ | ||
@Autowired | ||
private MapRepository mMapRepository; | ||
|
||
/** | ||
* Mapを保存する. | ||
* @param mapEntity MapEntity | ||
*/ | ||
@Transactional(readOnly = false) | ||
public void saveMap(final MapEntity mapEntity) { | ||
|
||
// TODO 衝突データを作成する | ||
|
||
this.mMapRepository.save(mapEntity); | ||
|
||
// TODO 確認用のため完成したら削除する | ||
this.mMapRepository.findAll().forEach(System.out::println); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.07 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+991 Bytes
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+991 Bytes
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.05 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.03 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.14 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.05 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.09 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.12 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.02 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.15 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.17 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.13 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.25 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.23 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.17 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.21 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-23.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.11 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.16 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.18 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-26.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.21 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-27.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.06 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.13 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.2 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.15 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.19 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-7.png
Oops, something went wrong.
Binary file added
BIN
+1.15 KB
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-8.png
Oops, something went wrong.
Binary file added
BIN
+1020 Bytes
JavajoTeachingForKids/src/main/resources/resources/images/map0/map0-9.png
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
JavajoTeachingForKids/src/main/resources/static/css/stage201.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@charset "utf-8"; | ||
|
||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
#enchant-stage { | ||
float: left; | ||
} | ||
|
||
#editor { | ||
float: left !imoirtant; | ||
width: 500px; | ||
margin: 0px 10px; | ||
} | ||
|
||
#map-dropdown-btn { | ||
width: 300px; | ||
} | ||
|
||
#map-selected { | ||
float: left; | ||
} | ||
|
||
ul > li { | ||
float: left; | ||
width: 32%; | ||
border: none; | ||
} | ||
|
||
ul > li:nth-child(3n+2) { | ||
margin: 0 1%; | ||
} |
94 changes: 94 additions & 0 deletions
94
JavajoTeachingForKids/src/main/resources/static/js/stage201.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
enchant(); | ||
|
||
/* 初期値 */ | ||
const WIDTH = 320; | ||
const HEIGHT = 320; | ||
const GRID = 16; | ||
const SCALE = 1.5; | ||
const FPS = 15; | ||
|
||
// 初期マップ作成 | ||
var mapData = new Array(); | ||
var collisionData = new Array(); | ||
for (var i = 0; i < (HEIGHT / GRID); i++){ | ||
mapData[i] = new Array(); | ||
collisionData[i] = new Array(); | ||
for(var j = 0; j < (WIDTH / GRID); j++) { | ||
mapData[i][j] = -1; | ||
collisionData[i][j] = -1; | ||
} | ||
} | ||
|
||
/* マス目の描画 */ | ||
function drawGrid() { | ||
var surface = new Surface(WIDTH, HEIGHT); | ||
surface.context.strokeStyle = "#808080"; | ||
surface.context.beginPath(); | ||
for(i = 1; i <= WIDTH / GRID; i++){ | ||
surface.context.moveTo(i * GRID, 0); | ||
surface.context.lineTo(i * GRID, HEIGHT); | ||
surface.context.stroke(); | ||
surface.context.moveTo(0, i * GRID); | ||
surface.context.lineTo(WIDTH, i * GRID); | ||
surface.context.stroke(); | ||
} | ||
var grid = new Sprite(WIDTH,HEIGHT); | ||
grid.image=surface; | ||
|
||
return grid; | ||
} | ||
|
||
window.onload = function() { | ||
|
||
core = new Core(WIDTH, HEIGHT); | ||
core.scale = SCALE; | ||
core.fps = FPS; | ||
core.preload("chara0.png", "map0.png"); | ||
core.preload("start.png", "gameover.png", "clear.png"); | ||
|
||
core.onload = function() { | ||
core.replaceScene(createGameScene()); | ||
}; | ||
|
||
core.start(); | ||
}; | ||
|
||
/** | ||
* ゲームシーン | ||
*/ | ||
function createGameScene() { | ||
var scene = new Scene(); | ||
|
||
/* フレームリセット */ | ||
core.frame = 0; | ||
|
||
var map = new Map(GRID, GRID); | ||
map.image = core.assets["map0.png"]; | ||
map.loadData(mapData); | ||
map.collisionData = collisionData; | ||
|
||
// タッチイベント定義 | ||
scene.addEventListener("touchend", function(e) { | ||
// 選んだマップ | ||
id = document.getElementById("map-selected").children[0].getAttribute("data-id"); | ||
collision = document.getElementById("map-selected").children[0].getAttribute("data-collision"); | ||
if (id == null) { | ||
alert("マップを選んでね"); | ||
} else { | ||
mapData[Math.floor(e.y / GRID)][Math.floor(e.x / GRID)] = id; | ||
collisionData[Math.floor(e.y / GRID)][Math.floor(e.x / GRID)] = collision; | ||
core.replaceScene(createGameScene()); | ||
} | ||
}); | ||
|
||
var stage = new Group(); | ||
stage.addChild(map); | ||
|
||
// エディタで枠線の表示にチェックされていた場合のみ表示 | ||
if(document.getElementById("grid-checkbox").checked) { | ||
stage.addChild(drawGrid()); | ||
} | ||
scene.addChild(stage); | ||
|
||
return scene; | ||
} |
Oops, something went wrong.