diff --git a/RiverCrossingAI/.classpath b/RiverCrossingAI/.classpath new file mode 100644 index 0000000..74d3257 --- /dev/null +++ b/RiverCrossingAI/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/RiverCrossingAI/.project b/RiverCrossingAI/.project new file mode 100644 index 0000000..5114cba --- /dev/null +++ b/RiverCrossingAI/.project @@ -0,0 +1,33 @@ + + + RiverCrossingAI + + + + + + org.eclipse.andmore.ResourceManagerBuilder + + + + + org.eclipse.andmore.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.andmore.ApkBuilder + + + + + + org.eclipse.andmore.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/RiverCrossingAI/.settings/org.eclipse.core.resources.prefs b/RiverCrossingAI/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..4895a38 --- /dev/null +++ b/RiverCrossingAI/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=MS932 diff --git a/RiverCrossingAI/.settings/org.eclipse.jdt.core.prefs b/RiverCrossingAI/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..48ab4c6 --- /dev/null +++ b/RiverCrossingAI/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/RiverCrossingAI/AndroidManifest.xml b/RiverCrossingAI/AndroidManifest.xml new file mode 100644 index 0000000..1037779 --- /dev/null +++ b/RiverCrossingAI/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RiverCrossingAI/RiverCrossingAI.apk b/RiverCrossingAI/RiverCrossingAI.apk new file mode 100644 index 0000000..e9719ef --- /dev/null +++ b/RiverCrossingAI/RiverCrossingAI.apk Binary files differ diff --git a/RiverCrossingAI/assets/bgm/game.ogg b/RiverCrossingAI/assets/bgm/game.ogg new file mode 100644 index 0000000..1ea5e5c --- /dev/null +++ b/RiverCrossingAI/assets/bgm/game.ogg Binary files differ diff --git a/RiverCrossingAI/assets/bgm/howtoplay.ogg b/RiverCrossingAI/assets/bgm/howtoplay.ogg new file mode 100644 index 0000000..14a5aec --- /dev/null +++ b/RiverCrossingAI/assets/bgm/howtoplay.ogg Binary files differ diff --git a/RiverCrossingAI/assets/bgm/title.ogg b/RiverCrossingAI/assets/bgm/title.ogg new file mode 100644 index 0000000..f1ecc00 --- /dev/null +++ b/RiverCrossingAI/assets/bgm/title.ogg Binary files differ diff --git a/RiverCrossingAI/assets/image/back/game.png b/RiverCrossingAI/assets/image/back/game.png new file mode 100644 index 0000000..50ae9b6 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/game.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay1.png b/RiverCrossingAI/assets/image/back/howtoplay1.png new file mode 100644 index 0000000..eb8538a --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay2.png b/RiverCrossingAI/assets/image/back/howtoplay2.png new file mode 100644 index 0000000..a645b90 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay3.png b/RiverCrossingAI/assets/image/back/howtoplay3.png new file mode 100644 index 0000000..ad21185 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay4.png b/RiverCrossingAI/assets/image/back/howtoplay4.png new file mode 100644 index 0000000..67bb51a --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay4.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay5.png b/RiverCrossingAI/assets/image/back/howtoplay5.png new file mode 100644 index 0000000..e0c59b1 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay5.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay6.png b/RiverCrossingAI/assets/image/back/howtoplay6.png new file mode 100644 index 0000000..0eb5428 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay6.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/howtoplay7.png b/RiverCrossingAI/assets/image/back/howtoplay7.png new file mode 100644 index 0000000..3b8c49e --- /dev/null +++ b/RiverCrossingAI/assets/image/back/howtoplay7.png Binary files differ diff --git a/RiverCrossingAI/assets/image/back/title.png b/RiverCrossingAI/assets/image/back/title.png new file mode 100644 index 0000000..5bce5e2 --- /dev/null +++ b/RiverCrossingAI/assets/image/back/title.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/aiThink.png b/RiverCrossingAI/assets/image/game/chara/aiThink.png new file mode 100644 index 0000000..84e2485 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/aiThink.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/ai_miss.png b/RiverCrossingAI/assets/image/game/chara/ai_miss.png new file mode 100644 index 0000000..34a3848 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/ai_miss.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/ai_success.png b/RiverCrossingAI/assets/image/game/chara/ai_success.png new file mode 100644 index 0000000..6223bd0 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/ai_success.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/ai_think1.png b/RiverCrossingAI/assets/image/game/chara/ai_think1.png new file mode 100644 index 0000000..d809d70 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/ai_think1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/apple.png b/RiverCrossingAI/assets/image/game/chara/apple.png new file mode 100644 index 0000000..6529288 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/apple.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/minamiGame.png b/RiverCrossingAI/assets/image/game/chara/minamiGame.png new file mode 100644 index 0000000..8d38339 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/minamiGame.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/minamiGameR.png b/RiverCrossingAI/assets/image/game/chara/minamiGameR.png new file mode 100644 index 0000000..8763fa0 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/minamiGameR.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/minami_clear.png b/RiverCrossingAI/assets/image/game/chara/minami_clear.png new file mode 100644 index 0000000..79a11a6 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/minami_clear.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/minami_game1.png b/RiverCrossingAI/assets/image/game/chara/minami_game1.png new file mode 100644 index 0000000..d598ae2 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/minami_game1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/nanbouGame.png b/RiverCrossingAI/assets/image/game/chara/nanbouGame.png new file mode 100644 index 0000000..8d4d731 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/nanbouGame.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/nanbouGameR.png b/RiverCrossingAI/assets/image/game/chara/nanbouGameR.png new file mode 100644 index 0000000..538cd13 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/nanbouGameR.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/nanbou_clear.png b/RiverCrossingAI/assets/image/game/chara/nanbou_clear.png new file mode 100644 index 0000000..50fc044 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/nanbou_clear.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/nanbou_game1.png b/RiverCrossingAI/assets/image/game/chara/nanbou_game1.png new file mode 100644 index 0000000..0a3643d --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/nanbou_game1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/snakeGame.png b/RiverCrossingAI/assets/image/game/chara/snakeGame.png new file mode 100644 index 0000000..7c66e5c --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/snakeGame.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/snakeGameR.png b/RiverCrossingAI/assets/image/game/chara/snakeGameR.png new file mode 100644 index 0000000..1c1f7e6 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/snakeGameR.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/snake_clear.png b/RiverCrossingAI/assets/image/game/chara/snake_clear.png new file mode 100644 index 0000000..1a7c310 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/snake_clear.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/chara/snake_game1.png b/RiverCrossingAI/assets/image/game/chara/snake_game1.png new file mode 100644 index 0000000..29c6e0a --- /dev/null +++ b/RiverCrossingAI/assets/image/game/chara/snake_game1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/game.png b/RiverCrossingAI/assets/image/game/game.png new file mode 100644 index 0000000..50ae9b6 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/game.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/game2.jpg b/RiverCrossingAI/assets/image/game/game2.jpg new file mode 100644 index 0000000..1f06a10 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/game2.jpg Binary files differ diff --git a/RiverCrossingAI/assets/image/game/screen/fadeMask.png b/RiverCrossingAI/assets/image/game/screen/fadeMask.png new file mode 100644 index 0000000..18fdd21 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/screen/fadeMask.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/screen/miss1.png b/RiverCrossingAI/assets/image/game/screen/miss1.png new file mode 100644 index 0000000..c4c4cd5 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/screen/miss1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/screen/miss2.png b/RiverCrossingAI/assets/image/game/screen/miss2.png new file mode 100644 index 0000000..2231691 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/screen/miss2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/screen/miss3.png b/RiverCrossingAI/assets/image/game/screen/miss3.png new file mode 100644 index 0000000..9997e57 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/screen/miss3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/backtotitle.png b/RiverCrossingAI/assets/image/game/ui/backtotitle.png new file mode 100644 index 0000000..694b323 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/backtotitle.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/boat_l.png b/RiverCrossingAI/assets/image/game/ui/boat_l.png new file mode 100644 index 0000000..4b876ec --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/boat_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/boat_r.png b/RiverCrossingAI/assets/image/game/ui/boat_r.png new file mode 100644 index 0000000..d3d00bd --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/boat_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/clear.png b/RiverCrossingAI/assets/image/game/ui/clear.png new file mode 100644 index 0000000..915dad4 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/clear.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/cross_minbox.png b/RiverCrossingAI/assets/image/game/ui/cross_minbox.png new file mode 100644 index 0000000..3c543e3 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/cross_minbox.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/cross_numbox.png b/RiverCrossingAI/assets/image/game/ui/cross_numbox.png new file mode 100644 index 0000000..d0e6fee --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/cross_numbox.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/cross_off.png b/RiverCrossingAI/assets/image/game/ui/cross_off.png new file mode 100644 index 0000000..a72eb48 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/cross_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/cross_on.png b/RiverCrossingAI/assets/image/game/ui/cross_on.png new file mode 100644 index 0000000..42f1fbb --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/cross_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/numbers.png b/RiverCrossingAI/assets/image/game/ui/numbers.png new file mode 100644 index 0000000..64022a9 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/numbers.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/onemoreplay.png b/RiverCrossingAI/assets/image/game/ui/onemoreplay.png new file mode 100644 index 0000000..eaee350 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/onemoreplay.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_2.png b/RiverCrossingAI/assets/image/game/ui/opposite_2.png new file mode 100644 index 0000000..51890fd --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_3.png b/RiverCrossingAI/assets/image/game/ui/opposite_3.png new file mode 100644 index 0000000..c2ce09b --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_apple_l.png b/RiverCrossingAI/assets/image/game/ui/opposite_apple_l.png new file mode 100644 index 0000000..807a373 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_apple_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_apple_r.png b/RiverCrossingAI/assets/image/game/ui/opposite_apple_r.png new file mode 100644 index 0000000..a26010e --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_apple_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_blank_l.png b/RiverCrossingAI/assets/image/game/ui/opposite_blank_l.png new file mode 100644 index 0000000..ec901f1 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_blank_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_blank_r.png b/RiverCrossingAI/assets/image/game/ui/opposite_blank_r.png new file mode 100644 index 0000000..2c8c77f --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_blank_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_minami_l.png b/RiverCrossingAI/assets/image/game/ui/opposite_minami_l.png new file mode 100644 index 0000000..728c207 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_minami_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_minami_r.png b/RiverCrossingAI/assets/image/game/ui/opposite_minami_r.png new file mode 100644 index 0000000..d153c64 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_minami_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_l.png b/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_l.png new file mode 100644 index 0000000..0b509a9 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_r.png b/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_r.png new file mode 100644 index 0000000..9162137 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_nanbou_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_snake_l.png b/RiverCrossingAI/assets/image/game/ui/opposite_snake_l.png new file mode 100644 index 0000000..cea08d3 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_snake_l.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/opposite_snake_r.png b/RiverCrossingAI/assets/image/game/ui/opposite_snake_r.png new file mode 100644 index 0000000..f9645f3 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/opposite_snake_r.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/perfect.png b/RiverCrossingAI/assets/image/game/ui/perfect.png new file mode 100644 index 0000000..84af587 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/perfect.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/return1.png b/RiverCrossingAI/assets/image/game/ui/return1.png new file mode 100644 index 0000000..59f1880 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/return1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/return2.png b/RiverCrossingAI/assets/image/game/ui/return2.png new file mode 100644 index 0000000..89c4ed6 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/return2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/select.png b/RiverCrossingAI/assets/image/game/ui/select.png new file mode 100644 index 0000000..07e9540 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/select.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s.png b/RiverCrossingAI/assets/image/game/ui/textbox_s.png new file mode 100644 index 0000000..5b4d953 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s0.png b/RiverCrossingAI/assets/image/game/ui/textbox_s0.png new file mode 100644 index 0000000..31e7095 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s0.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s1.png b/RiverCrossingAI/assets/image/game/ui/textbox_s1.png new file mode 100644 index 0000000..a661d2d --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s2.png b/RiverCrossingAI/assets/image/game/ui/textbox_s2.png new file mode 100644 index 0000000..7e4038b --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s3.png b/RiverCrossingAI/assets/image/game/ui/textbox_s3.png new file mode 100644 index 0000000..c3facab --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/game/ui/textbox_s4.png b/RiverCrossingAI/assets/image/game/ui/textbox_s4.png new file mode 100644 index 0000000..df4ab27 --- /dev/null +++ b/RiverCrossingAI/assets/image/game/ui/textbox_s4.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_click.png b/RiverCrossingAI/assets/image/howToPlay/textbox_click.png new file mode 100644 index 0000000..68e1757 --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_click.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_1.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_1.png new file mode 100644 index 0000000..a657556 --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_1.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_2.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_2.png new file mode 100644 index 0000000..cbac787 --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_2.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_3.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_3.png new file mode 100644 index 0000000..2fa66db --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_4.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_4.png new file mode 100644 index 0000000..435b33e --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_4.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_5.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_5.png new file mode 100644 index 0000000..4a6b6fe --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_5.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_6.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_6.png new file mode 100644 index 0000000..c26871e --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_6.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_7.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_7.png new file mode 100644 index 0000000..1c83478 --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_7.png Binary files differ diff --git a/RiverCrossingAI/assets/image/howToPlay/textbox_l_8.png b/RiverCrossingAI/assets/image/howToPlay/textbox_l_8.png new file mode 100644 index 0000000..a155080 --- /dev/null +++ b/RiverCrossingAI/assets/image/howToPlay/textbox_l_8.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_off.png new file mode 100644 index 0000000..7829564 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_on.png new file mode 100644 index 0000000..2c58fdb --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple1_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_off.png new file mode 100644 index 0000000..10f8a6b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_on.png new file mode 100644 index 0000000..5925d7d --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple2_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_off.png new file mode 100644 index 0000000..793fa2b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_on.png new file mode 100644 index 0000000..9a03aae --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_apple3_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_off.png new file mode 100644 index 0000000..e59bc87 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_on.png new file mode 100644 index 0000000..a733d4d --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat2_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_off.png new file mode 100644 index 0000000..f618dbc --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_on.png new file mode 100644 index 0000000..0002678 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat3_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_off.png new file mode 100644 index 0000000..34fc434 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_on.png new file mode 100644 index 0000000..94343aa --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_boat4_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_off.png new file mode 100644 index 0000000..40d19a2 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_on.png new file mode 100644 index 0000000..f512ed8 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami1_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_off.png new file mode 100644 index 0000000..d725203 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_on.png new file mode 100644 index 0000000..ee4335b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami2_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_off.png new file mode 100644 index 0000000..25f5d16 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_on.png new file mode 100644 index 0000000..ff41a7d --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_minami3_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_off.png new file mode 100644 index 0000000..163e549 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_on.png new file mode 100644 index 0000000..65ee863 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou1_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_off.png new file mode 100644 index 0000000..53890d1 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_on.png new file mode 100644 index 0000000..3f10942 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou2_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_off.png new file mode 100644 index 0000000..65d83e2 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_on.png new file mode 100644 index 0000000..6fd0b7c --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_nanbou3_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_off.png new file mode 100644 index 0000000..3b04fcd --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_on.png new file mode 100644 index 0000000..1224527 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake1_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_off.png new file mode 100644 index 0000000..e8e9a62 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_on.png new file mode 100644 index 0000000..28cb5bb --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake2_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_off.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_off.png new file mode 100644 index 0000000..242562c --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_on.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_on.png new file mode 100644 index 0000000..cb857fb --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_snake3_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_start.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_start.png new file mode 100644 index 0000000..21d7b97 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_start.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/ai_title.png b/RiverCrossingAI/assets/image/title/ai/ui/ai_title.png new file mode 100644 index 0000000..751290a --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/ai_title.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/textbox_s.png b/RiverCrossingAI/assets/image/title/ai/ui/textbox_s.png new file mode 100644 index 0000000..5b4d953 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/textbox_s.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/ai/ui/titleExample.png b/RiverCrossingAI/assets/image/title/ai/ui/titleExample.png new file mode 100644 index 0000000..2b1ca80 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/ai/ui/titleExample.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/title.jpg b/RiverCrossingAI/assets/image/title/title.jpg new file mode 100644 index 0000000..f6e2200 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/title.jpg Binary files differ diff --git a/RiverCrossingAI/assets/image/title/titlelogo.png b/RiverCrossingAI/assets/image/title/titlelogo.png new file mode 100644 index 0000000..156f64c --- /dev/null +++ b/RiverCrossingAI/assets/image/title/titlelogo.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/anim/minamiTitle.png b/RiverCrossingAI/assets/image/title/user/anim/minamiTitle.png new file mode 100644 index 0000000..cbf60ed --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/anim/minamiTitle.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/anim/nanbouTitle.png b/RiverCrossingAI/assets/image/title/user/anim/nanbouTitle.png new file mode 100644 index 0000000..783552b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/anim/nanbouTitle.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/anim/snakeTitle.png b/RiverCrossingAI/assets/image/title/user/anim/snakeTitle.png new file mode 100644 index 0000000..613d3b9 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/anim/snakeTitle.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/minami_title4.png b/RiverCrossingAI/assets/image/title/user/minami_title4.png new file mode 100644 index 0000000..d1d1157 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/minami_title4.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/nanbou_title4.png b/RiverCrossingAI/assets/image/title/user/nanbou_title4.png new file mode 100644 index 0000000..5a7b004 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/nanbou_title4.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/snake_title3.png b/RiverCrossingAI/assets/image/title/user/snake_title3.png new file mode 100644 index 0000000..67ce53e --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/snake_title3.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/easy.png b/RiverCrossingAI/assets/image/title/user/ui/easy.png new file mode 100644 index 0000000..a3e390b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/easy.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/hard.png b/RiverCrossingAI/assets/image/title/user/ui/hard.png new file mode 100644 index 0000000..405a70c --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/hard.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/howtoplay.png b/RiverCrossingAI/assets/image/title/user/ui/howtoplay.png new file mode 100644 index 0000000..dfb3d6b --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/howtoplay.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/mute_off.png b/RiverCrossingAI/assets/image/title/user/ui/mute_off.png new file mode 100644 index 0000000..c722b9f --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/mute_off.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/mute_on.png b/RiverCrossingAI/assets/image/title/user/ui/mute_on.png new file mode 100644 index 0000000..46e3977 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/mute_on.png Binary files differ diff --git a/RiverCrossingAI/assets/image/title/user/ui/normal.png b/RiverCrossingAI/assets/image/title/user/ui/normal.png new file mode 100644 index 0000000..17ea934 --- /dev/null +++ b/RiverCrossingAI/assets/image/title/user/ui/normal.png Binary files differ diff --git a/RiverCrossingAI/assets/return.ogg b/RiverCrossingAI/assets/return.ogg new file mode 100644 index 0000000..5958f87 --- /dev/null +++ b/RiverCrossingAI/assets/return.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/ai_miss.ogg b/RiverCrossingAI/assets/se/ai_miss.ogg new file mode 100644 index 0000000..8da3677 --- /dev/null +++ b/RiverCrossingAI/assets/se/ai_miss.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/attention.ogg b/RiverCrossingAI/assets/se/attention.ogg new file mode 100644 index 0000000..a7b6093 --- /dev/null +++ b/RiverCrossingAI/assets/se/attention.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/clear.ogg b/RiverCrossingAI/assets/se/clear.ogg new file mode 100644 index 0000000..3ef503c --- /dev/null +++ b/RiverCrossingAI/assets/se/clear.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/cross.ogg b/RiverCrossingAI/assets/se/cross.ogg new file mode 100644 index 0000000..266b9a3 --- /dev/null +++ b/RiverCrossingAI/assets/se/cross.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/failure.ogg b/RiverCrossingAI/assets/se/failure.ogg new file mode 100644 index 0000000..9c8c395 --- /dev/null +++ b/RiverCrossingAI/assets/se/failure.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/next.ogg b/RiverCrossingAI/assets/se/next.ogg new file mode 100644 index 0000000..d1826a7 --- /dev/null +++ b/RiverCrossingAI/assets/se/next.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/parfect.ogg b/RiverCrossingAI/assets/se/parfect.ogg new file mode 100644 index 0000000..7a7cfba --- /dev/null +++ b/RiverCrossingAI/assets/se/parfect.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/return.ogg b/RiverCrossingAI/assets/se/return.ogg new file mode 100644 index 0000000..5958f87 --- /dev/null +++ b/RiverCrossingAI/assets/se/return.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/ride.ogg b/RiverCrossingAI/assets/se/ride.ogg new file mode 100644 index 0000000..6599c73 --- /dev/null +++ b/RiverCrossingAI/assets/se/ride.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/select.ogg b/RiverCrossingAI/assets/se/select.ogg new file mode 100644 index 0000000..a39915b --- /dev/null +++ b/RiverCrossingAI/assets/se/select.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se/select2.ogg b/RiverCrossingAI/assets/se/select2.ogg new file mode 100644 index 0000000..9370be5 --- /dev/null +++ b/RiverCrossingAI/assets/se/select2.ogg Binary files differ diff --git a/RiverCrossingAI/assets/se1.ogg b/RiverCrossingAI/assets/se1.ogg new file mode 100644 index 0000000..11e96df --- /dev/null +++ b/RiverCrossingAI/assets/se1.ogg Binary files differ diff --git a/RiverCrossingAI/bin/AndroidManifest.xml b/RiverCrossingAI/bin/AndroidManifest.xml new file mode 100644 index 0000000..1037779 --- /dev/null +++ b/RiverCrossingAI/bin/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RiverCrossingAI/bin/classes/.gitignore b/RiverCrossingAI/bin/classes/.gitignore new file mode 100644 index 0000000..0740bc2 --- /dev/null +++ b/RiverCrossingAI/bin/classes/.gitignore @@ -0,0 +1,2 @@ +/library/ +/sample/ diff --git a/RiverCrossingAI/bin/jarlist.cache b/RiverCrossingAI/bin/jarlist.cache new file mode 100644 index 0000000..0565465 --- /dev/null +++ b/RiverCrossingAI/bin/jarlist.cache @@ -0,0 +1,3 @@ +# cache for current jar dependency. DO NOT EDIT. +# format is +# Encoding is UTF-8 diff --git a/RiverCrossingAI/gen/.gitignore b/RiverCrossingAI/gen/.gitignore new file mode 100644 index 0000000..b239d45 --- /dev/null +++ b/RiverCrossingAI/gen/.gitignore @@ -0,0 +1 @@ +/library/ diff --git a/RiverCrossingAI/ic_launcher-web.png b/RiverCrossingAI/ic_launcher-web.png new file mode 100644 index 0000000..a18cbb4 --- /dev/null +++ b/RiverCrossingAI/ic_launcher-web.png Binary files differ diff --git a/RiverCrossingAI/libs/android-support-v4.jar b/RiverCrossingAI/libs/android-support-v4.jar new file mode 100644 index 0000000..e74b0d7 --- /dev/null +++ b/RiverCrossingAI/libs/android-support-v4.jar Binary files differ diff --git a/RiverCrossingAI/proguard-project.txt b/RiverCrossingAI/proguard-project.txt new file mode 100644 index 0000000..b60ae7e --- /dev/null +++ b/RiverCrossingAI/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/RiverCrossingAI/project.properties b/RiverCrossingAI/project.properties new file mode 100644 index 0000000..6e18427 --- /dev/null +++ b/RiverCrossingAI/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-21 diff --git a/RiverCrossingAI/res/drawable-hdpi/ic_launcher.png b/RiverCrossingAI/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..288b665 --- /dev/null +++ b/RiverCrossingAI/res/drawable-hdpi/ic_launcher.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-hdpi/test.png b/RiverCrossingAI/res/drawable-hdpi/test.png new file mode 100644 index 0000000..52d8cfc --- /dev/null +++ b/RiverCrossingAI/res/drawable-hdpi/test.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-mdpi/ic_launcher.png b/RiverCrossingAI/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..6ae570b --- /dev/null +++ b/RiverCrossingAI/res/drawable-mdpi/ic_launcher.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-mdpi/test.png b/RiverCrossingAI/res/drawable-mdpi/test.png new file mode 100644 index 0000000..52d8cfc --- /dev/null +++ b/RiverCrossingAI/res/drawable-mdpi/test.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-xhdpi/ic_launcher.png b/RiverCrossingAI/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..d4fb7cd --- /dev/null +++ b/RiverCrossingAI/res/drawable-xhdpi/ic_launcher.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-xhdpi/test.png b/RiverCrossingAI/res/drawable-xhdpi/test.png new file mode 100644 index 0000000..52d8cfc --- /dev/null +++ b/RiverCrossingAI/res/drawable-xhdpi/test.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-xxhdpi/ic_launcher.png b/RiverCrossingAI/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..85a6081 --- /dev/null +++ b/RiverCrossingAI/res/drawable-xxhdpi/ic_launcher.png Binary files differ diff --git a/RiverCrossingAI/res/drawable-xxhdpi/test.png b/RiverCrossingAI/res/drawable-xxhdpi/test.png new file mode 100644 index 0000000..52d8cfc --- /dev/null +++ b/RiverCrossingAI/res/drawable-xxhdpi/test.png Binary files differ diff --git a/RiverCrossingAI/res/layout/activity_main.xml b/RiverCrossingAI/res/layout/activity_main.xml new file mode 100644 index 0000000..3064d4c --- /dev/null +++ b/RiverCrossingAI/res/layout/activity_main.xml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/RiverCrossingAI/res/menu/main.xml b/RiverCrossingAI/res/menu/main.xml new file mode 100644 index 0000000..316f52b --- /dev/null +++ b/RiverCrossingAI/res/menu/main.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/RiverCrossingAI/res/values-v11/styles.xml b/RiverCrossingAI/res/values-v11/styles.xml new file mode 100644 index 0000000..ffc9637 --- /dev/null +++ b/RiverCrossingAI/res/values-v11/styles.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/RiverCrossingAI/res/values-v14/styles.xml b/RiverCrossingAI/res/values-v14/styles.xml new file mode 100644 index 0000000..c0446ab --- /dev/null +++ b/RiverCrossingAI/res/values-v14/styles.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/RiverCrossingAI/res/values-w820dp/dimens.xml b/RiverCrossingAI/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..a22cf11 --- /dev/null +++ b/RiverCrossingAI/res/values-w820dp/dimens.xml @@ -0,0 +1,10 @@ + + + + 64dp + + diff --git a/RiverCrossingAI/res/values/dimens.xml b/RiverCrossingAI/res/values/dimens.xml new file mode 100644 index 0000000..2e0e2ae --- /dev/null +++ b/RiverCrossingAI/res/values/dimens.xml @@ -0,0 +1,7 @@ + + + + 16dp + 16dp + + diff --git a/RiverCrossingAI/res/values/strings.xml b/RiverCrossingAI/res/values/strings.xml new file mode 100644 index 0000000..1bb8228 --- /dev/null +++ b/RiverCrossingAI/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + RiverCrossingAI + Hello world! + Settings + + diff --git a/RiverCrossingAI/res/values/styles.xml b/RiverCrossingAI/res/values/styles.xml new file mode 100644 index 0000000..35406fa --- /dev/null +++ b/RiverCrossingAI/res/values/styles.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/RiverCrossingAI/src/library/core/debug/CoreLog.java b/RiverCrossingAI/src/library/core/debug/CoreLog.java new file mode 100644 index 0000000..938bf92 --- /dev/null +++ b/RiverCrossingAI/src/library/core/debug/CoreLog.java @@ -0,0 +1,49 @@ +package library.core.debug; + +import android.util.Log; + +/** + * ���O�p + * @author �M�T + * + */ +public class CoreLog { + + + public static void debugSimple(String s){ + Log.d("debug1", s); + } + + public static void debugSimple(String s,int index){ + Log.d("debug"+index, s); + } + + public static void debug(String s){ + Log.d("debug1", s+getInfo()); + } + + public static void debug(String s,int index){ + Log.d("debug"+index, s+getInfo()); + } + + public static void error(String s){ + Log.e("debug1", s+getInfo()); + } + + public static void error(String s,int index){ + Log.e("debug"+index, s+getInfo()); + } + + + private static String getInfo(){ + StackTraceElement[] e=Thread.currentThread().getStackTrace(); + + + return " < "+ e[4].getClassName()+" (line:"+e[4].getLineNumber()+") >"; + } + + + + + +} diff --git a/RiverCrossingAI/src/library/core/listener/OnCoreCollisionListener.java b/RiverCrossingAI/src/library/core/listener/OnCoreCollisionListener.java new file mode 100644 index 0000000..fbdff25 --- /dev/null +++ b/RiverCrossingAI/src/library/core/listener/OnCoreCollisionListener.java @@ -0,0 +1,30 @@ +package library.core.listener; + +import library.core.model.CoreModel; + +/** + * �l�����͊O�����牽�������������ƍl����@�i�󂯐g�̍l���j + * @author �M�T + * + */ +public interface OnCoreCollisionListener { + + /** + * ����model�ɂ���model���Փ˂��� + * @param model + */ + public abstract void onCollisionEnter(CoreModel model); + + /** + * ����model�ɂ���model���Փ˂��Ă��� + * @param model + */ + public abstract void onCollisionIn(CoreModel model); + + /** + * ����model�ɂ���model���Փ˂��Ă����̂ɉ������ɂ����� + * @param model + */ + public abstract void onCollisionOut(CoreModel model); + +} diff --git a/RiverCrossingAI/src/library/core/listener/OnCoreTouchDownListener.java b/RiverCrossingAI/src/library/core/listener/OnCoreTouchDownListener.java new file mode 100644 index 0000000..2282ecf --- /dev/null +++ b/RiverCrossingAI/src/library/core/listener/OnCoreTouchDownListener.java @@ -0,0 +1,7 @@ +package library.core.listener; + +public interface OnCoreTouchDownListener { + + + public abstract void onTouchDown(); +} diff --git a/RiverCrossingAI/src/library/core/listener/OnCoreTouchUpListener.java b/RiverCrossingAI/src/library/core/listener/OnCoreTouchUpListener.java new file mode 100644 index 0000000..e80067f --- /dev/null +++ b/RiverCrossingAI/src/library/core/listener/OnCoreTouchUpListener.java @@ -0,0 +1,8 @@ +package library.core.listener; + +public interface OnCoreTouchUpListener { + + + public abstract void onTouchUp(); + +} diff --git a/RiverCrossingAI/src/library/core/mainAI/CoreActivity.java b/RiverCrossingAI/src/library/core/mainAI/CoreActivity.java new file mode 100644 index 0000000..02e5eab --- /dev/null +++ b/RiverCrossingAI/src/library/core/mainAI/CoreActivity.java @@ -0,0 +1,204 @@ +package library.core.mainAI; + +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import library.core.debug.CoreLog; +import library.core.mainAI.R; +import library.core.object.CoreObjectFactory; +import library.core.object.CoreTextObjectFactory; +import library.core.screen.CoreScreen; +import android.app.Activity; +import android.media.AudioManager; +import android.os.Bundle; +import android.os.PowerManager; +import android.os.PowerManager.WakeLock; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.view.Window; +import android.view.WindowManager; + +public abstract class CoreActivity extends Activity implements Runnable,OnTouchListener{ + + + private ScheduledThreadPoolExecutor schedule = new ScheduledThreadPoolExecutor(1); + + private long time=0; + + public CoreObjectFactory objectFactory; //�I�u�W�F�N�g�̍쐬�p + public CoreTextObjectFactory textObjectFactory; + + private WakeLock wakeLock; + + protected CoreScreen screen; + + protected abstract void update(float deltaTime); + /** + * ���g�Ŏ�������^�b�`�C�x���g���� + * @param event + */ + protected abstract void touch(MotionEvent event); + /** + * �r�d�̃��[�h�͂��炩���ߍs��Ȃ��Ƃ����Ȃ� + */ + protected abstract void loadSe(); + + /** + * �X�N���[���̃��[�h�I�����ɌĂ΂��@���ꂪ�Ă΂ꂽ�ォ��ł����Ascreen���琳�m�ȉ�ʃT�C�Y���Ƃ�Ȃ� + */ + protected abstract void screenLoadEnd(); + + /** + * screenLoadEnd()�𒊏ۃN���X�ɂ��Ă�����O������ĂԂ��߂̃N�b�V���� + * @author �M�T + * + */ + public class ScreenLoadEndRecieve{ + public void sendLoadEnd(){ + + if(!RiverCrossingAI.screenLoad){ + RiverCrossingAI.screenLoad=true; + time=System.currentTimeMillis(); + screenLoadEnd(); + } + } + } + + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + + setContentView(R.layout.activity_main); + + + CoreLog.debug("coreActivity create"); + + setVolumeControlStream(AudioManager.STREAM_MUSIC); + + RiverCrossingAI.setContext(this); + + this.loadSe(); + + this.screen=(CoreScreen)findViewById(R.id.surfaceView); + this.screen.setOnTouchListener(this); + this.screen.setLoadEndRecieve(new ScreenLoadEndRecieve()); + + this.objectFactory=new CoreObjectFactory(screen); + this.textObjectFactory=new CoreTextObjectFactory(screen); + + schedule.scheduleWithFixedDelay(this, 0, 1, TimeUnit.MILLISECONDS); + + //�������[�̐��� + objectFactory.deleteAll(); + textObjectFactory.deleteAll(); + RiverCrossingAI.getImagePool().cleanDatas(); + + + + } + + + + //�X�V���� + @Override + public void run() { + + if(screen.isInitEnd() && RiverCrossingAI.getSePlayer().isLoadEnd()){ + + float difTime=System.currentTimeMillis()-time; + time=System.currentTimeMillis(); + + float deltaTime= (difTime/1000.0f); + + if(deltaTime>1){ + deltaTime=0.1f; + } + + update(deltaTime); + screen.checkCollision(); + screen.draw(); //�`��֘A + } + } + + @Override + public boolean onTouch(View v, MotionEvent event) { + + if(!RiverCrossingAI.isCanTouch()) return false; + + if(event.getAction()==MotionEvent.ACTION_UP){ + this.screen.checkTouchUp(event.getX(),event.getY()); + }else if(event.getAction()==MotionEvent.ACTION_DOWN){ + this.screen.checkTouchDown(event.getX(), event.getY()); + } + + this.touch(event); + + return false; + } + + + @Override + protected void onResume() { + super.onResume(); + + + if(schedule==null){ + schedule = new ScheduledThreadPoolExecutor(1); + schedule.scheduleWithFixedDelay(this, 0, 1, TimeUnit.MILLISECONDS); + } + RiverCrossingAI.getBgmPlayer().play(); + this.loadSe(); + + if(wakeLock!=null){ + wakeLock.acquire(); + }else{ + PowerManager pm = (PowerManager)getSystemService(POWER_SERVICE); + wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "tag"); + wakeLock.acquire(); + } + + } + + @Override + protected void onPause() { + super.onPause(); + RiverCrossingAI.getImagePool().cleanDatas(); + RiverCrossingAI.getBgmPlayer().pause(); + RiverCrossingAI.getSePlayer().release(); + schedule.shutdown(); + schedule=null; + + wakeLock.release(); + } + + + + + + /** + * �߂�{�^���̕��� + */ + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + if (event.getAction()==KeyEvent.ACTION_DOWN) { + switch (event.getKeyCode()) { + case KeyEvent.KEYCODE_BACK: + // �_�C�A���O�\���ȂǓ���̏������s�������ꍇ�͂����ɋL�q + // �e�N���X��dispatchKeyEvent()���Ăяo������true��Ԃ� + return true; + } + } + return super.dispatchKeyEvent(event); + } + + + +} diff --git a/RiverCrossingAI/src/library/core/mainAI/RiverCrossingAI.java b/RiverCrossingAI/src/library/core/mainAI/RiverCrossingAI.java new file mode 100644 index 0000000..b009814 --- /dev/null +++ b/RiverCrossingAI/src/library/core/mainAI/RiverCrossingAI.java @@ -0,0 +1,144 @@ +package library.core.mainAI; + +import library.core.debug.CoreLog; +import library.core.music.CoreBgmPlayer; +import library.core.music.CoreSePlayer; +import library.core.system.CoreImagePool; +import android.app.Application; +import android.content.Context; +import android.content.res.Configuration; + +public class RiverCrossingAI extends Application{ + + + private static CoreImagePool imagePool; + private static CoreSePlayer sePlayer; + private static CoreBgmPlayer bgmPlayer; + + public static boolean screenLoad; + + private static boolean isCanTouch=true; + + private static Context context; + + /** + *�A�v���P�[�V�����쐬�� + */ + @Override + public void onCreate(){ + CoreLog.debug("create Application"); + /*imagePool=new CoreImagePool(getApplicationContext()); + sePlayer=new CoreSePlayer(getApplicationContext()); + bgmPlayer=new CoreBgmPlayer(getApplicationContext());*/ + + //CoreApplication.context=getApplicationContext(); + + screenLoad=false; + } + + + public static void setContext(Context context){ + RiverCrossingAI.context=context; + } + + + /** + * �A�v���P�[�V�����I���� + */ + @Override + public void onTerminate(){ + CoreLog.debug("delete Application"); + if(sePlayer!=null){ + sePlayer.release(); + } + + } + + + /** + * �������[�ቺ�� + */ + @Override + public void onLowMemory(){ + CoreLog.debug("low memory"); + if(imagePool!=null){ + imagePool.cleanDatas(); + } + } + + + /** + * �I���G���e�[�V�����̕ύX�Ȃ� + */ + @Override + public void onConfigurationChanged(Configuration newConfig) { + CoreLog.debug("configuration Change"); + } + + + /** + * �A�N�e�B�r�e�B�[�̕ύX���ɌĂ� + */ + public static void changeActivity(){ + if(sePlayer!=null){ + sePlayer.release(); + } + if(imagePool!=null){ + imagePool.cleanDatas(); + } + screenLoad=false; + } + + + /** + * �^�b�`�C�x���g���L�����ǂ��� + * @return + */ + public static boolean isCanTouch() { + return isCanTouch; + } + + + /** + * �^�b�`�C�x���g�̗L���ݒ� + * @param is + */ + public static void setCanTouch(boolean is) { + isCanTouch = is; + } + + + + public static CoreImagePool getImagePool() { + + if(imagePool==null){ + imagePool=new CoreImagePool(context); + } + + return imagePool; + } + + + + public static CoreSePlayer getSePlayer() { + if(sePlayer==null){ + sePlayer=new CoreSePlayer(context); + } + + return sePlayer; + } + + + + public static CoreBgmPlayer getBgmPlayer() { + if(bgmPlayer==null){ + bgmPlayer=new CoreBgmPlayer(context); + } + + return bgmPlayer; + } + + + + +} diff --git a/RiverCrossingAI/src/library/core/model/CoreAnimation.java b/RiverCrossingAI/src/library/core/model/CoreAnimation.java new file mode 100644 index 0000000..bf35d5d --- /dev/null +++ b/RiverCrossingAI/src/library/core/model/CoreAnimation.java @@ -0,0 +1,199 @@ +package library.core.model; + +import java.util.ArrayList; + +import library.core.system.CoreImageData; + +/** + * �A�j���[�V�����f�[�^ + * @author �M�T + * + */ +public class CoreAnimation implements Cloneable{ + + private String animationName; + + private ArrayList animations; //�摜�f�[�^ + private ArrayList animationIndexs; //���ԃf�[�^ + private float speed=1f; + private boolean isLoop=false; + + private int index; //���Ԗڂ�animationIndex���g�p���Ă��邩 + private int nextAnimationIndex=-1; //���̕ʂ̃A�j���[�V������ID + + private CoreAnimationModel palent; + + private float time=0; + + private boolean endAnim=false; //�A�j���[�V�������I�����Ă��邩�ǂ��� + + + + /** + * ���̃A�j���[�V���������܂��Ă��Ȃ��z�p + * @param name�@�@�@���ʗp�̖��O�@endAnimation(CoreAnimationModel)�ȂǂŎg�������Ƃ��ɐݒ肷�邽�߁A�Ȃ�ł��悢 + * @param animations + * @param indexs + * @param speed + * @param isLoop + */ + public CoreAnimation(String name,ArrayList animations,ArrayList indexs,float speed,boolean isLoop){ + this.animations=animations; + this.animationIndexs=indexs; + this.speed=speed; + this.isLoop=isLoop; + + this.animationName=name; + + index=0; + } + + /** + * ���̃A�j���[�V���������܂��Ă���z�p + * @param name�@�@���ʗp�̖��O�@endAnimation(CoreAnimationModel)�ȂǂŎg�������Ƃ��ɐݒ肷�邽�߁A�Ȃ�ł��悢 + * @param animations + * @param indexs + * @param speed + * @param isLoop + * @param nextAnimId + */ + public CoreAnimation(String name,ArrayList animations,ArrayList indexs,float speed,boolean isLoop,int nextAnimId){ + this.animations=animations; + this.animationIndexs=indexs; + this.speed=speed; + this.isLoop=isLoop; + + this.animationName=name; + + index=0; + this.nextAnimationIndex=nextAnimId; + } + + @Override + public CoreAnimation clone(){ + CoreAnimation c=null; + + try { + c=(CoreAnimation)super.clone(); + c.animations=new ArrayList(); + for(int i=0;i(); + for(int i=0;i=speed){ + time=0; + index++; + if(index>animationIndexs.size()-1){ + + if(isLoop){ + index=0; + }else{ + endAnim=true; //���[�v���Ȃ��ꍇ�̓A�j���[�V�����̏I������ + + + //�A�j���[�V���������[�v���Ȃ����̃A�j���[�V����������ꍇ�͕ύX + if(nextAnimationIndex!=-1){ + palent.changeAnimation(nextAnimationIndex); + }else{ + index-=1; + } + } + } + } + + } + + + /** + * ���������p�@�icoreAnimationModel�̏��������ɌĂ΂��j + * @param palent + */ + public void setPalent(CoreAnimationModel palent){ + this.palent=palent; + } + + /** + * �摜�f�[�^�̎擾 + */ + public CoreImageData getImage(){ + return this.animations.get(animationIndexs.get(index)); + } + + + + public boolean isLoop() { + return isLoop; + } + + public void setLoop(boolean isLoop) { + this.isLoop = isLoop; + } + + public int getNextAnimationIndex() { + return nextAnimationIndex; + } + + public void setNextAnimationIndex(int nextAnimationIndex) { + this.nextAnimationIndex = nextAnimationIndex; + } + + public String getAnimationName() { + return animationName; + } + + public void setAnimationName(String animationName) { + this.animationName = animationName; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + + + + + +} diff --git a/RiverCrossingAI/src/library/core/model/CoreAnimationModel.java b/RiverCrossingAI/src/library/core/model/CoreAnimationModel.java new file mode 100644 index 0000000..da84349 --- /dev/null +++ b/RiverCrossingAI/src/library/core/model/CoreAnimationModel.java @@ -0,0 +1,100 @@ +package library.core.model; + +import java.util.ArrayList; + +public abstract class CoreAnimationModel extends CoreModel implements Cloneable{ + + + private ArrayList animations; //�����‚��̃A�j���[�V�����f�[�^���܂܂��@�P�‚̏ꍇ������ + + private CoreAnimation targetAnim; + + private long time=0; + + /** + * + * @param animations �A�j���[�V������� + * @param startTargetAnimIndex ���߂ɍs���A�j���[�V���� + * @param centerX + * @param centerY + * @param width + * @param height + */ + public CoreAnimationModel(ArrayList animations,int startTargetAnimIndex,float centerX, + float centerY, float width, float height) { + super(animations.get(startTargetAnimIndex).getImage(), centerX, centerY, width, height); + + this.animations=animations; + + this.targetAnim=animations.get(startTargetAnimIndex); + + + for(int i=0;i(); + for(int i=0;i seDatas; + + private SoundPool soundPool; + private Context context; + + private boolean isMute=false; + + public CoreSePlayer(Context context){ + this.isLoadEnd=true; + this.context=context; + init(); + + } + + private void init(){ + soundPool=new SoundPool(size, AudioManager.STREAM_MUSIC, 0); + soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() { + + @Override + public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { + CoreLog.debugSimple("se load OK"+sampleId+"/"+status); + + if(sampleId>=dataSize-1){ + isLoadEnd=true; + } + } + }); + } + + + public void load(ArrayList datas){ + + this.isLoadEnd=false; + + AssetManager asset=context.getAssets(); + + //�r�d�p�f�[�^�̏����� + if(this.seDatas!=null) this.seDatas.clear(); + this.seDatas=new ArrayList(); + + init(); + + dataSize=datas.size(); + + for(int i=0;i createObjects; + + public CoreObjectFactory(CoreScreen screen){ + this.screen=screen; + this.createObjects=new ArrayList(); + } + + public CoreObject create(CoreModel model,CoreView view){ + + CoreObject object=new CoreObject(model, view); + screen.addView(view); + + this.createObjects.add(object); + + return object; + } + + /** + * �I�u�W�F�N�g�폜 + * @param object + */ + public void delete(CoreObject object){ + this.screen.deleteView(object.getView()); + this.createObjects.remove(object); + object=null; + } + + public void deleteAll(){ + int objectSize=createObjects.size(); + + //���Ԃ񂱂�őS�������� + for(int i=objectSize-1;i>-1;i--){ + this.delete(createObjects.get(i)); + } + } + + /** + * �I�u�W�F�N�g�̍폜�@�i���f���f�[�^����ɍ폜�j + * @param model + */ + public void delete(CoreModel model){ + CoreObject o=null; + + for(int i=0;i createObjects; + + public CoreTextObjectFactory(CoreScreen screen){ + this.screen=screen; + this.createObjects=new ArrayList(); + } + + public CoreTextObject create(CoreTextModel model,CoreTextView view){ + + CoreTextObject object=new CoreTextObject(model, view); + screen.addTextView(view); + + this.createObjects.add(object); + + return object; + } + + /** + * �I�u�W�F�N�g�폜 + * @param object + */ + public void delete(CoreTextObject object){ + this.screen.deleteTextView(object.getView()); + this.createObjects.remove(object); + object=null; + } + + public void deleteAll(){ + int objectSize=createObjects.size(); + + //���Ԃ񂱂�őS�������� + for(int i=objectSize-1;i>-1;i--){ + this.delete(createObjects.get(i)); + } + } + + /** + * �I�u�W�F�N�g�̍폜�@�i���f���f�[�^����ɍ폜�j + * @param model + */ + public void delete(CoreTextModel model){ + CoreTextObject o=null; + + for(int i=0;i views; + private ArrayList colViews; + private ArrayList touchUpViews; + private ArrayList touchDownViews; + private ArrayList textViews; + + private int screenWidthBase=720; + private int screenHeightBase=1280; + + private boolean isInitEnd=false; //�������I���̔���@���ꂪtrue�łȂ��Ɖ�ʃT�C�Y�Ȃǂ��擾�ł��Ȃ� + + private ScreenLoadEndRecieve loadEndRecieve; + + public CoreScreen(Context context, AttributeSet attrs) { + super(context,attrs); + + getHolder().addCallback(this); + + views=new ArrayList(); + colViews=new ArrayList(); + touchUpViews=new ArrayList(); + touchDownViews=new ArrayList(); + textViews=new ArrayList(); + } + + public void setLoadEndRecieve(ScreenLoadEndRecieve recieve){ + this.loadEndRecieve=recieve; + } + + + + @Override + public void surfaceDestroyed(SurfaceHolder holder) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + @Override + public void surfaceCreated(SurfaceHolder holder) { + + } + + @Override + public void surfaceChanged(SurfaceHolder h, int format, int width, + int height) { + + isInitEnd=true; + loadEndRecieve.sendLoadEnd(); + } + + + + /** + * �`�� + * @param pool + */ + public void draw(){ + + + SurfaceHolder holder=getHolder(); + + if(!isInitEnd) return; + if(!holder.getSurface().isValid()) return ; + + Canvas canvas=null; + + try{ + canvas=holder.lockCanvas(); + canvas.drawColor(Color.BLACK); + + for(CoreView v : views){ + v.draw(canvas, getWidth()/(float)screenWidthBase, getHeight()/(float)screenHeightBase); + } + + //�����̕\�� + for(int i=0;i() { + @Override + public int compare(CoreView lhs, CoreView rhs) { + return lhs.getPriority()() { + @Override + public int compare(CoreView lhs, CoreView rhs) { + return lhs.getPriority() imageDatas){ + + + AssetManager assetManager=context.getResources().getAssets(); + InputStream input=null; + + try{ + input=assetManager.open(data.getFileName()); + }catch(IOException e){ + Log.e("error","not find "+data.getFileName()+" file"); + } + + Bitmap bmp=null; + + int x=data.getPointX(); + int y=data.getPointY(); + int w=data.getSpritW(); + int h=data.getSpritH(); + + //�摜���y�����鏈���@�d���Ȃ�����l���� + /*BitmapFactory.Options o=new Options(); + o.inPreferredConfig=Config.ARGB_4444; + o.inPurgeable=true; +*/ + + if(data.isSpriteImage()){ + //bmp= Bitmap.createBitmap(BitmapFactory.decodeStream(input, null, o),x*w, y*h, w, h); + bmp= Bitmap.createBitmap(BitmapFactory.decodeStream(input),x*w, y*h, w, h); + }else{ + //bmp= BitmapFactory.decodeStream(input,null,o); + bmp= BitmapFactory.decodeStream(input); + } + + + + imageDatas.put(data.getFileName()+"["+x+","+y+"]",bmp); + + return bmp; + + } + +} + diff --git a/RiverCrossingAI/src/library/core/system/CoreImagePool.java b/RiverCrossingAI/src/library/core/system/CoreImagePool.java new file mode 100644 index 0000000..89595d6 --- /dev/null +++ b/RiverCrossingAI/src/library/core/system/CoreImagePool.java @@ -0,0 +1,56 @@ +package library.core.system; + +import java.util.HashMap; + +import android.content.Context; +import android.graphics.Bitmap; + + +/** + * �S�摜�̕ۑ��p�N���X + * @author �M�T + * + */ +public class CoreImagePool { + + + + private HashMap imageDatas; + private CoreImageFactory factory; + + + public CoreImagePool(Context context){ + imageDatas=new HashMap(); + factory=new CoreImageFactory(context); + } + + + /** + * + * @param fileName + * @param splitX + * @param splitY + * @return + */ + public Bitmap getBitmap(CoreImageData data){ + Bitmap bmp=imageDatas.get(data.getFileName()+"["+data.getPointX()+","+data.getPointY()+"]"); + + + if(bmp==null){ + bmp = factory.load(data,imageDatas); + } + + return bmp; + } + + + /** + * bitmap�f�[�^����ɂ��� + * ��ʑJ�ڂ⃁�����[�̒ቺ���Ɏg�p + */ + public void cleanDatas(){ + this.imageDatas.clear(); + } + + +} diff --git a/RiverCrossingAI/src/library/core/view/CoreTextView.java b/RiverCrossingAI/src/library/core/view/CoreTextView.java new file mode 100644 index 0000000..10f3b16 --- /dev/null +++ b/RiverCrossingAI/src/library/core/view/CoreTextView.java @@ -0,0 +1,69 @@ +package library.core.view; + +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.RectF; +import android.graphics.Paint.Align; +import android.graphics.Paint.FontMetrics; +import library.core.model.CoreTextModel; +import library.core.model.CoreTextModel.TEXT_TYPE; + +public class CoreTextView { + + private CoreTextModel model; + + public CoreTextView(CoreTextModel model){ + this.model=model; + } + + public void draw(Canvas canvas){ + Paint p=new Paint(); + p.setAntiAlias(true); + p.setColor(Color.BLACK); + p.setTextSize(model.getSize()); + + FontMetrics fontMetrics=p.getFontMetrics(); + + float textW=p.measureText(model.getText()); //�������̎擾 + + float tx=0; + float ty=0; + float bx=0; + float by=0; + + TEXT_TYPE type=model.getType(); + + if(type==TEXT_TYPE.CENTER){ + p.setTextAlign(Align.CENTER); + }else if(type==TEXT_TYPE.LEFT){ + p.setTextAlign(Align.LEFT); + }else if(type==TEXT_TYPE.RIGHT){ + p.setTextAlign(Align.RIGHT); + } + + //�e�L�X�g�w�i�p�̌v�Z + tx=model.getCenterX()-textW*0.5f-5; + ty=model.getCenterY()-(fontMetrics.bottom-fontMetrics.top)*0.65f-5; + bx=model.getCenterX()+textW*0.5f+5; + by=model.getCenterY()+(fontMetrics.bottom-fontMetrics.top)*0.35f+5; + + Paint bp=new Paint(); + bp.setAntiAlias(true); + bp.setTextSize(model.getSize()); + bp.setColor(Color.GRAY); + bp.setTextAlign(Align.CENTER); + RectF r=new RectF(tx+4,ty+4,bx+4,by+4); + canvas.drawRoundRect(r, 5, 5, bp); + + bp.setColor(Color.LTGRAY); + r=new RectF(tx,ty,bx,by); + canvas.drawRoundRect(r, 5, 5, bp); + canvas.drawText(model.getText(), model.getCenterX(), model.getCenterY(),p); + } + + + public void setModel(CoreTextModel model){ + this.model=model; + } +} diff --git a/RiverCrossingAI/src/library/core/view/CoreView.java b/RiverCrossingAI/src/library/core/view/CoreView.java new file mode 100644 index 0000000..c5cd64a --- /dev/null +++ b/RiverCrossingAI/src/library/core/view/CoreView.java @@ -0,0 +1,249 @@ +package library.core.view; + +import java.util.ArrayList; + +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.Rect; + +public class CoreView implements Cloneable{ + + private ArrayList hitViews; //���̃r���[�Ƀq�b�g���Ă������ + private CoreModel model; + + private int priority=0; //�傫���قǗD��x�������A�\�ɕ\������� + + private Paint p; + + /** + * @param model + * @param priority �`��D��x�@�傫���قǗD��x�������A�\�ɕ\������� + */ + public CoreView(CoreModel model,int priority){ + this.model=model; + this.priority=priority; + + hitViews=new ArrayList(); + p=new Paint(); + } + + + public CoreView clone(){ + CoreView v=null; + + try { + v=(CoreView)super.clone(); + v.model=model.clone(); + } catch (CloneNotSupportedException e) { + // TODO �����������ꂽ catch �u���b�N + e.printStackTrace(); + } + + return v; + + + } + + + /** + * �^�b�`���� + * @param x + * @param y + * @return + */ + public boolean isTouch(float x,float y){ + + //���������Ȃ�I�[�o�[���C�h���ď����̕ύX������ + if(!model.isShowView()) return false; //��\���̏ꍇ�̓{�^���̔���͍s��Ȃ�(�Փ˔���͍s��) + + + float centerX=model.getCenterX(); + float centerY=model.getCenterY(); + float width=model.getWidth(); + float height=model.getHeight(); + + float tx=centerX-width*0.5f; + float ty=centerY-height*0.5f; + float bx=centerX+width*0.5f; + float by=centerY+height*0.5f; + + if(x>=tx&& x<=bx){ + + if(y>=ty && y<=by){ + return true; + } + } + + return false; + + } + + + + + + /** + * �Փ˔��� + * @param c + */ + public boolean checkCollision(CoreView cview){ + + CoreModel c=cview.getModel(); + float tx=model.getCenterX()-model.getWidth()*0.5f; + float ty=model.getCenterY()-model.getHeight()*0.5f; + float bx=model.getCenterX()+model.getWidth()*0.5f; + float by=model.getCenterY()+model.getHeight()*0.5f; + + float tx2=c.getCenterX()-c.getWidth()*0.5f; + float ty2=c.getCenterY()-c.getHeight()*0.5f; + float bx2=c.getCenterX()+c.getWidth()*0.5f; + float by2=c.getCenterY()+c.getHeight()*0.5f; + + + + if((tx<=tx2 && bx>=tx2)){ + if((ty<=ty2 && by>=ty2) || (ty<=by2 && by>=by2 )){ + return true; + } + }else if((tx<=bx2 && bx>=bx2)){ + if((ty<=ty2 && by>=ty2) || (ty<=by2 && by>=by2 )){ + return true; + } + } + + return false; + + } + + /** + * �Փ˂����r���[�̓o�^ + * @param view + */ + public void hitOtherView(CoreView view){ + if(this.hitViews.indexOf(view)==-1){ + this.hitViews.add(view); + } + } + + /** + * �Փ˃`�F�b�N + * @param view + * @return + */ + public boolean isHitView(CoreView view){ + + if(this.hitViews.indexOf(view)==-1){ + return false; + } + + return true; + } + + /** + * �o�^�폜 + * @param view + */ + public void outOtherView(CoreView view){ + this.hitViews.remove(view); + } + + + + + + + + /** + * �`�揈�� + * @param canvas + * @param pool + * @param widthRate + * @param heightRate + */ + public void draw(Canvas canvas,float widthRate,float heightRate){ + + if(!model.isShowView()) return; + + model.drawUpdate(); + + Bitmap bmp=RiverCrossingAI.getImagePool().getBitmap(model.getImageData()); + + + + float x=model.getCenterX()*widthRate; + float y=model.getCenterY()*heightRate; + float w=model.getWidth()*widthRate; + float h=model.getHeight()*heightRate; + float r=model.getRotation(); + + + int tx=(int)((x-w*0.5f)); + int ty=(int)((y-h*0.5f)); + int bx=(int)((x+w*0.5f)); + int by=(int)((y+h*0.5f)); + + Rect src=new Rect(0,0,bmp.getWidth(),bmp.getHeight()); + Rect dst=new Rect(tx,ty,bx,by); + + if(p==null) p=new Paint(); //�N���[���p + + + if(model.isChangeAlpha()){ //���񂱂�����Əd���� + + if(model.getAlpha()==255){ //�s�����ɖ߂����ꍇ�͂��Ƃ̏����ɖ߂� + model.setChangeAlpha(false); + } + + p.setAlpha(model.getAlpha()); //�A���t�@�[�̕ύX + + canvas.save(); + if(r!=0){ + canvas.rotate(r,(bx-tx)*0.5f+tx,(by-ty)*0.5f+ty); + canvas.drawBitmap(bmp, src, dst, p); + }else{ + canvas.drawBitmap(bmp, src, dst, p); + } + canvas.restore(); + + }else{ + + canvas.save(); + if(r!=0){ + canvas.rotate(r,(bx-tx)*0.5f+tx,(by-ty)*0.5f+ty); + canvas.drawBitmap(bmp, src, dst, null); + }else{ + canvas.drawBitmap(bmp, src, dst, null); + } + canvas.restore(); + + } + + + } + + + public CoreModel getModel() { + return model; + } + + + public void setModel(CoreModel model) { + this.model = model; + } + + public int getPriority() { + return priority; + } + + + public void setPriority(int priority) { + this.priority = priority; + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/ai/AiSystem.java b/RiverCrossingAI/src/sample/game/ai/AiSystem.java new file mode 100644 index 0000000..8699691 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/ai/AiSystem.java @@ -0,0 +1,20 @@ +package sample.game.ai; + + +public abstract class AiSystem { + + + protected Memory targetMemory; + + public abstract void update(float delataTime); + + public abstract void callGameOver(); + + + public Memory getAiMemory(){ + return this.targetMemory; + } + + public abstract void changeAiMoveCharaSpeed(); + public abstract int getMoveSpeed(); +} diff --git a/RiverCrossingAI/src/sample/game/ai/AiSystemType1.java b/RiverCrossingAI/src/sample/game/ai/AiSystemType1.java new file mode 100644 index 0000000..8931eff --- /dev/null +++ b/RiverCrossingAI/src/sample/game/ai/AiSystemType1.java @@ -0,0 +1,638 @@ +package sample.game.ai; + +import java.util.ArrayList; + +import library.core.debug.CoreLog; +import sample.game.controller.GameController; +import sample.game.manager.EndIsland; +import sample.game.manager.Island; +import sample.game.manager.StartIsland; +import sample.game.model.BoatModel; +import sample.game.model.CharaModel; + +public class AiSystemType1 extends AiSystem{ + + + + + + + private boolean nowMovePhase; + private boolean nowStartIsland; + private boolean nowSleepPhase; + private boolean endTurnFlag=false; //�����I�Ƀ^�[������シ�� + private float time=0; + private float targetX=0; // + private float targetY=0; // + + + private GameController gameController; + private StartIsland startIsland; + private EndIsland endIsland; + private BoatModel boat; + + + + private int moveMinisterNum=0; + private int moveWolfNum=0; + private int moveCabbageNum=0; + private int moveCattleNum=0; + + //��‘O�̈ړ���� + private int bifmoveMinisterNum=0; + private int bifmoveWolfNum=0; + private int bifmoveCabbageNum=0; + private int bifmoveCattleNum=0; + + private boolean marginTimeSwitch=true; + private boolean thinkFlag=false; + private boolean isStopUpdate; + + + private float moveSpeed=1f; + + + public AiSystemType1(GameController g,BoatModel b,StartIsland startIsland,EndIsland eIsland) { + + nowStartIsland=true; + nowMovePhase=false; + nowSleepPhase=false; + endTurnFlag=false; + + marginTimeSwitch=true; + + this.boat=b; + this.gameController=g; + this.startIsland=startIsland; + this.endIsland=eIsland; + + targetMemory=gameController.getMoveData(); + + + + time=0; + + this.isStopUpdate=false; + + + thinkInit(); + + } + + /** + * �ăX�^�[�g�p + * @param memory + * @param g + * @param b + * @param startIsland + * @param eIsland + * @param layout + */ + public AiSystemType1(Memory memory, GameController g,BoatModel b,StartIsland startIsland,EndIsland eIsland) { + + nowStartIsland=startIsland.getNowTurn(); + nowMovePhase=false; + nowSleepPhase=false; + endTurnFlag=false; + + this.boat=b; + this.gameController=g; + this.startIsland=startIsland; + this.endIsland=eIsland; + + targetMemory=memory; + + marginTimeSwitch=true; + this.isStopUpdate=false; + thinkInit(); + + + + } + + + + @Override + public void update(float deltaTime) { + + if(isStopUpdate) return; + + if(nowSleepPhase){ //�x�e�t�F�C�Y + + //�x�e�I������ + if(!gameController.isNowTurnChangePhase()){ + CoreLog.debug("start AI"); + nowSleepPhase=false; + nowMovePhase=false; + endTurnFlag=false; + + //startNextTurn�̏I�����Ƀ������[�̍X�V���s���Ă��邽�߂����ł�����L���b�` +/* targetMemory=gameController.getMoveData(); + CoreLog.debug("start isLand"); + CoreLog.debug("ministersNum :"+targetMemory.getStartIsland().getMinisters().size()); + CoreLog.debug("wolfsNum :"+targetMemory.getStartIsland().getWolfs().size()); + CoreLog.debug("cabbagesNum :"+targetMemory.getStartIsland().getCabbages().size()); + CoreLog.debug("cattlesNum :"+targetMemory.getStartIsland().getCattles().size()); + CoreLog.debug(" //"); + CoreLog.debug("end isLand"); + CoreLog.debug("ministersNum :"+targetMemory.getEndIsland().getMinisters().size()); + CoreLog.debug("wolfsNum :"+targetMemory.getEndIsland().getWolfs().size()); + CoreLog.debug("cabbagesNum :"+targetMemory.getEndIsland().getCabbages().size()); + CoreLog.debug("cattlesNum :"+targetMemory.getEndIsland().getCattles().size()); + CoreLog.debug(" //"); + CoreLog.debug("nowStartIsland :"+targetMemory.getStartIsland().getNowTurn());*/ + + + thinkInit(); + CoreLog.debug("end thinkInit AI"); + time=0; + } + + return ; + } + + time+=deltaTime*moveSpeed; + + + + if(time>=0.1f){ + time=0; + + //�����҂��Ă��珈�������Ȃ��Ɖ��o�������Ȃ����߈�莞�ԊԊu�ŏ����𕪂��� + if(marginTimeSwitch){ + marginTimeSwitch=!marginTimeSwitch; + thinkFlag=think(); + CoreLog.debug("end think AI"); + }else{ + marginTimeSwitch=!marginTimeSwitch; + if(thinkFlag){ + if(endTurnFlag ||gameController.checkNextTurn()){ + gameController.changeTurn(false); + nowStartIsland=!nowStartIsland; + nowSleepPhase=true; + CoreLog.debug(" turn change"); + }else{ + //�v�l�𑱍s + nowMovePhase=false; + } + }else{ + //�D�ɏ悹��L�������Ȃ��ꍇ + gameController.changeTurn(false); + nowStartIsland=!nowStartIsland; + nowSleepPhase=true; + } + } + + } + + + + + } + + + /** + * �v�l���� + */ + private void thinkInit(){ + /* CoreLog.debug("start thinkInit"); + CoreLog.debug("deep: "+targetMemory.getDeepNumber()); + CoreLog.debug("id: "+targetMemory.getId()); + CoreLog.debug("next num: "+targetMemory.getNextMemorys().size()); +*/ + + CoreLog.debugSimple("start thinkInit",2); + CoreLog.debugSimple("deep :"+targetMemory.getDeepNumber(),2); + CoreLog.debugSimple("id :"+targetMemory.getId(),2); + + + targetMemory.setData(startIsland.clone(), endIsland.clone(), boat.clone()); + + + //�������[�v�΍� + if(targetMemory.getBifMemory()!=null){ + Memory m=targetMemory.getBifMemory(); + for(int i=0;i0){ + + CoreLog.debugSimple("size :"+targetMemory.getNextMemorys().size(),2); + CoreLog.debugSimple("------------------------------------",2); + + targetMemory=gameController.changeMemoryAndRemoveBifNextRoot(); + CoreLog.debugSimple(""+targetMemory.getMinisterMoveNum()); + CoreLog.debugSimple(""+targetMemory.getWolfMoveNum()); + CoreLog.debugSimple(""+targetMemory.getCabbageMoveNum()); + CoreLog.debugSimple(""+targetMemory.getCattleMoveNum()); + CoreLog.debugSimple("---------------------"); + + }else{ + + //���߂̃^�[���ȊO��startIsland�̃^�[���ł���A���‚��ׂẴL�����������ɂ���ꍇ�͎~�߂� + if( targetMemory.getBifMemory()!=null && nowStartIsland){ + if(endIsland.getMinisters().size()==0 && endIsland.getWolfs().size()==0 && + endIsland.getCabbages().size()==0 && endIsland.getCattles().size()==0){ + CoreLog.debug("return start state"); +// gameController.setNowTurnChangePhase(true); + this.thinkRestartProcess(false); + return; + } + + } + + + + + + //���̈ړ��̉”\���𔻒� + //�܂��͖q�t����l�������ꍇ �q�t����l�ȊO�ňړ����Ă����Ȃ��l�ŁA�������݂Ɉړ�����”\�������� + if(targetMemory.getBifMemory()!=null){ //��ԏ��߂̏ꍇ�͍l���ɓ���Ȃ� + if(targetMemory.getMinisterMoveNum()>1 || + (targetMemory.getWolfMoveNum()>0 || targetMemory.getCabbageMoveNum()>0 || targetMemory.getCattleMoveNum()>0 ) ){ + targetMemory.addNextMemorys(new Memory(targetMemory, startIsland.clone(), endIsland.clone(), + boat.clone(),1, 0 ,0, 0)); + CoreLog.debug("add only miniser"); + } + } + + //�q�t����l�ňړ�����ȊO�̈ړ� + thinkNextMove(is, boat.getRideMaxMenberNum()-1, + 1, 0, 0, 0); + + CoreLog.debugSimple("size :"+targetMemory.getNextMemorys().size(),2); + CoreLog.debugSimple("------------------------------------",2); + + //�{�[�g�ɏ悹��l���̑������ɂ��邽�߂ɂ����ă\�[�g + //Collections.reverse(targetMemory.getNextMemorys()); + + + if(targetMemory.getNextMemorys().size()>0){ + targetMemory=gameController.changeMemoryAndRemoveBifNextRoot(); + }else{ +// gameController.setNowTurnChangePhase(true); + CoreLog.debug("0 desu"); + this.thinkRestartProcess(false); + return; + } + + } + + CoreLog.debug("3"); + //�ړ��L�^���̏����� + + //CoreLog.debug(""+moveMinisterNum+"/"+moveWolfNum+"/"+moveCabbageNum+"/"+moveCattleNum); + + bifmoveMinisterNum=moveMinisterNum; + bifmoveWolfNum=moveWolfNum; + bifmoveCabbageNum=moveCabbageNum; + bifmoveCattleNum=moveCattleNum; + + moveMinisterNum=0; + moveWolfNum=0; + moveCabbageNum=0; + moveCattleNum=0; + + + } + + + private void thinkNextMove(Island is, int rideNum,int mMoveNum,int wMoveNum,int cabMoveNum,int catMoveNum){ + + if(rideNum>0){ + + int ministerNum=is.getMinisters().size()-mMoveNum; + int wolfNum=is.getWolfs().size()-wMoveNum; + int cabbageNum=is.getCabbages().size()-cabMoveNum; + int cattleNum=is.getCattles().size()-catMoveNum; + + + if(ministerNum>1){ + + //�q�t�𓮂����ꍇ + thinkNextMoveSubProcess(is, rideNum, mMoveNum+1, wMoveNum, cabMoveNum, catMoveNum); + CoreLog.debug("add m1"); + + if(cattleNum>0){ + CoreLog.debug("add cat1"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum, catMoveNum+1); + } + + if(wolfNum>0){ + CoreLog.debug("add w1"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum+1, cabMoveNum, catMoveNum); + } + + if(cabbageNum>0){ + CoreLog.debug("add cab1"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum+1, catMoveNum); + } + + + + }else if(ministerNum==1){ + + + if((cattleNum>0 && wolfNum==0 &&cabbageNum==0) || (cabbageNum>0 && cattleNum==0) || + (wolfNum>0 && cattleNum==0)){ + thinkNextMoveSubProcess(is, rideNum, mMoveNum+1, wMoveNum, cabMoveNum, catMoveNum); + CoreLog.debug("add m2"); + } + + if(cattleNum>0){ + CoreLog.debug("add cat2"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum, catMoveNum+1); + } + + if(wolfNum>0){ + CoreLog.debug("add w2"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum+1, cabMoveNum, catMoveNum); + } + + if(cabbageNum>0){ + CoreLog.debug("add cab2"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum+1, catMoveNum); + } + + }else{ + //�q�t����l�����Ȃ��ꍇ + + + + if((cattleNum>0)){ + CoreLog.debug("add cat3"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum, catMoveNum+1); + } + + if((wolfNum>0 )){ + CoreLog.debug("add w3"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum+1, cabMoveNum, catMoveNum); + } + + if((cabbageNum>0)){ + CoreLog.debug("add cab3"); + thinkNextMoveSubProcess(is, rideNum, mMoveNum, wMoveNum, cabMoveNum+1, catMoveNum); + } + + } + + } + } + + /** + * thinkNextMove�̋��ʏ��������𒊏o + * @param is + * @param rideNum + * @param mMoveNum + * @param wMoveNum + * @param cabMoveNum + * @param catMoveNum + */ + private void thinkNextMoveSubProcess(Island is, int rideNum,int mMoveNum,int wMoveNum,int cabMoveNum,int catMoveNum){ + + targetMemory.addNextMemorys(new Memory(targetMemory, startIsland.clone(), endIsland.clone(), + boat.clone(),mMoveNum, wMoveNum ,cabMoveNum, catMoveNum)); + + thinkNextMove(is, rideNum-1, mMoveNum, wMoveNum, cabMoveNum, catMoveNum); + } + + + /** + * �v�l + * @return + */ + private boolean think(){ + + + Island is=null; + + if(nowStartIsland){ + is=startIsland; + }else{ + is=endIsland; + + + } + + //�����ł�targetMemory�͈ړ���̃������[�ł���A�ǂ�����Ă����Ɉړ����邩�̏��������Ă��� + + + //�ړ�������̂ƁA�ړ����Ă������̂������ɂȂ�̂�h�� + if(targetMemory.getMinisterMoveNum()==bifmoveMinisterNum && + targetMemory.getWolfMoveNum()==bifmoveWolfNum && + targetMemory.getCabbageMoveNum()==bifmoveCabbageNum && + targetMemory.getCattleMoveNum()==bifmoveCattleNum && + targetMemory.getBifMemory()!=null){ + if(targetMemory.getNextMemorys().size()>1){ + for(int i=1;imoveMinisterNum){ + + ArrayList c=is.getMinisters(); + + moveMinisterNum++; + for(int i=0;imoveWolfNum){ + ArrayList c=is.getWolfs(); + + moveWolfNum++; + for(int i=0;imoveCabbageNum){ + ArrayList c=is.getCabbages(); + + moveCabbageNum++; + for(int i=0;imoveCattleNum){ + ArrayList c=is.getCattles(); + + moveCattleNum++; + for(int i=0;i1){ + + + /*Memory a=targetMemory.getNextMemorys().get(0); + targetMemory.removeNextmemorys(0); + targetMemory=a;*/ + break; + } + + + + } + + CoreLog.debugSimple("[return :"+count+"]",2); + CoreLog.debug("back Turn ="+count); + + + + gameController.returnGameTurn(count,nowTurnChange); + //gameController.reStart(targetMemory.getStartIsland(), targetMemory.getEndIsland(), targetMemory.getBoat(),targetMemory.getLayout()); + + + + + } + + + @Override + public void changeAiMoveCharaSpeed(){ + + } + + @Override + public int getMoveSpeed(){ + return 1; + } + + + + + + + + +} diff --git a/RiverCrossingAI/src/sample/game/ai/Memory.java b/RiverCrossingAI/src/sample/game/ai/Memory.java new file mode 100644 index 0000000..f43af36 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/ai/Memory.java @@ -0,0 +1,144 @@ +package sample.game.ai; + +import java.util.ArrayList; + +import sample.game.manager.EndIsland; +import sample.game.manager.StartIsland; +import sample.game.model.BoatModel; + +public class Memory { + + //���߂ɂ����̏����m�肳���� + private StartIsland startIsland; + private EndIsland endIsland; + private BoatModel boat; + + + //�ǂ�����Ă����̗v�f�ɗ�������\�� + private int ministerMoveNum=0; + private int wolfMoveNum=0; + private int cabbageMoveNum=0; + private int cattleMoveNum=0; + + private ArrayList nextMemorys; + private Memory bifMemory; + + private int deepNumber=0; //�[�������� + private int id=0; + + + public Memory(Memory bif,StartIsland s,EndIsland e,BoatModel b, + int mNum,int wNum,int cabNum,int catNum){ + this.startIsland=s; + this.endIsland=e; + this.boat=b; + + this.bifMemory=bif; + + this.ministerMoveNum=mNum; + this.wolfMoveNum=wNum; + this.cabbageMoveNum=cabNum; + this.cattleMoveNum=catNum; + + this.nextMemorys=new ArrayList(); + + if(bif!=null){ + this.deepNumber=bif.getDeepNumber()+1; + }else{ + deepNumber=0; + } + } + + /** + * ���p���ɕK�v�ȃf�[�^���ăZ�b�g�@ + * �iAI�ł�nextMemory�ւ̒lj��̃^�C�~���O�̖��ł����̂S�‚̃f�[�^ + * ��ʂ��؂�ւ�������_�ōăZ�b�g����K�v������j + * @param s + * @param e + * @param b + * @param layout + */ + public void setData(StartIsland s,EndIsland e,BoatModel b){ + this.startIsland=s; + this.endIsland=e; + this.boat=b; + } + + + public int getDeepNumber(){ + return this.deepNumber; + } + + public int getId(){ + return this.id; + } + + public void setId(int d){ + this.id=d; + } + + + + public StartIsland getStartIsland() { + return startIsland; + } + + + + public EndIsland getEndIsland() { + return endIsland; + } + + + public BoatModel getBoat() { + return boat; + } + + + + public int getMinisterMoveNum() { + return ministerMoveNum; + } + + + + public int getWolfMoveNum() { + return wolfMoveNum; + } + + + + public int getCabbageMoveNum() { + return cabbageMoveNum; + } + + + + public int getCattleMoveNum() { + + return cattleMoveNum; + } + + public Memory getBifMemory(){ + return bifMemory; + } + + + public void addNextMemorys(Memory ai){ + this.nextMemorys.add(ai); + ai.setId(this.nextMemorys.size()); + } + + + + public ArrayList getNextMemorys(){ + return nextMemorys; + } + + + public void removeNextmemorys(int index){ + this.nextMemorys.remove(index); + } + + +} diff --git a/RiverCrossingAI/src/sample/game/builder/GameBuilder.java b/RiverCrossingAI/src/sample/game/builder/GameBuilder.java new file mode 100644 index 0000000..19d9ebe --- /dev/null +++ b/RiverCrossingAI/src/sample/game/builder/GameBuilder.java @@ -0,0 +1,956 @@ +package sample.game.builder; + +import java.util.ArrayList; + +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreAnimation; +import library.core.model.CoreModel; +import library.core.object.CoreObjectFactory; +import library.core.system.CoreImageData; +import library.core.view.CoreView; +import sample.game.ai.Memory; +import sample.game.controller.GameController; +import sample.game.main.MainActivity; +import sample.game.manager.EndIsland; +import sample.game.manager.Island; +import sample.game.manager.LayoutManager; +import sample.game.manager.StartIsland; +import sample.game.model.AiChara; +import sample.game.model.BackToTitleButton; +import sample.game.model.BoatModel; +import sample.game.model.ButtonNextTurn; +import sample.game.model.CharaModel; +import sample.game.model.CharaModel.TARGET_TYPE; +import sample.game.model.CrossButton; +import sample.game.model.ExampleBox; +import sample.game.model.NumBox; +import sample.game.model.OnemorePlayButton; +import sample.game.model.OppositeIcon; + +public class GameBuilder { + + + private CoreObjectFactory objectFactory; + private StartIsland island; + private EndIsland endIsland; + private BoatModel boat; + private ButtonNextTurn buttonNextTurn; + private LayoutManager layoutManager; + + private static final float CHARA_ANIM_SPEED=0.2f; + + private GameController gameController; + + + public GameBuilder(MainActivity activity,CoreObjectFactory objectFactory,int boatSize){ + + gameController=new GameController(true); + + this.objectFactory=objectFactory; + this.layoutManager=new LayoutManager(true, boatSize); + + createEndIsLand(); + createStartIsLand(); + createBoat(boatSize); + createUI(); + + gameController.init(activity, island, endIsland, buttonNextTurn, boat, layoutManager); + + } + + + /** + * �Đ����p + * @param activity + * @param gameScreen + * @param sIsland + * @param eIsland + * @param boat + * @param layoutManager + */ + public GameBuilder(MainActivity activity,CoreObjectFactory objectFactory, + StartIsland sIsland,EndIsland eIsland,BoatModel boat){ + + gameController=new GameController(false); + this.layoutManager=new LayoutManager(true, boat.getRideMaxMenberNum()); + + this.objectFactory=objectFactory; + this.layoutManager=new LayoutManager(sIsland.getNowTurn(),boat.getRideMaxMenberNum()); + + + this.island=sIsland; + this.endIsland=eIsland; + + //�{�[�g���Đ��� + this.boat=boat; + this.reCreateBoat(boat); + + this.createUI(); + + gameController.init(activity, island, endIsland, buttonNextTurn, boat, layoutManager); + + } + + + + public GameController build(boolean isUseAi,int ministerNum ,int wolfNum,int cabbageNum,int cattleNum){ + + addBackImage(); + + for(int i=0;i charas=is.getMinisters(); + for(int i=0;i anims=new ArrayList(); + ArrayList anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/aiThink.png",0,0,256,256)); + anim1.add(new CoreImageData("image/game/chara/aiThink.png",1,0,256,256)); + anim1.add(new CoreImageData("image/game/chara/aiThink.png",2,0,256,256)); + + ArrayList anim1Index=new ArrayList(); + anim1Index.add(1); + anim1Index.add(0); + anim1Index.add(1); + anim1Index.add(2); + anims.add(new CoreAnimation("aiThink", anim1,anim1Index, 0.4f, true)); + + anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/ai_miss.png")); + anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("aiMiss", anim1, anim1Index, 0.4f, false)); + + anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/ai_success.png")); + anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("aiMiss", anim1, anim1Index, 0.4f, false)); + + AiChara aiChara=new AiChara(anims, 0, 540, 620, 256, 256); + objectFactory.create(aiChara, new CoreView(aiChara, 8)); + gameController.setAiChara(aiChara); + + } + + + public void addAiUi(){ + CoreModel returnBack=new CoreModel(new CoreImageData("image/game/ui/return1.png"), + 640, 360, 1280, 720); + returnBack.setShowView(false); + objectFactory.create(returnBack, new CoreView(returnBack, 7)); + gameController.setReturnBackScreen(returnBack); + + CoreModel returnIcon=new CoreModel(new CoreImageData("image/game/ui/return2.png"), + 640, 360, 200, 100); + returnIcon.setShowView(false); + objectFactory.create(returnIcon, new CoreView(returnIcon, 8)); + gameController.setReturnIcon(returnIcon); + } + + + /** + * �q�t�lj� + */ + public void addMaster(){ + + + ArrayList anims=new ArrayList(); + ArrayList anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/minami_game1.png")); + + ArrayList anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("minamiClear", anim1,anim1Index, 0.4f, false)); + + + ArrayList anim2=new ArrayList(); + anim2.add(new CoreImageData("image/game/chara/minamiGame.png",0,0,144,144)); + anim2.add(new CoreImageData("image/game/chara/minamiGame.png",1,0,144,144)); + anim2.add(new CoreImageData("image/game/chara/minamiGame.png",2,0,144,144)); + + ArrayList anim2Index=new ArrayList(); + anim2Index.add(1); + anim2Index.add(0); + anim2Index.add(1); + anim2Index.add(2); + + anims.add(new CoreAnimation("minamiLeft", anim2,anim2Index, CHARA_ANIM_SPEED, true)); + + + ArrayList anim3=new ArrayList(); + anim3.add(new CoreImageData("image/game/chara/minamiGameR.png",0,0,144,144)); + anim3.add(new CoreImageData("image/game/chara/minamiGameR.png",1,0,144,144)); + anim3.add(new CoreImageData("image/game/chara/minamiGameR.png",2,0,144,144)); + + ArrayList anim3Index=new ArrayList(); + anim3Index.add(1); + anim3Index.add(0); + anim3Index.add(1); + anim3Index.add(2); + + anims.add(new CoreAnimation("minamiRight", anim3,anim3Index, CHARA_ANIM_SPEED, true)); + + + ArrayList anim4=new ArrayList(); + anim4.add(new CoreImageData("image/game/chara/minami_clear.png")); + + ArrayList anim4Index=new ArrayList(); + anim4Index.add(0); + anims.add(new CoreAnimation("minamiClear", anim4,anim4Index, 0.4f, false)); + + + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.MINISTART, + anims, 0, 0, 0, 144, 144); + objectFactory.create(chara, new CoreView(chara, 3)); + + island.addCharacter(chara); + layoutManager.addRight(chara,true); + gameController.addAllCharacter(chara); +/* + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.MINISTART, + new CoreImageData("image/konanC1.png"),1000, 100, 100,100); + this.objectFactory.create(chara,new CoreView(chara, 2)); + + island.addCharacter(chara); + layoutManager.addRight(chara);*/ + } + + /** + * �I�I�J�~�lj� + */ + public void addWolf(){ + + + ArrayList anims=new ArrayList(); + ArrayList anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/snake_game1.png")); + + ArrayList anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("snakeClear", anim1,anim1Index, 0.4f, false)); + + + ArrayList anim2=new ArrayList(); + anim2.add(new CoreImageData("image/game/chara/snakeGame.png",0,0,144,144)); + anim2.add(new CoreImageData("image/game/chara/snakeGame.png",1,0,144,144)); + + ArrayList anim2Index=new ArrayList(); + anim2Index.add(0); + anim2Index.add(1); + + + anims.add(new CoreAnimation("snakeLeft", anim2,anim2Index,CHARA_ANIM_SPEED, true)); + + + ArrayList anim3=new ArrayList(); + anim3.add(new CoreImageData("image/game/chara/snakeGameR.png",0,0,144,144)); + anim3.add(new CoreImageData("image/game/chara/snakeGameR.png",1,0,144,144)); + + ArrayList anim3Index=new ArrayList(); + anim3Index.add(0); + anim3Index.add(1); + + anims.add(new CoreAnimation("snakeRight", anim3,anim3Index,CHARA_ANIM_SPEED, true)); + + + ArrayList anim4=new ArrayList(); + anim4.add(new CoreImageData("image/game/chara/snake_clear.png")); + + ArrayList anim4Index=new ArrayList(); + anim4Index.add(0); + anims.add(new CoreAnimation("snakeClear", anim4,anim4Index, 0.4f, false)); + + + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.WOLF, + anims, 0, 0, 0, 144, 144); + objectFactory.create(chara, new CoreView(chara, 3)); + + island.addCharacter(chara); + layoutManager.addRight(chara,true); + gameController.addAllCharacter(chara); + +/* CharaModel chara=new CharaModel(gameController, TARGET_TYPE.WOLF, + new CoreImageData("image/wolf.jpg"), 1000,250, 100,100); + this.objectFactory.create(chara,new CoreView(chara, 2)); + + island.addCharacter(chara); + layoutManager.addRight(chara);*/ + } + + /** + * ���lj� + */ + public void addCattle(){ + + + ArrayList anims=new ArrayList(); + ArrayList anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/nanbou_game1.png")); + + ArrayList anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("nanbouClear", anim1,anim1Index, 0.4f, false)); + + + ArrayList anim2=new ArrayList(); + anim2.add(new CoreImageData("image/game/chara/nanbouGame.png",0,0,144,144)); + anim2.add(new CoreImageData("image/game/chara/nanbouGame.png",1,0,144,144)); + anim2.add(new CoreImageData("image/game/chara/nanbouGame.png",2,0,144,144)); + + ArrayList anim2Index=new ArrayList(); + anim2Index.add(1); + anim2Index.add(0); + anim2Index.add(1); + anim2Index.add(2); + + anims.add(new CoreAnimation("nanbouLeft", anim2,anim2Index,CHARA_ANIM_SPEED, true)); + + + ArrayList anim3=new ArrayList(); + anim3.add(new CoreImageData("image/game/chara/nanbouGameR.png",0,0,144,144)); + anim3.add(new CoreImageData("image/game/chara/nanbouGameR.png",1,0,144,144)); + anim3.add(new CoreImageData("image/game/chara/nanbouGameR.png",2,0,144,144)); + + ArrayList anim3Index=new ArrayList(); + anim3Index.add(1); + anim3Index.add(0); + anim3Index.add(1); + anim3Index.add(2); + + anims.add(new CoreAnimation("nanbouRight", anim3,anim3Index,CHARA_ANIM_SPEED, true)); + + + ArrayList anim4=new ArrayList(); + anim4.add(new CoreImageData("image/game/chara/nanbou_clear.png")); + + ArrayList anim4Index=new ArrayList(); + anim4Index.add(0); + anims.add(new CoreAnimation("nanbouClear", anim4,anim4Index, 0.4f, false)); + + + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.CATTLE, + anims, 0, 0, 0, 144, 144); + objectFactory.create(chara, new CoreView(chara, 3)); + + island.addCharacter(chara); + layoutManager.addRight(chara,true); + gameController.addAllCharacter(chara); + +/* + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.CATTLE, + new CoreImageData("image/cattle.jpg"), 1000,400, 100,100); + + this.objectFactory.create(chara,new CoreView(chara, 2)); + + island.addCharacter(chara); + layoutManager.addRight(chara);*/ + } + + /** + * �L���x�c�lj� + */ + public void addCabbage(){ + + ArrayList anims=new ArrayList(); + ArrayList anim1=new ArrayList(); + anim1.add(new CoreImageData("image/game/chara/apple.png")); + + ArrayList anim1Index=new ArrayList(); + anim1Index.add(0); + anims.add(new CoreAnimation("apple", anim1,anim1Index, 0.4f, false)); + + + CharaModel chara=new CharaModel(gameController, TARGET_TYPE.CABBAGE, + anims, 0, 0, 0, 96, 144); + objectFactory.create(chara, new CoreView(chara, 3)); + + island.addCharacter(chara); + layoutManager.addRight(chara,true); + gameController.addAllCharacter(chara); + + + /* CharaModel chara=new CharaModel(gameController, TARGET_TYPE.CABBAGE, + new CoreImageData("image/cabbage.jpg"),1000, 550, 100,100); + + this.objectFactory.create(chara,new CoreView(chara, 2)); + island.addCharacter(chara); + layoutManager.addRight(chara);*/ + } + + + + /** + * �X�^�[�g���̐ݒ� + */ + public void createStartIsLand(){ + + island=new StartIsland(); + + } + + /*** + * �I�����̐ݒ� + */ + public void createEndIsLand(){ + endIsland=new EndIsland(); + } + + + + /** + * �{�[�g�֘A���쐬 + */ + private void createBoat(int boatSize){ + + //���E�̃A�j���[�V������lj� + ArrayList animImagesL=new ArrayList(); + animImagesL.add(new CoreImageData("image/game/ui/boat_l.png",0,0,272,130)); + animImagesL.add(new CoreImageData("image/game/ui/boat_l.png",1,0,272,130)); + animImagesL.add(new CoreImageData("image/game/ui/boat_l.png",2,0,272,130)); + + + ArrayList animImagesR=new ArrayList(); + animImagesR.add(new CoreImageData("image/game/ui/boat_r.png",0,0,272,130)); + animImagesR.add(new CoreImageData("image/game/ui/boat_r.png",1,0,272,130)); + animImagesR.add(new CoreImageData("image/game/ui/boat_r.png",2,0,272,130)); + + + ArrayList animLIndex=new ArrayList(); + animLIndex.add(0); + animLIndex.add(1); + animLIndex.add(2); + + ArrayList animRIndex=new ArrayList(); + animRIndex.add(0); + animRIndex.add(1); + animRIndex.add(2); + + ArrayList boatAnims=new ArrayList(); + boatAnims.add(new CoreAnimation("boatLeft", animImagesL,animLIndex, 0.2f, true)); + boatAnims.add(new CoreAnimation("boatRight", animImagesR,animRIndex, 0.2f, true)); + + + boat=new BoatModel(boatSize, boatAnims, 0, 420,400, 272, 130); + this.objectFactory.create(boat, new CoreView(boat, 4)); + + } + + /** + * �{�[�g�̍Đ��� + * @param b + */ + private void reCreateBoat(BoatModel b){ + //boatArea�������Ȃ����̂ł��Ƃ肠������ + } + + + /** + * UI�̍쐬 + */ + private void createUI(){ + + buttonNextTurn=new ButtonNextTurn(gameController, new CoreImageData("image/goText.png"), + 640,670, 400,100); + this.objectFactory.create(buttonNextTurn, new CoreView(buttonNextTurn, 1)); + + + //////////////////////////////////////// + //������ + //////////////////////////////////////// + ArrayList examples=new ArrayList(); + examples.add(new CoreImageData("image/game/ui/textbox_s0.png")); + examples.add(new CoreImageData("image/game/ui/textbox_s1.png")); + examples.add(new CoreImageData("image/game/ui/textbox_s2.png")); + examples.add(new CoreImageData("image/game/ui/textbox_s3.png")); + examples.add(new CoreImageData("image/game/ui/textbox_s4.png")); + ExampleBox exampleBox=new ExampleBox(examples, boat.getRideMaxMenberNum(), + 920, 644, 528, 96); + + objectFactory.create(exampleBox, new CoreView(exampleBox, 1)); + gameController.setExampleBox(exampleBox); + + ///////////////////////////////////////// + //�E���̌������݃A�C�R�� + //////////////////////////////////////// + + //�~�i�~ + CoreModel numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 150, 247, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + CoreModel numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 150, 247, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + OppositeIcon oppositeIcon=new OppositeIcon(TARGET_TYPE.MINISTART, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_l.png"), + new CoreImageData("image/game/ui/opposite_minami_l.png"), + endIsland.getCharaNum(TARGET_TYPE.MINISTART), + 140, 247, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeRightIcon(oppositeIcon,island.getNowTurn()); + + //�����S + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 150, 247+130, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 150, 247+130, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.CABBAGE, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_l.png"), + new CoreImageData("image/game/ui/opposite_apple_l.png"), + endIsland.getCharaNum(TARGET_TYPE.CABBAGE), + 140, 247+130, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeRightIcon(oppositeIcon,island.getNowTurn()); + + + //�Ȃ�ڂ� + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 150, 247+130*2, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 150, 247+130*2, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.CATTLE, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_l.png"), + new CoreImageData("image/game/ui/opposite_nanbou_l.png"), + endIsland.getCharaNum(TARGET_TYPE.CATTLE), + 140, 247+130*2, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeRightIcon(oppositeIcon,island.getNowTurn()); + + + //�ւ� + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 150, 247+130*3, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 150, 247+130*3, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.WOLF, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_l.png"), + new CoreImageData("image/game/ui/opposite_snake_l.png"), + endIsland.getCharaNum(TARGET_TYPE.WOLF), + 140, 247+130*3, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeRightIcon(oppositeIcon,island.getNowTurn()); + + + ///////////////////////////////////////// + //�����̌������݃A�C�R�� + //////////////////////////////////////// + + //�~�i�~ + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 1280-150, 247, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 1280-150, 247, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.MINISTART, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_r.png"), + new CoreImageData("image/game/ui/opposite_minami_r.png"), + island.getCharaNum(TARGET_TYPE.MINISTART), + 1280-140, 247, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeLeftIcon(oppositeIcon,!island.getNowTurn()); + + //�����S + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 1280-150, 247+130, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 1280-150, 247+130, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.CABBAGE, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_r.png"), + new CoreImageData("image/game/ui/opposite_apple_r.png"), + island.getCharaNum(TARGET_TYPE.CABBAGE), + 1280-140, 247+130, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeLeftIcon(oppositeIcon,!island.getNowTurn()); + + + //�Ȃ�ڂ� + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 1280-150, 247+130*2, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 1280-150, 247+130*2, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.CATTLE, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_r.png"), + new CoreImageData("image/game/ui/opposite_nanbou_r.png"), + island.getCharaNum(TARGET_TYPE.CATTLE), + 1280-140, 247+130*2, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeLeftIcon(oppositeIcon,!island.getNowTurn()); + + + //�ւ� + numIconX2=new CoreModel(new CoreImageData("image/game/ui/opposite_2.png"), + 1280-150, 247+130*3, 112, 112); + objectFactory.create(numIconX2, new CoreView(numIconX2, 2)); + + numIconX3=new CoreModel(new CoreImageData("image/game/ui/opposite_3.png"), + 1280-150, 247+130*3, 112, 112); + objectFactory.create(numIconX3, new CoreView(numIconX3, 2)); + + + oppositeIcon=new OppositeIcon(TARGET_TYPE.WOLF, + new CoreModel[]{numIconX2,numIconX3}, + new CoreImageData("image/game/ui/opposite_blank_r.png"), + new CoreImageData("image/game/ui/opposite_snake_r.png"), + island.getCharaNum(TARGET_TYPE.WOLF), + 1280-140, 247+130*3, 144, 112); + this.objectFactory.create(oppositeIcon, new CoreView(oppositeIcon, 1)); + gameController.addoppositeLeftIcon(oppositeIcon,!island.getNowTurn()); + + + + ////////////////////////////////////////////////// + ///����̓n������ + /////////////////////////////////////////////////// + + ArrayList rightNumbers=new ArrayList(); + + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,0,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,0,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,0,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,1,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,1,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,1,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,2,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,2,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,2,48,64), 176, 118, 48, 64)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,3,48,64), 176, 118, 48, 64)); + + for(int i=0;i leftNumbers=new ArrayList(); + + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,0,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,0,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,0,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,1,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,1,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,1,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,2,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,2,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,2,48,64), 124, 118, 48, 64)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,3,48,64), 124, 118, 48, 64)); + + for(int i=0;i(); + + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,0,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,0,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,0,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,1,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,1,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,1,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,2,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,2,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,2,48,64), 1137,234, 20,26)); + rightNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,3,48,64), 1137,234, 20,26)); + + for(int i=0;i(); + + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,0,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,0,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,0,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,1,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,1,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,1,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,2,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",1,2,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",2,2,48,64), 1118,234, 20,26)); + leftNumbers.add(new CoreModel(new CoreImageData("image/game/ui/numbers.png",0,3,48,64), 1118,234, 20,26)); + + for(int i=0;i screens=new ArrayList(); + screens.add(new CoreImageData("image/back/howtoplay1.png")); + screens.add(new CoreImageData("image/back/howtoplay2.png")); + screens.add(new CoreImageData("image/back/howtoplay3.png")); + screens.add(new CoreImageData("image/back/howtoplay4.png")); + screens.add(new CoreImageData("image/back/howtoplay5.png")); + screens.add(new CoreImageData("image/back/howtoplay6.png")); + screens.add(new CoreImageData("image/back/howtoplay7.png")); + + HowToPlayScreen s=new HowToPlayScreen(screens, 640, 360, 1280, 720); + objectFactory.create(s, new CoreView(s, 0)); + controller.setScreen(s); + + ArrayList texts=new ArrayList(); + texts.add(new CoreImageData("image/howToPlay/textbox_l_1.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_2.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_3.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_4.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_5.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_6.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_7.png")); + texts.add(new CoreImageData("image/howToPlay/textbox_l_8.png")); + + HowToPlayText t=new HowToPlayText(controller,texts, 640, 610, 1088, 128); + objectFactory.create(t, new CoreView(t, 1)); + controller.setText(t); + + + CoreModel nextIcon=new CoreModel(new CoreImageData("image/howToPlay/textbox_click.png"), + 999, 638, 16, 16); + objectFactory.create(nextIcon, new CoreView(nextIcon, 3)); + controller.setNextIcon(nextIcon); + + + //�t�F�C�h�p�̃}�X�N + CoreModel fadeMask=new CoreModel(new CoreImageData("image/game/screen/fadeMask.png"), + 640, 360, 1280, 720); + fadeMask.setShowView(false); + fadeMask.setAlpha(0); + objectFactory.create(fadeMask, new CoreView(fadeMask, 20)); + controller.setFadeMask(fadeMask); + + controller.checkInitProduction(); + + return controller; + + + } + + +} diff --git a/RiverCrossingAI/src/sample/game/builder/TitleAiBuilder.java b/RiverCrossingAI/src/sample/game/builder/TitleAiBuilder.java new file mode 100644 index 0000000..ccf2c72 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/builder/TitleAiBuilder.java @@ -0,0 +1,234 @@ +package sample.game.builder; + +import java.util.ArrayList; + +import library.core.model.CoreModel; +import library.core.object.CoreObjectFactory; +import library.core.system.CoreImageData; +import library.core.view.CoreView; +import sample.game.controller.TitleAiController; +import sample.game.main.AiGameTitle; +import sample.game.model.titleAi.NumberButton; +import sample.game.model.titleAi.NumberButton.TitleAiButtonType; +import sample.game.model.titleAi.TitleAiNextButton; + +public class TitleAiBuilder { + + + + private CoreObjectFactory objectFactory; + + + public TitleAiBuilder(CoreObjectFactory objectFactory){ + this.objectFactory=objectFactory; + + + } + + + public TitleAiController build(AiGameTitle palent,int boatNum,int ministerNum,int wolfNum, + int cabbageNum,int cattleNum){ + + + TitleAiController controller=new TitleAiController(palent); + + + //���S�̕\�� + CoreModel logo=new CoreModel(new CoreImageData("image/title/titlelogo.png"), + 640, 96, 1024, 144); + objectFactory.create(logo, new CoreView(logo, 2)); + + + //�w�i�\�� + CoreModel back=new CoreModel(new CoreImageData("image/back/title.png"), + 640, 369, 1280, 720); + objectFactory.create(back, new CoreView(back, 0)); + controller.setBackScreen(back); + + //�t�F�C�h�p�̃}�X�N + CoreModel fadeMask=new CoreModel(new CoreImageData("image/game/screen/fadeMask.png"), + 640, 360, 1280, 720); + fadeMask.setShowView(false); + fadeMask.setAlpha(0); + objectFactory.create(fadeMask, new CoreView(fadeMask, 20)); + controller.setFadeMask(fadeMask); + + + back=new CoreModel(new CoreImageData("image/back/title.png"), + -640, 369, 1280, 720); + objectFactory.create(back, new CoreView(back, 0)); + controller.setBackScreen2(back); + + + //�����̐����� + CoreModel titleExample=new CoreModel(new CoreImageData("image/title/ai/ui/titleExample.png"), + 350, 645, 528, 96); + objectFactory.create(titleExample, new CoreView(titleExample, 2)); + + //�E���̃Q�[���X�^�[�g�{�^�� + TitleAiNextButton button=new TitleAiNextButton(controller, new CoreImageData("image/title/ai/ui/ai_start.png"), + 920, 645, 532, 156); + objectFactory.create(button, new CoreView(button, 2)); + controller.setNextButton(button); + + + //�{�^���̔w�i�̕\�� + CoreModel buttonBack=new CoreModel(new CoreImageData("image/title/ai/ui/ai_title.png"), + 640, 370, 1024, 416); + objectFactory.create(buttonBack, new CoreView(buttonBack, 1)); + + + ///////////////////////////////////////////////////// + //�{�^�� + ///////////////////////////////////////////////////// + ArrayList numberButtons=new ArrayList(); + + //�{�[�g + CoreImageData off=new CoreImageData("image/title/ai/ui/ai_boat2_off.png"); + CoreImageData on=new CoreImageData("image/title/ai/ui/ai_boat2_on.png"); + + NumberButton numbutton=new NumberButton(2==boatNum?true:false,controller,TitleAiButtonType.boat, + 2, on, off, 190, 262, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_boat3_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_boat3_on.png"); + + numbutton=new NumberButton(3==boatNum?true:false,controller,TitleAiButtonType.boat, + 3, on, off, 190, 384, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_boat4_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_boat4_on.png"); + + numbutton=new NumberButton(4==boatNum?true:false,controller,TitleAiButtonType.boat, + 4, on, off, 190, 517, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + ///////////////////////////////////////////////////////////////////////////////// + //�݂Ȃ� + off=new CoreImageData("image/title/ai/ui/ai_minami1_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_minami1_on.png"); + + numbutton=new NumberButton(1==ministerNum?true:false,controller,TitleAiButtonType.minister, + 1, on, off, 416, 262, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + off=new CoreImageData("image/title/ai/ui/ai_minami2_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_minami2_on.png"); + + numbutton=new NumberButton(2==ministerNum?true:false,controller,TitleAiButtonType.minister, + 2, on, off, 416, 384, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_minami3_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_minami3_on.png"); + + numbutton=new NumberButton(3==ministerNum?true:false,controller,TitleAiButtonType.minister, + 3, on, off, 416, 517, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + ////////////////////////////////////////////////////////////////////////////////// + //��� + off=new CoreImageData("image/title/ai/ui/ai_apple1_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_apple1_on.png"); + + numbutton=new NumberButton(1==cabbageNum?true:false,controller,TitleAiButtonType.cabbage, + 1, on, off, 640, 262, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + off=new CoreImageData("image/title/ai/ui/ai_apple2_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_apple2_on.png"); + + numbutton=new NumberButton(2==cabbageNum?true:false,controller,TitleAiButtonType.cabbage, + 2, on, off, 640, 384, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_apple3_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_apple3_on.png"); + + numbutton=new NumberButton(3==cabbageNum?true:false,controller,TitleAiButtonType.cabbage, + 3, on, off, 640, 517, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + ////////////////////////////////////////////////////////////////////////////////// + //�Ȃ�ڂ� + off=new CoreImageData("image/title/ai/ui/ai_nanbou1_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_nanbou1_on.png"); + + numbutton=new NumberButton(1==cattleNum?true:false,controller,TitleAiButtonType.cattle, + 1, on, off, 865, 262, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + off=new CoreImageData("image/title/ai/ui/ai_nanbou2_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_nanbou2_on.png"); + + numbutton=new NumberButton(2==cattleNum?true:false,controller,TitleAiButtonType.cattle, + 2, on, off, 865, 384, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_nanbou3_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_nanbou3_on.png"); + + numbutton=new NumberButton(3==cattleNum?true:false,controller,TitleAiButtonType.cattle, + 3, on, off, 865, 517, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + ////////////////////////////////////////////////////////////////////////////////// + //�ւ� + off=new CoreImageData("image/title/ai/ui/ai_snake1_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_snake1_on.png"); + + numbutton=new NumberButton(1==wolfNum?true:false,controller,TitleAiButtonType.wolf, + 1, on, off, 1088, 262, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + off=new CoreImageData("image/title/ai/ui/ai_snake2_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_snake2_on.png"); + + numbutton=new NumberButton(2==wolfNum?true:false,controller,TitleAiButtonType.wolf, + 2, on, off, 1088, 384, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + off=new CoreImageData("image/title/ai/ui/ai_snake3_off.png"); + on=new CoreImageData("image/title/ai/ui/ai_snake3_on.png"); + + numbutton=new NumberButton(3==wolfNum?true:false,controller,TitleAiButtonType.wolf, + 3, on, off, 1088, 517, 96, 96); + objectFactory.create(numbutton, new CoreView(numbutton, 4)); + numberButtons.add(numbutton); + + + + controller.setNumberButtons(numberButtons); + + + controller.checkInitProduction(); + + return controller; + + + } +} diff --git a/RiverCrossingAI/src/sample/game/builder/TitleUserBuilder.java b/RiverCrossingAI/src/sample/game/builder/TitleUserBuilder.java new file mode 100644 index 0000000..3ed71f5 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/builder/TitleUserBuilder.java @@ -0,0 +1,200 @@ +package sample.game.builder; + +import java.util.ArrayList; + +import library.core.model.CoreAnimation; +import library.core.model.CoreModel; +import library.core.object.CoreObjectFactory; +import library.core.system.CoreImageData; +import library.core.view.CoreView; +import sample.game.controller.TitleController; +import sample.game.controller.TitleController.Level; +import sample.game.main.UserGameTitle; +import sample.game.model.title.HowToPlayButton; +import sample.game.model.title.LevelButton; +import sample.game.model.title.SoundButton; +import sample.game.model.title.TitleAnimationModel; + +public class TitleUserBuilder { + + private CoreObjectFactory objectFactory; + + private ArrayList levelButtons; + + public TitleUserBuilder(CoreObjectFactory coreObjectFactory){ + this.objectFactory=coreObjectFactory; + + this.levelButtons=new ArrayList(); + + } + + + public TitleController build(UserGameTitle palent){ + + TitleController controller=new TitleController(palent); + + /*CoreModel back=new CoreModel(new CoreImageData("image/title/title.jpg"), + 640, 369, 1280, 720);*/ + CoreModel back=new CoreModel(new CoreImageData("image/back/title.png"), + 640, 369, 1280, 720); + objectFactory.create(back, new CoreView(back, 0)); + controller.setBackScreen(back); + + + back=new CoreModel(new CoreImageData("image/back/title.png"), + -640, 369, 1280, 720); + objectFactory.create(back, new CoreView(back, 0)); + controller.setBackScreen2(back); + + + //���S�̕\�� + CoreModel logo=new CoreModel(new CoreImageData("image/title/titlelogo.png"), + 640, 96, 1024, 144); + objectFactory.create(logo, new CoreView(logo, 0)); + controller.setLogo(logo); + + + //���{�^���̕\�� + ArrayList soundImages=new ArrayList(); + soundImages.add(new CoreImageData("image/title/user/ui/mute_on.png")); + soundImages.add(new CoreImageData("image/title/user/ui/mute_off.png")); + SoundButton soundButton=new SoundButton(soundImages, 1153, 230, 96, 96); + objectFactory.create(soundButton, new CoreView(soundButton, 1)); + controller.setSoundButton(soundButton); + + //�V�ѕ��{�^�� + HowToPlayButton howToPlayButton=new HowToPlayButton(controller, + new CoreImageData("image/title/user/ui/howtoplay.png"),1006 , 230, 96, 96); + objectFactory.create(howToPlayButton, new CoreView(howToPlayButton, 1)); + controller.setHowToPlayButton(howToPlayButton); + + + //���x���I���{�^�� + LevelButton button=new LevelButton(Level.easy,controller,new CoreImageData("image/title/user/ui/easy.png"), + 250, 630, 352, 96); + levelButtons.add(button); + objectFactory.create(button, new CoreView(button, 1)); + + button=new LevelButton(Level.normal,controller,new CoreImageData("image/title/user/ui/normal.png"), + 640, 630, 352, 96); + levelButtons.add(button); + objectFactory.create(button, new CoreView(button, 1)); + + button=new LevelButton(Level.hard,controller,new CoreImageData("image/title/user/ui/hard.png"), + 1030, 630, 352, 96); + levelButtons.add(button); + objectFactory.create(button, new CoreView(button, 1)); + + controller.setLevelButtons(levelButtons); + + + //�^�C�g���̃L���� + //�~�i�~ + ArrayList animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/anim/minamiTitle.png",0,0,324,324)); + animDatas.add(new CoreImageData("image/title/user/anim/minamiTitle.png",1,0,324,324)); + animDatas.add(new CoreImageData("image/title/user/anim/minamiTitle.png",2,0,324,324)); + + ArrayList animIndexs=new ArrayList(); + animIndexs.add(1); + animIndexs.add(0); + animIndexs.add(1); + animIndexs.add(2); + + ArrayList anims=new ArrayList(); + + //���[�v�G�̐ݒ� + anims.add(new CoreAnimation("easyLoop", animDatas,animIndexs,0.3f, true)); + + + animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/minami_title4.png")); + animIndexs=new ArrayList(); + animIndexs.add(0); + + //��~�G�̐ݒ� + anims.add(new CoreAnimation("easyEnd", animDatas, animIndexs, 1f, false)); + + + TitleAnimationModel animationModel=new TitleAnimationModel(anims, 0, 250, 384, 324, 324); + objectFactory.create(animationModel, new CoreView(animationModel, 1)); + controller.setEasyCharaAnim(animationModel); + + + //�Ȃ�ڂ� + animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/anim/nanbouTitle.png",0,0,324,324)); + animDatas.add(new CoreImageData("image/title/user/anim/nanbouTitle.png",1,0,324,324)); + animDatas.add(new CoreImageData("image/title/user/anim/nanbouTitle.png",2,0,324,324)); + + animIndexs=new ArrayList(); + animIndexs.add(1); + animIndexs.add(0); + animIndexs.add(1); + animIndexs.add(2); + + anims=new ArrayList(); + + //���[�v�G�̐ݒ� + anims.add(new CoreAnimation("normalLoop", animDatas,animIndexs,0.3f, true)); + + + animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/nanbou_title4.png")); + animIndexs=new ArrayList(); + animIndexs.add(0); + + //��~�G�̐ݒ� + anims.add(new CoreAnimation("normalEnd", animDatas, animIndexs, 1f, false)); + + + animationModel=new TitleAnimationModel(anims, 0, 640, 384, 324, 324); + objectFactory.create(animationModel, new CoreView(animationModel, 1)); + controller.setNormalCharaAnim(animationModel); + + + //�ւ� + animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/anim/snakeTitle.png",0,0,324,324)); + animDatas.add(new CoreImageData("image/title/user/anim/snakeTitle.png",1,0,324,324)); + + animIndexs=new ArrayList(); + animIndexs.add(0); + animIndexs.add(1); + + anims=new ArrayList(); + + //���[�v�G�̐ݒ� + anims.add(new CoreAnimation("hardLoop", animDatas,animIndexs,0.3f, true)); + + + animDatas=new ArrayList(); + animDatas.add(new CoreImageData("image/title/user/snake_title3.png")); + animIndexs=new ArrayList(); + animIndexs.add(0); + + //��~�G�̐ݒ� + anims.add(new CoreAnimation("hardEnd", animDatas, animIndexs, 1f, false)); + + + animationModel=new TitleAnimationModel(anims, 0, 1030, 384, 324, 324); + objectFactory.create(animationModel, new CoreView(animationModel, 1)); + controller.setHardCharaAnim(animationModel); + + + //�t�F�C�h�p�̃}�X�N + CoreModel fadeMask=new CoreModel(new CoreImageData("image/game/screen/fadeMask.png"), + 640, 360, 1280, 720); + fadeMask.setShowView(false); + fadeMask.setAlpha(0); + objectFactory.create(fadeMask, new CoreView(fadeMask, 20)); + controller.setFadeMask(fadeMask); + + controller.checkInitProduction(); + + return controller; + + } + + +} diff --git a/RiverCrossingAI/src/sample/game/controller/GameController.java b/RiverCrossingAI/src/sample/game/controller/GameController.java new file mode 100644 index 0000000..444bd8e --- /dev/null +++ b/RiverCrossingAI/src/sample/game/controller/GameController.java @@ -0,0 +1,1789 @@ +package sample.game.controller; + + +import java.util.ArrayList; + +import library.core.debug.CoreLog; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.object.CoreTextObjectFactory; +import sample.game.ai.AiSystem; +import sample.game.ai.AiSystemType1; +import sample.game.ai.Memory; +import sample.game.main.MainActivity; +import sample.game.main.MainActivity.gameSeType; +import sample.game.manager.EndIsland; +import sample.game.manager.Island; +import sample.game.manager.LayoutManager; +import sample.game.manager.StartIsland; +import sample.game.model.AiChara; +import sample.game.model.BackToTitleButton; +import sample.game.model.BoatModel; +import sample.game.model.ButtonNextTurn; +import sample.game.model.CharaModel; +import sample.game.model.CharaModel.TARGET_TYPE; +import sample.game.model.CrossButton; +import sample.game.model.ExampleBox; +import sample.game.model.NumBox; +import sample.game.model.OnemorePlayButton; +import sample.game.model.OppositeIcon; +import android.view.MotionEvent; + + + +public class GameController { + + private CoreTextObjectFactory textFactory; + private ArrayList targets; + private ArrayList allCharacter; + private BoatModel boat; + private StartIsland startIsland; + private EndIsland endIsland; + private LayoutManager layoutManager; + private ButtonNextTurn turnChangeButton; + private MainActivity palent; + + private ArrayList oppositeRightIcons; + private ArrayList oppositeLeftIcons; + private ArrayList selectIcons; + private AiChara aiChara; + private CrossButton crossButton; + private ExampleBox exampleBox; + private OnemorePlayButton onemorePlayButton; + private BackToTitleButton backToTitleButton; + private CoreModel fadeMask; + private CoreModel perfectLogo; + private CoreModel clearLogo; + private NumBox numbox; + private NumBox numboxS; + private CoreModel backScreen; + private CoreModel gameoverScreenTypeWolf; + private CoreModel gameoverScreenTypeCabbage; + private CoreModel gameoverScreenTypeAi; + private CoreModel returnBackScreen; + private CoreModel returnIcon; + + + private int moveNum; //�ړ������L�����̐� + private int moveNumMax; + + private float time=0; + private float bifTouchX; + private float bifTouchY; + + //�^�[�Q�b�g�̈ړ��O���W + private float targetBifX; + private float targetBifY; + + private boolean isEndGame=false; + private boolean nowTurnChangePhase=false; //�^�[���ύX���̉��o�p + private boolean nowCharaMovePhase=false; //�L�����̈ړ����o�t���O + private boolean nowBackScreenMovePhase=false; + private boolean nowCharaGetOffPhase=false; //�L�������D����~���t�F�[�Y + private boolean isUseAi=true; + private boolean isStopUpdate=false; + private boolean isStopUpdate2=false; + private boolean isRestarGamePhase=false; + private boolean isGameEndPhase=false; + + + private boolean initProduction; + + + //�`�h�Ɏg�p������� + private AiSystem ai; + + private Memory moveData; //�ړ����̕ۑ� + private boolean isNowReturnPhase=false; + private boolean isNowReturnPhaseIfBoatMode=false; + private boolean isNowReturnPhaseIfNormal=false; + private boolean isNowboatBackMove=false; //�{�[�g���}�Ɍ������ɓ������t���O + + private int bifMoveMinisterNum=0; + private int bifMoveWolfNum=0; + private int bifMoveCabbageNum=0; + private int bifMoveCattleMoveNum=0; + + private int count=0; + private float returnTime=0; + + + /** + * �������o�����邩�ǂ��� + * @param isInitProduction + */ + public GameController(boolean isInitProduction){ + oppositeRightIcons=new ArrayList(); + oppositeLeftIcons=new ArrayList(); + selectIcons=new ArrayList(); + targets=new ArrayList(); + allCharacter=new ArrayList(); + + + this.initProduction=isInitProduction; + + + + this.isNowReturnPhase=false; + this.isNowReturnPhaseIfBoatMode=false; + this.isNowboatBackMove=false; + + RiverCrossingAI.getBgmPlayer().play("bgm/game.ogg", 0); + + } + + + /** + * ������ + * @param palent + * @param textFactory + * @param startIsland + * @param endIsland + * @param nextButton + * @param boat + * @param layoutManager + */ + public void init(MainActivity palent,StartIsland startIsland,EndIsland endIsland, + ButtonNextTurn nextButton, + BoatModel boat,LayoutManager layoutManager){ + + + this.startIsland=startIsland; + this.endIsland=endIsland; + this.palent=palent; + this.boat=boat; + this.turnChangeButton=nextButton; + this.layoutManager=layoutManager; + + this.targets.clear(); + + this.moveNum=0; + + moveNumMax=boat.getRideMaxMenberNum(); + //moveNumMax=4; + } + + /** + * �������o���s�����ǂ����̔��� + */ + public void checkInitProduction(){ + //�������o������ꍇ�A���͂���莞�Ԃ����؂� + if(initProduction){ + //init�̌Ă΂��^�C�~���O�ł́A���ׂẴt�B�[���h�̏������������Ă��邱�Ƃ�z�� + for(int i=0;i0.5f){ + deltaTime=0.5f; + } + time+=deltaTime; + + + float rate=time/1.5f; + if(rate>1) rate=1f; + RiverCrossingAI.getBgmPlayer().setVolume(rate); + fadeMask.setAlpha((int)((1-rate)*255)); + + if(time>1.5f){ + RiverCrossingAI.getBgmPlayer().setVolume(1f); + CoreLog.debug("end :"+time); + time=0; + + fadeMask.setShowView(false); + + for(int i=0;i1) rate=1f; + RiverCrossingAI.getBgmPlayer().setVolume(1f-rate); + fadeMask.setAlpha((int)(rate*255)); + + if(time>1f){ + RiverCrossingAI.getBgmPlayer().stop(); + if(isRestarGamePhase){ + this.reStartGame(); + }else{ + this.endGame(); + } + } + } + /*time+=deltaTime; + CoreLog.debug("end"); + if(time>2){ + //����Ń^�C�g���s���ƃo�O�� + if(startIsland.checkGaemClear()){ //�N���A�[�����ꍇ�̓^�C�g����ʂɖ߂� + palent.moveTitle(); + } + + //�Q�[���I�[�o�[�̏ꍇ�̓��X�^�[�g�ł��ǂ����A����̓^�C�g���ɖ߂� + this.endGame(); + }*/ + return; + } + + + + + /** + * �Q�[���̊����߂����� + */ + + if(isNowReturnPhase && !isNowReturnPhaseIfBoatMode){ + CoreLog.debug("--"); + + time+=deltaTime; + returnTime+=deltaTime; + + if(returnTime>=0.5f){ + returnTime=0; + //���̔��] + returnIcon.setShowView(!returnIcon.isShowView()); + } + + if(time>=0.01f && !nowTurnChangePhase){ + time=0; + + if(count==0){ + count++; + bifMoveMinisterNum=moveData.getMinisterMoveNum(); + bifMoveWolfNum=moveData.getWolfMoveNum(); + bifMoveCabbageNum=moveData.getCabbageMoveNum(); + bifMoveCattleMoveNum=moveData.getCattleMoveNum(); + CoreLog.debug("--2"+bifMoveMinisterNum+"/"+bifMoveWolfNum+"/"+bifMoveCabbageNum+"/"+bifMoveCattleMoveNum); + + //�߂�����Z�b�g���Ă���A���̃������[�ɒu�������� + moveData=moveData.getBifMemory(); + moveData.removeNextmemorys(0); + }else{ + Island island=null; + + if(startIsland.getNowTurn()){ + island=startIsland; + }else{ + island=endIsland; + } + + + if(bifMoveMinisterNum>0){ + bifMoveMinisterNum--; + CoreLog.debug(""+island.getMinisters().size()); + //island.getMinisters().get(island.getMinisters().size()-1).onTouchDown(); + + + ArrayList c=island.getMinisters(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveWolfNum>0){ + bifMoveWolfNum--; + //island.getWolfs().get(island.getWolfs().size()-1).onTouchDown(); + + ArrayList c=island.getWolfs(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveCabbageNum>0){ + bifMoveCabbageNum--; + //island.getCabbages().get(island.getCabbages().size()-1).onTouchDown(); + + ArrayList c=island.getCabbages(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveCattleMoveNum>0){ + bifMoveCattleMoveNum--; + //island.getCattles().get(island.getCattles().size()-1).onTouchDown(); + + ArrayList c=island.getCattles(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else{ + //flag=true; + + //�{�[�g�̕����ύX + if(!startIsland.getNowTurn()){ + boat.changeAnimation(0); + }else{ + boat.changeAnimation(1); + } + + this.changeTurn(true); + } + + /*if(bifMoveMinisterNum>0){ + bifMoveMinisterNum--; + island.getMinisters().get(island.getMinisters().size()-1).onTouchDown(); + }else if(bifMoveWolfNum>0){ + bifMoveWolfNum--; + island.getWolfs().get(island.getWolfs().size()-1).onTouchDown(); + }else if(bifMoveCabbageNum>0){ + bifMoveCabbageNum--; + island.getCabbages().get(island.getCabbages().size()-1).onTouchDown(); + }else if(bifMoveCattleMoveNum>0){ + bifMoveCattleMoveNum--; + island.getCattles().get(island.getCattles().size()-1).onTouchDown(); + }else{ + this.changeTurn(true); + }*/ + } + return; + } + + + + + if(nowTurnChangePhase){ + CoreLog.debug("/"); + if(nowCharaMovePhase){ //�L������D�ɏ悹��ړ����� + ////////////////////////////////////////////////////////////// + //�L������D�ɏ悹��t�F�[�Y + ///////////////////////////////////////////////////////////// + + + if(layoutManager.charaMove2Boat(targets, deltaTime, 1f)){ + nowCharaMovePhase=false; + nowBackScreenMovePhase=true; + layoutManager.moveBackScreenInit(backScreen, boat, targets,aiChara, !startIsland.getNowTurn());//���������� + } + + }else if(nowBackScreenMovePhase){ + ////////////////////////////////////////////////////////////// + //�w�i�ړ��t�F�[�Y�i�D�̈ړ��j + ///////////////////////////////////////////////////////////// + + + if(layoutManager.moveBackScreen(this,backScreen, boat, targets,aiChara,numbox, deltaTime, 1.5f,false)){ + nowBackScreenMovePhase=false; + nowCharaGetOffPhase=true; + + if(!startIsland.getNowTurn()){ + for(int i=0;i icons=null; + Island land=null; + if(!startIsland.getNowTurn()){ + icons=oppositeLeftIcons; + land=startIsland; + }else{ + icons=oppositeRightIcons; + land=endIsland; + } + + for(int i=0;i=0.5f){ + returnTime=0; + //���̔��] + returnIcon.setShowView(!returnIcon.isShowView()); + } + + + if(nowBackScreenMovePhase){ + ////////////////////////////////////////////////////////////// + //�w�i�ړ��t�F�[�Y�i�D�̈ړ��j + ///////////////////////////////////////////////////////////// + + if(layoutManager.moveBackScreen(this,backScreen, boat, targets,aiChara,numbox, deltaTime, 1.5f,isNowboatBackMove)){ + nowBackScreenMovePhase=false; + nowCharaGetOffPhase=true; + + isNowboatBackMove=false; //�����߂��̈ꕔ�Ŏg�p���邽�߁i�g������false�j + + if(!startIsland.getNowTurn()){ + for(int i=0;i icons=null; + Island land=null; + if(!startIsland.getNowTurn()){ + icons=oppositeLeftIcons; + land=startIsland; + }else{ + icons=oppositeRightIcons; + land=endIsland; + } + + for(int i=0;i icons=null; + Island land=null; + if(!startIsland.getNowTurn()){ + icons=oppositeLeftIcons; + land=startIsland; + }else{ + icons=oppositeRightIcons; + land=endIsland; + } + + for(int i=0;i icons=null; + if(!startIsland.getNowTurn()){ + icons=oppositeRightIcons; + }else{ + icons=oppositeLeftIcons; + } + + for(int i=0;i=moveNumMax){ + return true; + } + return false; + } + + + /** + * �n��{�^���������邩�ǂ��� + * @return + */ + public void checkCrossButton(){ + + boolean selectMinister=false; + for(int i=0;i0)){ + crossButton.setCanMove(true); + if(startIsland.getNowTurn()){ + crossButton.setXY(boat.getCenterX(), boat.getCenterY()); + }else{ + crossButton.setXY(boat.getCenterX()-30, boat.getCenterY()); + } + }else{ + crossButton.setCanMove(false); + crossButton.setXY(-100,-100); + } + + } + + + public void startNextTurn(){ + + //���ׂẴL�����̃^�b�`�𕕈���� + for(int i=0;imaxIndex) maxIndex=tmp; + } + + if(maxIndex==-1){ //�^�[�Q�b�g�̂h�c���o�^����Ă��Ȃ������ꍇ + maxIndex=0; + }else{ //�o�^����Ă���ꍇ�͎��̂h�c��U�� + maxIndex+=1; + } + + this.selectIcons.get(maxIndex).setXY(chara.getCenterX(), chara.getCenterY()); + chara.setTargetId(maxIndex); + + + this.targets.add(chara); + + //�n��{�^���̔��� + checkCrossButton(); + + CoreLog.debug("a1"); + return true; + } + + CoreLog.debug("b1"); + return false; + } + + public void removeTarget(CharaModel chara){ + //this.selectIcons.get(chara.getTargetId()).setXY(500+100*moveNum,100); + + int targetId=chara.getTargetId(); + + //�^�[�Q�b�g�h�c�̓r���̐�����������ꍇ�A����̂��߂ɂ���ȏ��̐����̐������炷 + for(int i=0;itargetId){ + targets.get(i).setTargetId(tmpId-1); + } + } + + //targetID�̐�����A�o�^���폜 + this.targets.remove(chara); + + //�c���targets��selectButton�𐮗� + //�\���̖���selectButton�����񂵒��� + for(int i=0;i<4;i++){ + if(i0){ + turnChangeButton.setShowView(true); + } + + + } + + + public void gameOver(){ + RiverCrossingAI.getBgmPlayer().setVolume(0.5f); + + //���ׂẴL�����̃^�b�`�𕕈���� + for(int i=0;i0){ + bifMoveMinisterNum--; + CoreLog.debug(""+island.getMinisters().size()); + //island.getMinisters().get(island.getMinisters().size()-1).onTouchDown(); + + + ArrayList c=island.getMinisters(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveWolfNum>0){ + bifMoveWolfNum--; + //island.getWolfs().get(island.getWolfs().size()-1).onTouchDown(); + + ArrayList c=island.getWolfs(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveCabbageNum>0){ + bifMoveCabbageNum--; + //island.getCabbages().get(island.getCabbages().size()-1).onTouchDown(); + + ArrayList c=island.getCabbages(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else if(bifMoveCattleMoveNum>0){ + bifMoveCattleMoveNum--; + //island.getCattles().get(island.getCattles().size()-1).onTouchDown(); + + ArrayList c=island.getCattles(); + for(int i=c.size()-1;i>=0;i--){ + if(!c.get(i).isNowTarget()){ + c.get(i).onTouchDown(); + break; + } + } + + }else{ + flag=true; + } + } + + CoreLog.debug("-2 "+targets.size()); + this.changeTurn(true); + CoreLog.debug("-3"); + + + + //�{�[�g�̕����ύX + if(!startIsland.getNowTurn()){ + boat.changeAnimation(1); + }else{ + boat.changeAnimation(0); + } + + } + + + + RiverCrossingAI.getSePlayer().play(gameSeType.RETURN.ordinal()); + + //�Z���N�g�{�^���̕\�������� + for(int i=0;i1) rate=1; + RiverCrossingAI.getBgmPlayer().setVolume(rate); + this.fadeMask.setAlpha((int)(255*(1f-rate))); + + if(time>=1f){ + fadeMask.setShowView(false); + unLockButtons(); + this.nowShowInitProductPhase=false; + time=0; + } + + + return; + } + + + if(nowEndProductionPhase){ + + time+=deltaTime; + + if(time>=0.5f){ + fadeout((1.5f-time)/1f); + } + + if(time>=1.5f){ + time=-100; + this.goTitle(); + } + return; + } + + + this.iconMoveTime+=deltaTime; + if(iconMoveTime>=0.01f){ + iconMoveTime=0; + iconMoveCount++; + if(iconMoveCount>=iconMoveCountMax){ + iconMoveCount=0; + iconMoveLen=-iconMoveLen; + } + nextIcon.move(0, iconMoveLen); + } + + + + + } + + public void fadeout(float rate){ + int alpha=(int)((rate)*255); + if(alpha<0) alpha=0; + if(rate<0) rate=0; + RiverCrossingAI.getBgmPlayer().setVolume(rate); + fadeMask.setAlpha(255-alpha); + } + + public void goEndPhase(){ + + this.time=0; + + lockButtons(); + + fadeMask.setAlpha(0); + fadeMask.setShowView(true); + + this.nowEndProductionPhase=true; + } + + + private void goTitle(){ + palent.startTitle(); + } + + + public void lockButtons(){ + this.text.setTouch(false); + } + + public void unLockButtons(){ + this.text.setTouch(true); + } + + public void nextScreen(){ + screen.nextScreen(); + } + + + public void setScreen(HowToPlayScreen screen) { + this.screen = screen; + } + + public void setText(HowToPlayText text) { + this.text = text; + } + + public void setFadeMask(CoreModel fadeMask) { + this.fadeMask = fadeMask; + } + + public void setNextIcon(CoreModel nextIcon) { + this.nextIcon = nextIcon; + } + + + +} diff --git a/RiverCrossingAI/src/sample/game/controller/TitleAiController.java b/RiverCrossingAI/src/sample/game/controller/TitleAiController.java new file mode 100644 index 0000000..f282e58 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/controller/TitleAiController.java @@ -0,0 +1,277 @@ +package sample.game.controller; + +import java.util.ArrayList; + +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import sample.game.main.AiGameTitle; +import sample.game.model.titleAi.NumberButton; +import sample.game.model.titleAi.TitleAiNextButton; + +public class TitleAiController { + + + private int boatSize=2; + private int ministerNum=1; + private int wolfNum=1; + private int cabbageNum=1; + private int cattleNum=1; + + private AiGameTitle palent; + + + private ArrayList numberButtons; + + private CoreModel backScreen; + private CoreModel backScreen2; + private TitleAiNextButton nextButton; + private CoreModel fadeMask; + + private float time=0; + private float backScreenMoveTime; + + private boolean nowInitProductPhase; + private boolean moveBackScreen; + + private boolean isSelectStage=false; + + + public TitleAiController(AiGameTitle palent){ + this.palent=palent; + + this.backScreenMoveTime=0; + this.isSelectStage=false; + + numberButtons=new ArrayList(); + + RiverCrossingAI.getBgmPlayer().play("bgm/title.ogg", 0); + } + + + /** + * �������o�̐ݒ� + */ + public void checkInitProduction(){ + + lockButton(); + + this.fadeMask.setAlpha(255); + this.fadeMask.setShowView(true); + + this.nowInitProductPhase=true; + time=0; + + this.moveBackScreen=true; + + + } + + public void update(float deltaTime){ + + //�J�n���o + if(nowInitProductPhase){ + time+=deltaTime; + + float rate=time/1f; + + if(rate>1) rate=1; + + this.fadeMask.setAlpha((int)(255*(1f-rate))); + RiverCrossingAI.getBgmPlayer().setVolume(rate); + + if(time>=1f){ + RiverCrossingAI.getBgmPlayer().setVolume(1f); + fadeMask.setShowView(false); + unlockButton(); + this.nowInitProductPhase=false; + time=0; + } + + return; + + } + + + + //�w�i�̃��[�v + if(moveBackScreen){ + backScreenMoveTime+=deltaTime; + if(backScreenMoveTime>=0.01f){ + backScreenMoveTime=0; + backScreen.move(4f, 0); + backScreen2.move(4f, 0); + + if(backScreen.getCenterX()>=1920){ + backScreen.setCenterX(-640); + } + + if(backScreen2.getCenterX()>=1920){ + backScreen2.setCenterX(-640); + } + } + } + + + + //�Q�[����ʂւ̈ړ����o + if(isSelectStage){ + + time+=deltaTime; + + if(time>=0.5f){ + fadeout((1.5f-time)/1f); + } + + if(time>=1.5f){ + time=-100; + RiverCrossingAI.getBgmPlayer().stop(); + startGame(); + } + } + + } + + + + /** + *�@�t�F�C�h���� + * @param rate 0�Ŋ��S�ɓ��� + */ + public void fadeout(float rate){ + int alpha=(int)((rate)*255); + if(alpha<0) alpha=0; + + if(rate<0) rate=0; + RiverCrossingAI.getBgmPlayer().setVolume(rate); + + fadeMask.setAlpha(255-alpha); + } + + + /** + * ���g�Ɠ��������̃{�^���ȊO���\���ɂ��� + * @param button + */ + public void elseButtonOff(NumberButton button){ + for(int i=0;i button){ + this.numberButtons=button; + } + + public int getBoatSize() { + return boatSize; + } + + public void setBoatSize(int boatSize) { + this.boatSize = boatSize; + } + + public int getMinisterNum() { + return ministerNum; + } + + public void setMinisterNum(int ministerNum) { + this.ministerNum = ministerNum; + } + + public int getWolfNum() { + return wolfNum; + } + + public void setWolfNum(int wolfNum) { + this.wolfNum = wolfNum; + } + + public int getCabbageNum() { + return cabbageNum; + } + + public void setCabbageNum(int cabbageNum) { + this.cabbageNum = cabbageNum; + } + + public int getCattleNum() { + return cattleNum; + } + + public void setCattleNum(int cattleNum) { + this.cattleNum = cattleNum; + } + + public void setBackScreen(CoreModel backScreen) { + this.backScreen = backScreen; + } + + public void setBackScreen2(CoreModel backScreen2) { + this.backScreen2 = backScreen2; + } + + public void setNextButton(TitleAiNextButton nextButton) { + this.nextButton = nextButton; + } + + public void setFadeMask(CoreModel fadeMask) { + this.fadeMask = fadeMask; + } + + + + + + +} diff --git a/RiverCrossingAI/src/sample/game/controller/TitleController.java b/RiverCrossingAI/src/sample/game/controller/TitleController.java new file mode 100644 index 0000000..dea328a --- /dev/null +++ b/RiverCrossingAI/src/sample/game/controller/TitleController.java @@ -0,0 +1,322 @@ +package sample.game.controller; + +import java.util.ArrayList; + +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import sample.game.main.UserGameTitle; +import sample.game.model.title.HowToPlayButton; +import sample.game.model.title.LevelButton; +import sample.game.model.title.SoundButton; +import sample.game.model.title.TitleAnimationModel; + + +/** + * ���[�U�[�����삷��^�C�g���̃R���g���[���[ + * @author �M�T + * + */ +public class TitleController { + + public enum Level{ + easy, + normal, + hard + }; + + + private Level targetLevel=Level.easy; + private UserGameTitle palent; + + private CoreModel backScreen; + private CoreModel backScreen2; //���[�v�̌�ǂ� + private CoreModel logo; + private ArrayList levelButtons; + private TitleAnimationModel easyCharaAnim; + private TitleAnimationModel normalCharaAnim; + private TitleAnimationModel hardCharaAnim; + private SoundButton soundButton; + private HowToPlayButton howToPlayButton; + private CoreModel fadeMask; + + private float time; + private float backScreenMoveTime; + + private boolean isSelectStage=false; + private boolean nowShowInitProductPhase=true; + private boolean moveBackScreen=false; + private boolean isSelectHowToPlay=false; + + public TitleController(UserGameTitle palent){ + this.palent=palent; + + time=0; + backScreenMoveTime=0; + + RiverCrossingAI.getBgmPlayer().play("bgm/title.ogg", 0); + } + + + /** + * �������o���� + */ + public void checkInitProduction(){ + + lockButtons(); + + this.fadeMask.setAlpha(255); + this.fadeMask.setShowView(true); + + this.nowShowInitProductPhase=true; + this.isSelectHowToPlay=false; + time=0; + + moveBackScreen=true; + } + + + public void update(float deltaTime){ + + + //�˓����̃t�F�C�h���� + if(nowShowInitProductPhase){ + time+=deltaTime; + + //CoreLog.debug("time: "+time); + + float rate=time/1f; + + if(rate>1) rate=1; + RiverCrossingAI.getBgmPlayer().setVolume(rate);; + this.fadeMask.setAlpha((int)(255*(1f-rate))); + + if(time>=1f){ + fadeMask.setShowView(false); + unlockButtons(); + this.nowShowInitProductPhase=false; + time=0; + } + + + return; + } + + if(moveBackScreen){ + backScreenMoveTime+=deltaTime; + if(backScreenMoveTime>=0.01f){ + backScreenMoveTime=0; + backScreen.move(4f, 0); + backScreen2.move(4f, 0); + + if(backScreen.getCenterX()>=1920){ + backScreen.setCenterX(-640); + } + + if(backScreen2.getCenterX()>=1920){ + backScreen2.setCenterX(-640); + } + } + } + + //�X�e�[�W�̑I�������ꂽ�ꍇ + if(isSelectStage){ + + time+=deltaTime; + + if(time>=0.5f){ + fadeout((1.5f-time)/1f); + } + + if(time>=1.5f){ + time=-100; + if(isSelectHowToPlay){ + palent.loadHowToPlay(); + }else{ + goGameScreen(); + } + } + } + + } + + + /** + *�@���摜�ł���������������� + * @param rate 0�Ŋ��S�ɓ��� + */ + public void fadeout(float rate){ + int alpha=(int)((rate)*255); + if(alpha<0) alpha=0; + + if(rate<0) rate=0; + RiverCrossingAI.getBgmPlayer().setVolume(rate); + + fadeMask.setAlpha(255-alpha); + + + /*backScreen.setAlpha(alpha); + backScreen2.setAlpha(alpha); + for (LevelButton l : levelButtons) { + l.setAlpha(alpha); + } + easyCharaAnim.setAlpha(alpha); + normalCharaAnim.setAlpha(alpha); + hardCharaAnim.setAlpha(alpha); + soundButton.setAlpha(alpha); + howToPlayButton.setAlpha(alpha); + logo.setAlpha(alpha);*/ + } + + + + /** + * �������̓s���ɂ�蕪�� + * @param buttons + */ + public void setLevelButtons(ArrayList buttons){ + this.levelButtons=buttons; + } + + /** + * �������̓s���ɂ�蕪�� + * @param buttons + */ + public void setSoundButton(SoundButton soundButton) { + this.soundButton = soundButton; + } + + /** + * �������̓s���ɂ�蕪�� + * @param buttons + */ + public void setHowToPlayButton(HowToPlayButton howToPlayButton) { + this.howToPlayButton = howToPlayButton; + } + + public void setEasyCharaAnim(TitleAnimationModel anim){ + this.easyCharaAnim=anim; + } + + public void setNormalCharaAnim(TitleAnimationModel anim){ + this.normalCharaAnim=anim; + } + + public void setHardCharaAnim(TitleAnimationModel anim){ + this.hardCharaAnim=anim; + } + + public void setBackScreen(CoreModel backScreen) { + this.backScreen = backScreen; + } + + public void setBackScreen2(CoreModel backScreen) { + this.backScreen2 = backScreen; + } + + public void setLogo(CoreModel logo) { + this.logo = logo; + } + + /** + * ���x���̑I���i�{�^�����́j�i�Q�[�����[�h�̌���j + * @param level + */ + public void selectLevet(Level level){ + time=0; + + lockButtons(); + this.targetLevel=level; + isSelectStage=true; + + fadeMask.setAlpha(0); + fadeMask.setShowView(true); + + //�A�j���[�V�����̐؂�ւ� + /*switch (level) { + case easy: + easyCharaAnim.changeAnimation(1); + break; + case normal: + normalCharaAnim.changeAnimation(1); + break; + case hard: + hardCharaAnim.changeAnimation(1); + break; + }*/ + easyCharaAnim.changeAnimation(1); + normalCharaAnim.changeAnimation(1); + hardCharaAnim.changeAnimation(1); + + moveBackScreen=false; + } + + /** + * �Q�[���V�[���ւ̑J�� + */ + public void goGameScreen(){ + this.palent.loadGameScreen(targetLevel); + } + + + /** + * �V�ѕ���I�񂾏ꍇ + */ + public void selectHowToPlay(){ + + time=0; + + lockButtons(); + isSelectStage=true; + isSelectHowToPlay=true; + + fadeMask.setAlpha(0); + fadeMask.setShowView(true); + + easyCharaAnim.changeAnimation(1); + normalCharaAnim.changeAnimation(1); + hardCharaAnim.changeAnimation(1); + + moveBackScreen=false; + + + } + + + + /** + * �{�^���̖����� + */ + private void lockButtons(){ + for(int i=0;i ses; + private int ministerNum; + private int wolfNum; + private int cabbageNum; + private int cattleNum; + private int boatSize; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + screen.setScreenSize(1280, 720); + + Intent intent=getIntent(); + ministerNum=intent.getIntExtra("minister",1); + wolfNum=intent.getIntExtra("wolf",1); + cabbageNum=intent.getIntExtra("cabbage",1); + cattleNum=intent.getIntExtra("cattle", 1); + boatSize=intent.getIntExtra("boat", 2); + + + builder=new TitleAiBuilder(objectFactory); + + } + + + @Override + protected void update(float deltaTime) { + if(controller!=null){ + controller.update(deltaTime); + } + + } + + @Override + protected void touch(MotionEvent event) { + } + + @Override + protected void screenLoadEnd() { + controller=builder.build(this, boatSize, ministerNum, wolfNum, cabbageNum, cattleNum); + } + + /** + * �Q�[���J�n + * @param bSize + * @param mSize + * @param wSize + * @param cabSize + * @param catSize + */ + public void startGame(int bSize,int mSize,int wSize,int cabSize,int catSize){ + Intent intent = new Intent(AiGameTitle.this,MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",mSize); + intent.putExtra("wolf",wSize); + intent.putExtra("cabbage",cabSize); + intent.putExtra("cattle",catSize); + intent.putExtra("boat",bSize); + intent.putExtra("isUseAi",true); + intent.putExtra("short",0); + intent.putExtra("isNormalGameMode",true); + + RiverCrossingAI.changeActivity(); + startActivity(intent); + } + + + @Override + protected void loadSe() { + ses = new ArrayList(); + + ses.add(new CoreSeData("se/next.ogg",1,1,1,0,false,1)); + ses.add(new CoreSeData("se/select.ogg",2,1,1,2,false,1)); + + RiverCrossingAI.getSePlayer().load(ses); + + } + +} diff --git a/RiverCrossingAI/src/sample/game/main/HowToPlay.java b/RiverCrossingAI/src/sample/game/main/HowToPlay.java new file mode 100644 index 0000000..7158598 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/main/HowToPlay.java @@ -0,0 +1,62 @@ +package sample.game.main; + +import library.core.mainAI.CoreActivity; +import library.core.mainAI.RiverCrossingAI; +import sample.game.builder.HowToPlayBuilder; +import sample.game.controller.HowToPlayController; +import android.content.Intent; +import android.os.Bundle; +import android.view.MotionEvent; + +public class HowToPlay extends CoreActivity{ + + private HowToPlayBuilder builder; + private HowToPlayController controller; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + screen.setScreenSize(1280, 720); + + + builder=new HowToPlayBuilder(objectFactory); + + } + + + + @Override + protected void update(float deltaTime) { + + if(controller!=null){ + controller.update(deltaTime); + } + + } + + @Override + protected void touch(MotionEvent event) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + @Override + protected void loadSe() { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + public void startTitle(){ + Intent intent = new Intent(HowToPlay.this,UserGameTitle.class); + RiverCrossingAI.changeActivity(); + startActivity(intent); + } + + + @Override + protected void screenLoadEnd() { + controller=builder.build(this); + } + +} diff --git a/RiverCrossingAI/src/sample/game/main/MainActivity.java b/RiverCrossingAI/src/sample/game/main/MainActivity.java new file mode 100644 index 0000000..e587b78 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/main/MainActivity.java @@ -0,0 +1,165 @@ +package sample.game.main; + +import java.util.ArrayList; + +import library.core.mainAI.CoreActivity; +import library.core.mainAI.RiverCrossingAI; +import library.core.music.CoreSeData; +import sample.game.ai.Memory; +import sample.game.builder.GameBuilder; +import sample.game.controller.GameController; +import sample.game.manager.EndIsland; +import sample.game.manager.StartIsland; +import sample.game.model.BoatModel; +import sample.game.system.define; +import android.content.Intent; +import android.os.Bundle; +import android.view.MotionEvent; + +public class MainActivity extends CoreActivity{ + + private GameController gameController; + + private boolean isUseAi=true; + + private int boatSize=2; + private int ministerNum=1; + private int wolfNum=1; + private int cabbageNum=1; + private int cattleNum=1; + private int shortest=1; + + + public enum gameSeType{ + AI_MISS, + ATTENTION, + CLEAR, + CROSS, + FAILUER, + PARFECT, + RETURN, + RIDE, + NEXT, + SELECT, + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + screen.setScreenSize(1280, 720); + + Intent intent=getIntent(); + ministerNum=intent.getIntExtra("minister",1); + wolfNum=intent.getIntExtra("wolf",1); + cabbageNum=intent.getIntExtra("cabbage",1); + cattleNum=intent.getIntExtra("cattle", 1); + boatSize=intent.getIntExtra("boat", 2); + shortest=intent.getIntExtra("short", 1); + isUseAi=intent.getBooleanExtra("isUseAi",true); + + } + + @Override + protected void update(float deltaTime) { + if(gameController!=null) gameController.update(deltaTime); + } + + @Override + protected void touch(MotionEvent event) { + if(gameController!=null) gameController.onTouch(event, screen.castX(event.getX()), screen.castY(event.getY())); + } + + @Override + protected void screenLoadEnd() { + createGame(); + } + + /** + * �Q�[���̍ăX�^�[�g + */ + public void restartGame(){ + + Intent intent = new Intent(MainActivity.this,MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",ministerNum); + intent.putExtra("wolf",wolfNum); + intent.putExtra("cabbage",cabbageNum); + intent.putExtra("cattle",cattleNum); + intent.putExtra("boat",boatSize); + intent.putExtra("isUseAi",isUseAi); + intent.putExtra("short",shortest); + intent.putExtra("isNormalGameMode",true); + + RiverCrossingAI.changeActivity(); + startActivity(intent); + + } + + public void resumeStartGame(StartIsland s,EndIsland e,BoatModel b){ + Memory m=gameController.getMoveData(); + + objectFactory.deleteAll(); + textObjectFactory.deleteAll(); + + gameController=null; + GameBuilder bulBuilder=new GameBuilder(this, objectFactory, s, e, b); + gameController=bulBuilder.reBuild(isUseAi, m); + + } + + public void createGame(){ + GameBuilder builder=new GameBuilder(this,objectFactory, boatSize); + gameController=builder.build(isUseAi, ministerNum, wolfNum, cabbageNum, cattleNum); + } + + public void moveTitle(){ + + Intent intent=null; + + if(define.GAME_MODE_AI){ + intent = new Intent(MainActivity.this,AiGameTitle.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",ministerNum); + intent.putExtra("wolf",wolfNum); + intent.putExtra("cabbage",cabbageNum); + intent.putExtra("cattle",cattleNum); + intent.putExtra("boat",boatSize); + }else{ + intent = new Intent(MainActivity.this,UserGameTitle.class); + } + + RiverCrossingAI.changeActivity(); + startActivity(intent); + + + } + + public int getShortest() { + return shortest; + } + + @Override + protected void loadSe() { + + ArrayList ses = new ArrayList(); + + ses.add(new CoreSeData("se/ai_miss.ogg",gameSeType.AI_MISS.ordinal(),1,1,0,false,1)); + ses.add(new CoreSeData("se/attention.ogg",gameSeType.ATTENTION.ordinal(),1,1,2,false,1)); + ses.add(new CoreSeData("se/clear.ogg",gameSeType.CLEAR.ordinal(),1,1,0,false,1)); + ses.add(new CoreSeData("se/cross.ogg",gameSeType.CROSS.ordinal(),1,1,0,false,1)); + ses.add(new CoreSeData("se/failure.ogg",gameSeType.FAILUER.ordinal(),1,1,0,false,1)); + ses.add(new CoreSeData("se/parfect.ogg",gameSeType.PARFECT.ordinal(),1,1,0,false,1)); + ses.add(new CoreSeData("se/return.ogg",gameSeType.RETURN.ordinal(),1,1,0,true,1)); + ses.add(new CoreSeData("se/ride.ogg",gameSeType.RIDE.ordinal(),1,1,2,false,1f)); + ses.add(new CoreSeData("se/next.ogg",gameSeType.NEXT.ordinal(),1,1,1,false,1f)); + ses.add(new CoreSeData("se/select2.ogg",gameSeType.SELECT.ordinal(),0.7f,0.7f,1,false,1f)); + + RiverCrossingAI.getSePlayer().load(ses); + + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/main/StartActivity.java b/RiverCrossingAI/src/sample/game/main/StartActivity.java new file mode 100644 index 0000000..5127060 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/main/StartActivity.java @@ -0,0 +1,63 @@ +package sample.game.main; + +import sample.game.system.define; +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + + +public class StartActivity extends Activity{ + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if(define.GAME_MODE_AI){ + Intent intent = new Intent(StartActivity.this,AiGameTitle.class); + startActivity(intent); + + }else{ + Intent intent = new Intent(StartActivity.this,UserGameTitle.class); + startActivity(intent); + + + } + } + +/* @Override + protected void update(float deltaTime) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + @Override + protected void touch(MotionEvent event) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + @Override + protected void loadSe() { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + + @Override + protected void screenLoadEnd() { + if(define.GAME_MODE_AI){ + Intent intent = new Intent(StartActivity.this,AiGameTitle.class); + CoreApplication.changeActivity(); + startActivity(intent); + + }else{ + Intent intent = new Intent(StartActivity.this,UserGameTitle.class); + CoreApplication.changeActivity(); + startActivity(intent); + + } + + }*/ + + +} diff --git a/RiverCrossingAI/src/sample/game/main/UserGameTitle.java b/RiverCrossingAI/src/sample/game/main/UserGameTitle.java new file mode 100644 index 0000000..a4e689d --- /dev/null +++ b/RiverCrossingAI/src/sample/game/main/UserGameTitle.java @@ -0,0 +1,119 @@ +package sample.game.main; + +import java.util.ArrayList; + +import library.core.debug.CoreLog; +import library.core.mainAI.CoreActivity; +import library.core.mainAI.RiverCrossingAI; +import library.core.music.CoreSeData; +import sample.game.builder.TitleUserBuilder; +import sample.game.controller.TitleController; +import sample.game.controller.TitleController.Level; +import android.content.Intent; +import android.os.Bundle; +import android.view.MotionEvent; + +public class UserGameTitle extends CoreActivity{ + + private TitleUserBuilder builder; + private TitleController controller; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + CoreLog.debug("create Title"); + + screen.setScreenSize(1280, 720); + + builder=new TitleUserBuilder(objectFactory); + } + + @Override + protected void update(float deltaTime) { + if(controller!=null) controller.update(deltaTime); + + } + + @Override + protected void touch(MotionEvent event) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + if(event.getAction()==MotionEvent.ACTION_DOWN){ + CoreLog.debug(""+screen.castX(event.getX())+"/"+ screen.castY(event.getY())); + } + + } + + @Override + protected void screenLoadEnd() { + controller= builder.build(this); + } + + + /** + * �Q�[����ʂւ̑J�� + */ + public void loadGameScreen(Level level){ + + Intent intent = new Intent(UserGameTitle.this,MainActivity.class); + + switch (level) { + case easy: + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",1); + intent.putExtra("wolf",1); + intent.putExtra("cabbage",1); + intent.putExtra("cattle",1); + intent.putExtra("boat",2); + intent.putExtra("short",7); + intent.putExtra("isUseAi",false); + intent.putExtra("isNormalGameMode",true); + break; + case normal: + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",1); + intent.putExtra("wolf",1); + intent.putExtra("cabbage",1); + intent.putExtra("cattle",3); + intent.putExtra("boat",3); + intent.putExtra("short",7); + intent.putExtra("isUseAi",false); + intent.putExtra("isNormalGameMode",true); + break; + case hard: + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra("minister",1); + intent.putExtra("wolf",1); + intent.putExtra("cabbage",3); + intent.putExtra("cattle",2); + intent.putExtra("boat",3); + intent.putExtra("short",7); + intent.putExtra("isUseAi",false); + intent.putExtra("isNormalGameMode",true); + break; + } + + + startActivity(intent); + RiverCrossingAI.changeActivity(); + } + + public void loadHowToPlay(){ + Intent intent = new Intent(UserGameTitle.this,HowToPlay.class); + startActivity(intent); + RiverCrossingAI.changeActivity(); + } + + @Override + protected void loadSe() { + ArrayList ses = new ArrayList(); + + ses.add(new CoreSeData("se/next.ogg",1,1,1,0,false,1)); + ses.add(new CoreSeData("se/select.ogg",2,1,1,2,false,1)); + + RiverCrossingAI.getSePlayer().load(ses); + } + + +} diff --git a/RiverCrossingAI/src/sample/game/manager/EndIsland.java b/RiverCrossingAI/src/sample/game/manager/EndIsland.java new file mode 100644 index 0000000..c0a2427 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/manager/EndIsland.java @@ -0,0 +1,20 @@ +package sample.game.manager; + + +public class EndIsland extends Island{ + + public EndIsland(){ + this.nowTurn=false; + } + + + @Override + public EndIsland clone(){ + EndIsland e=null; + + e=(EndIsland)super.clone(); + + return e; + } + +} diff --git a/RiverCrossingAI/src/sample/game/manager/Island.java b/RiverCrossingAI/src/sample/game/manager/Island.java new file mode 100644 index 0000000..8fccb26 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/manager/Island.java @@ -0,0 +1,408 @@ +package sample.game.manager; + +import java.util.ArrayList; + +import library.core.debug.CoreLog; +import sample.game.model.CharaModel; +import sample.game.model.CharaModel.TARGET_TYPE; + + + + + +public class Island implements Cloneable{ + + protected ArrayList ministers; + protected ArrayList wolfs; + protected ArrayList cattles; + protected ArrayList cabbages; + + protected boolean nowTurn; + + private int gameOverTypeId=0; //�Q�[���I�[�o�[�^�C�v + + public Island(){ + this.ministers=new ArrayList(); + this.wolfs=new ArrayList(); + this.cattles=new ArrayList(); + this.cabbages=new ArrayList(); + + } + + @Override + public Island clone(){ + Island is=null; + + + try { + is=(Island)super.clone(); + + is.ministers=new ArrayList(); + for(int i=0;i(); + for(int i=0;i(); + for(int i=0;i(); + for(int i=0;i0){ + for (CharaModel b : ministers) { + b.setCanMove(canMove); + } + } + + if(wolfs.size()>0){ + for (CharaModel b : wolfs) { + b.setCanMove(canMove); + } + } + + if(cattles.size()>0){ + for (CharaModel b : cattles) { + b.setCanMove(canMove); + } + } + + if(cabbages.size()>0){ + for (CharaModel b : cabbages) { + b.setCanMove(canMove); + } + } + + } + + + /** + * �l�W�������̍s������ + * @param canMove + */ + public void setMoveType1(boolean canMove){ + if(ministers.size()>0){ + for (CharaModel b : ministers) { + b.setCanMove(canMove); + } + } + + } + + /** + * �����E��؃W�������̍s������ + * @param canMove + */ + public void setMoveType2(boolean canMove){ + + if(wolfs.size()>0){ + for (CharaModel b : wolfs) { + b.setCanMove(canMove); + } + } + + if(cattles.size()>0){ + for (CharaModel b : cattles) { + b.setCanMove(canMove); + } + } + + if(cabbages.size()>0){ + for (CharaModel b : cabbages) { + b.setCanMove(canMove); + } + } + + } + + public void checkMyData(){ + if(ministers.size()>0){ + for (CharaModel b : ministers) { + CoreLog.debug("minister :"+b.isCanMove()); + } + } + + if(wolfs.size()>0){ + for (CharaModel b : wolfs) { + CoreLog.debug("wolf :"+b.isCanMove()); + } + } + + if(cattles.size()>0){ + for (CharaModel b : cattles) { + CoreLog.debug("cattle :"+b.isCanMove()); + } + } + + if(cabbages.size()>0){ + for (CharaModel b : cabbages) { + CoreLog.debug("cabbage :"+b.isCanMove()); + } + } + } + + + + /** + * �Q�[���I�[�o�[���� + * @return + */ + public boolean cheakGameOver(){ + if(ministers.size()==0){ + if(wolfs.size()>0 && cattles.size()>0){ + this.gameOverTypeId=1; + return true; + }else if(cattles.size()>0 && cabbages.size()>0){ + this.gameOverTypeId=2; + return true; + } + } + return false; + } + + /** + * �e�L�����̏��������m�F + * @param type + * @return + */ + public int getCharaNum(TARGET_TYPE type){ + switch (type) { + case MINISTART: + return this.ministers.size(); + case WOLF: + return this.wolfs.size(); + case CABBAGE: + return this.cabbages.size(); + case CATTLE: + return this.cattles.size(); + } + return 0; + } + + + public ArrayList getMinisters() { + return ministers; + } + + + + + public ArrayList getWolfs() { + return wolfs; + } + + + + + public ArrayList getCattles() { + return cattles; + } + + + + + public ArrayList getCabbages() { + return cabbages; + } + + + //�ړ��”\�Ȗq�t�̐�1 + public int canMoveMinisterNum(){ + int size=0; + + if(ministers.size()>0){ + for(int i=0;i0){ + for(int i=0;i0){ + for(int i=0;i0){ + for(int i=0;i lenXs; + private ArrayList lenYs; + private ArrayList charaDefoCenterXs; + private ArrayList charaDefoCenterYs; + private float time; + + private float moveSpeed=1f; + + private int boatSize=1; + + public LayoutManager(boolean isNowTurnRight,int boatSize){ + + + rightMinisters=new CharaModel[3]; + rightCabbages=new CharaModel[3]; + rightCattels=new CharaModel[3]; + rightWolfs=new CharaModel[3]; + + leftMinisters=new CharaModel[3]; + leftCabbages=new CharaModel[3]; + leftCattels=new CharaModel[3]; + leftWolfs=new CharaModel[3]; + + + this.boatSize=boatSize; + + indexBox=new int[]{1,0,2}; + } + + + /** + * �E�ɃL������lj� + * @param type + * @param model + * @param setMove //���W�̈ړ��܂ł���Ă��܂����ǂ��� + */ + public void addRight(CharaModel model,boolean setMove){ + + int mId=0; + + switch (model.getType()) { + case MINISTART: + mId=0; + for(int i=0;i<3;i++){ + if(rightMinisters[i]==null){ + rightMinisters[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(RIGHT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case WOLF: + mId=3; + for(int i=0;i<3;i++){ + if(rightWolfs[i]==null){ + rightWolfs[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(RIGHT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case CABBAGE: + mId=1; + for(int i=0;i<3;i++){ + if(rightCabbages[i]==null){ + rightCabbages[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(RIGHT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case CATTLE: + mId=2; + for(int i=0;i<3;i++){ + if(rightCattels[i]==null){ + rightCattels[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(RIGHT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + } + + } + + + /** + * �E�̃L�����̍폜 + * @param model + */ + public void removeRight(CharaModel model){ + + switch (model.getType()) { + case MINISTART: + for(int i=0;i<3;i++){ + if(rightMinisters[i]==null) continue; + + if(rightMinisters[i].equals(model)){ + rightMinisters[i]=null; + } + } + break; + case WOLF: + for(int i=0;i<3;i++){ + if(rightWolfs[i]==null) continue; + + if(rightWolfs[i].equals(model)){ + rightWolfs[i]=null; + } + } + break; + case CABBAGE: + for(int i=0;i<3;i++){ + if(rightCabbages[i]==null) continue; + + if(rightCabbages[i].equals(model)){ + rightCabbages[i]=null; + } + } + break; + case CATTLE: + for(int i=0;i<3;i++){ + if(rightCattels[i]==null) continue; + + if(rightCattels[i].equals(model)){ + rightCattels[i]=null; + } + } + break; + } + } + + + /** + * + * @param model + * @param setMove + */ + public void addLeft(CharaModel model,boolean setMove){ + + int mId=0; + + switch (model.getType()) { + case MINISTART: + mId=0; + for(int i=0;i<3;i++){ + if(leftMinisters[i]==null){ + leftMinisters[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(LEFT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case WOLF: + mId=3; + for(int i=0;i<3;i++){ + if(leftWolfs[i]==null){ + leftWolfs[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(LEFT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case CABBAGE: + mId=1; + for(int i=0;i<3;i++){ + if(leftCabbages[i]==null){ + leftCabbages[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(LEFT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + case CATTLE: + mId=2; + for(int i=0;i<3;i++){ + if(leftCattels[i]==null){ + leftCattels[i]=model; + model.setLayoutId(mId, indexBox[i]); + if(!setMove) break; + model.setXY(LEFT_CHARA_X_TOP+CHARA_X_MARGIN*mId, CHARA_Y_TOP+CHARA_Y_MARGIN*indexBox[i]); + break; + } + } + break; + } + + } + + public void removeLeft(CharaModel model){ + switch (model.getType()) { + case MINISTART: + for(int i=0;i<3;i++){ + if(leftMinisters[i]==null) continue; + + if(leftMinisters[i].equals(model)){ + leftMinisters[i]=null; + } + } + break; + case WOLF: + for(int i=0;i<3;i++){ + if(leftWolfs[i]==null) continue; + + if(leftWolfs[i].equals(model)){ + leftWolfs[i]=null; + } + } + break; + case CABBAGE: + for(int i=0;i<3;i++){ + if(leftCabbages[i]==null) continue; + + if(leftCabbages[i].equals(model)){ + leftCabbages[i]=null; + } + } + break; + case CATTLE: + for(int i=0;i<3;i++){ + if(leftCattels[i]==null) continue; + + if(leftCattels[i].equals(model)){ + leftCattels[i]=null; + } + } + break; + } + } + + + + + /** + * �L�������{�[�g�Ɉړ����邽�߂̏������̍쐬 + * @param boat + * @param charas + */ + public void charaMove2BoatInit(BoatModel boat,ArrayList charas){ + + if(lenXs==null){ + lenXs=new ArrayList(); //�L�����ƃ{�[�g�̋��� + }else{ + lenXs.clear(); + } + + if(lenYs==null){ + lenYs=new ArrayList(); //�L�����ƃ{�[�g�̋��� + }else{ + lenYs.clear(); + } + + + //�L�����̏����ʒu�m�ۗp���X�g + if(charaDefoCenterXs==null){ + charaDefoCenterXs=new ArrayList(); + }else{ + charaDefoCenterXs.clear(); + } + + if(charaDefoCenterYs==null){ + charaDefoCenterYs=new ArrayList(); + }else{ + charaDefoCenterYs.clear(); + } + + + + //�������v�Z���� + for(int i=0;i charas,float deltaTime,float moveTime){ + + time+=deltaTime*moveSpeed; + + float rate=time/moveTime; + if(rate>=1) rate=1; + + for(int i=0;i=1){ + + for(int i=0;i charas,AiChara ai,boolean isStartIsland){ + time=0; + + boatDefoX=boat.getCenterX(); + boatDefoY=boat.getCenterY(); + + backScreenDefoX=backScreen.getCenterX(); + backScreenDefoY=backScreen.getCenterY(); + + if(charaDefoCenterXs==null){ + charaDefoCenterXs=new ArrayList(); + }else{ + charaDefoCenterXs.clear(); + } + + if(charaDefoCenterYs==null){ + charaDefoCenterYs=new ArrayList(); + }else{ + charaDefoCenterYs.clear(); + } + + for(int i=0;i rideCharas, + AiChara ai,NumBox numbox,float deltaTime,float moveTime,boolean isReturn){ + + //���Ԃ�move�ł���������̏����ݒ�ł���Ȃɒl���m�ۂ��Ȃ��Ă��ށE�E�E + + if(isReturn) { + deltaTime=-deltaTime; + } + + time+=deltaTime*moveSpeed; + + + float rate=time/moveTime; + + if(rate>1) rate=1; + else if(rate<0) rate=0; + + + if(nowBackScreenRightPoint){ + + + backScreen.setXY(backScreenDefoX+1280*rate, backScreenDefoY); + + for(int i=0;i=1){ + return true; + } + }else{ + if(rate<=0){ + return true; + } + } + + + if(!checkFlag&&rate>=0.5f){ + checkFlag=true; + controller.checkGameState(); + } + + + + return false; + + } + + + + + /** + * �L������D���牺�낷�����̏������� + */ + public void charaGetOffInit(ArrayList rideChara,boolean isStartIsland){ + + nowBackScreenRightPoint=isStartIsland; + + if(charaDefoCenterXs==null){ + charaDefoCenterXs=new ArrayList(); + }else{ + charaDefoCenterXs.clear(); + } + + if(charaDefoCenterYs==null){ + charaDefoCenterYs=new ArrayList(); + }else{ + charaDefoCenterYs.clear(); + } + + if(lenXs==null){ + lenXs=new ArrayList(); //�L�����ƃ{�[�g�̋��� + }else{ + lenXs.clear(); + } + + if(lenYs==null){ + lenYs=new ArrayList(); //�L�����ƃ{�[�g�̋��� + }else{ + lenYs.clear(); + } + + + + for(int i=0;i rideChara,float deltaTime,float moveTime){ + + time+=deltaTime*moveSpeed; + + float rate=time/moveTime; + if(rate>1) rate=1; + + + for(int i=0;i=1){ + //�L�������~�܂�����Ԃ̃A�j���[�V�����ɕύX + for(int i=0;i0){ + for(int i=0;i0){ + for(int i=0;i c=new ArrayList(); + + for(int i=0;i<4;i++){ + for(int j=0;j(); + + for(int i=0;i<4;i++){ + for(int j=0;j animations, + int startTargetAnimIndex, float centerX, float centerY, + float width, float height) { + super(animations, startTargetAnimIndex, centerX, centerY, width, height); + // TODO �����������ꂽ�R���X�g���N�^�[�E�X�^�u + } + + @Override + public void endAnimationEvent(CoreAnimation endAnim) { + // TODO �����������ꂽ���\�b�h�E�X�^�u + + } + +} diff --git a/RiverCrossingAI/src/sample/game/model/BackToTitleButton.java b/RiverCrossingAI/src/sample/game/model/BackToTitleButton.java new file mode 100644 index 0000000..7b2e3d9 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/BackToTitleButton.java @@ -0,0 +1,45 @@ +package sample.game.model; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.GameController; +import sample.game.main.MainActivity.gameSeType; + +public class BackToTitleButton extends CoreModel implements OnCoreTouchUpListener{ + + private GameController controller; + + private boolean isTouch; + + public BackToTitleButton(GameController controller,CoreImageData imageData, float centerX, + float centerY, float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.controller=controller; + + this.isTouch=true; + } + + @Override + public void onTouchUp() { + if(!isTouch) return; + + RiverCrossingAI.getSePlayer().play(gameSeType.NEXT.ordinal()); + isTouch=false; + + controller.endGameProduction(); + } + + public boolean isTouch() { + return isTouch; + } + + public void setTouch(boolean isTouch) { + this.isTouch = isTouch; + } + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/BoatModel.java b/RiverCrossingAI/src/sample/game/model/BoatModel.java new file mode 100644 index 0000000..3da1c3c --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/BoatModel.java @@ -0,0 +1,253 @@ +package sample.game.model; + +import java.util.ArrayList; + +import library.core.model.CoreAnimation; +import library.core.model.CoreAnimationModel; +import sample.game.model.CharaModel.TARGET_TYPE; + + +/*** + * + * isMountTarget()����Ȃ��H + * + * @author �M�T + * + */ +public class BoatModel extends CoreAnimationModel { + + + + + private ArrayList rideMenbers; + private int maxMenberNum; //��D�l���̐��� + + private static final int BOAT_RIGHT_X=800; + private static final int BOAT_LEFT_X=500; + private static final int BOAT_DIFER=300; + + private float time=0; + private int count=0; + + private int moveCount=10; + private int countMaxDefo=10; + private int moveSpeed=4; + private int moveSpeedDefo=4; + private int moveChangeSpeed; + + private int moveNum=0; //�ړ��� + + private boolean nowRight; + + + + + public BoatModel(int maxNum,ArrayList animations, + int startTargetAnimIndex, float centerX, float centerY, + float width, float height) { + super(animations, startTargetAnimIndex, centerX, centerY, width, height); + + this.maxMenberNum=maxNum; + this.rideMenbers=new ArrayList(); + + this.nowRight=true; + this.moveChangeSpeed=moveCount; + + moveNum=0; //�ړ��� + } + + + + @Override + public BoatModel clone(){ + + BoatModel b=null; + + b=(BoatModel)super.clone(); + b.rideMenbers=new ArrayList(this.rideMenbers); + + return b; + } + + /** + * �D�ɃL�����N�^�[���悹�� + * @param c + * @return + */ + public boolean addCharacter(CharaModel c){ + + if(maxMenberNum<=this.rideMenbers.size()){ + return false; + } + + this.rideMenbers.add(c); + + return true; + } + + public int getRideMenberNum(){ + return this.rideMenbers.size(); + } + + public int getRideMenberNum(TARGET_TYPE type){ + int num=0; + + for(int i=0;i0.05){ + time=0; + + this.setCenterX((int) (BOAT_LEFT_X+BOAT_DIFER*((float)count/moveCount))); + + //��D���Ă���Ώۂ̈ړ� + for(int i=0;imoveCount){ + moveInit(); + nowRight=true; + return true; + } + } + + + return false; + } + + + private boolean moveLeft(float deltaTime){ + + time+=deltaTime; + if(time>0.05){ + time=0; + + this.setCenterX((int) (BOAT_RIGHT_X-BOAT_DIFER*((float)count/moveCount))); + + //��D���Ă���Ώۂ̈ړ� + for(int i=0;imoveCount){ + moveInit(); + nowRight=false; + return true; + } + } + + + return false; + } + + + + public ArrayList getRideMenbers(){ + return this.rideMenbers; + } + + public CharaModel getRideMenber(int index){ + return this.rideMenbers.get(index); + } + + public void clearRideMenber(){ + this.rideMenbers.clear(); + } + + + public int getRideMaxMenberNum(){ + return this.maxMenberNum; + } + + public void difMoveNum(){ + this.moveNum--; + } + + public void addMoveNum(){ + this.moveNum++; + } + + public int getMoveNum(){ + return this.moveNum; + } + + + + @Override + public void endAnimationEvent(CoreAnimation endAnim) { + + + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/ButtonNextTurn.java b/RiverCrossingAI/src/sample/game/model/ButtonNextTurn.java new file mode 100644 index 0000000..025586d --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/ButtonNextTurn.java @@ -0,0 +1,31 @@ +package sample.game.model; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.GameController; + +public class ButtonNextTurn extends CoreModel implements OnCoreTouchUpListener{ + + private GameController controller; + + public ButtonNextTurn(GameController controller,CoreImageData imageData, float centerX, + float centerY, float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.controller=controller; + this.setShowView(false); //���̃{�^���͏����ł͔�\�� + } + + @Override + public void onTouchUp() { + if(!isShowView()) return; + + controller.changeTurn(false); + } + + + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/CharaModel.java b/RiverCrossingAI/src/sample/game/model/CharaModel.java new file mode 100644 index 0000000..e23d0ef --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/CharaModel.java @@ -0,0 +1,182 @@ +package sample.game.model; + + +import java.util.ArrayList; + +import library.core.debug.CoreLog; +import library.core.listener.OnCoreCollisionListener; +import library.core.listener.OnCoreTouchDownListener; +import library.core.model.CoreAnimation; +import library.core.model.CoreAnimationModel; +import library.core.model.CoreModel; +import sample.game.controller.GameController; + + + +public class CharaModel extends CoreAnimationModel implements + Cloneable,OnCoreCollisionListener,OnCoreTouchDownListener{ + + + + + public enum TARGET_TYPE{ + MINISTART, + WOLF, + CATTLE, + CABBAGE, + } + private TARGET_TYPE type; + + private boolean canMove; + private boolean nowTarget; + private boolean canTouch; + + private GameController controller; + + //���C�A�E�g�Ŏg�p����h�c + private int layoutXId=0; + private int layoutYId=0; + + //�^�[�Q�b�g�̂h�c���ʗp�@�Z���N�g�{�^���̂h�c�Ɏg�p + private int targetId=0; + + + + public CharaModel(GameController controller,TARGET_TYPE type,ArrayList animations, + int startTargetAnimIndex, float centerX, float centerY, + float width, float height) { + super(animations, startTargetAnimIndex, centerX, centerY, width, height); + + + this.type=type; + this.canMove=true; + this.canTouch=true; + this.nowTarget=false; + + this.controller=controller; + + this.targetId=0; + } + + @Override + public CharaModel clone(){ + CharaModel c=null; + + c=(CharaModel) super.clone(); + + return c; + } + + + /** + * ���X�^�[�g���Ȃǂ̃Q�[���̍Đݒ�Ɏg�p + */ + public void reset(){ + this.canMove=true; + this.canTouch=true; + this.nowTarget=false; + } + + /** + *���Z�b�g�������Ƃ��ɃQ�[���R���g���[���[�̃C���X�^���X���ς���Ă���̂œ���Ȃ��� + * @param g + */ + public void setGameController(GameController g){ + this.controller=g; + } + + public TARGET_TYPE getType(){ + return type; + } + + + public boolean isCanMove() { + return canMove; + } + + public void setCanMove(boolean canMove) { + this.canMove = canMove; + } + + public boolean isNowTarget() { + return nowTarget; + } + + public void setNowTarget(boolean nowTarget) { + this.nowTarget = nowTarget; + } + + + public void setLayoutId(int x,int y){ + this.layoutXId=x; + this.layoutYId=y; + } + + + + + public int getLayoutXId() { + return layoutXId; + } + + public int getLayoutYId() { + return layoutYId; + } + + public void setTargetId(int id){ + this.targetId=id; + } + + public int getTargetId(){ + return targetId; + } + + + public boolean isCanTouch() { + return canTouch; + } + + public void setCanTouch(boolean canTouch) { + this.canTouch = canTouch; + } + + @Override + public void onTouchDown() { + if(!canTouch) return; //�^�b�`�ł��Ȃ� + + + if(nowTarget){ + controller.removeTarget(this); + nowTarget=false; + }else{ + if(controller.addTarget(this)){ + nowTarget=true; + } + } + + CoreLog.debug("touch chara"); + + + } + + @Override + public void onCollisionEnter(CoreModel model) { + + } + + @Override + public void onCollisionOut(CoreModel model) { + + } + + @Override + public void onCollisionIn(CoreModel model) { + + } + + @Override + public void endAnimationEvent(CoreAnimation endAnim) { + + } + +} diff --git a/RiverCrossingAI/src/sample/game/model/CrossButton.java b/RiverCrossingAI/src/sample/game/model/CrossButton.java new file mode 100644 index 0000000..708563f --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/CrossButton.java @@ -0,0 +1,64 @@ +package sample.game.model; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.GameController; + +/** + * �n��{�^�� + * @author �M�T + * + */ +public class CrossButton extends CoreModel implements OnCoreTouchUpListener{ + + private GameController controller; + private CoreImageData onImage; + private CoreImageData offImage; + + private boolean canMove; //�n��{�^���������邩�ǂ��� + + public CrossButton(CoreImageData offImage,CoreImageData onImage,GameController controller, float centerX, float centerY, + float width, float height) { + super(offImage, centerX, centerY, width, height); + + this.offImage=offImage; + this.onImage=onImage; + this.controller=controller; + + this.canMove=false; + } + + + public boolean isCanMove() { + return canMove; + } + + + public void setCanMove(boolean canMove) { + this.canMove = canMove; + + this.setShowView(true); //�\���������Ă���”\��������̂ŁA�ꉞ���������� + + if(canMove){ + this.setImageData(onImage); + }else{ + this.setImageData(offImage); + } + } + + + + + + @Override + public void onTouchUp() { + if(canMove){ //�{�^����������ꍇ + canMove=false; + controller.changeTurn(false); + + this.setShowView(false); + } + } + +} diff --git a/RiverCrossingAI/src/sample/game/model/ExampleBox.java b/RiverCrossingAI/src/sample/game/model/ExampleBox.java new file mode 100644 index 0000000..f3af85a --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/ExampleBox.java @@ -0,0 +1,32 @@ +package sample.game.model; + +import java.util.ArrayList; + +import library.core.model.CoreModel; +import library.core.system.CoreImageData; + +public class ExampleBox extends CoreModel{ + + + private ArrayList examples; + + public ExampleBox(ArrayList examples,int num, float centerX, float centerY, + float width, float height) { + super(examples.get(0), centerX, centerY, width, height); + + this.examples=examples; + + this.setExample(num); + } + + + /** + * �������̐ݒ�@�i�c���D�l���������j + * @param num + */ + public void setExample(int num){ + this.setImageData(examples.get(num)); + } + + +} diff --git a/RiverCrossingAI/src/sample/game/model/NumBox.java b/RiverCrossingAI/src/sample/game/model/NumBox.java new file mode 100644 index 0000000..9c42140 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/NumBox.java @@ -0,0 +1,114 @@ +package sample.game.model; + +import java.util.ArrayList; + +import library.core.model.CoreModel; +import library.core.system.CoreImageData; + +public class NumBox extends CoreModel{ + + + private ArrayList rightNumModel; //0~9 + private ArrayList leftNumModel; + + private int num; + + public NumBox(int num,ArrayList leftNum,ArrayList rightNum,CoreImageData imageData, float centerX, float centerY, + float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.num=num; + + this.rightNumModel=rightNum; + this.leftNumModel=leftNum; + + this.setNmber(num); + + + } + + + public void setNmber(int num){ + + if(num>99) num=99; + + int one=0; + int ten=0; + + if(num==0){ + one=0; + ten=0; + }else{ + one=num%10; + ten=(num-one)/10; + } + + + //1�̈ʂ̕\�� + for(int i=0;i=1){ + setEmpty(false); + //�����̐ݒ� + + if(menberNum==2){ + numberIcons[0].setShowView(true); + numberIcons[1].setShowView(false); + }else if(menberNum==3){ + numberIcons[0].setShowView(false); + numberIcons[1].setShowView(true); + }else{ + numberIcons[0].setShowView(false); + numberIcons[1].setShowView(false); + } + } + } + + /** + * �A�C�R���̐؂�ւ� + * @param b + */ + private void setEmpty(boolean b){ + if(b){ + this.setImageData(emptyIcon); + }else{ + this.setImageData(charaIcon); + } + + isEmpty=b; + } + + public TARGET_TYPE getType() { + return type; + } + + + @Override + public void setShowView(boolean b){ + super.setShowView(b); + + if(!b){ + numberIcons[0].setShowView(false); + numberIcons[1].setShowView(false); + } + + } + + +} diff --git a/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayScreen.java b/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayScreen.java new file mode 100644 index 0000000..62bfa78 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayScreen.java @@ -0,0 +1,40 @@ +package sample.game.model.hotToPlay; + +import java.util.ArrayList; + +import library.core.model.CoreModel; +import library.core.system.CoreImageData; + +public class HowToPlayScreen extends CoreModel{ + + + private ArrayList backScreens; + private int page; + + private boolean pageFlag; + + public HowToPlayScreen(ArrayList screens, float centerX, + float centerY, float width, float height) { + super(screens.get(0), centerX, centerY, width, height); + + this.backScreens=screens; + + this.pageFlag=false; + this.page=0; + } + + + public void nextScreen(){ + page++; + if(backScreens.size()<=page){ + page=backScreens.size()-1; + + } + + //�w�i�̕ύX + this.setImageData(backScreens.get(page)); + + } + + +} diff --git a/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayText.java b/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayText.java new file mode 100644 index 0000000..b543c16 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/hotToPlay/HowToPlayText.java @@ -0,0 +1,56 @@ +package sample.game.model.hotToPlay; + +import java.util.ArrayList; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.HowToPlayController; + + +public class HowToPlayText extends CoreModel implements OnCoreTouchUpListener{ + + + private ArrayList textDatas; + private HowToPlayController controller; + + private boolean isTouch; + + + private int page; + + public HowToPlayText(HowToPlayController controller,ArrayList texts, float centerX, float centerY, + float width, float height) { + super(texts.get(0), centerX, centerY, width, height); + + isTouch=true; + + this.controller=controller; + this.textDatas=texts; + this.page=0; + + } + + @Override + public void onTouchUp() { + if(!isTouch) return; + + page++; + if(page>=textDatas.size()){ + page=textDatas.size()-1; + controller.goEndPhase(); + } + + this.controller.nextScreen(); + this.setImageData(textDatas.get(page)); + + } + + public void setTouch(boolean isTouch) { + this.isTouch = isTouch; + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/title/HowToPlayButton.java b/RiverCrossingAI/src/sample/game/model/title/HowToPlayButton.java new file mode 100644 index 0000000..a76d809 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/title/HowToPlayButton.java @@ -0,0 +1,44 @@ +package sample.game.model.title; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.TitleController; + +/** + * �V�ѕ��{�^�� + * @author �M�T + * + */ +public class HowToPlayButton extends CoreModel implements OnCoreTouchUpListener{ + + private TitleController controller; + private boolean canUse; + + public HowToPlayButton(TitleController controller,CoreImageData imageData, float centerX, + float centerY, float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.controller=controller; + + canUse=true; + } + + @Override + public void onTouchUp() { + if(!canUse) return; + + RiverCrossingAI.getSePlayer().play(1); + controller.selectHowToPlay(); + + } + + public void setCanUse(boolean canUse) { + this.canUse = canUse; + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/title/LevelButton.java b/RiverCrossingAI/src/sample/game/model/title/LevelButton.java new file mode 100644 index 0000000..b72d7db --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/title/LevelButton.java @@ -0,0 +1,50 @@ +package sample.game.model.title; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.TitleController; +import sample.game.controller.TitleController.Level; + +public class LevelButton extends CoreModel implements OnCoreTouchUpListener{ + + private TitleController controller; + private Level level; + + private boolean canUse=true; + + public LevelButton(Level level,TitleController controller,CoreImageData imageData, float centerX, float centerY, + float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.level=level; + this.controller=controller; + + this.canUse=true; + } + + + + @Override + public void onTouchUp() { + if(canUse){ + RiverCrossingAI.getSePlayer().play(1); + canUse=false; + controller.selectLevet(level); + } + } + + + /** + * �{�^���̗L���� + * @param canUse + */ + public void setCanUse(boolean canUse) { + this.canUse = canUse; + } + + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/title/SoundButton.java b/RiverCrossingAI/src/sample/game/model/title/SoundButton.java new file mode 100644 index 0000000..5a7c11d --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/title/SoundButton.java @@ -0,0 +1,72 @@ +package sample.game.model.title; + +import java.util.ArrayList; + +import library.core.listener.OnCoreTouchDownListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; + +public class SoundButton extends CoreModel implements OnCoreTouchDownListener{ + + + public ArrayList images; //ON��OFF�̂Q�‚̉摜 + + private boolean canUse; + private boolean isSoundOn; //�����‚��Ă��邩�ǂ��� + + public SoundButton(ArrayList images, float centerX, float centerY, + float width, float height) { + super(images.get(0), centerX, centerY, width, height); + + this.images=images; + + this.canUse=true; + this.isSoundOn=true; + } + +/* + @Override + public void onTouchUp() { + if(!canUse) return; + + if(isSoundOn){ //�����‚� + this.setImageData(images.get(0)); + }else{ //�~���[�g + this.setImageData(images.get(1)); + } + + isSoundOn=!isSoundOn; + } +*/ + + public void setCanUse(boolean canUse) { + this.canUse = canUse; + } + + + @Override + public void onTouchDown() { + if(!canUse) return; + + isSoundOn=!isSoundOn; + + + RiverCrossingAI.getSePlayer().play(2); + if(isSoundOn){ //�����‚� + RiverCrossingAI.getBgmPlayer().setMute(false); + RiverCrossingAI.getSePlayer().setMute(false); + RiverCrossingAI.getBgmPlayer().play("bgm/title.ogg", 1); + this.setImageData(images.get(0)); + }else{ //�~���[�g + RiverCrossingAI.getBgmPlayer().setMute(true); + RiverCrossingAI.getSePlayer().setMute(true); + this.setImageData(images.get(1)); + } + + + } + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/title/TitleAnimationModel.java b/RiverCrossingAI/src/sample/game/model/title/TitleAnimationModel.java new file mode 100644 index 0000000..53d6b92 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/title/TitleAnimationModel.java @@ -0,0 +1,30 @@ +package sample.game.model.title; + +import java.util.ArrayList; + +import library.core.model.CoreAnimation; +import library.core.model.CoreAnimationModel; + +/** + * �^�C�g���ŕ����Ă���L�����̃��f�� + * @author �M�T + * + */ +public class TitleAnimationModel extends CoreAnimationModel{ + + public TitleAnimationModel(ArrayList animations, + int startTargetAnimIndex, float centerX, float centerY, + float width, float height) { + super(animations, startTargetAnimIndex, centerX, centerY, width, height); + + + + } + + @Override + public void endAnimationEvent(CoreAnimation endAnim) { + + + } + +} diff --git a/RiverCrossingAI/src/sample/game/model/titleAi/NumberButton.java b/RiverCrossingAI/src/sample/game/model/titleAi/NumberButton.java new file mode 100644 index 0000000..c514140 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/titleAi/NumberButton.java @@ -0,0 +1,145 @@ +package sample.game.model.titleAi; + +import library.core.listener.OnCoreTouchDownListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.TitleAiController; + +public class NumberButton extends CoreModel implements OnCoreTouchDownListener{ + + public enum TitleAiButtonType{ + boat, + minister, + wolf, + cabbage, + cattle, + }; + + private TitleAiButtonType type=TitleAiButtonType.boat; + private int num=0; + + private CoreImageData onImage; + private CoreImageData offImage; + + private TitleAiController controller; + private boolean canUse; + + + public NumberButton(boolean isOn,TitleAiController controller,TitleAiButtonType type,int menberNum, + CoreImageData onImage,CoreImageData offImage, float centerX, float centerY, + float width, float height) { + super(offImage, centerX, centerY, width, height); + + this.type=type; + this.num=menberNum; + this.controller=controller; + + this.onImage=onImage; + this.offImage=offImage; + + this.canUse=true; + + if(isOn){ + this.setNum(); + this.setImageData(onImage); + } + } + + +/* *//** + * ���̕ύX + *//* + @Override + public void onTouchUp() { + if(!canUse) return; + + //controller.iconMove(type); + + switch (type) { + case boat: + this.controller.setBoatSize(num); + break; + case minister: + this.controller.setMinisterNum(num); + break; + case wolf: + this.controller.setWolfNum(num); + break; + case cabbage: + this.controller.setCabbageNum(num); + break; + case cattle: + this.controller.setCattleNum(num); + break; + } + + this.setImageData(onImage); + + //���g�Ɠ��������̃{�^�����I�t�ɂ��� + controller.elseButtonOff(this); + }*/ + + /** + * �{�^�����I�t�ɂ��� (�^�C�v��^���Ă��̃^�C�v�Ȃ�{�^��������) + */ + public void setOffImage(TitleAiButtonType type){ + if(type==this.type){ + this.setImageData(offImage); + } + } + + + public TitleAiButtonType getType() { + return type; + } + + +/** + * �{�^���̗L���ݒ� + * @param canUse + */ + public void setCanUse(boolean canUse) { + this.canUse = canUse; + } + + + @Override + public void onTouchDown() { + if(!canUse) return; + + RiverCrossingAI.getSePlayer().play(2); + + this.setNum(); + + this.setImageData(onImage); + + //���g�Ɠ��������̃{�^�����I�t�ɂ��� + controller.elseButtonOff(this); + + } + + + private void setNum(){ + switch (type) { + case boat: + this.controller.setBoatSize(num); + break; + case minister: + this.controller.setMinisterNum(num); + break; + case wolf: + this.controller.setWolfNum(num); + break; + case cabbage: + this.controller.setCabbageNum(num); + break; + case cattle: + this.controller.setCattleNum(num); + break; + } + } + + + +} diff --git a/RiverCrossingAI/src/sample/game/model/titleAi/TitleAiNextButton.java b/RiverCrossingAI/src/sample/game/model/titleAi/TitleAiNextButton.java new file mode 100644 index 0000000..d6c4a74 --- /dev/null +++ b/RiverCrossingAI/src/sample/game/model/titleAi/TitleAiNextButton.java @@ -0,0 +1,41 @@ +package sample.game.model.titleAi; + +import library.core.listener.OnCoreTouchUpListener; +import library.core.mainAI.RiverCrossingAI; +import library.core.model.CoreModel; +import library.core.system.CoreImageData; +import sample.game.controller.TitleAiController; + +public class TitleAiNextButton extends CoreModel implements OnCoreTouchUpListener{ + + + private TitleAiController controller; + + private boolean isTouch; + + public TitleAiNextButton(TitleAiController controller,CoreImageData imageData, float centerX, + float centerY, float width, float height) { + super(imageData, centerX, centerY, width, height); + + this.controller=controller; + + this.isTouch=true; + } + + @Override + public void onTouchUp() { + if(!isTouch) return ; + RiverCrossingAI.getSePlayer().play(1); + isTouch=false; + + controller.startGameProduct(); + + } + + public void setTouch(boolean isTouch) { + this.isTouch = isTouch; + } + + + +} diff --git a/RiverCrossingAI/src/sample/game/system/define.java b/RiverCrossingAI/src/sample/game/system/define.java new file mode 100644 index 0000000..5c37d3f --- /dev/null +++ b/RiverCrossingAI/src/sample/game/system/define.java @@ -0,0 +1,7 @@ +package sample.game.system; + +public class define { + +public static final boolean GAME_MODE_AI=true; + +}