mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Compare commits
741 Commits
github_pag
...
savegame-n
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f78a991a74 | ||
|
|
bf62a3502f | ||
|
|
ad4432a2df | ||
|
|
12350f3fdb | ||
|
|
c650e4aa75 | ||
|
|
94f81db7ba | ||
|
|
4a8f784fd5 | ||
|
|
7877fbdca7 | ||
|
|
2c67adcda2 | ||
|
|
1ff1835feb | ||
|
|
6b24efc014 | ||
|
|
894bf9ea8d | ||
|
|
dcbb525fb6 | ||
|
|
689f7820eb | ||
|
|
d47f26d038 | ||
|
|
3c5645156f | ||
|
|
edd79b4e4e | ||
|
|
8a95194465 | ||
|
|
80b55c1717 | ||
|
|
faca85e283 | ||
|
|
40d84d8c78 | ||
|
|
f0988afaa5 | ||
|
|
03b0ec16de | ||
|
|
3a31b3d00c | ||
|
|
50a697c85a | ||
|
|
af77d8e497 | ||
|
|
c6b80f1ff1 | ||
|
|
edbccb62e5 | ||
|
|
24a7578c67 | ||
|
|
200e44ad15 | ||
|
|
ac669f4aaa | ||
|
|
f73d993934 | ||
|
|
15657d08da | ||
|
|
b0829d7195 | ||
|
|
e31cee7fef | ||
|
|
ec2f4d74b2 | ||
|
|
773a9dbbe3 | ||
|
|
0de31eefd2 | ||
|
|
cd764d4c10 | ||
|
|
283418d43a | ||
|
|
e99da003d1 | ||
|
|
fc29346dee | ||
|
|
6ee86d8c56 | ||
|
|
5f91d084ed | ||
|
|
7989c84723 | ||
|
|
e280ad1423 | ||
|
|
35b762e891 | ||
|
|
b40eb7dc66 | ||
|
|
a3b74eb08a | ||
|
|
6b724c5e8d | ||
|
|
a407260c33 | ||
|
|
e0dc8e24b6 | ||
|
|
fcb21a1218 | ||
|
|
c54ade42d9 | ||
|
|
5460d52baf | ||
|
|
84c5242195 | ||
|
|
278e61cf7e | ||
|
|
7537309cd3 | ||
|
|
7dc2bcaa59 | ||
|
|
1e99c026cb | ||
|
|
ae23d99c7f | ||
|
|
a97f3cee64 | ||
|
|
c0e5f77d53 | ||
|
|
7c8e269b09 | ||
|
|
87bdd6036a | ||
|
|
4d222f7b06 | ||
|
|
9b8d0665a1 | ||
|
|
498600c6bd | ||
|
|
b2031e0f50 | ||
|
|
7536d14a34 | ||
|
|
10772abcb4 | ||
|
|
b5996767c1 | ||
|
|
1f7adadf78 | ||
|
|
810bcff78c | ||
|
|
e953d34d17 | ||
|
|
3b5fe2e622 | ||
|
|
9f46492f86 | ||
|
|
f1e69677be | ||
|
|
17e573a7a9 | ||
|
|
4cb6c26363 | ||
|
|
09974c67e4 | ||
|
|
51b0554668 | ||
|
|
3c3610d63c | ||
|
|
468ec1ee83 | ||
|
|
dcb6fcb3a6 | ||
|
|
9c080c4334 | ||
|
|
7b7fefb954 | ||
|
|
616e43ce8f | ||
|
|
318d070e05 | ||
|
|
4a7739a1bf | ||
|
|
e12250509e | ||
|
|
afb025fd91 | ||
|
|
8899cb5ea4 | ||
|
|
c6a7bc8c14 | ||
|
|
f2bb6d547b | ||
|
|
1fdcb23d04 | ||
|
|
131088ad22 | ||
|
|
5d3a51e8f2 | ||
|
|
d1cd8a8cef | ||
|
|
c2757dcbce | ||
|
|
274ef6a44f | ||
|
|
efff180339 | ||
|
|
8fb51c0647 | ||
|
|
7db9cf50ca | ||
|
|
8128707aa4 | ||
|
|
de7740ab14 | ||
|
|
31633be812 | ||
|
|
bcb5d36999 | ||
|
|
7d847dfde5 | ||
|
|
b703e774ae | ||
|
|
f6207be9d4 | ||
|
|
7c87c53421 | ||
|
|
a4ed3688a2 | ||
|
|
6ab8f5f836 | ||
|
|
f9c1724228 | ||
|
|
25c77fdf5e | ||
|
|
3bf9c6ae94 | ||
|
|
0e70b027f5 | ||
|
|
17b17187ff | ||
|
|
dc226ebe5d | ||
|
|
55f5edbb6a | ||
|
|
29d65fbf64 | ||
|
|
f3f35be0bf | ||
|
|
204c8e046c | ||
|
|
1a1710a6c2 | ||
|
|
1a2cc00184 | ||
|
|
b3b3f6ff98 | ||
|
|
7df8b0330c | ||
|
|
528dd2254e | ||
|
|
33fb7c83bf | ||
|
|
50ad382eed | ||
|
|
7d1c7cfd74 | ||
|
|
5b637099a1 | ||
|
|
0d6d725f87 | ||
|
|
a98c5d5416 | ||
|
|
3361973722 | ||
|
|
91bc6568ee | ||
|
|
2e583fbfcf | ||
|
|
50eab6ff38 | ||
|
|
d743550cc7 | ||
|
|
1c0efc8fa4 | ||
|
|
5ff38ea870 | ||
|
|
4c146f7896 | ||
|
|
4e5aa4314e | ||
|
|
5223951db4 | ||
|
|
ddcb355113 | ||
|
|
7a80e15628 | ||
|
|
34dc053011 | ||
|
|
0266449d67 | ||
|
|
ea3afcf99d | ||
|
|
c84418186c | ||
|
|
956990dbd5 | ||
|
|
08f6a2b289 | ||
|
|
741a4c02a0 | ||
|
|
dcff4939f4 | ||
|
|
506ce02697 | ||
|
|
95bd17b371 | ||
|
|
16ef7088a6 | ||
|
|
f70b0c8a41 | ||
|
|
d68d45d7c7 | ||
|
|
7af2844305 | ||
|
|
fd8c5166b6 | ||
|
|
2c931b6cd2 | ||
|
|
210069f8e9 | ||
|
|
2453897d31 | ||
|
|
dc0e758f64 | ||
|
|
ac3bf4a008 | ||
|
|
caf16299e7 | ||
|
|
cfa19ed9d9 | ||
|
|
6e5d82f340 | ||
|
|
98456b99e8 | ||
|
|
45c6e571cb | ||
|
|
e6c5545cd3 | ||
|
|
402c3ae538 | ||
|
|
f6018ab466 | ||
|
|
0ff738c85e | ||
|
|
4876e6696d | ||
|
|
167da0d70f | ||
|
|
2748aded3f | ||
|
|
103434baa0 | ||
|
|
c2da7bcbe2 | ||
|
|
c64cf99d88 | ||
|
|
de59d8de8d | ||
|
|
718886ba3a | ||
|
|
3789f1fd0a | ||
|
|
1e6df02e45 | ||
|
|
886a425aaf | ||
|
|
7e24d50c0c | ||
|
|
8f7d48c297 | ||
|
|
3cc81e2510 | ||
|
|
0f0be1c18e | ||
|
|
5f689e3d6c | ||
|
|
f04d3e40d4 | ||
|
|
68a74e07fa | ||
|
|
199cdbb787 | ||
|
|
375fcb37a2 | ||
|
|
bc1743dedf | ||
|
|
f7771f79c2 | ||
|
|
7ebce6b36b | ||
|
|
b4240eee3a | ||
|
|
514acc2b65 | ||
|
|
48bc854c8a | ||
|
|
07391dc6c7 | ||
|
|
7e905e84b7 | ||
|
|
200a45f0cb | ||
|
|
ebff0554f7 | ||
|
|
e54487d0b0 | ||
|
|
96a6e7ab20 | ||
|
|
95ff8ceb7e | ||
|
|
5aa4308e27 | ||
|
|
aa892be308 | ||
|
|
6971bcf9b5 | ||
|
|
0581e98b55 | ||
|
|
5c2e653cdf | ||
|
|
aa4cd722d2 | ||
|
|
10b2f37ed8 | ||
|
|
d7ae2a7082 | ||
|
|
c246a79726 | ||
|
|
8e4d75705e | ||
|
|
ffdaba2d8c | ||
|
|
97187071af | ||
|
|
dceab6b729 | ||
|
|
7771872947 | ||
|
|
cc123f76d6 | ||
|
|
a6ad03c534 | ||
|
|
45491871e6 | ||
|
|
8988f37896 | ||
|
|
09b4324873 | ||
|
|
a5a2764cb4 | ||
|
|
6de4d0c374 | ||
|
|
48c33d766b | ||
|
|
22493ee0e9 | ||
|
|
8afc3133c6 | ||
|
|
d0cfa29929 | ||
|
|
6a51d462d7 | ||
|
|
4f7cc4942c | ||
|
|
6631e01b64 | ||
|
|
133dffe330 | ||
|
|
6e5d17173f | ||
|
|
7463d15159 | ||
|
|
beff0f1b71 | ||
|
|
867ed36419 | ||
|
|
387c1e126f | ||
|
|
c9d7cda233 | ||
|
|
b75521da59 | ||
|
|
5f9ee8a410 | ||
|
|
296c3b453c | ||
|
|
6e2da63308 | ||
|
|
445cd9fe8e | ||
|
|
a0cc567694 | ||
|
|
70d084fba7 | ||
|
|
5236aa0bf9 | ||
|
|
0eccb511db | ||
|
|
88c17db72b | ||
|
|
098fb95653 | ||
|
|
21d6bb7b7d | ||
|
|
ce91c5c7c8 | ||
|
|
613ab9101e | ||
|
|
3fbc7cf65f | ||
|
|
dc18289d18 | ||
|
|
6473e231e4 | ||
|
|
33a61b7a57 | ||
|
|
c070a39f7c | ||
|
|
995ec0f697 | ||
|
|
6cba6872c9 | ||
|
|
8812f664e7 | ||
|
|
d9113b2dab | ||
|
|
ad0025ba03 | ||
|
|
984aa17cc0 | ||
|
|
4cad05ce6b | ||
|
|
197ab946be | ||
|
|
e4cdbc1840 | ||
|
|
04f00553ae | ||
|
|
0c02902ceb | ||
|
|
aba93fb15b | ||
|
|
1c8330b99a | ||
|
|
a8de7c2860 | ||
|
|
4ca8bbfc12 | ||
|
|
a5c004e4d4 | ||
|
|
e957e409e0 | ||
|
|
70d6340c11 | ||
|
|
bbbb69b175 | ||
|
|
4d5b7d8667 | ||
|
|
43da08f57d | ||
|
|
7b97367bdd | ||
|
|
e6fb647b99 | ||
|
|
5e4d7aba18 | ||
|
|
a96086b9af | ||
|
|
0566cf899c | ||
|
|
c8e87fb3d0 | ||
|
|
0a56a0ba86 | ||
|
|
026ccde2ff | ||
|
|
7813994b81 | ||
|
|
d3b070844f | ||
|
|
7a879f99b1 | ||
|
|
e810cdb3cb | ||
|
|
398be07c31 | ||
|
|
6db4c7bb3c | ||
|
|
c402824641 | ||
|
|
abc020e8f5 | ||
|
|
82caf260ce | ||
|
|
cbcf5ff8ca | ||
|
|
39d07bf8a8 | ||
|
|
93174f0d65 | ||
|
|
6afbeb9a2a | ||
|
|
a7cbd644f3 | ||
|
|
f674aff07c | ||
|
|
07b89a288c | ||
|
|
0264c418ca | ||
|
|
494b9c47cc | ||
|
|
6ff6c6dd6c | ||
|
|
00ab587265 | ||
|
|
67fa480805 | ||
|
|
91db56e7a7 | ||
|
|
36d52bedad | ||
|
|
c36b676720 | ||
|
|
5e0a999249 | ||
|
|
8fff4aff60 | ||
|
|
8c5344ff37 | ||
|
|
91e49b6c4a | ||
|
|
52cfb37b21 | ||
|
|
87886f08bb | ||
|
|
a31d7f9589 | ||
|
|
5600957f32 | ||
|
|
d6840a83c9 | ||
|
|
06fdd39648 | ||
|
|
b5763e7f76 | ||
|
|
75f01f20b9 | ||
|
|
dd366ab69e | ||
|
|
6ab443ec2c | ||
|
|
e0056cbf5c | ||
|
|
9f9397e1f3 | ||
|
|
d5a43cc7e1 | ||
|
|
408d8aa8b8 | ||
|
|
1e663069e8 | ||
|
|
dbcec1a199 | ||
|
|
04b4193548 | ||
|
|
058803184f | ||
|
|
5b5912c5bc | ||
|
|
759e632c07 | ||
|
|
6e311ecb64 | ||
|
|
b480fd9173 | ||
|
|
226459ddb8 | ||
|
|
92de033bc8 | ||
|
|
faf0dd061c | ||
|
|
9eaf9ea2ed | ||
|
|
00c4f77251 | ||
|
|
96ef9eedbb | ||
|
|
a5d94c03e2 | ||
|
|
9d15d380a3 | ||
|
|
bff780c837 | ||
|
|
0c493952c8 | ||
|
|
a1f6e1d29c | ||
|
|
fc71f43755 | ||
|
|
16afcf4886 | ||
|
|
b64a3c2109 | ||
|
|
5c0dc66183 | ||
|
|
3047f653bd | ||
|
|
393a478d13 | ||
|
|
560cb326f9 | ||
|
|
3fe2d7260f | ||
|
|
2cd4bc7ee5 | ||
|
|
19468b591d | ||
|
|
903117d32f | ||
|
|
f5bfc98c62 | ||
|
|
3274feb1e9 | ||
|
|
392b4d8577 | ||
|
|
92e4afde4b | ||
|
|
0c7724fe33 | ||
|
|
ca5be34fc2 | ||
|
|
28c3c7a0ec | ||
|
|
7f39cf1a6f | ||
|
|
365839571a | ||
|
|
5c3a04ca77 | ||
|
|
758a580063 | ||
|
|
ad5dbc9f9d | ||
|
|
4a86680928 | ||
|
|
ece63cf442 | ||
|
|
b487140a1b | ||
|
|
ad72bf8895 | ||
|
|
5919c429d2 | ||
|
|
1f365b170e | ||
|
|
0b6580e7c9 | ||
|
|
6efb2b3860 | ||
|
|
7ae084073f | ||
|
|
36df0b1732 | ||
|
|
b8fb100bd5 | ||
|
|
82b904d176 | ||
|
|
44723978e1 | ||
|
|
7c7b4829f6 | ||
|
|
050b027ff5 | ||
|
|
8fac65e268 | ||
|
|
111aca868c | ||
|
|
2171c16d47 | ||
|
|
acd4d84783 | ||
|
|
cc25cc97f1 | ||
|
|
93ecebc448 | ||
|
|
f5713a3eb2 | ||
|
|
90001bb4d6 | ||
|
|
357cab9b1e | ||
|
|
5ea272f286 | ||
|
|
0c876bd1c5 | ||
|
|
0ac2999694 | ||
|
|
49af3c4b6d | ||
|
|
2a54b31d31 | ||
|
|
64766ce50a | ||
|
|
311accfdd3 | ||
|
|
2b5bf2fa4a | ||
|
|
64342c96d7 | ||
|
|
f8649bb0a5 | ||
|
|
fde6608c26 | ||
|
|
3f339c14a2 | ||
|
|
922db05c4d | ||
|
|
b849de8b66 | ||
|
|
f798b29729 | ||
|
|
e58e7a2588 | ||
|
|
a1ef339831 | ||
|
|
2002d51f6b | ||
|
|
025283b70b | ||
|
|
577b1aa034 | ||
|
|
da637c0cc8 | ||
|
|
d026ff690a | ||
|
|
d14ed56669 | ||
|
|
64cfacb7ff | ||
|
|
98a800e070 | ||
|
|
35219c8e88 | ||
|
|
b636cad347 | ||
|
|
733328cd29 | ||
|
|
36db28f805 | ||
|
|
6d4c1c3c14 | ||
|
|
eadb95f8e8 | ||
|
|
014f67f270 | ||
|
|
cd8657adb4 | ||
|
|
c007fc4d1c | ||
|
|
7e6c864ba3 | ||
|
|
f2da8f767a | ||
|
|
bd856541d6 | ||
|
|
bdde2176d9 | ||
|
|
171893a2c1 | ||
|
|
c6c1d6d03d | ||
|
|
ec8b114782 | ||
|
|
aaecb8ae4a | ||
|
|
4e2e3b370c | ||
|
|
c14f8f84a0 | ||
|
|
13c8012710 | ||
|
|
3806d77b26 | ||
|
|
af94220715 | ||
|
|
af07c47832 | ||
|
|
322007e5ac | ||
|
|
af5cdb9d49 | ||
|
|
3ada8ceaa7 | ||
|
|
68fa0068dc | ||
|
|
7b5fc79375 | ||
|
|
5dfa750227 | ||
|
|
cbe0773310 | ||
|
|
72a19eeb80 | ||
|
|
a993cc5a08 | ||
|
|
83724ba408 | ||
|
|
a4cd8f7460 | ||
|
|
7a52bbb9f3 | ||
|
|
3552ff8a9f | ||
|
|
0e081f3319 | ||
|
|
1d94519e1c | ||
|
|
0bbc6adb4b | ||
|
|
b48ddd4999 | ||
|
|
be8dad981d | ||
|
|
f9708f48a4 | ||
|
|
155b01bdea | ||
|
|
19810b2099 | ||
|
|
c6886f7a3e | ||
|
|
3bea24f9cc | ||
|
|
4b8f5c4908 | ||
|
|
66d9618b1b | ||
|
|
488d6347d0 | ||
|
|
d39d0c9265 | ||
|
|
33fe96dada | ||
|
|
51fd0d0994 | ||
|
|
50833af145 | ||
|
|
ca7c2388aa | ||
|
|
8e7d6adca5 | ||
|
|
17edb96ff8 | ||
|
|
3f3869916c | ||
|
|
1d2fc7ade7 | ||
|
|
aa84e5a73d | ||
|
|
4ecf7d2dda | ||
|
|
dca1cb676c | ||
|
|
9a4f41eac2 | ||
|
|
23012b0d40 | ||
|
|
916134bd9b | ||
|
|
1d6777daae | ||
|
|
4793751ba8 | ||
|
|
185c0eaf7c | ||
|
|
4b50d13149 | ||
|
|
23b58c3e7c | ||
|
|
2d5ebc3b13 | ||
|
|
59e2e3035c | ||
|
|
6d5ddfdbfa | ||
|
|
f8ae18721f | ||
|
|
63bc7c3a4e | ||
|
|
8e72763314 | ||
|
|
9310d53362 | ||
|
|
a71dcc13a3 | ||
|
|
ea95f4ff87 | ||
|
|
f35167d112 | ||
|
|
9f935190f2 | ||
|
|
c11430cf6b | ||
|
|
8f97a27ab7 | ||
|
|
9e36f848dc | ||
|
|
b24d52b1da | ||
|
|
e2a9307560 | ||
|
|
e3ac804f61 | ||
|
|
fd504d2df5 | ||
|
|
0e615d3f11 | ||
|
|
47646457ab | ||
|
|
8e393b93d8 | ||
|
|
3289bd6fb1 | ||
|
|
23a331d655 | ||
|
|
112301c444 | ||
|
|
f50e4f1d38 | ||
|
|
d623c22b38 | ||
|
|
d11bf5b0aa | ||
|
|
e30f67e327 | ||
|
|
6946b1f2b3 | ||
|
|
96a1a5760a | ||
|
|
58b802e911 | ||
|
|
f9b095565b | ||
|
|
19817eb97d | ||
|
|
f46d2aedbf | ||
|
|
913b651953 | ||
|
|
5283eed28e | ||
|
|
deb824d50e | ||
|
|
6841d862e4 | ||
|
|
f94723b0cd | ||
|
|
ab41168736 | ||
|
|
2d73c4687a | ||
|
|
e454deb8b1 | ||
|
|
074891805a | ||
|
|
d2d32bc4ed | ||
|
|
22daeb0c33 | ||
|
|
db30253baf | ||
|
|
312cb7dec7 | ||
|
|
7befd27951 | ||
|
|
c1e3bfa7ed | ||
|
|
ddec991082 | ||
|
|
79e6fe7b65 | ||
|
|
25e36dc535 | ||
|
|
83c579a929 | ||
|
|
0c694115ee | ||
|
|
bf9723b0c1 | ||
|
|
b81bacb1fe | ||
|
|
329acad741 | ||
|
|
41ad345a89 | ||
|
|
f79633fb85 | ||
|
|
8071ebe28f | ||
|
|
09ff14bd14 | ||
|
|
fee94d4262 | ||
|
|
ec14dbe917 | ||
|
|
cc1d20aba6 | ||
|
|
4feebd058b | ||
|
|
265469f88e | ||
|
|
2dd9f8fcab | ||
|
|
50c522c20a | ||
|
|
08dea48010 | ||
|
|
781ddcf7a7 | ||
|
|
76127d9d85 | ||
|
|
e826232611 | ||
|
|
d879629e4a | ||
|
|
2e7eb84f88 | ||
|
|
10ebaf925f | ||
|
|
4c8302b11e | ||
|
|
235f1c912d | ||
|
|
a5721a4a25 | ||
|
|
5adbbd61b9 | ||
|
|
196223bf73 | ||
|
|
d89a615990 | ||
|
|
863cc1a0bb | ||
|
|
1cec98249b | ||
|
|
15ba005062 | ||
|
|
86c1b7496d | ||
|
|
0a194f1e25 | ||
|
|
6ada4c9649 | ||
|
|
2705e1c208 | ||
|
|
3ec7a76ce2 | ||
|
|
5ec9a76c65 | ||
|
|
146f62b283 | ||
|
|
b9d4e52101 | ||
|
|
934f578083 | ||
|
|
0d604f6346 | ||
|
|
5a555d554c | ||
|
|
8ccaabfb0d | ||
|
|
fb887cc869 | ||
|
|
368359af08 | ||
|
|
dc15a9ecde | ||
|
|
1f6db65a45 | ||
|
|
0a70cdd852 | ||
|
|
493f3675dd | ||
|
|
7b3b950982 | ||
|
|
58cb83ee0c | ||
|
|
97d03a76c5 | ||
|
|
d42046dc30 | ||
|
|
fc6d11b096 | ||
|
|
716d0076cd | ||
|
|
e19e73c6a1 | ||
|
|
779a2e81fd | ||
|
|
cd1e764f92 | ||
|
|
71bd56fff4 | ||
|
|
0e48faa5b2 | ||
|
|
9d0f17d2a2 | ||
|
|
67720592f4 | ||
|
|
ba97e71957 | ||
|
|
ee5f525591 | ||
|
|
bed80e48b0 | ||
|
|
90c8293fd2 | ||
|
|
6c390c6b39 | ||
|
|
9785a8ece9 | ||
|
|
362c3f8b74 | ||
|
|
bb707047a0 | ||
|
|
efe0691f74 | ||
|
|
30906135e1 | ||
|
|
0a8b598f04 | ||
|
|
b7ea7ccaab | ||
|
|
6a959f88d4 | ||
|
|
311c1cb1ae | ||
|
|
7023401f1f | ||
|
|
f4e7995b8e | ||
|
|
0712dac81b | ||
|
|
40693d99b9 | ||
|
|
8aeb391239 | ||
|
|
fc6821ea94 | ||
|
|
92a77518ae | ||
|
|
a345b22116 | ||
|
|
3d4869bf29 | ||
|
|
fa19e69494 | ||
|
|
721123fbca | ||
|
|
c0aae189c9 | ||
|
|
c9619ea6a6 | ||
|
|
7a72521cd2 | ||
|
|
e5d43460db | ||
|
|
7743cd803e | ||
|
|
96df9670b3 | ||
|
|
5319a611bc | ||
|
|
e179d0cdf6 | ||
|
|
f330a48f51 | ||
|
|
e6268fbd14 | ||
|
|
ef0ee63d6f | ||
|
|
ab0487a900 | ||
|
|
4eb9db2532 | ||
|
|
c81ee4768c | ||
|
|
a034f3aced | ||
|
|
d446548863 | ||
|
|
37e66e6bf4 | ||
|
|
a6a456882d | ||
|
|
590cb7ed42 | ||
|
|
378d8b3185 | ||
|
|
69bb657b76 | ||
|
|
e012c6473e | ||
|
|
1b10ce2796 | ||
|
|
98a97ba9d4 | ||
|
|
85e6f1d6ba | ||
|
|
c9d28f2023 | ||
|
|
2b216ec152 | ||
|
|
0d203f5962 | ||
|
|
2a3400baa9 | ||
|
|
fadf1a91a0 | ||
|
|
2c4280bb9c | ||
|
|
7a3d9ee354 | ||
|
|
223180f822 | ||
|
|
27ae0979a0 | ||
|
|
c8aab8d383 | ||
|
|
dab311041c | ||
|
|
2bbb56d2ca | ||
|
|
4ed9a78b82 | ||
|
|
b2f6e46959 | ||
|
|
921c792135 | ||
|
|
08aba800ca | ||
|
|
c62c71e64e | ||
|
|
a7ce535569 | ||
|
|
55237a6d1b | ||
|
|
edd475d765 | ||
|
|
23d476c51d | ||
|
|
a825707748 | ||
|
|
072e75e0fb | ||
|
|
68c88c424e | ||
|
|
6ef7703cc9 | ||
|
|
2047d2230f | ||
|
|
0c938b1505 | ||
|
|
559e01e6e9 | ||
|
|
fa851fd05d | ||
|
|
b812e7f3c2 | ||
|
|
bd56757e7e | ||
|
|
ec8d851211 | ||
|
|
81700155e6 | ||
|
|
6e12754d47 | ||
|
|
0459c66b3d | ||
|
|
daf4da54c4 | ||
|
|
e809006eba | ||
|
|
1775fa3ae1 | ||
|
|
bf49318d9b | ||
|
|
927fafd708 | ||
|
|
2afd109e4a | ||
|
|
765617ea52 | ||
|
|
35cf007569 | ||
|
|
54f358858b | ||
|
|
6cd22e3f63 | ||
|
|
a2cef1376d | ||
|
|
8d8ae8227b | ||
|
|
cdefb95056 | ||
|
|
1f3a7e147f | ||
|
|
062f2157c0 | ||
|
|
1a2087b2d3 | ||
|
|
f725349590 | ||
|
|
fc3c070a96 | ||
|
|
e06f10ca41 | ||
|
|
062469c955 | ||
|
|
c780518fc1 | ||
|
|
a88d346325 | ||
|
|
fb7af524e8 | ||
|
|
e6dfa8db68 | ||
|
|
e491ab4abf | ||
|
|
a61038c74b | ||
|
|
bfc843f496 | ||
|
|
696d1f086e | ||
|
|
7f0a9a1588 | ||
|
|
07568b15d0 | ||
|
|
17461da8f3 | ||
|
|
964ec8a276 | ||
|
|
7d65ddf25d | ||
|
|
2661badb73 | ||
|
|
9a3fbdf7d9 | ||
|
|
6d18e00535 | ||
|
|
127cba55f5 | ||
|
|
a4e95b1c98 | ||
|
|
2649471c5f | ||
|
|
bd17ea8cee | ||
|
|
c24c8d1444 | ||
|
|
a3c632947b | ||
|
|
edd147e970 | ||
|
|
4f1dd93ba6 | ||
|
|
737736dca2 | ||
|
|
0f32f09b0d | ||
|
|
324be2768c |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/AndorsTrail/.idea/workspace.xml
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="src" path="gen"/>
|
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
|
||||||
</classpath>
|
|
||||||
38
AndorsTrail/.gitignore
vendored
38
AndorsTrail/.gitignore
vendored
@@ -1,8 +1,12 @@
|
|||||||
# Android ignores
|
|
||||||
gen/
|
gen/
|
||||||
bin/
|
bin/
|
||||||
target/
|
target/
|
||||||
local.properties
|
local.properties
|
||||||
|
app/build/intermediates/
|
||||||
|
build/
|
||||||
|
debug/
|
||||||
|
release/
|
||||||
|
.gradle/
|
||||||
|
|
||||||
#IntelliJ
|
#IntelliJ
|
||||||
.idea/
|
.idea/
|
||||||
@@ -14,3 +18,35 @@ out/test/
|
|||||||
# Other
|
# Other
|
||||||
.metadata
|
.metadata
|
||||||
.svn/
|
.svn/
|
||||||
|
|
||||||
|
|
||||||
|
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
|
||||||
|
.gradle
|
||||||
|
**/build/
|
||||||
|
!src/**/build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Avoid ignore Gradle wrappper properties
|
||||||
|
!gradle-wrapper.properties
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# Eclipse Gradle plugin generated files
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
|
||||||
|
|
||||||
|
|
||||||
|
/AndorsTrail/.gradle
|
||||||
|
/AndorsTrail/gradle/wrapper
|
||||||
|
/AndorsTrail/app/build/
|
||||||
|
/AndorsTrail/app/debug/
|
||||||
|
/AndorsTrail/app/release/
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>AndorsTrail</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="JAVA_MODULE" version="4">
|
|
||||||
<component name="EclipseModuleManager" forced_jdk="true">
|
|
||||||
<conelement value="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" />
|
|
||||||
<conelement value="com.android.ide.eclipse.adt.LIBRARIES" />
|
|
||||||
<src_description expected_position="1">
|
|
||||||
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
|
|
||||||
<src_folder value="file://$MODULE_DIR$/gen" expected_position="1" />
|
|
||||||
</src_description>
|
|
||||||
</component>
|
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="android" name="Android">
|
|
||||||
<configuration />
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
|
||||||
<output url="file://$MODULE_DIR$/bin/classes" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module-library">
|
|
||||||
<library>
|
|
||||||
<CLASSES>
|
|
||||||
<root url="jar://$MODULE_DIR$/libs/android-support-v4.jar!/" />
|
|
||||||
</CLASSES>
|
|
||||||
<JAVADOC />
|
|
||||||
<SOURCES />
|
|
||||||
</library>
|
|
||||||
</orderEntry>
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
|
|
||||||
77
AndorsTrail/app/build.gradle
Normal file
77
AndorsTrail/app/build.gradle
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 34
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.gpl.rpg.AndorsTrail"
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 34
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
manifestPlaceholders icon_name: 'icon', fileproviderPath: 'AndorsTrail'
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||||
|
applicationIdSuffix 'beta2'
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namespace 'com.gpl.rpg.AndorsTrail'
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
res.srcDirs = ['build/gen-res', 'src/main/res']
|
||||||
|
assets.srcDirs = ['build/gen-assets', 'src/main/assets']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyRes(type: Copy) {
|
||||||
|
description "Copies the res folder to the modules res folder (& renames .tmx to .xml)"
|
||||||
|
from "${rootDir}/res"
|
||||||
|
into "${projectDir}/build/gen-res"
|
||||||
|
rename "(.*)\\.tmx", "\$1.xml"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyResValuesIn(type: Copy) {
|
||||||
|
description "Exception Indonesian language code (Old IN was renamed to now ID)"
|
||||||
|
from "${rootDir}/res/values-id/"
|
||||||
|
into "${projectDir}/build/gen-res/values-in/"
|
||||||
|
}
|
||||||
|
|
||||||
|
task copyTranslation(type: Copy) {
|
||||||
|
description("Copies the translation files to the modules translations folder")
|
||||||
|
from "${rootDir}/assets/translation"
|
||||||
|
into "${projectDir}/build/gen-assets/translation"
|
||||||
|
}
|
||||||
|
|
||||||
|
task cleanup(type: Delete) {
|
||||||
|
description("Deletes the assets/translation and the res folder from the modules folder")
|
||||||
|
delete "${projectDir}/build/gen-res", "${projectDir}/build/gen-assets/translation"
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
project.tasks.copyRes.dependsOn project.tasks.copyResValuesIn
|
||||||
|
|
||||||
|
mergeDebugResources.dependsOn project.tasks.copyRes
|
||||||
|
extractDeepLinksDebug.dependsOn project.tasks.copyRes
|
||||||
|
mergeReleaseResources.dependsOn project.tasks.copyRes
|
||||||
|
extractDeepLinksRelease.dependsOn project.tasks.copyRes
|
||||||
|
|
||||||
|
mergeDebugAssets.dependsOn project.tasks.copyTranslation
|
||||||
|
mergeReleaseAssets.dependsOn project.tasks.copyTranslation
|
||||||
|
extractDeepLinksDebug.dependsOn project.tasks.copyTranslation
|
||||||
|
extractDeepLinksRelease.dependsOn project.tasks.copyTranslation
|
||||||
|
|
||||||
|
clean.dependsOn project.tasks.cleanup
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<lint>
|
<lint>
|
||||||
<issue id="MissingTranslation" severity="ignore" />
|
<issue id="MissingTranslation" severity="ignore" />
|
||||||
<issue id="TypographyDashes" severity="ignore" />
|
<issue id="TypographyDashes" severity="ignore" />
|
||||||
@@ -3,14 +3,10 @@
|
|||||||
<manifest
|
<manifest
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.gpl.rpg.AndorsTrail"
|
package="com.gpl.rpg.AndorsTrail"
|
||||||
android:versionCode="64"
|
android:versionCode="74"
|
||||||
android:versionName="0.7.17"
|
android:versionName="0.8.8beta"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
>
|
>
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="4"
|
|
||||||
android:targetSdkVersion="30"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:smallScreens="true"
|
android:smallScreens="true"
|
||||||
@@ -27,7 +23,7 @@
|
|||||||
<application
|
<application
|
||||||
android:name="com.gpl.rpg.AndorsTrail.AndorsTrailApplication"
|
android:name="com.gpl.rpg.AndorsTrail.AndorsTrailApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:icon="@drawable/icon"
|
android:icon="@drawable/${icon_name}"
|
||||||
android:description="@string/app_description"
|
android:description="@string/app_description"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:theme="@style/AndorsTrailTheme_Blue"
|
android:theme="@style/AndorsTrailTheme_Blue"
|
||||||
@@ -36,6 +32,7 @@
|
|||||||
android:preserveLegacyExternalStorage="true"
|
android:preserveLegacyExternalStorage="true"
|
||||||
>
|
>
|
||||||
<activity
|
<activity
|
||||||
|
android:exported="true"
|
||||||
android:name="com.gpl.rpg.AndorsTrail.activity.StartScreenActivity"
|
android:name="com.gpl.rpg.AndorsTrail.activity.StartScreenActivity"
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
>
|
>
|
||||||
@@ -66,8 +63,8 @@
|
|||||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.DisplayWorldMapActivity" />
|
<activity android:name="com.gpl.rpg.AndorsTrail.activity.DisplayWorldMapActivity" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="android.support.v4.content.FileProvider"
|
android:name="androidx.core.content.FileProvider"
|
||||||
android:authorities="com.gpl.rpg.AndorsTrail.fileprovider"
|
android:authorities="${applicationId}.fileprovider"
|
||||||
android:grantUriPermissions="true"
|
android:grantUriPermissions="true"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<meta-data
|
<meta-data
|
||||||
@@ -28,11 +28,11 @@ public final class AndorsTrailApplication extends Application {
|
|||||||
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
||||||
public static final boolean DEVELOPMENT_VALIDATEDATA = false;
|
public static final boolean DEVELOPMENT_VALIDATEDATA = false;
|
||||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = false;
|
public static final boolean DEVELOPMENT_DEBUGMESSAGES = false;
|
||||||
public static final String CURRENT_VERSION_DISPLAY = "0.7.17";
|
public static final String CURRENT_VERSION_DISPLAY = "0.8.8beta";
|
||||||
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-d].*");
|
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-d].*");
|
||||||
public static final boolean DEVELOPMENT_INCOMPATIBLE_SAVEGAMES = DEVELOPMENT_DEBUGRESOURCES || DEVELOPMENT_DEBUGBUTTONS || DEVELOPMENT_FASTSPEED || !IS_RELEASE_VERSION;
|
public static final boolean DEVELOPMENT_INCOMPATIBLE_SAVEGAMES = DEVELOPMENT_DEBUGRESOURCES || DEVELOPMENT_DEBUGBUTTONS || DEVELOPMENT_FASTSPEED || !IS_RELEASE_VERSION;
|
||||||
public static final int DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION = 999;
|
public static final int DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION = 999;
|
||||||
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : 64;
|
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : 75;
|
||||||
|
|
||||||
private final AndorsTrailPreferences preferences = new AndorsTrailPreferences();
|
private final AndorsTrailPreferences preferences = new AndorsTrailPreferences();
|
||||||
private WorldContext world = new WorldContext();
|
private WorldContext world = new WorldContext();
|
||||||
@@ -78,7 +78,7 @@ public final class AndorsTrailPreferences {
|
|||||||
dest.dpadTransparency = Integer.parseInt(prefs.getString("dpadtransparency", Integer.toString(DPAD_TRANSPARENCY_50_PERCENT)));
|
dest.dpadTransparency = Integer.parseInt(prefs.getString("dpadtransparency", Integer.toString(DPAD_TRANSPARENCY_50_PERCENT)));
|
||||||
dest.dpadMinimizeable = prefs.getBoolean("dpadMinimizeable", true);
|
dest.dpadMinimizeable = prefs.getBoolean("dpadMinimizeable", true);
|
||||||
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
|
dest.optimizedDrawing = prefs.getBoolean("optimized_drawing", false);
|
||||||
dest.highQualityFilters = prefs.getBoolean("high_quality_filters", true);
|
dest.highQualityFilters = prefs.getBoolean("high_quality_filters", false);
|
||||||
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
|
dest.enableUiAnimations = prefs.getBoolean("enableUiAnimations", true);
|
||||||
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
|
dest.displayOverwriteSavegame = Integer.parseInt(prefs.getString("display_overwrite_savegame", Integer.toString(CONFIRM_OVERWRITE_SAVEGAME_ALWAYS)));
|
||||||
dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
|
dest.quickslotsPosition = Integer.parseInt(prefs.getString("quickslots_placement", Integer.toString(QUICKSLOTS_POSITION_HORIZONTAL_CENTER_BOTTOM)));
|
||||||
@@ -15,7 +15,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -46,14 +46,15 @@ import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
|||||||
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
||||||
|
|
||||||
public final class Dialogs {
|
public final class Dialogs {
|
||||||
|
|
||||||
private static void showDialogAndPause(Dialog d, final ControllerContext context) {
|
private static void showDialogAndPause(CustomDialog d, final ControllerContext context) {
|
||||||
showDialogAndPause(d, context, null);
|
showDialogAndPause(d, context, null);
|
||||||
}
|
}
|
||||||
private static void showDialogAndPause(Dialog d, final ControllerContext context, final OnDismissListener onDismiss) {
|
private static void showDialogAndPause(CustomDialog d, final ControllerContext context, final OnDismissListener onDismiss) {
|
||||||
context.gameRoundController.pause();
|
context.gameRoundController.pause();
|
||||||
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -195,7 +196,7 @@ public final class Dialogs {
|
|||||||
// itemList.setPadding(20, 0, 20, 20);
|
// itemList.setPadding(20, 0, 20, 20);
|
||||||
itemList.setAdapter(new ItemContainerAdapter(mainActivity, world.tileManager, combinedLoot.items, world.model.player));
|
itemList.setAdapter(new ItemContainerAdapter(mainActivity, world.tileManager, combinedLoot.items, world.model.player));
|
||||||
|
|
||||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||||
mainActivity.getResources().getString(title),
|
mainActivity.getResources().getString(title),
|
||||||
mainActivity.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
mainActivity.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
||||||
msg,
|
msg,
|
||||||
@@ -249,7 +250,7 @@ public final class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showHeroDied(final MainActivity mainActivity, final ControllerContext controllers) {
|
public static void showHeroDied(final MainActivity mainActivity, final ControllerContext controllers) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||||
mainActivity.getResources().getString(R.string.dialog_game_over_title),
|
mainActivity.getResources().getString(R.string.dialog_game_over_title),
|
||||||
mainActivity.getResources().getDrawable(R.drawable.ui_icon_combat),
|
mainActivity.getResources().getDrawable(R.drawable.ui_icon_combat),
|
||||||
mainActivity.getResources().getString(R.string.dialog_game_over_text),
|
mainActivity.getResources().getString(R.string.dialog_game_over_text),
|
||||||
@@ -286,7 +287,7 @@ public final class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showConfirmRest(final Activity currentActivity, final ControllerContext controllerContext, final MapObject area) {
|
public static void showConfirmRest(final Activity currentActivity, final ControllerContext controllerContext, final MapObject area) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||||
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
||||||
null,
|
null,
|
||||||
currentActivity.getResources().getString(R.string.dialog_rest_confirm_message),
|
currentActivity.getResources().getString(R.string.dialog_rest_confirm_message),
|
||||||
@@ -310,7 +311,7 @@ public final class Dialogs {
|
|||||||
// .setMessage(R.string.dialog_rest_message)
|
// .setMessage(R.string.dialog_rest_message)
|
||||||
// .setNeutralButton(android.R.string.ok, null)
|
// .setNeutralButton(android.R.string.ok, null)
|
||||||
// .create();
|
// .create();
|
||||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||||
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
currentActivity.getResources().getString(R.string.dialog_rest_title),
|
||||||
null,
|
null,
|
||||||
currentActivity.getResources().getString(R.string.dialog_rest_message),
|
currentActivity.getResources().getString(R.string.dialog_rest_message),
|
||||||
@@ -336,7 +337,7 @@ public final class Dialogs {
|
|||||||
text += currentActivity.getResources().getString(R.string.dialog_newversion_permission_information);
|
text += currentActivity.getResources().getString(R.string.dialog_newversion_permission_information);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Dialog d = CustomDialogFactory.createDialog(currentActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(currentActivity,
|
||||||
currentActivity.getResources().getString(R.string.dialog_newversion_title),
|
currentActivity.getResources().getString(R.string.dialog_newversion_title),
|
||||||
null,
|
null,
|
||||||
text,
|
text,
|
||||||
@@ -371,7 +372,7 @@ public final class Dialogs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!world.model.statistics.hasUnlimitedSaves()) {
|
if (!world.model.statistics.hasUnlimitedSaves()) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(mainActivity,
|
final CustomDialog d = CustomDialogFactory.createDialog(mainActivity,
|
||||||
mainActivity.getResources().getString(R.string.menu_save_switch_character_title),
|
mainActivity.getResources().getString(R.string.menu_save_switch_character_title),
|
||||||
null,
|
null,
|
||||||
mainActivity.getResources().getString(R.string.menu_save_switch_character),
|
mainActivity.getResources().getString(R.string.menu_save_switch_character),
|
||||||
@@ -460,7 +461,7 @@ public final class Dialogs {
|
|||||||
itemList.setAdapter(new ArrayAdapter<String>(context, R.layout.combatlog_row, android.R.id.text1, combatLogMessages));
|
itemList.setAdapter(new ArrayAdapter<String>(context, R.layout.combatlog_row, android.R.id.text1, combatLogMessages));
|
||||||
view = itemList;
|
view = itemList;
|
||||||
|
|
||||||
final Dialog d = CustomDialogFactory.createDialog(context,
|
final CustomDialog d = CustomDialogFactory.createDialog(context,
|
||||||
context.getResources().getString(R.string.combat_log_title),
|
context.getResources().getString(R.string.combat_log_title),
|
||||||
context.getResources().getDrawable(R.drawable.ui_icon_combat),
|
context.getResources().getDrawable(R.drawable.ui_icon_combat),
|
||||||
null,
|
null,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.gpl.rpg.AndorsTrail.activity;
|
package com.gpl.rpg.AndorsTrail.activity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||||
|
|
||||||
@@ -23,6 +23,7 @@ import com.gpl.rpg.AndorsTrail.controller.ItemController;
|
|||||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ejwessel
|
* @author ejwessel
|
||||||
@@ -206,7 +207,7 @@ public final class BulkSelectionInterface extends AndorsTrailBaseActivity implem
|
|||||||
// })
|
// })
|
||||||
// .setNegativeButton(android.R.string.no, null)
|
// .setNegativeButton(android.R.string.no, null)
|
||||||
// .show();
|
// .show();
|
||||||
final Dialog d = CustomDialogFactory.createDialog(v.getContext(),
|
final CustomDialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||||
v.getContext().getResources().getString(R.string.bulkselection_sell_confirmation_title),
|
v.getContext().getResources().getString(R.string.bulkselection_sell_confirmation_title),
|
||||||
v.getContext().getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
v.getContext().getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||||
message,
|
message,
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
package com.gpl.rpg.AndorsTrail.activity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||||
|
import com.gpl.rpg.AndorsTrail.R;
|
||||||
|
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||||
|
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||||
|
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||||
|
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||||
|
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||||
|
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.MainView;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
public final class DebugInterface {
|
||||||
|
private final ControllerContext controllerContext;
|
||||||
|
private final MainActivity mainActivity;
|
||||||
|
private final Resources res;
|
||||||
|
private final WorldContext world;
|
||||||
|
|
||||||
|
private DebugButton[] buttons;
|
||||||
|
private List<DebugButton> tpButtons = new ArrayList<DebugButton>();
|
||||||
|
private List<DebugButton> tpButtons2 = new ArrayList<DebugButton>();
|
||||||
|
|
||||||
|
public DebugInterface(ControllerContext controllers, WorldContext world, MainActivity mainActivity) {
|
||||||
|
this.controllerContext = controllers;
|
||||||
|
this.world = world;
|
||||||
|
this.res = mainActivity.getResources();
|
||||||
|
this.mainActivity = mainActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addDebugButtons() {
|
||||||
|
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||||
|
|
||||||
|
List<DebugButton> buttonList = new ArrayList<DebugButton>();
|
||||||
|
buttonList.addAll(Arrays.asList(new DebugButton[] {
|
||||||
|
new DebugButton("dbg", new OnClickListener() {
|
||||||
|
boolean hidden = false;
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
hidden = !hidden;
|
||||||
|
for (int i = 1; i < buttons.length; i++) {
|
||||||
|
buttons[i].b.setVisibility(hidden ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
for (DebugButton b : tpButtons) {
|
||||||
|
b.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
for (DebugButton b : tpButtons2) {
|
||||||
|
b.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("teleport", new OnClickListener() {
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
for (int i = 0; i < buttons.length; i++) {
|
||||||
|
buttons[i].b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
for (DebugButton tpButton : tpButtons) {
|
||||||
|
tpButton.b.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("dmg", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
world.model.player.damagePotential.set(500, 500);
|
||||||
|
world.model.player.attackChance = 500;
|
||||||
|
world.model.player.attackCost = 1;
|
||||||
|
showToast(mainActivity, "DEBUG: damagePotential=500, chance=500%, cost=1", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/*,new DebugButton("dmg=1", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
world.model.player.damagePotential.set(1, 1);
|
||||||
|
showToast(mainActivity, "DEBUG: damagePotential=1", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})*/
|
||||||
|
,new DebugButton("itm", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
for (ItemType item : world.itemTypes.UNITTEST_getAllItemTypes().values()) {
|
||||||
|
world.model.player.inventory.addItem(item, 10);
|
||||||
|
}
|
||||||
|
world.model.player.inventory.gold += 50000;
|
||||||
|
showToast(mainActivity, "DEBUG: added items", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("xp", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.actorStatsController.addExperience(10000);
|
||||||
|
showToast(mainActivity, "DEBUG: given 10000 exp", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("rst", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
for(PredefinedMap map : world.maps.getAllMaps()) {
|
||||||
|
map.resetTemporaryData();
|
||||||
|
}
|
||||||
|
showToast(mainActivity, "DEBUG: maps respawned", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("hp", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
world.model.player.baseTraits.maxHP = 500;
|
||||||
|
world.model.player.health.max = world.model.player.baseTraits.maxHP;
|
||||||
|
controllerContext.actorStatsController.setActorMaxHealth(world.model.player);
|
||||||
|
world.model.player.conditions.clear();
|
||||||
|
showToast(mainActivity, "DEBUG: hp set to max", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("skl", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
world.model.player.availableSkillIncreases += 10;
|
||||||
|
showToast(mainActivity, "DEBUG: 10 skill points", Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("spd", new OnClickListener() {
|
||||||
|
boolean fast = Constants.MINIMUM_INPUT_INTERVAL == Constants.MINIMUM_INPUT_INTERVAL_FAST;
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
fast = !fast;
|
||||||
|
if (fast) {
|
||||||
|
Constants.MINIMUM_INPUT_INTERVAL = Constants.MINIMUM_INPUT_INTERVAL_FAST;
|
||||||
|
} else {
|
||||||
|
Constants.MINIMUM_INPUT_INTERVAL = Constants.MINIMUM_INPUT_INTERVAL_STD;
|
||||||
|
}
|
||||||
|
MainView.SCROLL_DURATION = Constants.MINIMUM_INPUT_INTERVAL;
|
||||||
|
AndorsTrailApplication.getApplicationFromActivity(mainActivity).getControllerContext().movementController.resetMovementHandler();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("map", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
showToast(mainActivity, "DEBUG: map=" + world.model.currentMaps.map.name , Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
|
||||||
|
tpButtons.addAll(Arrays.asList(new DebugButton[] {
|
||||||
|
new DebugButton("teleport", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
for (DebugButton tpButton : tpButtons2) {
|
||||||
|
tpButton.b.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
for (DebugButton tpButton : tpButtons) {
|
||||||
|
tpButton.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("cg", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "crossglen", "hall", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("vg", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "vilegard_s", "tavern", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("cr", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "houseatcrossroads4", "down", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("lf", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "loneford9", "south", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("fh", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "fallhaven_ne", "clothes", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("prm", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "blackwater_mountain29", "south", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("bwm", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "blackwater_mountain43", "south", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("rmg", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "remgard0", "east", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("chr", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "waytolostmine2", "minerhouse4", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("ldr", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "lodarhouse0", "lodarhouse", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("sf", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "wild20", "south2", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("gm", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "guynmart_wood_1", "farmhouse", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}));
|
||||||
|
buttonList.addAll(tpButtons);
|
||||||
|
|
||||||
|
tpButtons2.addAll(Arrays.asList(new DebugButton[] {
|
||||||
|
new DebugButton("teleport", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
for (int i = 0; i < buttons.length; i++) {
|
||||||
|
buttons[i].b.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
for (DebugButton tpButton : tpButtons) {
|
||||||
|
tpButton.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
for (DebugButton tpButton : tpButtons2) {
|
||||||
|
tpButton.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("brv", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "brimhaven4", "south2", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("aru", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "mountainlake5", "north", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("ws", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "woodsettlement0", "east", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("sul", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "sullengard2", "south", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
,new DebugButton("gal", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_19", "south", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
,new DebugButton("apl", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "sullengard_apple_farm_east", "house", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
,new DebugButton("wch", new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "lake_shore_road_0", "west", 0, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}));
|
||||||
|
buttonList.addAll(tpButtons2);
|
||||||
|
|
||||||
|
buttons = buttonList.toArray(new DebugButton[buttonList.size()]);
|
||||||
|
addDebugButtons(buttons);
|
||||||
|
|
||||||
|
for (DebugButton b : tpButtons) {
|
||||||
|
b.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
for (DebugButton b : tpButtons2) {
|
||||||
|
b.b.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showToast(Context context, String msg, int duration) {
|
||||||
|
Toast.makeText(context, msg, duration).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class DebugButton {
|
||||||
|
public final String text;
|
||||||
|
public final OnClickListener listener;
|
||||||
|
public Button b = null;
|
||||||
|
public DebugButton(String text, OnClickListener listener) {
|
||||||
|
this.text = text;
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
public void makeButton(Context c, int id) {
|
||||||
|
b = new Button(c);
|
||||||
|
b.setText(text);
|
||||||
|
b.setTextSize(10);//res.getDimension(R.dimen.actionbar_text));
|
||||||
|
b.setId(id);
|
||||||
|
b.setOnClickListener(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDebugButton(DebugButton button, int id, RelativeLayout layout) {
|
||||||
|
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||||
|
|
||||||
|
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, res.getDimensionPixelSize(R.dimen.smalltext_buttonheight));
|
||||||
|
if (id == 1)
|
||||||
|
lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||||
|
else
|
||||||
|
lp.addRule(RelativeLayout.RIGHT_OF, id - 1);
|
||||||
|
lp.addRule(RelativeLayout.ABOVE, R.id.main_statusview);
|
||||||
|
button.makeButton(mainActivity, id);
|
||||||
|
button.b.setLayoutParams(lp);
|
||||||
|
layout.addView(button.b);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDebugButtons(DebugButton[] buttons) {
|
||||||
|
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||||
|
|
||||||
|
if (buttons == null || buttons.length <= 0) return;
|
||||||
|
RelativeLayout layout = (RelativeLayout) mainActivity.findViewById(R.id.main_container);
|
||||||
|
|
||||||
|
int id = 1;
|
||||||
|
for (DebugButton b : buttons) {
|
||||||
|
addDebugButton(b, id, layout);
|
||||||
|
++id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package com.gpl.rpg.AndorsTrail.activity;
|
|||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentTabHost;
|
import androidx.fragment.app.FragmentTabHost;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -0,0 +1,911 @@
|
|||||||
|
package com.gpl.rpg.AndorsTrail.activity;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.documentfile.provider.DocumentFile;
|
||||||
|
|
||||||
|
import android.text.InputType;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewGroup.LayoutParams;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||||
|
import com.gpl.rpg.AndorsTrail.AndorsTrailPreferences;
|
||||||
|
import com.gpl.rpg.AndorsTrail.R;
|
||||||
|
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||||
|
import com.gpl.rpg.AndorsTrail.model.ModelContainer;
|
||||||
|
import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
||||||
|
import com.gpl.rpg.AndorsTrail.savegames.Savegames;
|
||||||
|
import com.gpl.rpg.AndorsTrail.savegames.Savegames.FileHeader;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
|
|
||||||
|
public final class LoadSaveActivity extends AndorsTrailBaseActivity implements OnClickListener {
|
||||||
|
private boolean isLoading = true;
|
||||||
|
//region special slot numbers
|
||||||
|
private static final int SLOT_NUMBER_CREATE_NEW_SLOT = -1;
|
||||||
|
public static final int SLOT_NUMBER_EXPORT_SAVEGAMES = -2;
|
||||||
|
public static final int SLOT_NUMBER_IMPORT_SAVEGAMES = -3;
|
||||||
|
public static final int SLOT_NUMBER_IMPORT_WORLDMAP = -4;
|
||||||
|
private static final int SLOT_NUMBER_FIRST_SLOT = 1;
|
||||||
|
//endregion
|
||||||
|
private ModelContainer model;
|
||||||
|
private TileManager tileManager;
|
||||||
|
private AndorsTrailPreferences preferences;
|
||||||
|
private String newSaveName;
|
||||||
|
private LayoutParams save_name_inputParams;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
setTheme(ThemeHelper.getDialogTheme());
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
final AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||||
|
app.setWindowParameters(this);
|
||||||
|
this.model = app.getWorld().model;
|
||||||
|
this.preferences = app.getPreferences();
|
||||||
|
this.tileManager = app.getWorld().tileManager;
|
||||||
|
|
||||||
|
String loadsave = getIntent().getData().getLastPathSegment();
|
||||||
|
isLoading = (loadsave.equalsIgnoreCase("load"));
|
||||||
|
|
||||||
|
setContentView(R.layout.loadsave);
|
||||||
|
|
||||||
|
TextView tv = (TextView) findViewById(R.id.loadsave_title);
|
||||||
|
if (isLoading) {
|
||||||
|
tv.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_search, 0, 0, 0);
|
||||||
|
tv.setText(R.string.loadsave_title_load);
|
||||||
|
} else {
|
||||||
|
tv.setCompoundDrawablesWithIntrinsicBounds(android.R.drawable.ic_menu_save, 0, 0, 0);
|
||||||
|
tv.setText(R.string.loadsave_title_save);
|
||||||
|
}
|
||||||
|
|
||||||
|
ViewGroup slotList = (ViewGroup) findViewById(R.id.loadsave_slot_list);
|
||||||
|
Button slotTemplateButton = (Button) findViewById(R.id.loadsave_slot_n);
|
||||||
|
LayoutParams params = slotTemplateButton.getLayoutParams();
|
||||||
|
slotList.removeView(slotTemplateButton);
|
||||||
|
EditText save_name_inputTemplateEditText = (EditText) findViewById(R.id.save_name_input);
|
||||||
|
save_name_inputParams = slotTemplateButton.getLayoutParams();
|
||||||
|
slotList.removeView(save_name_inputTemplateEditText);
|
||||||
|
|
||||||
|
ViewGroup newSlotContainer = (ViewGroup) findViewById(R.id.loadsave_save_to_new_slot_container);
|
||||||
|
Button createNewSlot = (Button) findViewById(R.id.loadsave_save_to_new_slot);
|
||||||
|
|
||||||
|
Button exportSaves = (Button) findViewById(R.id.loadsave_export_save);
|
||||||
|
Button importSaves = (Button) findViewById(R.id.loadsave_import_save);
|
||||||
|
Button importWorldmap = (Button) findViewById(R.id.loadsave_import_worldmap);
|
||||||
|
|
||||||
|
exportSaves.setTag(SLOT_NUMBER_EXPORT_SAVEGAMES);
|
||||||
|
importSaves.setTag(SLOT_NUMBER_IMPORT_SAVEGAMES);
|
||||||
|
importWorldmap.setTag(SLOT_NUMBER_IMPORT_WORLDMAP);
|
||||||
|
|
||||||
|
ViewGroup exportImportContainer = (ViewGroup) findViewById(R.id.loadsave_export_import_save_container);
|
||||||
|
|
||||||
|
|
||||||
|
addSavegameSlotButtons(slotList, params, Savegames.getUsedSavegameSlots(this));
|
||||||
|
|
||||||
|
checkAndRequestPermissions();
|
||||||
|
|
||||||
|
if (!isLoading) {
|
||||||
|
createNewSlot.setTag(SLOT_NUMBER_CREATE_NEW_SLOT);
|
||||||
|
createNewSlot.setOnClickListener(this);
|
||||||
|
newSlotContainer.setVisibility(View.VISIBLE);
|
||||||
|
exportImportContainer.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
newSlotContainer.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
exportSaves.setOnClickListener(this);
|
||||||
|
importSaves.setOnClickListener(this);
|
||||||
|
importWorldmap.setOnClickListener(this);
|
||||||
|
exportImportContainer.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
boolean hasSavegames = !Savegames.getUsedSavegameSlots(this).isEmpty();
|
||||||
|
exportSaves.setEnabled(hasSavegames);
|
||||||
|
} else {
|
||||||
|
exportImportContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int READ_EXTERNAL_STORAGE_REQUEST = 1;
|
||||||
|
private static final int WRITE_EXTERNAL_STORAGE_REQUEST = 2;
|
||||||
|
|
||||||
|
private void checkAndRequestPermissions() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||||
|
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||||
|
if (getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
this.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||||
|
READ_EXTERNAL_STORAGE_REQUEST);
|
||||||
|
}
|
||||||
|
if (getApplicationContext().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
this.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
|
WRITE_EXTERNAL_STORAGE_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||||
|
if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
Toast.makeText(this, R.string.storage_permissions_mandatory, Toast.LENGTH_LONG).show();
|
||||||
|
((AndorsTrailApplication) getApplication()).discardWorld();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSavegameSlotButtons(ViewGroup parent,
|
||||||
|
LayoutParams params,
|
||||||
|
List<Integer> usedSavegameSlots) {
|
||||||
|
int unused = 1;
|
||||||
|
for (int slot : usedSavegameSlots) {
|
||||||
|
final FileHeader header = Savegames.quickload(this, slot);
|
||||||
|
if (header == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (unused < slot) {
|
||||||
|
Button b = new Button(this);
|
||||||
|
b.setLayoutParams(params);
|
||||||
|
b.setTag(unused);
|
||||||
|
b.setOnClickListener(this);
|
||||||
|
b.setText(getString(R.string.loadsave_empty_slot, unused));
|
||||||
|
tileManager.setImageViewTileForPlayer(getResources(), b, header.iconID);
|
||||||
|
parent.addView(b, params);
|
||||||
|
unused++;
|
||||||
|
}
|
||||||
|
unused++;
|
||||||
|
|
||||||
|
Button b = new Button(this);
|
||||||
|
b.setLayoutParams(params);
|
||||||
|
b.setTag(slot);
|
||||||
|
b.setOnClickListener(this);
|
||||||
|
b.setText(slot + ". " + header.describe());
|
||||||
|
tileManager.setImageViewTileForPlayer(getResources(), b, header.iconID);
|
||||||
|
parent.addView(b, params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelLoadSaveActivity(int slot) {
|
||||||
|
completeLoadSaveActivity(slot, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void completeLoadSaveActivity(int slot) {
|
||||||
|
completeLoadSaveActivity(slot, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void completeLoadSaveActivity(int slot, boolean success) {
|
||||||
|
Intent i = new Intent();
|
||||||
|
if (slot == SLOT_NUMBER_CREATE_NEW_SLOT) {
|
||||||
|
slot = getFirstFreeSlot();
|
||||||
|
} else if (slot == SLOT_NUMBER_EXPORT_SAVEGAMES
|
||||||
|
|| slot == SLOT_NUMBER_IMPORT_SAVEGAMES
|
||||||
|
|| slot == SLOT_NUMBER_IMPORT_WORLDMAP) {
|
||||||
|
i.putExtra("import_export", true);
|
||||||
|
|
||||||
|
if (slot == SLOT_NUMBER_IMPORT_WORLDMAP) {
|
||||||
|
i.putExtra("import_worldmap", true);
|
||||||
|
}
|
||||||
|
if (slot == SLOT_NUMBER_IMPORT_SAVEGAMES) {
|
||||||
|
i.putExtra("import_savegames", true);
|
||||||
|
}
|
||||||
|
if (slot == SLOT_NUMBER_EXPORT_SAVEGAMES) {
|
||||||
|
i.putExtra("export", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (slot < SLOT_NUMBER_FIRST_SLOT) {
|
||||||
|
slot = SLOT_NUMBER_FIRST_SLOT;
|
||||||
|
}
|
||||||
|
i.putExtra("slot", slot);
|
||||||
|
if (success) {
|
||||||
|
i.putExtra(Constants.SAVEGAME_NAME_INTENT_EXTRA, newSaveName);
|
||||||
|
setResult(Activity.RESULT_OK, i);
|
||||||
|
} else {
|
||||||
|
setResult(Activity.RESULT_CANCELED, i);
|
||||||
|
}
|
||||||
|
LoadSaveActivity.this.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getFirstFreeSlot() {
|
||||||
|
int slot;
|
||||||
|
List<Integer> usedSlots = Savegames.getUsedSavegameSlots(this);
|
||||||
|
if (usedSlots.isEmpty()) {
|
||||||
|
slot = SLOT_NUMBER_FIRST_SLOT;
|
||||||
|
} else {
|
||||||
|
slot = Collections.max(usedSlots) + 1;
|
||||||
|
}
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getConfirmOverwriteQuestion(int slot) {
|
||||||
|
if (isLoading) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getConfirmOverwriteQuestionIgnoringLoading(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getConfirmOverwriteQuestionIgnoringLoading(int slot) {
|
||||||
|
if (slot == SLOT_NUMBER_CREATE_NEW_SLOT) {
|
||||||
|
return null;//creating a new savegame
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Savegames.getSlotFile(slot, this).exists()) {
|
||||||
|
return null;//nothing in slot to overwrite
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preferences.displayOverwriteSavegame
|
||||||
|
== AndorsTrailPreferences.CONFIRM_OVERWRITE_SAVEGAME_ALWAYS) {
|
||||||
|
return getString(R.string.loadsave_save_overwrite_confirmation_all);
|
||||||
|
}
|
||||||
|
if (preferences.displayOverwriteSavegame == AndorsTrailPreferences.CONFIRM_OVERWRITE_SAVEGAME_NEVER) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String currentPlayerName = model.player.getName();
|
||||||
|
final FileHeader header = Savegames.quickload(this, slot);
|
||||||
|
if (header == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String savedPlayerName = header.playerName;
|
||||||
|
if (currentPlayerName.equals(savedPlayerName)) {
|
||||||
|
return null; //if the names match
|
||||||
|
}
|
||||||
|
|
||||||
|
return getString(R.string.loadsave_save_overwrite_confirmation, savedPlayerName, currentPlayerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final int slot = (Integer) view.getTag();
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
switch (slot) {
|
||||||
|
case SLOT_NUMBER_IMPORT_WORLDMAP:
|
||||||
|
clickImportWorldmap();
|
||||||
|
return;
|
||||||
|
case SLOT_NUMBER_IMPORT_SAVEGAMES:
|
||||||
|
clickImportSaveGames();
|
||||||
|
return;
|
||||||
|
case SLOT_NUMBER_EXPORT_SAVEGAMES:
|
||||||
|
clickExportSaveGames();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isLoading
|
||||||
|
&& slot != SLOT_NUMBER_CREATE_NEW_SLOT
|
||||||
|
&& AndorsTrailApplication.CURRENT_VERSION
|
||||||
|
== AndorsTrailApplication.DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION) {
|
||||||
|
if (!isOverwriteTargetInIncompatibleVersion(slot)) {
|
||||||
|
saveOrOverwriteSavegame(slot);
|
||||||
|
}
|
||||||
|
} else if (isLoading) {
|
||||||
|
loadSaveGame(slot);
|
||||||
|
} else {
|
||||||
|
saveOrOverwriteSavegame(slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveOrOverwriteSavegame(int slot) {
|
||||||
|
final String message = getConfirmOverwriteQuestion(slot);
|
||||||
|
if (message != null) {
|
||||||
|
showConfirmOverwriteQuestion(slot, message);
|
||||||
|
} else {
|
||||||
|
showNameSaveQuestion(slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isOverwriteTargetInIncompatibleVersion(int slot) {
|
||||||
|
final FileHeader header = Savegames.quickload(this, slot);
|
||||||
|
if (header != null
|
||||||
|
&& header.fileversion != AndorsTrailApplication.DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createErrorDialog(this,
|
||||||
|
"Overwriting not allowed",
|
||||||
|
"You are currently using a development version of Andor's trail. Overwriting a regular savegame is not allowed in development mode.");
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//region Imports/Exports
|
||||||
|
|
||||||
|
//region Export
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void exportSaveGames(Intent data) {
|
||||||
|
Uri uri = data.getData();
|
||||||
|
|
||||||
|
Context context = getApplicationContext();
|
||||||
|
ContentResolver resolver = AndorsTrailApplication.getApplicationFromActivity(this)
|
||||||
|
.getContentResolver();
|
||||||
|
|
||||||
|
File storageDir = AndroidStorage.getStorageDirectory(context,
|
||||||
|
Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||||
|
DocumentFile target = DocumentFile.fromTreeUri(context, uri);
|
||||||
|
if (target == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File[] files = storageDir.listFiles();
|
||||||
|
if (files == null) {
|
||||||
|
showErrorExportingSaveGamesUnknown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasExistingFiles = false;
|
||||||
|
for (File file : files) {
|
||||||
|
String fileName = file.getName();
|
||||||
|
|
||||||
|
DocumentFile existingFile = target.findFile(fileName);
|
||||||
|
if (existingFile != null) {
|
||||||
|
hasExistingFiles = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasExistingFiles) {
|
||||||
|
showConfirmOverwriteByExportQuestion(resolver, target, files);
|
||||||
|
} else {
|
||||||
|
exportSaveGamesFolderContentToFolder(target, files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void exportSaveGamesFolderContentToFolder(DocumentFile target, File[] files) {
|
||||||
|
DocumentFile[] sourceFiles = new DocumentFile[files.length];
|
||||||
|
|
||||||
|
File[] worldmapFiles = null;
|
||||||
|
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
File file = files[i];
|
||||||
|
if (file.isFile()) {
|
||||||
|
sourceFiles[i] = DocumentFile.fromFile(file);
|
||||||
|
} else if (file.isDirectory() && Objects.equals(file.getName(),
|
||||||
|
Constants.FILENAME_WORLDMAP_DIRECTORY)) {
|
||||||
|
worldmapFiles = file.listFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Context context = this;
|
||||||
|
File[] finalWorldmapFiles = worldmapFiles;
|
||||||
|
CopyFilesToExternalFolder(target, sourceFiles, context, finalWorldmapFiles);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void CopyFilesToExternalFolder(DocumentFile target,
|
||||||
|
DocumentFile[] sourceFiles,
|
||||||
|
Context context,
|
||||||
|
File[] finalWorldmapFiles) {
|
||||||
|
AndroidStorage.copyDocumentFilesToDirAsync(sourceFiles,
|
||||||
|
context,
|
||||||
|
target,
|
||||||
|
getString(R.string.loadsave_exporting_savegames),
|
||||||
|
(success) -> {
|
||||||
|
if (success) {
|
||||||
|
CopyWorldmapFilesAsZip(target,
|
||||||
|
context,
|
||||||
|
finalWorldmapFiles);
|
||||||
|
} else {
|
||||||
|
completeLoadSaveActivity(
|
||||||
|
SLOT_NUMBER_EXPORT_SAVEGAMES,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void CopyWorldmapFilesAsZip(DocumentFile target,
|
||||||
|
Context context,
|
||||||
|
File[] finalWorldmapFiles) {
|
||||||
|
AndroidStorage.createZipDocumentFileFromFilesAsync(finalWorldmapFiles,
|
||||||
|
context,
|
||||||
|
target,
|
||||||
|
Constants.FILENAME_WORLDMAP_DIRECTORY,
|
||||||
|
getString(R.string.loadsave_exporting_worldmap),
|
||||||
|
(successWorldmap) -> completeLoadSaveActivity(
|
||||||
|
SLOT_NUMBER_EXPORT_SAVEGAMES,
|
||||||
|
successWorldmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void importSaveGames(Intent data) {
|
||||||
|
Uri uri = data.getData();
|
||||||
|
ClipData uris = data.getClipData();
|
||||||
|
|
||||||
|
if (uri == null && uris == null) {
|
||||||
|
//no file was selected
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Context context = getApplicationContext();
|
||||||
|
ContentResolver resolver = AndorsTrailApplication.getApplicationFromActivity(this)
|
||||||
|
.getContentResolver();
|
||||||
|
|
||||||
|
File storageDir = AndroidStorage.getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||||
|
DocumentFile appSavegameFolder = DocumentFile.fromFile(storageDir);
|
||||||
|
|
||||||
|
List<Uri> uriList = new ArrayList<>();
|
||||||
|
if (uri != null) {
|
||||||
|
uriList.add(uri);
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < uris.getItemCount(); i++) {
|
||||||
|
uriList.add(uris.getItemAt(i).getUri());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
importSaveGamesFromUris(context, resolver, appSavegameFolder, uriList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void importSaveGamesFromUris(Context context,
|
||||||
|
ContentResolver resolver,
|
||||||
|
DocumentFile appSavegameFolder,
|
||||||
|
List<Uri> uriList) {
|
||||||
|
int count = uriList.size();
|
||||||
|
|
||||||
|
ArrayList<DocumentFile> alreadyExistingFiles = new ArrayList<>();
|
||||||
|
ArrayList<DocumentFile> newFiles = new ArrayList<>();
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
Uri item = uriList.get(i);
|
||||||
|
DocumentFile itemFile = DocumentFile.fromSingleUri(context, item);
|
||||||
|
boolean fileAlreadyExists = getExistsSavegameInOwnFiles(itemFile, appSavegameFolder);
|
||||||
|
if (fileAlreadyExists) {
|
||||||
|
alreadyExistingFiles.add(itemFile);
|
||||||
|
} else {
|
||||||
|
newFiles.add(itemFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alreadyExistingFiles.size() > 0) {
|
||||||
|
showConfirmOverwriteByImportQuestion(resolver, appSavegameFolder, alreadyExistingFiles, newFiles);
|
||||||
|
} else {
|
||||||
|
importSaveGames(resolver, appSavegameFolder, newFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void importSaveGames(ContentResolver resolver,
|
||||||
|
DocumentFile appSavegameFolder,
|
||||||
|
List<DocumentFile> saveFiles) {
|
||||||
|
int size = saveFiles.size();
|
||||||
|
DocumentFile[] sources = new DocumentFile[size];
|
||||||
|
DocumentFile[] targets = new DocumentFile[size];
|
||||||
|
|
||||||
|
boolean saveAsNew = false;
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
DocumentFile file = saveFiles.get(i);
|
||||||
|
if (file == null) {//null is value a marker that the next should be saved as new
|
||||||
|
saveAsNew = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int slot = getSlotFromSavegameFileName(file.getName());
|
||||||
|
if (slot == -1) {
|
||||||
|
//invalid file name
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveAsNew) {
|
||||||
|
slot = getFirstFreeSlot();
|
||||||
|
saveAsNew = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String targetName = Savegames.getSlotFileName(slot);
|
||||||
|
sources[i] = file;
|
||||||
|
targets[i] = getOrCreateDocumentFile(appSavegameFolder, targetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
AndroidStorage.copyDocumentFilesFromToAsync(sources,
|
||||||
|
this,
|
||||||
|
targets,
|
||||||
|
getString(R.string.loadsave_importing_savegames),
|
||||||
|
(sucess) -> completeLoadSaveActivity(
|
||||||
|
SLOT_NUMBER_IMPORT_SAVEGAMES,
|
||||||
|
sucess));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getExistsSavegameInOwnFiles(DocumentFile savegameFile, DocumentFile appSavegameFolder) {
|
||||||
|
if (savegameFile == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DocumentFile foundFile = appSavegameFolder.findFile(Objects.requireNonNull(savegameFile.getName()));
|
||||||
|
return foundFile != null && foundFile.exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getSlotFromSavegameFileName(String fileName) {
|
||||||
|
if (fileName == null || !fileName.startsWith(Constants.FILENAME_SAVEGAME_FILENAME_PREFIX)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
String slotStr = fileName.substring(Constants.FILENAME_SAVEGAME_FILENAME_PREFIX.length());
|
||||||
|
|
||||||
|
int slot;
|
||||||
|
try {
|
||||||
|
slot = Integer.parseInt(slotStr);
|
||||||
|
return slot;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocumentFile getOrCreateDocumentFile(DocumentFile folder, String targetName) {
|
||||||
|
DocumentFile targetFile = folder.findFile(targetName);//try finding the file
|
||||||
|
if (targetFile == null)//no file found, creating new one
|
||||||
|
{
|
||||||
|
targetFile = folder.createFile(Constants.NO_FILE_EXTENSION_MIME_TYPE, targetName);
|
||||||
|
}
|
||||||
|
return targetFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void importWorldmap(Intent data) {
|
||||||
|
Uri uri = data.getData();
|
||||||
|
|
||||||
|
Context context = AndorsTrailApplication.getApplicationFromActivity(this).getApplicationContext();
|
||||||
|
|
||||||
|
DocumentFile chosenZip = DocumentFile.fromSingleUri(context, uri);
|
||||||
|
if (chosenZip == null || !chosenZip.isFile()) {
|
||||||
|
showErrorImportingWorldmapWrongDirectory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String chosenZipName = chosenZip.getName();
|
||||||
|
if (!chosenZipName.startsWith(Constants.FILENAME_WORLDMAP_DIRECTORY)) {
|
||||||
|
showErrorImportingWorldmapWrongDirectory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File ownWorldmapFolder = getOwnWorldmapFolder(context);
|
||||||
|
|
||||||
|
|
||||||
|
AndroidStorage.unzipDocumentFileToDirectoryAsync(chosenZip,
|
||||||
|
this,
|
||||||
|
ownWorldmapFolder,
|
||||||
|
false,
|
||||||
|
getString(R.string.loadsave_importing_worldmap),
|
||||||
|
(success) -> completeLoadSaveActivity(
|
||||||
|
SLOT_NUMBER_IMPORT_WORLDMAP,
|
||||||
|
success));
|
||||||
|
}
|
||||||
|
|
||||||
|
private File getOwnWorldmapFolder(Context context) {
|
||||||
|
File storageDir = AndroidStorage.getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||||
|
File ownWorldmapFolder = null;
|
||||||
|
for (File f : storageDir.listFiles()) {
|
||||||
|
if (f.getName().equals(Constants.FILENAME_WORLDMAP_DIRECTORY)) {
|
||||||
|
ownWorldmapFolder = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ownWorldmapFolder == null) {
|
||||||
|
ownWorldmapFolder = new File(storageDir, Constants.FILENAME_WORLDMAP_DIRECTORY);
|
||||||
|
ownWorldmapFolder.mkdir();
|
||||||
|
}
|
||||||
|
return ownWorldmapFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void clickExportSaveGames() {
|
||||||
|
showStartExportInfo(view -> startActivityForResult(AndroidStorage.getNewOpenDirectoryIntent(),
|
||||||
|
-SLOT_NUMBER_EXPORT_SAVEGAMES));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void clickImportSaveGames() {
|
||||||
|
showStartImportSavesInfo(view -> startActivityForResult(AndroidStorage.getNewSelectMultipleSavegameFilesIntent(),
|
||||||
|
-SLOT_NUMBER_IMPORT_SAVEGAMES));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void clickImportWorldmap() {
|
||||||
|
showStartImportWorldmapInfo(view -> startActivityForResult(AndroidStorage.getNewSelectZipIntent(),
|
||||||
|
-SLOT_NUMBER_IMPORT_WORLDMAP));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void showConfirmOverwriteByExportQuestion(ContentResolver resolver,
|
||||||
|
DocumentFile targetFolder,
|
||||||
|
File[] files) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
getString(R.string.loadsave_export_overwrite_confirmation_title),
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
|
getString(R.string.loadsave_export_overwrite_confirmation),
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(d,
|
||||||
|
android.R.string.yes,
|
||||||
|
v -> exportSaveGamesFolderContentToFolder(targetFolder, files));
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void showConfirmOverwriteByImportQuestion(ContentResolver resolver,
|
||||||
|
DocumentFile appSavegameFolder,
|
||||||
|
List<DocumentFile> alreadyExistingFiles,
|
||||||
|
List<DocumentFile> newFiles) {
|
||||||
|
final String title = getString(R.string.loadsave_import_overwrite_confirmation_title);
|
||||||
|
String message = getString(R.string.loadsave_import_file_exists_question);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append('\n');
|
||||||
|
int amount = alreadyExistingFiles.size();
|
||||||
|
|
||||||
|
Context context = AndorsTrailApplication.getApplicationFromActivity(this).getApplicationContext();
|
||||||
|
|
||||||
|
ArrayList<CustomDialog> dialogs = new ArrayList<>(amount);
|
||||||
|
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
DocumentFile alreadyExistingFile = alreadyExistingFiles.get(i);
|
||||||
|
int slot = getSlotFromSavegameFileName(alreadyExistingFile.getName());
|
||||||
|
FileHeader existingFileHeader = Savegames.quickload(context, slot);
|
||||||
|
FileHeader importedFileHeader = null;
|
||||||
|
try (InputStream stream = resolver.openInputStream(alreadyExistingFile.getUri());
|
||||||
|
DataInputStream dataStream = new DataInputStream(stream)) {
|
||||||
|
importedFileHeader = new FileHeader(dataStream, true);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
continue;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder messageSb = new StringBuilder();
|
||||||
|
String existingFileDescription = getString(R.string.loadsave_import_existing_description,
|
||||||
|
Integer.toString(slot),
|
||||||
|
existingFileHeader.describe());
|
||||||
|
String importedFileDescription = getString(R.string.loadsave_import_imported_description,
|
||||||
|
Integer.toString(slot),
|
||||||
|
importedFileHeader.describe());
|
||||||
|
messageSb.append(getString(R.string.loadsave_import_file_exists_question,
|
||||||
|
existingFileDescription,
|
||||||
|
importedFileDescription));
|
||||||
|
|
||||||
|
|
||||||
|
String m = messageSb.toString();
|
||||||
|
CustomDialog dialog = CustomDialogFactory.createDialog(this,
|
||||||
|
title,
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
|
m,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true);
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(dialog, R.string.loadsave_import_option_keep_existing, v -> {
|
||||||
|
//do nothing
|
||||||
|
GoToNextConflictOrFinish(resolver, appSavegameFolder, newFiles, dialogs);
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(dialog, R.string.loadsave_import_option_keep_imported, v -> {
|
||||||
|
newFiles.add(alreadyExistingFile);
|
||||||
|
GoToNextConflictOrFinish(resolver, appSavegameFolder, newFiles, dialogs);
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(dialog, R.string.loadsave_import_option_add_as_new, v -> {
|
||||||
|
newFiles.add(null);//add a null element as marker to know later if the next file
|
||||||
|
// should be imported as new or overwrite the existing one
|
||||||
|
newFiles.add(alreadyExistingFile);
|
||||||
|
GoToNextConflictOrFinish(resolver, appSavegameFolder, newFiles, dialogs);
|
||||||
|
});
|
||||||
|
|
||||||
|
CustomDialogFactory.addCancelButton(dialog, android.R.string.cancel);
|
||||||
|
CustomDialogFactory.setCancelListener(dialog, v -> {
|
||||||
|
completeLoadSaveActivity(SLOT_NUMBER_IMPORT_SAVEGAMES, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogs.add(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
GoToNextConflictOrFinish(resolver, appSavegameFolder, newFiles, dialogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void GoToNextConflictOrFinish(ContentResolver resolver,
|
||||||
|
DocumentFile appSavegameFolder,
|
||||||
|
List<DocumentFile> newFiles,
|
||||||
|
ArrayList<CustomDialog> dialogs) {
|
||||||
|
if (dialogs.stream().count() > 0) {
|
||||||
|
CustomDialog d = dialogs.remove(0);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
} else {
|
||||||
|
importSaveGames(resolver, appSavegameFolder, newFiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (resultCode != Activity.RESULT_OK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
switch (-requestCode) {
|
||||||
|
case SLOT_NUMBER_EXPORT_SAVEGAMES:
|
||||||
|
exportSaveGames(data);
|
||||||
|
return;
|
||||||
|
case SLOT_NUMBER_IMPORT_SAVEGAMES:
|
||||||
|
importSaveGames(data);
|
||||||
|
return;
|
||||||
|
case SLOT_NUMBER_IMPORT_WORLDMAP:
|
||||||
|
importWorldmap(data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
private void loadSaveGame(int slot) {
|
||||||
|
if (!Savegames.getSlotFile(slot, this).exists()) {
|
||||||
|
showErrorLoadingEmptySlot();
|
||||||
|
} else {
|
||||||
|
final FileHeader header = Savegames.quickload(this, slot);
|
||||||
|
if (header != null && !header.hasUnlimitedSaves) {
|
||||||
|
showSlotGetsDeletedOnLoadWarning(slot);
|
||||||
|
} else {
|
||||||
|
completeLoadSaveActivity(slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//region show Dialogs
|
||||||
|
|
||||||
|
//region Import/Export
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void showStartExportInfo(OnClickListener onOk) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
getString(R.string.loadsave_export),
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||||
|
getString(R.string.loadsave_export_info),
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.yes, onOk);
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void showStartImportSavesInfo(OnClickListener onOk) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
getString(R.string.loadsave_import_save),
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||||
|
getString(R.string.loadsave_import_save_info),
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.yes, onOk);
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||||
|
private void showStartImportWorldmapInfo(OnClickListener onOk) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
getString(R.string.loadsave_import_worldmap),
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||||
|
getString(R.string.loadsave_import_worldmap_info),
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.yes, onOk);
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showErrorImportingWorldmapWrongDirectory() {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createErrorDialog(this,
|
||||||
|
getString(R.string.loadsave_import_worldmap_unsuccessfull),
|
||||||
|
getString(R.string.loadsave_import_worldmap_wrong_file));
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showErrorExportingSaveGamesUnknown() {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createErrorDialog(this,
|
||||||
|
getString(R.string.loadsave_export_unsuccessfull),
|
||||||
|
getString(R.string.loadsave_export_error_unknown));
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
private void showErrorLoadingEmptySlot() {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createErrorDialog(this,
|
||||||
|
getString(R.string.startscreen_error_loading_game),
|
||||||
|
getString(R.string.startscreen_error_loading_empty_slot));
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showSlotGetsDeletedOnLoadWarning(final int slot) {
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
getString(R.string.startscreen_attention_slot_gets_delete_on_load),
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
|
getString(R.string.startscreen_attention_message_slot_gets_delete_on_load),
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.ok, v -> completeLoadSaveActivity(slot));
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showConfirmOverwriteQuestion(final int slot, String message) {
|
||||||
|
final String title = getString(R.string.loadsave_save_overwrite_confirmation_title) + ' '
|
||||||
|
+ getString(R.string.loadsave_save_overwrite_confirmation_slot, slot);
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
title,
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
|
message,
|
||||||
|
null,
|
||||||
|
true);
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.ok, v -> showNameSaveQuestion(slot));
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showNameSaveQuestion(final int slot) {
|
||||||
|
final String title = getString(R.string.loadsave_save_name_question);
|
||||||
|
final EditText input = new EditText(this);
|
||||||
|
input.setLayoutParams(save_name_inputParams);
|
||||||
|
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||||
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
|
title,
|
||||||
|
getResources().getDrawable(android.R.drawable.ic_menu_save),
|
||||||
|
null,
|
||||||
|
input,
|
||||||
|
true);
|
||||||
|
|
||||||
|
CustomDialogFactory.addButton(d, android.R.string.ok, v -> {
|
||||||
|
final String name = input.getText().toString();
|
||||||
|
Log.d("com.gpl.rpg.AndorsTrail.beta2", "showNameSaveQuestion: ");
|
||||||
|
if (name.length() == 0) {
|
||||||
|
Toast.makeText(this, getString(R.string.loadsave_save_name_empty), Toast.LENGTH_SHORT).show();
|
||||||
|
}else {
|
||||||
|
Toast.makeText(this, getString(R.string.loadsave_save_name_filled, name), Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
newSaveName = name;
|
||||||
|
completeLoadSaveActivity(slot);});
|
||||||
|
CustomDialogFactory.addDismissButton(d, android.R.string.no);
|
||||||
|
CustomDialogFactory.show(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
//endregion
|
||||||
|
|
||||||
|
}
|
||||||
@@ -20,11 +20,12 @@ import com.gpl.rpg.AndorsTrail.savegames.Savegames;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
|
|
||||||
public final class LoadingActivity extends AndorsTrailBaseActivity implements OnResourcesLoadedListener, OnSceneLoadedListener {
|
public final class LoadingActivity extends AndorsTrailBaseActivity implements OnResourcesLoadedListener, OnSceneLoadedListener {
|
||||||
|
|
||||||
private WorldSetup setup;
|
private WorldSetup setup;
|
||||||
private Dialog progressDialog;
|
private CustomDialog progressDialog;
|
||||||
private CloudsAnimatorView clouds_back, clouds_mid, clouds_front;
|
private CloudsAnimatorView clouds_back, clouds_mid, clouds_front;
|
||||||
boolean loaded = false;
|
boolean loaded = false;
|
||||||
|
|
||||||
@@ -165,7 +166,7 @@ public final class LoadingActivity extends AndorsTrailBaseActivity implements On
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showLoadingFailedDialog(int messageResourceID) {
|
private void showLoadingFailedDialog(int messageResourceID) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(this, getResources().getString(R.string.dialog_loading_failed_title), null, getResources().getString(messageResourceID), null, true);
|
final CustomDialog d = CustomDialogFactory.createDialog(this, getResources().getString(R.string.dialog_loading_failed_title), null, getResources().getString(messageResourceID), null, true);
|
||||||
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
||||||
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
CustomDialogFactory.setDismissListener(d, new OnDismissListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -43,6 +43,7 @@ import com.gpl.rpg.AndorsTrail.util.Coord;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CombatView;
|
import com.gpl.rpg.AndorsTrail.view.CombatView;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
import com.gpl.rpg.AndorsTrail.view.DisplayActiveActorConditionIcons;
|
import com.gpl.rpg.AndorsTrail.view.DisplayActiveActorConditionIcons;
|
||||||
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
import com.gpl.rpg.AndorsTrail.view.ItemContainerAdapter;
|
||||||
import com.gpl.rpg.AndorsTrail.view.MainView;
|
import com.gpl.rpg.AndorsTrail.view.MainView;
|
||||||
@@ -147,7 +148,8 @@ public final class MainActivity
|
|||||||
case INTENTREQUEST_SAVEGAME:
|
case INTENTREQUEST_SAVEGAME:
|
||||||
if (resultCode != Activity.RESULT_OK) break;
|
if (resultCode != Activity.RESULT_OK) break;
|
||||||
final int slot = data.getIntExtra("slot", 1);
|
final int slot = data.getIntExtra("slot", 1);
|
||||||
if (save(slot)) {
|
final String saveName = data.getStringExtra(Constants.SAVEGAME_NAME_INTENT_EXTRA);
|
||||||
|
if (save(slot, saveName)) {
|
||||||
Toast.makeText(this, getResources().getString(R.string.menu_save_gamesaved, slot), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getResources().getString(R.string.menu_save_gamesaved, slot), Toast.LENGTH_SHORT).show();
|
||||||
if (!world.model.statistics.hasUnlimitedSaves()) {
|
if (!world.model.statistics.hasUnlimitedSaves()) {
|
||||||
finish();
|
finish();
|
||||||
@@ -160,7 +162,10 @@ public final class MainActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean save(int slot) {
|
private boolean save(int slot) {
|
||||||
return Savegames.saveWorld(world, this, slot);
|
return save(slot, null);
|
||||||
|
}
|
||||||
|
private boolean save(int slot, String saveName) {
|
||||||
|
return Savegames.saveWorld(world, this, slot, saveName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -247,7 +252,7 @@ public final class MainActivity
|
|||||||
final ItemContainerAdapter inventoryListAdapter = new QuickslotsItemContainerAdapter(lv.getContext(), world.tileManager, world.model.player.inventory.usableItems(), world.model.player, wornTiles);
|
final ItemContainerAdapter inventoryListAdapter = new QuickslotsItemContainerAdapter(lv.getContext(), world.tileManager, world.model.player.inventory.usableItems(), world.model.player, wornTiles);
|
||||||
lv.setAdapter(inventoryListAdapter);
|
lv.setAdapter(inventoryListAdapter);
|
||||||
|
|
||||||
final Dialog d = CustomDialogFactory.createDialog(v.getContext(),
|
final CustomDialog d = CustomDialogFactory.createDialog(v.getContext(),
|
||||||
v.getResources().getString(R.string.inventory_assign),
|
v.getResources().getString(R.string.inventory_assign),
|
||||||
v.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
v.getResources().getDrawable(R.drawable.ui_icon_equipment),
|
||||||
v.getResources().getString(R.string.inventory_selectitem), view, false);
|
v.getResources().getString(R.string.inventory_selectitem), view, false);
|
||||||
@@ -30,6 +30,7 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
|||||||
private RangeBar hp;
|
private RangeBar hp;
|
||||||
private ViewGroup monsterinfo_container;
|
private ViewGroup monsterinfo_container;
|
||||||
private TextView monsterinfo_max_ap;
|
private TextView monsterinfo_max_ap;
|
||||||
|
private TextView monsterinfo_killcount;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,6 +48,7 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
|||||||
monsterinfo_title = (TextView) findViewById(R.id.monsterinfo_title);
|
monsterinfo_title = (TextView) findViewById(R.id.monsterinfo_title);
|
||||||
monsterinfo_difficulty = (TextView) findViewById(R.id.monsterinfo_difficulty);
|
monsterinfo_difficulty = (TextView) findViewById(R.id.monsterinfo_difficulty);
|
||||||
monsterinfo_max_ap = (TextView) findViewById(R.id.monsterinfo_max_ap);
|
monsterinfo_max_ap = (TextView) findViewById(R.id.monsterinfo_max_ap);
|
||||||
|
monsterinfo_killcount = (TextView) findViewById(R.id.monsterinfo_killcount);
|
||||||
|
|
||||||
Button b = (Button) findViewById(R.id.monsterinfo_close);
|
Button b = (Button) findViewById(R.id.monsterinfo_close);
|
||||||
b.setOnClickListener(new OnClickListener() {
|
b.setOnClickListener(new OnClickListener() {
|
||||||
@@ -94,6 +96,7 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
|||||||
false);
|
false);
|
||||||
hp.update(monster.getMaxHP(), monster.getCurrentHP());
|
hp.update(monster.getMaxHP(), monster.getCurrentHP());
|
||||||
monsterinfo_max_ap.setText(Integer.toString(monster.getMaxAP()));
|
monsterinfo_max_ap.setText(Integer.toString(monster.getMaxAP()));
|
||||||
|
monsterinfo_killcount.setText(Integer.toString(world.model.statistics.getNumberOfKillsForMonsterName(monster.getName()) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMonsterDifficultyResource(ControllerContext controllerContext, Monster monster) {
|
public static int getMonsterDifficultyResource(ControllerContext controllerContext, Monster monster) {
|
||||||
@@ -2,7 +2,7 @@ package com.gpl.rpg.AndorsTrail.activity;
|
|||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentTabHost;
|
import androidx.fragment.app.FragmentTabHost;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
@@ -11,6 +11,7 @@ import com.gpl.rpg.AndorsTrail.resource.tiles.TileManager;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
import com.gpl.rpg.AndorsTrail.view.CloudsAnimatorView;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@@ -20,8 +21,8 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.AnimationDrawable;
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager.OnBackStackChangedListener;
|
import androidx.fragment.app.FragmentManager.OnBackStackChangedListener;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
@@ -114,7 +115,7 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
|||||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||||
if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
final Dialog d = CustomDialogFactory.createDialog(this,
|
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||||
getResources().getString(R.string.dialog_permission_information_title),
|
getResources().getString(R.string.dialog_permission_information_title),
|
||||||
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
getResources().getDrawable(android.R.drawable.ic_dialog_info),
|
||||||
getResources().getString(R.string.dialog_permission_information),
|
getResources().getString(R.string.dialog_permission_information),
|
||||||
@@ -5,7 +5,7 @@ import java.util.Arrays;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -8,7 +8,7 @@ import java.util.Map;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -4,7 +4,7 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -12,7 +12,7 @@ import android.content.SharedPreferences.Editor;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -38,25 +38,26 @@ import com.gpl.rpg.AndorsTrail.util.AndroidStorage;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.L;
|
import com.gpl.rpg.AndorsTrail.util.L;
|
||||||
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
import com.gpl.rpg.AndorsTrail.util.ThemeHelper;
|
||||||
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory;
|
||||||
|
import com.gpl.rpg.AndorsTrail.view.CustomDialogFactory.CustomDialog;
|
||||||
|
|
||||||
public class StartScreenActivity_MainMenu extends Fragment {
|
public class StartScreenActivity_MainMenu extends Fragment {
|
||||||
|
|
||||||
private static final int INTENTREQUEST_PREFERENCES = 7;
|
private static final int INTENTREQUEST_PREFERENCES = 7;
|
||||||
public static final int INTENTREQUEST_LOADGAME = 9;
|
public static final int INTENTREQUEST_LOADGAME = 9;
|
||||||
|
|
||||||
private boolean hasExistingGame = false;
|
private boolean hasExistingGame = false;
|
||||||
private Button startscreen_continue;
|
private Button startscreen_continue;
|
||||||
private Button startscreen_newgame;
|
private Button startscreen_newgame;
|
||||||
private Button startscreen_load;
|
private Button startscreen_load;
|
||||||
private ViewGroup save_preview_holder;
|
private ViewGroup save_preview_holder;
|
||||||
private ImageView save_preview_hero_icon;
|
private ImageView save_preview_hero_icon;
|
||||||
private TextView save_preview_hero_desc;
|
private TextView save_preview_hero_desc;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
updatePreferences(false);
|
updatePreferences(false);
|
||||||
super.onCreateView(inflater, container, savedInstanceState);
|
super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
|
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
@@ -114,7 +115,7 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
|||||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
||||||
if (hasExistingGame && app != null && app.getWorld() != null && app.getWorld().model != null
|
if (hasExistingGame && app != null && app.getWorld() != null && app.getWorld().model != null
|
||||||
&& app.getWorld().model.statistics != null && !app.getWorld().model.statistics.hasUnlimitedSaves()) {
|
&& app.getWorld().model.statistics != null && !app.getWorld().model.statistics.hasUnlimitedSaves()) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(getActivity(),
|
final CustomDialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||||
getString(R.string.startscreen_load_game),
|
getString(R.string.startscreen_load_game),
|
||||||
getResources().getDrawable(android.R.drawable.ic_delete),
|
getResources().getDrawable(android.R.drawable.ic_delete),
|
||||||
getString(R.string.startscreen_load_game_confirm),
|
getString(R.string.startscreen_load_game_confirm),
|
||||||
@@ -189,14 +190,10 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
|||||||
setCurrentVersionForVersionCheck();
|
setCurrentVersionForVersionCheck();
|
||||||
checkAndRequestPermissions(getActivity());
|
checkAndRequestPermissions(getActivity());
|
||||||
migrateDataOnDemand(getActivity());
|
migrateDataOnDemand(getActivity());
|
||||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
|
||||||
startscreen_load.setEnabled(hasSavegames);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
|
||||||
startscreen_load.setEnabled(hasSavegames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(29)
|
@TargetApi(29)
|
||||||
@@ -204,23 +201,16 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
|||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||||
if (AndroidStorage.shouldMigrateToInternalStorage(activity.getApplicationContext())) {
|
if (AndroidStorage.shouldMigrateToInternalStorage(activity.getApplicationContext())) {
|
||||||
final Dialog d = CustomDialogFactory.createDialog(activity,
|
final CustomDialog d = CustomDialogFactory.createDialog(activity,
|
||||||
getString(R.string.startscreen_migration_title),
|
getString(R.string.startscreen_migration_title),
|
||||||
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
getString(R.string.startscreen_migration_text),
|
getString(R.string.startscreen_migration_text),
|
||||||
null,
|
null,
|
||||||
true);
|
true);
|
||||||
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
CustomDialogFactory.addDismissButton(d, android.R.string.ok);
|
||||||
d.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
|
||||||
@Override
|
|
||||||
public void onDismiss(DialogInterface arg0) {
|
|
||||||
boolean hasSavegames = !Savegames.getUsedSavegameSlots(getActivity()).isEmpty();
|
|
||||||
startscreen_load.setEnabled(hasSavegames);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
CustomDialogFactory.show(d);
|
CustomDialogFactory.show(d);
|
||||||
if (!AndroidStorage.migrateToInternalStorage(activity.getApplicationContext())) {
|
if (!AndroidStorage.migrateToInternalStorage(activity.getApplicationContext())) {
|
||||||
final Dialog errorDlg = CustomDialogFactory.createDialog(activity,
|
final CustomDialog errorDlg = CustomDialogFactory.createDialog(activity,
|
||||||
getString(R.string.startscreen_migration_title),
|
getString(R.string.startscreen_migration_title),
|
||||||
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
activity.getResources().getDrawable(android.R.drawable.ic_dialog_alert),
|
||||||
getString(R.string.startscreen_migration_failure),
|
getString(R.string.startscreen_migration_failure),
|
||||||
@@ -305,7 +295,7 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
|||||||
// .create().show();
|
// .create().show();
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
final Dialog d = CustomDialogFactory.createDialog(getActivity(),
|
final CustomDialog d = CustomDialogFactory.createDialog(getActivity(),
|
||||||
getString(R.string.startscreen_newgame),
|
getString(R.string.startscreen_newgame),
|
||||||
getResources().getDrawable(android.R.drawable.ic_delete),
|
getResources().getDrawable(android.R.drawable.ic_delete),
|
||||||
getResources().getString(R.string.startscreen_newgame_confirm),
|
getResources().getString(R.string.startscreen_newgame_confirm),
|
||||||
@@ -339,49 +329,75 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case INTENTREQUEST_LOADGAME:
|
case INTENTREQUEST_LOADGAME:
|
||||||
if (resultCode != Activity.RESULT_OK) break;
|
boolean unsuccessful = resultCode != Activity.RESULT_OK;
|
||||||
final int slot = data.getIntExtra("slot", 1);
|
if(data == null) break;
|
||||||
continueGame(false, slot, null);
|
|
||||||
break;
|
final boolean wasImportOrExport = data.getBooleanExtra("import_export", false);
|
||||||
case INTENTREQUEST_PREFERENCES:
|
if (wasImportOrExport) {
|
||||||
updatePreferences(true);
|
String message = getImportExportMessage(!unsuccessful, data);
|
||||||
break;
|
Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (unsuccessful) break;
|
||||||
|
final int slot = data.getIntExtra("slot", 1);
|
||||||
|
continueGame(false, slot, null);
|
||||||
|
break;
|
||||||
|
case INTENTREQUEST_PREFERENCES:
|
||||||
|
updatePreferences(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getImportExportMessage(boolean successful, Intent data) {
|
||||||
|
String message = "";
|
||||||
|
boolean isImportWorldmap = data.getBooleanExtra("import_worldmap", false);
|
||||||
|
boolean isImportSaves = data.getBooleanExtra("import_savegames", false);
|
||||||
|
boolean isExport = data.getBooleanExtra("export", false);
|
||||||
|
|
||||||
|
if(isImportWorldmap) {
|
||||||
|
message = getString(successful ? R.string.loadsave_import_worldmap_successfull : R.string.loadsave_import_worldmap_unsuccessfull);
|
||||||
|
} else if(isImportSaves) {
|
||||||
|
message = getString(successful ? R.string.loadsave_import_save_successfull : R.string.loadsave_import_save_unsuccessfull);
|
||||||
|
} else if(isExport) {
|
||||||
|
message = getString(successful ? R.string.loadsave_export_successfull : R.string.loadsave_export_unsuccessfull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePreferences(boolean alreadyStartedLoadingResources) {
|
private void updatePreferences(boolean alreadyStartedLoadingResources) {
|
||||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(getActivity());
|
||||||
AndorsTrailPreferences preferences = app.getPreferences();
|
AndorsTrailPreferences preferences = app.getPreferences();
|
||||||
preferences.read(getActivity());
|
preferences.read(getActivity());
|
||||||
if (app.setLocale(getActivity())) {
|
if (app.setLocale(getActivity())) {
|
||||||
if (alreadyStartedLoadingResources) {
|
if (alreadyStartedLoadingResources) {
|
||||||
// Changing the locale after having loaded the game requires resources to
|
// Changing the locale after having loaded the game requires resources to
|
||||||
// be re-loaded. Therefore, we just exit here.
|
// be re-loaded. Therefore, we just exit here.
|
||||||
Toast.makeText(getActivity(), R.string.change_locale_requires_restart, Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), R.string.change_locale_requires_restart, Toast.LENGTH_LONG).show();
|
||||||
doFinish();
|
doFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ThemeHelper.changeTheme(preferences.selectedTheme)) {
|
if (ThemeHelper.changeTheme(preferences.selectedTheme)) {
|
||||||
// Changing the theme requires a restart to re-create all activities.
|
// Changing the theme requires a restart to re-create all activities.
|
||||||
Toast.makeText(getActivity(), R.string.change_theme_requires_restart, Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), R.string.change_theme_requires_restart, Toast.LENGTH_LONG).show();
|
||||||
doFinish();
|
doFinish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
app.getWorld().tileManager.updatePreferences(preferences);
|
app.getWorld().tileManager.updatePreferences(preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private void doFinish() {
|
private void doFinish() {
|
||||||
//For Lollipop and above
|
//For Lollipop and above
|
||||||
((AndorsTrailApplication)getActivity().getApplication()).discardWorld();
|
((AndorsTrailApplication) getActivity().getApplication()).discardWorld();
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public interface OnNewGameRequestedListener {
|
public interface OnNewGameRequestedListener {
|
||||||
@@ -3,7 +3,7 @@ package com.gpl.rpg.AndorsTrail.activity.fragment;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
@@ -238,7 +238,7 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
|||||||
controllers.actorStatsController.addActorAP(player, player.getSkillLevel(SkillCollection.SkillID.cleave) * SkillCollection.PER_SKILLPOINT_INCREASE_CLEAVE_AP);
|
controllers.actorStatsController.addActorAP(player, player.getSkillLevel(SkillCollection.SkillID.cleave) * SkillCollection.PER_SKILLPOINT_INCREASE_CLEAVE_AP);
|
||||||
controllers.actorStatsController.addActorHealth(player, player.getSkillLevel(SkillCollection.SkillID.eater) * SkillCollection.PER_SKILLPOINT_INCREASE_EATER_HEALTH);
|
controllers.actorStatsController.addActorHealth(player, player.getSkillLevel(SkillCollection.SkillID.eater) * SkillCollection.PER_SKILLPOINT_INCREASE_EATER_HEALTH);
|
||||||
|
|
||||||
world.model.statistics.addMonsterKill(killedMonster.getMonsterTypeID());
|
world.model.statistics.addMonsterKill(killedMonster.monsterType);
|
||||||
controllers.actorStatsController.addExperience(loot.exp);
|
controllers.actorStatsController.addExperience(loot.exp);
|
||||||
world.model.combatLog.append(controllers.getResources().getString(R.string.dialog_monsterloot_gainedexp, loot.exp));
|
world.model.combatLog.append(controllers.getResources().getString(R.string.dialog_monsterloot_gainedexp, loot.exp));
|
||||||
|
|
||||||
@@ -579,6 +579,13 @@ public final class CombatController implements VisualEffectCompletedCallback {
|
|||||||
private static final int n = 50;
|
private static final int n = 50;
|
||||||
private static final int F = 40;
|
private static final int F = 40;
|
||||||
private static final float two_divided_by_PI = (float) (2f / Math.PI);
|
private static final float two_divided_by_PI = (float) (2f / Math.PI);
|
||||||
|
/**
|
||||||
|
* @implNote
|
||||||
|
* formula: 50 * (1 + (2 / pi) * atan((attackChance - blockChance - n) / F))
|
||||||
|
* <br/>
|
||||||
|
* n = {@value n}; F = {@value F}
|
||||||
|
* @return [0..100] . 100 == always hit.
|
||||||
|
*/
|
||||||
private static int getAttackHitChance(final Actor attacker, final Actor target) {
|
private static int getAttackHitChance(final Actor attacker, final Actor target) {
|
||||||
final int c = attacker.getAttackChance() - target.getBlockChance();
|
final int c = attacker.getAttackChance() - target.getBlockChance();
|
||||||
// (2/pi)*atan(..) will vary from -1 to +1 .
|
// (2/pi)*atan(..) will vary from -1 to +1 .
|
||||||
@@ -7,7 +7,7 @@ import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
|||||||
import com.gpl.rpg.AndorsTrail.util.Range;
|
import com.gpl.rpg.AndorsTrail.util.Range;
|
||||||
|
|
||||||
public final class Constants {
|
public final class Constants {
|
||||||
public static final int PERCENT_EXP_LOST_WHEN_DIED = 30;
|
public static final int PERCENT_EXP_LOST_WHEN_DIED = 20;
|
||||||
public static final int LEVELUP_EFFECT_HEALTH = 5;
|
public static final int LEVELUP_EFFECT_HEALTH = 5;
|
||||||
public static final int LEVELUP_EFFECT_ATK_CH = 5;
|
public static final int LEVELUP_EFFECT_ATK_CH = 5;
|
||||||
public static final int LEVELUP_EFFECT_ATK_DMG = 1;
|
public static final int LEVELUP_EFFECT_ATK_DMG = 1;
|
||||||
@@ -23,8 +23,8 @@ public final class Constants {
|
|||||||
public static final long MINIMUM_INPUT_INTERVAL_STD = 200;
|
public static final long MINIMUM_INPUT_INTERVAL_STD = 200;
|
||||||
//TODO restore final modifier before release
|
//TODO restore final modifier before release
|
||||||
public static long MINIMUM_INPUT_INTERVAL = AndorsTrailApplication.DEVELOPMENT_FASTSPEED ? MINIMUM_INPUT_INTERVAL_FAST : MINIMUM_INPUT_INTERVAL_STD;
|
public static long MINIMUM_INPUT_INTERVAL = AndorsTrailApplication.DEVELOPMENT_FASTSPEED ? MINIMUM_INPUT_INTERVAL_FAST : MINIMUM_INPUT_INTERVAL_STD;
|
||||||
public static final int MAX_MAP_WIDTH = 33;
|
public static final int MAX_MAP_WIDTH = 46;
|
||||||
public static final int MAX_MAP_HEIGHT = 33;
|
public static final int MAX_MAP_HEIGHT = 46;
|
||||||
|
|
||||||
public static final int MONSTER_MOVEMENT_TURN_DURATION_MS = 1200;
|
public static final int MONSTER_MOVEMENT_TURN_DURATION_MS = 1200;
|
||||||
public static final int MONSTER_IMMOBILE_MOVE_COST = 999;
|
public static final int MONSTER_IMMOBILE_MOVE_COST = 999;
|
||||||
@@ -42,6 +42,7 @@ public final class Constants {
|
|||||||
|
|
||||||
public static final String PREFERENCE_MODEL_LASTRUNVERSION = "lastversion";
|
public static final String PREFERENCE_MODEL_LASTRUNVERSION = "lastversion";
|
||||||
public static final String FILENAME_SAVEGAME_QUICKSAVE = "savegame";
|
public static final String FILENAME_SAVEGAME_QUICKSAVE = "savegame";
|
||||||
|
public static final String SAVEGAME_NAME_INTENT_EXTRA = "savegame_name";
|
||||||
public static final String FILENAME_SAVEGAME_DIRECTORY = "andors-trail";
|
public static final String FILENAME_SAVEGAME_DIRECTORY = "andors-trail";
|
||||||
public static final String FILENAME_WORLDMAP_DIRECTORY = "worldmap";
|
public static final String FILENAME_WORLDMAP_DIRECTORY = "worldmap";
|
||||||
public static final String FILENAME_WORLDMAP_HTMLFILE_PREFIX = "worldmap_";
|
public static final String FILENAME_WORLDMAP_HTMLFILE_PREFIX = "worldmap_";
|
||||||
@@ -51,6 +52,10 @@ public final class Constants {
|
|||||||
public static final String CHEAT_DETECTION_FOLDER = "dEAGyGE3YojqXjI3x4x7";
|
public static final String CHEAT_DETECTION_FOLDER = "dEAGyGE3YojqXjI3x4x7";
|
||||||
public static final String PASSIVE_ACHIEVEMENT_CHECK_PHRASE = "passive_achievement_check";
|
public static final String PASSIVE_ACHIEVEMENT_CHECK_PHRASE = "passive_achievement_check";
|
||||||
|
|
||||||
|
public static final String SAVEGAME_FILE_MIME_TYPE = "application/octet-stream";
|
||||||
|
public static final String WORLDMAP_FILE_MIME_TYPE = "image/png";
|
||||||
|
public static final String NO_FILE_EXTENSION_MIME_TYPE = "application/no_file_extension_mime_type";
|
||||||
|
|
||||||
public static final Random rnd = new Random();
|
public static final Random rnd = new Random();
|
||||||
public static int rollValue(final ConstRange r) { return rollValue(r.max, r.current); }
|
public static int rollValue(final ConstRange r) { return rollValue(r.max, r.current); }
|
||||||
public static int rollValue(final ConstRange r, int bias) { return rollValue((r.max + 1) * 100 -1, r.current * 100 + bias)/100; }
|
public static int rollValue(final ConstRange r, int bias) { return rollValue((r.max + 1) * 100 -1, r.current * 100 + bias)/100; }
|
||||||
@@ -22,6 +22,7 @@ import com.gpl.rpg.AndorsTrail.model.conversation.Reply;
|
|||||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
||||||
import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
import com.gpl.rpg.AndorsTrail.model.item.Loot;
|
||||||
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
||||||
|
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||||
import com.gpl.rpg.AndorsTrail.model.map.MonsterSpawnArea;
|
import com.gpl.rpg.AndorsTrail.model.map.MonsterSpawnArea;
|
||||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||||
import com.gpl.rpg.AndorsTrail.model.quest.QuestLogEntry;
|
import com.gpl.rpg.AndorsTrail.model.quest.QuestLogEntry;
|
||||||
@@ -124,6 +125,9 @@ public final class ConversationController {
|
|||||||
case changeMapFilter:
|
case changeMapFilter:
|
||||||
changeMapFilter(res, effect.mapName, effect.effectID);
|
changeMapFilter(res, effect.mapName, effect.effectID);
|
||||||
break;
|
break;
|
||||||
|
case mapchange:
|
||||||
|
mapchange(effect.mapName, effect.effectID);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,6 +176,13 @@ public final class ConversationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mapchange(String mapName, String place) {
|
||||||
|
PredefinedMap map = findMapForScriptEffect(mapName);
|
||||||
|
// controllers.mapController.activateMapObjectGroup(map, mapObjectGroupID);
|
||||||
|
// controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, effect.mapName, effect.effectID, 0, 0); //cbcbcb check
|
||||||
|
controllers.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, mapName, place, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void addAlignmentReward(Player player, String faction, int delta) {
|
private void addAlignmentReward(Player player, String faction, int delta) {
|
||||||
player.addAlignment(faction, delta);
|
player.addAlignment(faction, delta);
|
||||||
MovementController.refreshMonsterAggressiveness(world.model.currentMaps.map, world.model.player);
|
MovementController.refreshMonsterAggressiveness(world.model.currentMaps.map, world.model.player);
|
||||||
@@ -311,6 +322,18 @@ public final class ConversationController {
|
|||||||
case factionScoreEquals:
|
case factionScoreEquals:
|
||||||
result = player.getAlignment(requirement.requireID) == requirement.value;
|
result = player.getAlignment(requirement.requireID) == requirement.value;
|
||||||
break;
|
break;
|
||||||
|
case date:
|
||||||
|
result = world.model.worldData.getDate(requirement.requireID) >= requirement.value;
|
||||||
|
break;
|
||||||
|
case dateEquals:
|
||||||
|
result = world.model.worldData.getDate(requirement.requireID) == requirement.value;
|
||||||
|
break;
|
||||||
|
case time:
|
||||||
|
result = world.model.worldData.getTime(requirement.requireID) >= requirement.value;
|
||||||
|
break;
|
||||||
|
case timeEquals:
|
||||||
|
result = world.model.worldData.getTime(requirement.requireID) == requirement.value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,342 @@
|
|||||||
|
package com.gpl.rpg.AndorsTrail.controller;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.util.SparseIntArray;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.view.View.OnLongClickListener;
|
||||||
|
|
||||||
|
import com.gpl.rpg.AndorsTrail.activity.HeroinfoActivity;
|
||||||
|
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||||
|
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.L;
|
||||||
|
|
||||||
|
public final class InputController implements OnClickListener, OnLongClickListener{
|
||||||
|
private final ControllerContext controllers;
|
||||||
|
private final WorldContext world;
|
||||||
|
|
||||||
|
private final Coord lastTouchPosition_tileCoords = new Coord();
|
||||||
|
private int lastTouchPosition_dx = 0;
|
||||||
|
private int lastTouchPosition_dy = 0;
|
||||||
|
private long lastTouchEventTime = 0;
|
||||||
|
private boolean isDpadActive = false;
|
||||||
|
|
||||||
|
private int keyState_dx = 0;
|
||||||
|
private int keyState_dy = 0;
|
||||||
|
private boolean keyState_attack = false;
|
||||||
|
private boolean keyState_flee = false;
|
||||||
|
private boolean keyState_endturn = false;
|
||||||
|
|
||||||
|
final private int KEY_UNHANDLED = 0; // Default, for unhandled keycodes
|
||||||
|
final private int KEY_MOVE_UP = 1;
|
||||||
|
final private int KEY_MOVE_DOWN = 2;
|
||||||
|
final private int KEY_MOVE_LEFT = 3;
|
||||||
|
final private int KEY_MOVE_RIGHT = 4;
|
||||||
|
final private int KEY_MOVE_UP_LEFT = 5;
|
||||||
|
final private int KEY_MOVE_UP_RIGHT = 6;
|
||||||
|
final private int KEY_MOVE_DOWN_LEFT = 7;
|
||||||
|
final private int KEY_MOVE_DOWN_RIGHT = 8;
|
||||||
|
final private int KEY_ATTACK = 9;
|
||||||
|
final private int KEY_FLEE = 10;
|
||||||
|
final private int KEY_END_TURN = 11;
|
||||||
|
final private int KEY_HERO_INFO = 12;
|
||||||
|
final private int KEY_TOOLBOX = 13;
|
||||||
|
|
||||||
|
private SparseIntArray keyMap = new SparseIntArray(); // Android keycode to internal key event mapping. TODO: Configure via preferences
|
||||||
|
|
||||||
|
public InputController(ControllerContext controllers, WorldContext world) {
|
||||||
|
this.controllers = controllers;
|
||||||
|
this.world = world;
|
||||||
|
initializeKeyMap();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* New keyboard handler. Both Key Down and Key Up events handled here to allow conditional behaviours.
|
||||||
|
On 4-way dpad controllers, cursor keys, and WASD, diagonals are generated by chording two keys.
|
||||||
|
Single-key diagonals are supported on numeric keypad and 8-way dpads (not seen/tested in the wild).
|
||||||
|
|
||||||
|
Because two-key combos initially generate a ordinal movement (one key comes in first), which can
|
||||||
|
be dangerous in tight spaces, modifiers are provided to "lock" the input until both keys are down.
|
||||||
|
TODO: Use delay timer to enable chorded diagonals on first move without locking kludge?
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Map key codes to spectic internal actions
|
||||||
|
// TODO: Move mapping out of code to JSON/XML file, or maybe player prefs
|
||||||
|
private void initializeKeyMap() {
|
||||||
|
int key;
|
||||||
|
|
||||||
|
// Keys mapping to UP
|
||||||
|
key = KEY_MOVE_UP;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_UP, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_8, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_8, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_W, key);
|
||||||
|
|
||||||
|
// Keys mapping to DOWN
|
||||||
|
key = KEY_MOVE_DOWN;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_2, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_2, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_S, key);
|
||||||
|
|
||||||
|
// Keys mapping to LEFT
|
||||||
|
key = KEY_MOVE_LEFT;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_LEFT, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_4, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_4, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_A, key);
|
||||||
|
|
||||||
|
// Keys mapping to RIGHT
|
||||||
|
key = KEY_MOVE_RIGHT;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_6, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_6, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_D, key);
|
||||||
|
|
||||||
|
// Keys mapping to UP_LEFT
|
||||||
|
key = KEY_MOVE_UP_LEFT;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_LEFT, key);
|
||||||
|
}
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_7, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_7, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_MOVE_HOME, key);
|
||||||
|
|
||||||
|
// Keys mapping to UP_RIGHT
|
||||||
|
key = KEY_MOVE_UP_RIGHT;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_RIGHT, key);
|
||||||
|
}
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_9, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_9, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_PAGE_UP, key);
|
||||||
|
|
||||||
|
// Keys mapping to DOWN_LEFT
|
||||||
|
key = KEY_MOVE_DOWN_LEFT;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_LEFT, key);
|
||||||
|
}
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_1, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_1, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_MOVE_END, key);
|
||||||
|
|
||||||
|
// Keys mapping to DOWN_RIGHT
|
||||||
|
key = KEY_MOVE_DOWN_RIGHT;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_RIGHT, key);
|
||||||
|
}
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_3, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_3, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_PAGE_DOWN, key);
|
||||||
|
|
||||||
|
// Keys mapping to ATTACK
|
||||||
|
key = KEY_ATTACK;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_DPAD_CENTER, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_BUTTON_A, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_SPACE, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_5, key);
|
||||||
|
|
||||||
|
// Keys mapping to FLEE
|
||||||
|
key = KEY_FLEE;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_BUTTON_X, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_F, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_ENTER, key);
|
||||||
|
|
||||||
|
// Keys mapping to END_TURN
|
||||||
|
key = KEY_END_TURN;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_BUTTON_Y, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_E, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_FORWARD_DEL, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, key);
|
||||||
|
|
||||||
|
// Keys mapping to HERO_INFO
|
||||||
|
key = KEY_HERO_INFO;
|
||||||
|
//keyMap.put(KeyEvent.KEYCODE_BUTTON_SELECT, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_BUTTON_L1, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUM_LOCK, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_C, key);
|
||||||
|
|
||||||
|
// Keys mapping to TOOLBOX
|
||||||
|
key = KEY_TOOLBOX;
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_BUTTON_R1, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, key);
|
||||||
|
keyMap.put(KeyEvent.KEYCODE_B, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate game actions based on mapped keys
|
||||||
|
public boolean onKeyboardAction(Context context, KeyEvent event, boolean acceptInput) {
|
||||||
|
//L.log("onKeyboardAction(): Processing action " + event.getAction() + " for keyCode " + event.getKeyCode());
|
||||||
|
|
||||||
|
if (event.getAction() != KeyEvent.ACTION_DOWN && event.getAction() != KeyEvent.ACTION_UP) return false; // don't handle other actions
|
||||||
|
boolean keydown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||||
|
boolean inihbit = (keyState_attack || keyState_flee); // used to inhibit movement if an action key is held down
|
||||||
|
|
||||||
|
switch (keyMap.get(event.getKeyCode())) {
|
||||||
|
|
||||||
|
// Ordinal directional keys - only modify one direction register; registers are combined when
|
||||||
|
// keys used simultaneously to create synthetic diagonals
|
||||||
|
case KEY_MOVE_UP:
|
||||||
|
keyState_dy = keydown ? -1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_DOWN:
|
||||||
|
keyState_dy = keydown ? 1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_LEFT:
|
||||||
|
keyState_dx = keydown ? -1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_RIGHT:
|
||||||
|
keyState_dx = keydown ? 1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Diagonal directional keys. Modify both direction registers, can't be combined
|
||||||
|
// TODO: store individual key position to allow combinations. May not be worth the trouble.
|
||||||
|
case KEY_MOVE_UP_LEFT:
|
||||||
|
keyState_dx = keydown ? -1 : 0;
|
||||||
|
keyState_dy = keydown ? -1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_UP_RIGHT:
|
||||||
|
keyState_dx = keydown ? 1 : 0;
|
||||||
|
keyState_dy = keydown ? -1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_DOWN_LEFT:
|
||||||
|
keyState_dx = keydown ? -1 : 0;
|
||||||
|
keyState_dy = keydown ? 1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
case KEY_MOVE_DOWN_RIGHT:
|
||||||
|
keyState_dx = keydown ? 1 : 0;
|
||||||
|
keyState_dy = keydown ? 1 : 0;
|
||||||
|
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Special key handling below - some combat/movement stuff done here because it's too
|
||||||
|
// specific for logic in onRelativeMovement
|
||||||
|
|
||||||
|
// "Attack" shortcut - freeze movement to allow chorded direction when key is released.
|
||||||
|
// if in combat, executes an attack on key release
|
||||||
|
case KEY_ATTACK:
|
||||||
|
if (keydown && !keyState_attack) { // key pressed - pause any movement
|
||||||
|
if(!world.model.uiSelections.isInCombat) controllers.movementController.stopMovement();
|
||||||
|
} else if (!keydown && keyState_attack) { // key released - execute attack / move in direction
|
||||||
|
if (acceptInput) onRelativeMovement(keyState_dx, keyState_dy);
|
||||||
|
}
|
||||||
|
keyState_attack = keydown;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// "Flee" shortcut. Intitiates flee when pressed. If a direction is held, moves in chosen direction when released
|
||||||
|
case KEY_FLEE:
|
||||||
|
if (world.model.uiSelections.isInCombat) {
|
||||||
|
if (keydown && !keyState_flee) { // button pressed - set flee; movement locked while pressed
|
||||||
|
if(acceptInput) controllers.combatController.startFlee();
|
||||||
|
} else if (!keydown && keyState_flee) { // button released - move flee direction, if held
|
||||||
|
// We need to do a special call because the movement key may already be down, and if the device
|
||||||
|
// doesn't generate repeat keystrokes, this handler won't get another event
|
||||||
|
if ((keyState_dx != 0 || keyState_dy != 0) && allowInputInterval()) {
|
||||||
|
if(acceptInput) controllers.combatController.executeMoveAttack(keyState_dx, keyState_dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
keyState_flee = keydown;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// "End Turn" shortcut. Flag prevents repeated end turn if key is held down.
|
||||||
|
case KEY_END_TURN:
|
||||||
|
if (acceptInput && keydown && !keyState_endturn) {
|
||||||
|
if (world.model.uiSelections.isInCombat) controllers.combatController.endPlayerTurn();
|
||||||
|
}
|
||||||
|
keyState_endturn = keydown;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// "Hero Info" screen shortcut. New activity takes focus, so we don't need to worry about repeats.
|
||||||
|
case KEY_HERO_INFO:
|
||||||
|
if (acceptInput && keydown) context.startActivity(new Intent(context, HeroinfoActivity.class));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_TOOLBOX:
|
||||||
|
// ??? ToolboxView toolboxview = context.getApplicationContext(). findViewById(R.id.main_toolboxview);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_UNHANDLED: // Unhandled keycode
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default: // unhandled keymap code entry (should not happen)
|
||||||
|
L.log("onKeyboardAction(): Unhandled keyMap code constant " + keyMap.get(event.getKeyCode()) + " for keyCode " + event.getKeyCode());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRelativeMovement(int dx, int dy) {
|
||||||
|
//L.log("onRelativeMovement(): dx=" + dx + " dy=" + dy + " combat: " + world.model.uiSelections.isInCombat);
|
||||||
|
if (world.model.uiSelections.isInCombat) {
|
||||||
|
if (allowInputInterval()) controllers.combatController.executeMoveAttack(dx, dy);
|
||||||
|
} else if (dx == 0 && dy == 0) {
|
||||||
|
controllers.movementController.stopMovement();
|
||||||
|
} else {
|
||||||
|
controllers.movementController.startMovement(dx, dy, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onKeyboardCancel() {
|
||||||
|
controllers.movementController.stopMovement();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View arg0) {
|
||||||
|
if (!world.model.uiSelections.isInCombat) return;
|
||||||
|
onRelativeMovement(lastTouchPosition_dx, lastTouchPosition_dy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View arg0) {
|
||||||
|
if (world.model.uiSelections.isInCombat) {
|
||||||
|
//TODO: Should be able to mark positions far away (mapwalk / ranged combat)
|
||||||
|
if (lastTouchPosition_dx == 0 && lastTouchPosition_dy == 0) return false;
|
||||||
|
if (Math.abs(lastTouchPosition_dx) > 1) return false;
|
||||||
|
if (Math.abs(lastTouchPosition_dy) > 1) return false;
|
||||||
|
|
||||||
|
controllers.combatController.setCombatSelection(lastTouchPosition_tileCoords);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean allowInputInterval() {
|
||||||
|
final long now = System.currentTimeMillis();
|
||||||
|
if ((now - lastTouchEventTime) < Constants.MINIMUM_INPUT_INTERVAL) return false;
|
||||||
|
lastTouchEventTime = now;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDpadActive(boolean isDpadActive) {
|
||||||
|
this.isDpadActive = isDpadActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onTouchCancel() {
|
||||||
|
controllers.movementController.stopMovement();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onTouchedTile(int tile_x, int tile_y) {
|
||||||
|
lastTouchPosition_tileCoords.set(tile_x, tile_y);
|
||||||
|
lastTouchPosition_dx = tile_x - world.model.player.position.x;
|
||||||
|
lastTouchPosition_dy = tile_y - world.model.player.position.y;
|
||||||
|
|
||||||
|
if (world.model.uiSelections.isInCombat || isDpadActive) return false;
|
||||||
|
|
||||||
|
controllers.movementController.startMovement(lastTouchPosition_dx, lastTouchPosition_dy, lastTouchPosition_tileCoords);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.gpl.rpg.AndorsTrail.controller;
|
package com.gpl.rpg.AndorsTrail.controller;
|
||||||
|
|
||||||
|
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||||
import com.gpl.rpg.AndorsTrail.controller.listeners.CombatActionListeners;
|
import com.gpl.rpg.AndorsTrail.controller.listeners.CombatActionListeners;
|
||||||
@@ -17,6 +18,7 @@ import com.gpl.rpg.AndorsTrail.model.item.ItemCategory;
|
|||||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||||
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
import com.gpl.rpg.AndorsTrail.model.item.ItemTypeCollection;
|
||||||
import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.L;
|
||||||
|
|
||||||
public final class SkillController {
|
public final class SkillController {
|
||||||
private final ControllerContext controllers;
|
private final ControllerContext controllers;
|
||||||
@@ -58,6 +60,9 @@ public final class SkillController {
|
|||||||
|
|
||||||
public static int getDropChanceRollBias(DropItem item, Player player) {
|
public static int getDropChanceRollBias(DropItem item, Player player) {
|
||||||
if (player == null) return 0;
|
if (player == null) return 0;
|
||||||
|
if(item.itemType == null && AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES){
|
||||||
|
L.log("Item type missing: " + item + " " + player.id);
|
||||||
|
}
|
||||||
|
|
||||||
if (ItemTypeCollection.isGoldItemType(item.itemType.id)) {
|
if (ItemTypeCollection.isGoldItemType(item.itemType.id)) {
|
||||||
return getRollBias(item, player, SkillID.coinfinder, SkillCollection.PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT);
|
return getRollBias(item, player, SkillID.coinfinder, SkillCollection.PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT);
|
||||||
@@ -19,10 +19,12 @@ import com.gpl.rpg.AndorsTrail.model.actor.MonsterType;
|
|||||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||||
import com.gpl.rpg.AndorsTrail.model.quest.Quest;
|
import com.gpl.rpg.AndorsTrail.model.quest.Quest;
|
||||||
|
import com.gpl.rpg.AndorsTrail.util.HashMapHelper;
|
||||||
|
|
||||||
public final class GameStatistics {
|
public final class GameStatistics {
|
||||||
private int deaths = 0;
|
private int deaths = 0;
|
||||||
private final HashMap<String, Integer> killedMonsters = new HashMap<String, Integer>();
|
private final HashMap<String, Integer> killedMonstersByTypeID = new HashMap<String, Integer>();
|
||||||
|
private final HashMap<String, Integer> killedMonstersByName = new HashMap<String, Integer>();
|
||||||
private final HashMap<String, Integer> usedItems = new HashMap<String, Integer>();
|
private final HashMap<String, Integer> usedItems = new HashMap<String, Integer>();
|
||||||
private int spentGold = 0;
|
private int spentGold = 0;
|
||||||
private boolean unlimitedSaves = true;
|
private boolean unlimitedSaves = true;
|
||||||
@@ -33,10 +35,14 @@ public final class GameStatistics {
|
|||||||
this.startLives = startLives;
|
this.startLives = startLives;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMonsterKill(String monsterTypeID) {
|
public void addMonsterKill(MonsterType monsterType) {
|
||||||
if (!killedMonsters.containsKey(monsterTypeID)) killedMonsters.put(monsterTypeID, 1);
|
// Track monster kills by type ID, for savegame file
|
||||||
else killedMonsters.put(monsterTypeID, killedMonsters.get(monsterTypeID) + 1);
|
killedMonstersByTypeID.put(monsterType.id, getNumberOfKillsForMonsterType(monsterType.id) + 1);
|
||||||
|
|
||||||
|
// Also track by name, for statistics display (multiple IDs w/same name don't matter to player)
|
||||||
|
killedMonstersByName.put(monsterType.name, getNumberOfKillsForMonsterName(monsterType.name) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayerDeath(int lostExp) {
|
public void addPlayerDeath(int lostExp) {
|
||||||
++deaths;
|
++deaths;
|
||||||
}
|
}
|
||||||
@@ -45,8 +51,7 @@ public final class GameStatistics {
|
|||||||
}
|
}
|
||||||
public void addItemUsage(ItemType type) {
|
public void addItemUsage(ItemType type) {
|
||||||
final String n = type.id;
|
final String n = type.id;
|
||||||
if (!usedItems.containsKey(n)) usedItems.put(n, 1);
|
usedItems.put(n, HashMapHelper.getOrDefault(usedItems, n,0) + 1);
|
||||||
else usedItems.put(n, usedItems.get(n) + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDeaths() {
|
public int getDeaths() {
|
||||||
@@ -68,30 +73,30 @@ public final class GameStatistics {
|
|||||||
public boolean isDead() { return !hasUnlimitedLives() && getLivesLeft() < 1; }
|
public boolean isDead() { return !hasUnlimitedLives() && getLivesLeft() < 1; }
|
||||||
|
|
||||||
public int getNumberOfKillsForMonsterType(String monsterTypeID) {
|
public int getNumberOfKillsForMonsterType(String monsterTypeID) {
|
||||||
Integer v = killedMonsters.get(monsterTypeID);
|
return HashMapHelper.getOrDefault(killedMonstersByTypeID, monsterTypeID, 0);
|
||||||
if (v == null) return 0;
|
}
|
||||||
return v;
|
|
||||||
|
public int getNumberOfKillsForMonsterName(String monsterName) {
|
||||||
|
return HashMapHelper.getOrDefault(killedMonstersByName, monsterName, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTop5MostCommonlyKilledMonsters(WorldContext world, Resources res) {
|
public String getTop5MostCommonlyKilledMonsters(WorldContext world, Resources res) {
|
||||||
if (killedMonsters.isEmpty()) return null;
|
if (killedMonstersByTypeID.isEmpty()) return null;
|
||||||
List<Entry<String, Integer>> entries = new ArrayList<Entry<String, Integer>>(killedMonsters.entrySet());
|
List<Entry<String, Integer>> entries = new ArrayList<Entry<String, Integer>>(killedMonstersByName.entrySet());
|
||||||
Collections.sort(entries, descendingValueComparator);
|
Collections.sort(entries, descendingValueComparator);
|
||||||
StringBuilder sb = new StringBuilder(100);
|
StringBuilder sb = new StringBuilder(100);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (Entry<String, Integer> e : entries) {
|
for (Entry<String, Integer> e : entries) {
|
||||||
if (i++ >= 5) break;
|
if (i++ >= 5) break;
|
||||||
MonsterType t = world.monsterTypes.getMonsterType(e.getKey());
|
sb.append(res.getString(R.string.heroinfo_gamestats_name_and_qty, e.getKey(), e.getValue())).append('\n');
|
||||||
if (t == null) continue;
|
|
||||||
sb.append(res.getString(R.string.heroinfo_gamestats_name_and_qty, t.name, e.getValue())).append('\n');
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMostPowerfulKilledMonster(WorldContext world) {
|
public String getMostPowerfulKilledMonster(WorldContext world) {
|
||||||
if (killedMonsters.isEmpty()) return null;
|
if (killedMonstersByTypeID.isEmpty()) return null;
|
||||||
HashMap<String, Integer> expPerMonsterType = new HashMap<String, Integer>(killedMonsters.size());
|
HashMap<String, Integer> expPerMonsterType = new HashMap<String, Integer>(killedMonstersByTypeID.size());
|
||||||
for (String monsterTypeID : killedMonsters.keySet()) {
|
for (String monsterTypeID : killedMonstersByTypeID.keySet()) {
|
||||||
MonsterType t = world.monsterTypes.getMonsterType(monsterTypeID);
|
MonsterType t = world.monsterTypes.getMonsterType(monsterTypeID);
|
||||||
expPerMonsterType.put(monsterTypeID, t != null ? t.exp : 0);
|
expPerMonsterType.put(monsterTypeID, t != null ? t.exp : 0);
|
||||||
}
|
}
|
||||||
@@ -135,20 +140,15 @@ public final class GameStatistics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfUsedItems() {
|
public int getNumberOfUsedItems() {
|
||||||
int result = 0;
|
return HashMapHelper.sumIntegerValues(usedItems);
|
||||||
for (int v : usedItems.values()) result += v;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfTimesItemHasBeenUsed(String itemId) {
|
public int getNumberOfTimesItemHasBeenUsed(String itemId) {
|
||||||
if (!usedItems.containsKey(itemId)) return 0;
|
return HashMapHelper.getOrDefault(usedItems, itemId, 0);
|
||||||
return usedItems.get(itemId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfKilledMonsters() {
|
public int getNumberOfKilledMonsters() {
|
||||||
int result = 0;
|
return HashMapHelper.sumIntegerValues(killedMonstersByTypeID);
|
||||||
for (int v : killedMonsters.values()) result += v;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Comparator<Entry<String, Integer>> descendingValueComparator = new Comparator<Entry<String, Integer>>() {
|
private static final Comparator<Entry<String, Integer>> descendingValueComparator = new Comparator<Entry<String, Integer>>() {
|
||||||
@@ -172,8 +172,14 @@ public final class GameStatistics {
|
|||||||
if (type == null) continue;
|
if (type == null) continue;
|
||||||
id = type.id;
|
id = type.id;
|
||||||
}
|
}
|
||||||
this.killedMonsters.put(id, value);
|
this.killedMonstersByTypeID.put(id, value);
|
||||||
|
|
||||||
|
// Also track by name, for statistics display (multiple IDs w/same name don't matter to player)
|
||||||
|
MonsterType t = world.monsterTypes.getMonsterType(id);
|
||||||
|
|
||||||
|
if (t != null) killedMonstersByName.put(t.name, getNumberOfKillsForMonsterName(t.name) + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileversion <= 17) return;
|
if (fileversion <= 17) return;
|
||||||
|
|
||||||
final int numItems = src.readInt();
|
final int numItems = src.readInt();
|
||||||
@@ -192,7 +198,7 @@ public final class GameStatistics {
|
|||||||
|
|
||||||
public void writeToParcel(DataOutputStream dest) throws IOException {
|
public void writeToParcel(DataOutputStream dest) throws IOException {
|
||||||
dest.writeInt(deaths);
|
dest.writeInt(deaths);
|
||||||
Set<Entry<String, Integer> > set = killedMonsters.entrySet();
|
Set<Entry<String, Integer> > set = killedMonstersByTypeID.entrySet();
|
||||||
dest.writeInt(set.size());
|
dest.writeInt(set.size());
|
||||||
for (Entry<String, Integer> e : set) {
|
for (Entry<String, Integer> e : set) {
|
||||||
dest.writeUTF(e.getKey());
|
dest.writeUTF(e.getKey());
|
||||||
@@ -6,6 +6,8 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
public final class WorldData {
|
public final class WorldData {
|
||||||
private long worldTime = 0; // Measured in number of game rounds
|
private long worldTime = 0; // Measured in number of game rounds
|
||||||
private final HashMap<String, Long> timers = new HashMap<String, Long>();
|
private final HashMap<String, Long> timers = new HashMap<String, Long>();
|
||||||
@@ -36,6 +38,62 @@ public final class WorldData {
|
|||||||
return v + duration <= worldTime;
|
return v + duration <= worldTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDate(String format) {
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
int ret;
|
||||||
|
switch (format) {
|
||||||
|
case "YYYYMMDD":
|
||||||
|
ret = now.get(Calendar.YEAR)*10000 + (now.get(Calendar.MONTH) + 1)*100 + now.get(Calendar.DAY_OF_MONTH);
|
||||||
|
break;
|
||||||
|
case "YYYYMM":
|
||||||
|
ret = now.get(Calendar.YEAR)*100 + (now.get(Calendar.MONTH) + 1);
|
||||||
|
break;
|
||||||
|
case "YYYY":
|
||||||
|
ret = now.get(Calendar.YEAR);
|
||||||
|
break;
|
||||||
|
case "MMDD":
|
||||||
|
ret = (now.get(Calendar.MONTH) + 1)*100 + now.get(Calendar.DAY_OF_MONTH);
|
||||||
|
break;
|
||||||
|
case "MM":
|
||||||
|
ret = (now.get(Calendar.MONTH) + 1);
|
||||||
|
break;
|
||||||
|
case "DD":
|
||||||
|
ret = now.get(Calendar.DAY_OF_MONTH);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = 99999999; //never true
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTime(String format) {
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
int ret;
|
||||||
|
switch (format) {
|
||||||
|
case "HHMMSS":
|
||||||
|
ret = now.get(Calendar.HOUR_OF_DAY)*10000 + now.get(Calendar.MINUTE)*100 + now.get(Calendar.SECOND);
|
||||||
|
break;
|
||||||
|
case "HHMM":
|
||||||
|
ret = now.get(Calendar.HOUR_OF_DAY)*100 + now.get(Calendar.MINUTE);
|
||||||
|
break;
|
||||||
|
case "HH":
|
||||||
|
ret = now.get(Calendar.HOUR_OF_DAY);
|
||||||
|
break;
|
||||||
|
case "MMSS":
|
||||||
|
ret = now.get(Calendar.MINUTE)*100 + now.get(Calendar.SECOND);
|
||||||
|
break;
|
||||||
|
case "MM":
|
||||||
|
ret = now.get(Calendar.MINUTE);
|
||||||
|
break;
|
||||||
|
case "SS":
|
||||||
|
ret = now.get(Calendar.SECOND);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = 99999999; //never true
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// ====== PARCELABLE ===================================================================
|
// ====== PARCELABLE ===================================================================
|
||||||
|
|
||||||
public WorldData(DataInputStream src, int fileversion) throws IOException {
|
public WorldData(DataInputStream src, int fileversion) throws IOException {
|
||||||
@@ -83,7 +83,7 @@ public final class SkillCollection {
|
|||||||
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT = 30;
|
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_CHANCE_PERCENT = 30;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_MAGICFINDER_CHANCE_PERCENT = 50;
|
public static final int PER_SKILLPOINT_INCREASE_MAGICFINDER_CHANCE_PERCENT = 50;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_QUANTITY_PERCENT = 50;
|
public static final int PER_SKILLPOINT_INCREASE_COINFINDER_QUANTITY_PERCENT = 50;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_MORE_EXP_PERCENT = 5;
|
public static final int PER_SKILLPOINT_INCREASE_MORE_EXP_PERCENT = 10;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_CLEAVE_AP = 3;
|
public static final int PER_SKILLPOINT_INCREASE_CLEAVE_AP = 3;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_EATER_HEALTH = 1;
|
public static final int PER_SKILLPOINT_INCREASE_EATER_HEALTH = 1;
|
||||||
public static final int PER_SKILLPOINT_INCREASE_FORTITUDE_HEALTH = 1;
|
public static final int PER_SKILLPOINT_INCREASE_FORTITUDE_HEALTH = 1;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user