Compare commits
393 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c569232e74 | ||
|
|
14c526d0c4 | ||
|
|
5c4ac6b702 | ||
|
|
d58cc18136 | ||
|
|
36c01fde94 | ||
|
|
d4d9d59fe4 | ||
|
|
8dbd0a6130 | ||
|
|
3746344cba | ||
|
|
d07fd1bbfe | ||
|
|
02f95c0ed4 | ||
|
|
c98fcbd795 | ||
|
|
d071877963 | ||
|
|
0267cb4006 | ||
|
|
bf571e595c | ||
|
|
c0cad70212 | ||
|
|
7bd6dbb4b4 | ||
|
|
6d932e3d04 | ||
|
|
e154b5179d | ||
|
|
52110d6008 | ||
|
|
103b08fd1d | ||
|
|
cb09d10e7f | ||
|
|
a041c1e60d | ||
|
|
586b4cf4bd | ||
|
|
d0ff149cca | ||
|
|
f8ddc8325c | ||
|
|
59ec09e82c | ||
|
|
2ae5c96690 | ||
|
|
fda9e6bb9c | ||
|
|
b70de81c2d | ||
|
|
5e89b2568f | ||
|
|
ac1d8215ff | ||
|
|
fefc734bfa | ||
|
|
7f8735842c | ||
|
|
a226983470 | ||
|
|
28526d0a12 | ||
|
|
913e005bae | ||
|
|
7bd9fd5bae | ||
|
|
ef936214f0 | ||
|
|
18fce6b3e3 | ||
|
|
ecda4d74ab | ||
|
|
31124037b5 | ||
|
|
aaf95e0756 | ||
|
|
804e311875 | ||
|
|
61ad9bc47d | ||
|
|
2b23b7876a | ||
|
|
547d334f43 | ||
|
|
7432dc115e | ||
|
|
905defe8ce | ||
|
|
0a8ff0cde7 | ||
|
|
bd5f44030e | ||
|
|
79abb86262 | ||
|
|
fe6f98ec5a | ||
|
|
e39a856e54 | ||
|
|
64e5f8155d | ||
|
|
8328b11f6b | ||
|
|
15778b2ca5 | ||
|
|
b7842014c1 | ||
|
|
a804053904 | ||
|
|
2aee72b47b | ||
|
|
0cb8c600b7 | ||
|
|
aa5348f37e | ||
|
|
0736574a57 | ||
|
|
d56365ce63 | ||
|
|
c82d2f856a | ||
|
|
8432677826 | ||
|
|
0c0c6e5470 | ||
|
|
57019b6e20 | ||
|
|
12ab2249b4 | ||
|
|
22d0992d38 | ||
|
|
f8def04653 | ||
|
|
6349530fc5 | ||
|
|
ad83a7dcc3 | ||
|
|
cfc2239733 | ||
|
|
91552a3a2b | ||
|
|
4e3204bc6d | ||
|
|
a94998bd02 | ||
|
|
81c78eafa6 | ||
|
|
273523480f | ||
|
|
b27fefae88 | ||
|
|
aa00a1b8d1 | ||
|
|
ba62e0eefc | ||
|
|
cb16c75e11 | ||
|
|
3efed0ace3 | ||
|
|
879fb8194f | ||
|
|
049dd89470 | ||
|
|
1f59d4354a | ||
|
|
8dea45d9d5 | ||
|
|
21ba6e257c | ||
|
|
18ebda01a4 | ||
|
|
3acb843109 | ||
|
|
1768aea66f | ||
|
|
4b61f273d5 | ||
|
|
a1dbbbdafc | ||
|
|
dcb840f290 | ||
|
|
e6c4c66199 | ||
|
|
b76cd558aa | ||
|
|
85b077b5c5 | ||
|
|
c34d6e6606 | ||
|
|
a5fd0aebe6 | ||
|
|
aaec04d04a | ||
|
|
b4272e0387 | ||
|
|
77f9d6cb1d | ||
|
|
aaa82b34e4 | ||
|
|
7a6b1129d9 | ||
|
|
1f8918c773 | ||
|
|
e9fe724e59 | ||
|
|
80001246ef | ||
|
|
50461bb7c8 | ||
|
|
c7c7cfde74 | ||
|
|
dcc29c0c48 | ||
|
|
635e299464 | ||
|
|
382fdcbb40 | ||
|
|
468e092422 | ||
|
|
6904d4693f | ||
|
|
3ef7ec3be5 | ||
|
|
70257cbbfa | ||
|
|
6ef31d0ec1 | ||
|
|
d3077bec58 | ||
|
|
a1095353fc | ||
|
|
66fab1b3df | ||
|
|
569d6d4272 | ||
|
|
07c19ce085 | ||
|
|
d86dd4f80b | ||
|
|
f0f89f0894 | ||
|
|
47af2e83f7 | ||
|
|
8ec87872c8 | ||
|
|
f30ea80b42 | ||
|
|
1dd6e66167 | ||
|
|
4e681b2dd1 | ||
|
|
58be00b3ce | ||
|
|
5604ac6b6a | ||
|
|
effdaefdf3 | ||
|
|
5775fad030 | ||
|
|
eabc6d79c3 | ||
|
|
5f4ca6e383 | ||
|
|
c05020e28e | ||
|
|
5206079e23 | ||
|
|
9b01140882 | ||
|
|
4dae27da98 | ||
|
|
f0cab65a6d | ||
|
|
699a47351b | ||
|
|
af004da699 | ||
|
|
b5ad885237 | ||
|
|
07bd0fec70 | ||
|
|
318e51d736 | ||
|
|
ae90db50fe | ||
|
|
64772c195e | ||
|
|
05ead63bdc | ||
|
|
6f5c64420d | ||
|
|
d9d9a00a24 | ||
|
|
c1de67032c | ||
|
|
890d49fdd7 | ||
|
|
ba96ea5a0c | ||
|
|
b481b784bb | ||
|
|
53b6e68a85 | ||
|
|
e3d16418a0 | ||
|
|
e41f560ecd | ||
|
|
d394d9a529 | ||
|
|
a73015fa6e | ||
|
|
87846864cc | ||
|
|
f3b976bdd1 | ||
|
|
3a06e319b0 | ||
|
|
fe31c404ff | ||
|
|
cc23378758 | ||
|
|
5cac949ea8 | ||
|
|
a35e897194 | ||
|
|
8e92edeae1 | ||
|
|
f289a0a9a8 | ||
|
|
65a7e89a8c | ||
|
|
43be3259c9 | ||
|
|
54a4c95a1b | ||
|
|
ddac5cbfbc | ||
|
|
22342d01a5 | ||
|
|
7cffaeb193 | ||
|
|
2534496543 | ||
|
|
fe9b11e771 | ||
|
|
032347840f | ||
|
|
2978bc6ac5 | ||
|
|
a3b0bb323f | ||
|
|
a6246d27d9 | ||
|
|
884b649b53 | ||
|
|
92a2f770b4 | ||
|
|
e88ce078df | ||
|
|
77f0dfb9b1 | ||
|
|
78d1accf07 | ||
|
|
2ec68a7f07 | ||
|
|
bbaa2a2c92 | ||
|
|
341bb67ef4 | ||
|
|
e377cb423b | ||
|
|
81e954c258 | ||
|
|
79d41ba7ac | ||
|
|
e740e4da87 | ||
|
|
b476c47194 | ||
|
|
b2d61a93d9 | ||
|
|
a045ec9d46 | ||
|
|
1daf8d2743 | ||
|
|
295824f440 | ||
|
|
22b59e0cf6 | ||
|
|
ecabdb82e6 | ||
|
|
924b1c1a67 | ||
|
|
0454c4c25a | ||
|
|
3a3b81941b | ||
|
|
0875c29da5 | ||
|
|
0d4cf9f6c4 | ||
|
|
6a525dcf59 | ||
|
|
01f6904f82 | ||
|
|
23bd9a989b | ||
|
|
acfa02475b | ||
|
|
9dba304011 | ||
|
|
69b0020d15 | ||
|
|
ce2896cb38 | ||
|
|
68fd09c222 | ||
|
|
c832a7b93f | ||
|
|
49e19ab34d | ||
|
|
c1c82b451d | ||
|
|
ea6f88b7f6 | ||
|
|
2a6ee6d65b | ||
|
|
583342b430 | ||
|
|
7289c1080c | ||
|
|
9ed4f2b7a3 | ||
|
|
7396f91a5e | ||
|
|
ccc926d812 | ||
|
|
bd39255ead | ||
|
|
add7b1a7d9 | ||
|
|
8e471f9939 | ||
|
|
c61568ef98 | ||
|
|
3260e45e71 | ||
|
|
ea61b560b8 | ||
|
|
f8ad7d485b | ||
|
|
229e624434 | ||
|
|
7a3fb9c759 | ||
|
|
9a7ea0d28c | ||
|
|
ee5e655668 | ||
|
|
58be055f57 | ||
|
|
38e1944503 | ||
|
|
992b402e9c | ||
|
|
81bf28e4ed | ||
|
|
f10734b083 | ||
|
|
bf8f565631 | ||
|
|
9bc1ff8fa2 | ||
|
|
56239b6bbf | ||
|
|
cedd2bfe57 | ||
|
|
7e187a57d8 | ||
|
|
572a30a2c5 | ||
|
|
f3235ef7e8 | ||
|
|
7448eb32cc | ||
|
|
33e8cc4711 | ||
|
|
6cdb016c2c | ||
|
|
ababb7f5ab | ||
|
|
9f2b66e09d | ||
|
|
8de267f6a9 | ||
|
|
ecf9a3cbc9 | ||
|
|
01300b97e2 | ||
|
|
787163fb06 | ||
|
|
3701a3c3d9 | ||
|
|
68c51bb1bc | ||
|
|
df147c700c | ||
|
|
f5fc4d99dd | ||
|
|
2a4aa9e550 | ||
|
|
0a489f1117 | ||
|
|
9cc7c061a3 | ||
|
|
a1e7274ec3 | ||
|
|
51d516a39e | ||
|
|
de7c38231c | ||
|
|
c352ef9382 | ||
|
|
e36b5551e9 | ||
|
|
57856c38d6 | ||
|
|
2a8e02339b | ||
|
|
57f94ca6a2 | ||
|
|
0eaca8b80a | ||
|
|
d2dbab57dc | ||
|
|
cb448a3494 | ||
|
|
3fa6eae05b | ||
|
|
52cc7d699a | ||
|
|
ec4eac3a7d | ||
|
|
fbcfb23676 | ||
|
|
dbb2371801 | ||
|
|
4d6dc9546f | ||
|
|
06b9d328f4 | ||
|
|
48c7daa4ab | ||
|
|
3c83b88127 | ||
|
|
3a63fa5475 | ||
|
|
882790d133 | ||
|
|
bcf72b894d | ||
|
|
9f723c39ef | ||
|
|
56fc40a64d | ||
|
|
091f591ffb | ||
|
|
4d88a8206a | ||
|
|
363bf7c552 | ||
|
|
7ff4e5879d | ||
|
|
0b7decbfdd | ||
|
|
be9ea33aa4 | ||
|
|
d4b2cad94e | ||
|
|
ac039ce7cd | ||
|
|
946e60937d | ||
|
|
6f6601d270 | ||
|
|
71016f0d7c | ||
|
|
c2c2551607 | ||
|
|
d7812ec030 | ||
|
|
f184b0700f | ||
|
|
07f0be8d8d | ||
|
|
dd45b43d7f | ||
|
|
9b505106e3 | ||
|
|
d552f37daf | ||
|
|
6a7ff13859 | ||
|
|
9e3af13efc | ||
|
|
92a968217c | ||
|
|
37b9df3202 | ||
|
|
7dc33111fc | ||
|
|
ab2f260a52 | ||
|
|
1aa4b8cb88 | ||
|
|
dfed36748c | ||
|
|
d35f736548 | ||
|
|
cfecdae970 | ||
|
|
59ade6cf09 | ||
|
|
642842888a | ||
|
|
3ae51edf3a | ||
|
|
d8ccb81015 | ||
|
|
0db6020231 | ||
|
|
738c0a5c9c | ||
|
|
a2f7d3e241 | ||
|
|
9b86ded164 | ||
|
|
6cbb645b10 | ||
|
|
066a1d7591 | ||
|
|
5f82d575ee | ||
|
|
302ae0a83c | ||
|
|
82c4c791cc | ||
|
|
3c0310120d | ||
|
|
21c106e9d5 | ||
|
|
2c8cd2f8dc | ||
|
|
380d9908b4 | ||
|
|
6abef7d645 | ||
|
|
98ac25ac29 | ||
|
|
93bec04c92 | ||
|
|
136559cddd | ||
|
|
3f63a6ed70 | ||
|
|
2fcb3c4420 | ||
|
|
baaeb229cf | ||
|
|
a3bda3a941 | ||
|
|
3d536aa28d | ||
|
|
454267455b | ||
|
|
8e9adeb4b4 | ||
|
|
1f18e7beed | ||
|
|
b5e8e54107 | ||
|
|
f41e426b69 | ||
|
|
6375862a71 | ||
|
|
be2a745d78 | ||
|
|
d89feb2c75 | ||
|
|
b4a20c8fcb | ||
|
|
73087a92f4 | ||
|
|
2b58bd5bd8 | ||
|
|
bce0101278 | ||
|
|
bba418c79d | ||
|
|
cb58eb82fc | ||
|
|
3aafffabc1 | ||
|
|
66b9cdf64c | ||
|
|
d31fbf3b6f | ||
|
|
dbee30a412 | ||
|
|
f3cc881930 | ||
|
|
3d9c9e639d | ||
|
|
d6969d2c74 | ||
|
|
b7e28a73ba | ||
|
|
1e8206757d | ||
|
|
a0e94577fc | ||
|
|
a2a0c2f791 | ||
|
|
63a0fde121 | ||
|
|
c06152de07 | ||
|
|
0b3ccbda20 | ||
|
|
97b7eb0768 | ||
|
|
b712301804 | ||
|
|
76ebe3ff41 | ||
|
|
d988bb1821 | ||
|
|
64f1fbe400 | ||
|
|
c2c837329c | ||
|
|
b6531efe08 | ||
|
|
2c97a4aefe | ||
|
|
f0ffebd58c | ||
|
|
05e407f064 | ||
|
|
6dd2eec1b6 | ||
|
|
df13436688 | ||
|
|
fa0d89b6df | ||
|
|
ab0f8defa4 | ||
|
|
6b3329845b | ||
|
|
14fe35bba0 | ||
|
|
cb9d3414f2 | ||
|
|
677526cb16 | ||
|
|
08690b9d9e | ||
|
|
d3eb9c9d99 | ||
|
|
a0ef3a0e44 | ||
|
|
87c5ad79f4 | ||
|
|
2e210e7adc | ||
|
|
c56f4783c0 | ||
|
|
a1d351aa37 |
3
.gitignore
vendored
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
/core/assets/mindustry-saves/
|
/core/assets/mindustry-saves/
|
||||||
/core/assets/mindustry-maps/
|
/core/assets/mindustry-maps/
|
||||||
|
/core/assets/bundles/output/
|
||||||
/deploy/
|
/deploy/
|
||||||
/desktop/packr-out/
|
/desktop/packr-out/
|
||||||
/desktop/packr-export/
|
/desktop/packr-export/
|
||||||
@@ -19,6 +20,8 @@
|
|||||||
/android/assets/mindustry-saves/
|
/android/assets/mindustry-saves/
|
||||||
/core/assets/gifexport/
|
/core/assets/gifexport/
|
||||||
/core/assets/version.properties
|
/core/assets/version.properties
|
||||||
|
/core/assets/locales.json
|
||||||
|
/ios/src/io/anuke/mindustry/gen/
|
||||||
*.gif
|
*.gif
|
||||||
|
|
||||||
version.properties
|
version.properties
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ jdk:
|
|||||||
|
|
||||||
android:
|
android:
|
||||||
components:
|
components:
|
||||||
- android-26
|
- android-27
|
||||||
|
|
||||||
# Additional components
|
# Additional components
|
||||||
- extra-google-google_play_services
|
- extra-google-google_play_services
|
||||||
- extra-google-m2repository
|
- extra-google-m2repository
|
||||||
- extra-android-m2repository
|
- extra-android-m2repository
|
||||||
- addon-google_apis-google-26
|
- addon-google_apis-google-27
|
||||||
|
- build-tools-27.0.3
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./gradlew desktop:dist
|
- ./gradlew desktop:dist
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||

|

|
||||||
|
|
||||||
[](https://travis-ci.org/Anuken/Mindustry)
|
[](https://travis-ci.org/Anuken/Mindustry)
|
||||||
[](https://waffle.io/Anuken/Mindustry)
|
\
|
||||||
|
|
||||||
A pixelated sandbox tower defense game made using [LibGDX](https://libgdx.badlogicgames.com/). Winner of the [GDL Metal Monstrosity Jam](https://itch.io/jam/gdl---metal-monstrosity-jam).
|
A pixelated sandbox tower defense game made using [LibGDX](https://libgdx.badlogicgames.com/). Winner of the [GDL Metal Monstrosity Jam](https://itch.io/jam/gdl---metal-monstrosity-jam).
|
||||||
|
|
||||||
_[Issue tracker](https://waffle.io/Anuken/Mindustry)_
|
|
||||||
_[Trello Board](https://trello.com/b/aE2tcUwF/mindustry-40-plans)_
|
_[Trello Board](https://trello.com/b/aE2tcUwF/mindustry-40-plans)_
|
||||||
_[Wiki](http://mindustry.wikia.com/wiki/Mindustry_Wiki)_
|
_[Wiki](http://mindustry.wikia.com/wiki/Mindustry_Wiki)_
|
||||||
_[Discord](https://discord.gg/r8BkXNd)_
|
_[Discord](https://discord.gg/r8BkXNd)_
|
||||||
|
|||||||
39
TRANSLATING.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## Translating for Mindustry
|
||||||
|
|
||||||
|
**DISCLAIMER:** *Currently, 4.0 is far from done, which means that things such as block names, descriptions, and core text will be changing often. If you begin translating now, you might have to re-do large chunks of the bundle before final release.*
|
||||||
|
|
||||||
|
|
||||||
|
To begin, log in to your GitHub account, or if you don't have one yet, create it [here](https://github.com/).
|
||||||
|
|
||||||
|
Consult [this list](https://www.science.co.il/language/Locale-codes.php) to find the locale code for your language. Once you've found it,
|
||||||
|
head over to the translation bundle folder and check the [list of bundles](https://github.com/Anuken/Mindustry/tree/master/core/assets/bundles) that have already been created.
|
||||||
|
You're looking for a file called "`bundle_`(insert locale code here)`.properties`". If you don't find one, create one manually (more info below).
|
||||||
|
|
||||||
|
#### Editing an existing translation
|
||||||
|
|
||||||
|
If a translation bundle already exists, that means someone has already started working on a translation. To edit it or translate text, simply click the file and press the edit (pencil) button in the top right. Once you're done editing, press the green "propose file change" button at the bottom, then "create pull request" (twice).
|
||||||
|
Once this is done, all you need to do is wait for me to approve your changes.
|
||||||
|
|
||||||
|
#### Creating a new translation bundle
|
||||||
|
|
||||||
|
If a translation bundle for your language *doesn't* exist, you need to create one yourself.
|
||||||
|
In the folder with all the bundles in it, click the *'create new file'* button, and name it `bundle_(locale code here).properties`.
|
||||||
|
Then, copy-paste the entire contents of the [English translation bundle](https://raw.githubusercontent.com/Anuken/Mindustry/master/core/assets/bundles/bundle.properties) into the file, and translate all the necessary text to your language.
|
||||||
|
Once you are done, press the *propose new file* button at the bottom, then 'create pull request' twice.
|
||||||
|
|
||||||
|
#### Useful Information
|
||||||
|
|
||||||
|
- When you see text surrounded by square brackets, such as `[RED]`, `[]` or `[accent]`, this indicates a color code. Don't translate it.
|
||||||
|
- `{0}` means an argument that will be replaced when the text is displayed. For example, `Wave: {0}` will replace the `{0}` with whatever wave you are in.
|
||||||
|
- Empty lines are fine, and it doesn't matter in what order you place the text.
|
||||||
|
- `\n` means "new line". If you want to split text into multiple lines, use `\n` to do it.
|
||||||
|
|
||||||
|
#### Testing your translation bundle
|
||||||
|
|
||||||
|
There are two ways to test the translation bundle:
|
||||||
|
1) Assuming you have the PC version downloaded, download your bundle file, name it `bundle.properties`, then place it in the same folder as the Mindustry desktop executable and run it. *You should get a popup message in-game confirming that you have loaded an external translation.*
|
||||||
|
2) For advanced users: simply download your fork of mindustry and compile/run the game.
|
||||||
|
|
||||||
|
**And that's it.**
|
||||||
|
|
||||||
|
*(...of course, that's never really it. Bother me on Discord when something inevitably goes wrong.)*
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name="io.anuke.mindustry.AndroidLauncher"
|
android:name="io.anuke.mindustry.AndroidLauncher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="sensor"
|
android:screenOrientation="user"
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ dependencies {
|
|||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||||
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
|
||||||
implementation "com.badlogicgames.gdx:gdx-ai:$aiVersion"
|
|
||||||
implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
|
implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import android.provider.Settings.Secure;
|
|||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
import com.badlogic.gdx.files.FileHandle;
|
import com.badlogic.gdx.files.FileHandle;
|
||||||
import com.badlogic.gdx.utils.Base64Coder;
|
import com.badlogic.gdx.utils.Base64Coder;
|
||||||
@@ -25,8 +24,8 @@ import io.anuke.kryonet.KryoClient;
|
|||||||
import io.anuke.kryonet.KryoServer;
|
import io.anuke.kryonet.KryoServer;
|
||||||
import io.anuke.mindustry.core.Platform;
|
import io.anuke.mindustry.core.Platform;
|
||||||
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
import io.anuke.mindustry.core.ThreadHandler.ThreadProvider;
|
||||||
|
import io.anuke.mindustry.game.Saves.SaveSlot;
|
||||||
import io.anuke.mindustry.io.SaveIO;
|
import io.anuke.mindustry.io.SaveIO;
|
||||||
import io.anuke.mindustry.io.Saves.SaveSlot;
|
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
import io.anuke.mindustry.ui.dialogs.FileChooser;
|
import io.anuke.mindustry.ui.dialogs.FileChooser;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
@@ -48,19 +47,16 @@ import java.util.Locale;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class AndroidLauncher extends AndroidApplication{
|
public class AndroidLauncher extends PatchedAndroidApplication{
|
||||||
public static final int PERMISSION_REQUEST_CODE = 1;
|
public static final int PERMISSION_REQUEST_CODE = 1;
|
||||||
|
|
||||||
boolean doubleScaleTablets = true;
|
boolean doubleScaleTablets = true;
|
||||||
FileChooser chooser;
|
FileChooser chooser;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState){
|
protected void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
config.useImmersiveMode = true;
|
config.useImmersiveMode = true;
|
||||||
|
|
||||||
Platform.instance = new Platform(){
|
Platform.instance = new Platform(){
|
||||||
DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
DateFormat format = SimpleDateFormat.getDateTimeInstance();
|
||||||
|
|
||||||
@@ -109,18 +105,14 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
try{
|
try{
|
||||||
String s = Secure.getString(getContext().getContentResolver(),
|
String s = Secure.getString(getContext().getContentResolver(),
|
||||||
Secure.ANDROID_ID);
|
Secure.ANDROID_ID);
|
||||||
|
|
||||||
int len = s.length();
|
int len = s.length();
|
||||||
byte[] data = new byte[len / 2];
|
byte[] data = new byte[len / 2];
|
||||||
for(int i = 0; i < len; i += 2){
|
for(int i = 0; i < len; i += 2){
|
||||||
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
|
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
|
||||||
+ Character.digit(s.charAt(i + 1), 16));
|
+ Character.digit(s.charAt(i + 1), 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = new String(Base64Coder.encode(data));
|
String result = new String(Base64Coder.encode(data));
|
||||||
|
|
||||||
if(result.equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
if(result.equals("AAAAAAAAAOA=")) throw new RuntimeException("Bad UUID.");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
return super.getUUID();
|
return super.getUUID();
|
||||||
@@ -129,28 +121,23 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shareFile(FileHandle file){
|
public void shareFile(FileHandle file){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showFileChooser(String text, String content, Consumer<FileHandle> cons, boolean open, String filetype){
|
public void showFileChooser(String text, String content, Consumer<FileHandle> cons, boolean open, String filetype){
|
||||||
chooser = new FileChooser(text, file -> file.extension().equalsIgnoreCase(filetype), open, cons);
|
chooser = new FileChooser(text, file -> file.extension().equalsIgnoreCase(filetype), open, cons);
|
||||||
|
|
||||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED &&
|
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED &&
|
||||||
checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)){
|
checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)){
|
||||||
chooser.show();
|
chooser.show();
|
||||||
chooser = null;
|
chooser = null;
|
||||||
}else{
|
}else{
|
||||||
ArrayList<String> perms = new ArrayList<>();
|
ArrayList<String> perms = new ArrayList<>();
|
||||||
|
|
||||||
if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
|
if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
|
||||||
perms.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
perms.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
|
if(checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
|
||||||
perms.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
perms.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPermissions(perms.toArray(new String[perms.size()]), PERMISSION_REQUEST_CODE);
|
requestPermissions(perms.toArray(new String[perms.size()]), PERMISSION_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,7 +157,6 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try{
|
try{
|
||||||
ProviderInstaller.installIfNeeded(this);
|
ProviderInstaller.installIfNeeded(this);
|
||||||
}catch(GooglePlayServicesRepairableException e){
|
}catch(GooglePlayServicesRepairableException e){
|
||||||
@@ -179,18 +165,13 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
}catch(GooglePlayServicesNotAvailableException e){
|
}catch(GooglePlayServicesNotAvailableException e){
|
||||||
Log.e("SecurityException", "Google Play Services not available.");
|
Log.e("SecurityException", "Google Play Services not available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doubleScaleTablets && isTablet(this.getContext())){
|
if(doubleScaleTablets && isTablet(this.getContext())){
|
||||||
Unit.dp.addition = 0.5f;
|
Unit.dp.addition = 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.hideStatusBar = true;
|
config.hideStatusBar = true;
|
||||||
|
|
||||||
Net.setClientProvider(new KryoClient());
|
Net.setClientProvider(new KryoClient());
|
||||||
Net.setServerProvider(new KryoServer());
|
Net.setServerProvider(new KryoServer());
|
||||||
|
|
||||||
initialize(new Mindustry(), config);
|
initialize(new Mindustry(), config);
|
||||||
|
|
||||||
checkFiles(getIntent());
|
checkFiles(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +181,6 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
for(int i : grantResults){
|
for(int i : grantResults){
|
||||||
if(i != PackageManager.PERMISSION_GRANTED) return;
|
if(i != PackageManager.PERMISSION_GRANTED) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chooser != null){
|
if(chooser != null){
|
||||||
chooser.show();
|
chooser.show();
|
||||||
}
|
}
|
||||||
@@ -220,21 +200,16 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
//error
|
//error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean save = uri.getPath().endsWith(saveExtension);
|
boolean save = uri.getPath().endsWith(saveExtension);
|
||||||
boolean map = uri.getPath().endsWith(mapExtension);
|
boolean map = uri.getPath().endsWith(mapExtension);
|
||||||
|
|
||||||
InputStream inStream;
|
InputStream inStream;
|
||||||
if(myFile != null) inStream = new FileInputStream(myFile);
|
if(myFile != null) inStream = new FileInputStream(myFile);
|
||||||
else inStream = getContentResolver().openInputStream(uri);
|
else inStream = getContentResolver().openInputStream(uri);
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
Gdx.app.postRunnable(() -> {
|
||||||
|
|
||||||
if(save){ //open save
|
if(save){ //open save
|
||||||
System.out.println("Opening save.");
|
System.out.println("Opening save.");
|
||||||
FileHandle file = Gdx.files.local("temp-save." + saveExtension);
|
FileHandle file = Gdx.files.local("temp-save." + saveExtension);
|
||||||
file.write(inStream, false);
|
file.write(inStream, false);
|
||||||
|
|
||||||
if(SaveIO.isSaveValid(file)){
|
if(SaveIO.isSaveValid(file)){
|
||||||
try{
|
try{
|
||||||
SaveSlot slot = control.getSaves().importSave(file);
|
SaveSlot slot = control.getSaves().importSave(file);
|
||||||
@@ -245,20 +220,17 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
}else{
|
}else{
|
||||||
ui.showError("$text.save.import.invalid");
|
ui.showError("$text.save.import.invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(map){ //open map
|
}else if(map){ //open map
|
||||||
Gdx.app.postRunnable(() -> {
|
Gdx.app.postRunnable(() -> {
|
||||||
System.out.println("Opening map.");
|
System.out.println("Opening map.");
|
||||||
if(!ui.editor.isShown()){
|
if(!ui.editor.isShown()){
|
||||||
ui.editor.show();
|
ui.editor.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.editor.beginEditMap(inStream);
|
ui.editor.beginEditMap(inStream);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ public class AndroidTextFieldDialog{
|
|||||||
while(!isBuild){
|
while(!isBuild){
|
||||||
try{
|
try{
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
} catch (InterruptedException e) { }
|
}catch(InterruptedException e){
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -8,12 +8,9 @@ import android.support.v4.app.FragmentManager;
|
|||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
import org.sufficientlysecure.donations.DonationsFragment;
|
import org.sufficientlysecure.donations.DonationsFragment;
|
||||||
|
|
||||||
public class DonationsActivity extends FragmentActivity{
|
public class DonationsActivity extends FragmentActivity{
|
||||||
DonationsFragment donationsFragment;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Google
|
* Google
|
||||||
*/
|
*/
|
||||||
@@ -22,6 +19,7 @@ public class DonationsActivity extends FragmentActivity {
|
|||||||
"mindustry.donation.1", "mindustry.donation.2", "mindustry.donation.5",
|
"mindustry.donation.1", "mindustry.donation.2", "mindustry.donation.5",
|
||||||
"mindustry.donation.10", "mindustry.donation.15",
|
"mindustry.donation.10", "mindustry.donation.15",
|
||||||
"mindustry.donation.25", "mindustry.donation.50"};
|
"mindustry.donation.25", "mindustry.donation.50"};
|
||||||
|
DonationsFragment donationsFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the activity is first created.
|
* Called when the activity is first created.
|
||||||
@@ -50,7 +48,8 @@ public class DonationsActivity extends FragmentActivity {
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
Button b = ((Button) findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button));
|
Button b = ((Button) findViewById(org.sufficientlysecure.donations.R.id.donations__google_android_market_donate_button));
|
||||||
b.setOnClickListener(new View.OnClickListener(){
|
b.setOnClickListener(new View.OnClickListener(){
|
||||||
@Override public void onClick(View view) {
|
@Override
|
||||||
|
public void onClick(View view){
|
||||||
donationsFragment.donateGoogleOnClick(donationsFragment.getView());
|
donationsFragment.donateGoogleOnClick(donationsFragment.getView());
|
||||||
b.setEnabled(false);
|
b.setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -58,7 +57,6 @@ public class DonationsActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Needed for Google Play In-app Billing. It uses startIntentSenderForResult(). The result is not propagated to
|
* Needed for Google Play In-app Billing. It uses startIntentSenderForResult(). The result is not propagated to
|
||||||
* the Fragment like in startActivityForResult(). Thus we need to propagate manually to our Fragment.
|
* the Fragment like in startActivityForResult(). Thus we need to propagate manually to our Fragment.
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package io.anuke.mindustry;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
public class PatchedAndroidApplication extends AndroidApplication {
|
||||||
|
private final ExecutorService exec = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause () {
|
||||||
|
if(useImmersiveMode) {
|
||||||
|
exec.submit(() -> {
|
||||||
|
try {Thread.sleep(100);} catch (InterruptedException ignored) {}
|
||||||
|
graphics.onDrawFrame(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,13 @@ public class TextFieldDialogListener extends ClickListener{
|
|||||||
private int type;
|
private int type;
|
||||||
private int max;
|
private int max;
|
||||||
|
|
||||||
|
//type - 0 is text, 1 is numbers, 2 is decimals
|
||||||
|
public TextFieldDialogListener(TextField field, int type, int max){
|
||||||
|
this.field = field;
|
||||||
|
this.type = type;
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
public static void add(TextField field, int type, int max){
|
public static void add(TextField field, int type, int max){
|
||||||
field.addListener(new TextFieldDialogListener(field, type, max));
|
field.addListener(new TextFieldDialogListener(field, type, max));
|
||||||
field.addListener(new InputListener(){
|
field.addListener(new InputListener(){
|
||||||
@@ -29,13 +36,6 @@ public class TextFieldDialogListener extends ClickListener{
|
|||||||
add(field, 0, 16);
|
add(field, 0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
//type - 0 is text, 1 is numbers, 2 is decimals
|
|
||||||
public TextFieldDialogListener(TextField field, int type, int max){
|
|
||||||
this.field = field;
|
|
||||||
this.type = type;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clicked(final InputEvent event, float x, float y){
|
public void clicked(final InputEvent event, float x, float y){
|
||||||
|
|
||||||
if(Gdx.app.getType() == ApplicationType.Desktop) return;
|
if(Gdx.app.getType() == ApplicationType.Desktop) return;
|
||||||
|
|||||||
@@ -11,45 +11,6 @@ import java.lang.annotation.Target;
|
|||||||
*/
|
*/
|
||||||
public class Annotations{
|
public class Annotations{
|
||||||
|
|
||||||
/**Marks a method as invokable remotely across a server/client connection.*/
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
@Retention(RetentionPolicy.CLASS)
|
|
||||||
public @interface Remote {
|
|
||||||
/**Specifies the locations from which this method can be invoked.*/
|
|
||||||
Loc targets() default Loc.server;
|
|
||||||
/**Specifies which methods are generated. Only affects server-to-client methods.*/
|
|
||||||
Variant variants() default Variant.all;
|
|
||||||
/**The local locations where this method is called locally, when invoked.*/
|
|
||||||
Loc called() default Loc.none;
|
|
||||||
/**Whether to forward this packet to all other clients upon recieval. Server only.*/
|
|
||||||
boolean forward() default false;
|
|
||||||
/**Whether the packet for this method is sent with UDP instead of TCP.
|
|
||||||
* UDP is faster, but is prone to packet loss and duplication.*/
|
|
||||||
boolean unreliable() default false;
|
|
||||||
/**The simple class name where this method is placed.*/
|
|
||||||
String in() default "Call";
|
|
||||||
/**Priority of this event.*/
|
|
||||||
PacketPriority priority() default PacketPriority.normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**Specifies that this method will be used to write classes of the type returned by {@link #value()}.<br>
|
|
||||||
* This method must return void and have two parameters, the first being of type {@link java.nio.ByteBuffer} and the second
|
|
||||||
* being the type returned by {@link #value()}.*/
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
@Retention(RetentionPolicy.CLASS)
|
|
||||||
public @interface WriteClass {
|
|
||||||
Class<?> value();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**Specifies that this method will be used to read classes of the type returned by {@link #value()}. <br>
|
|
||||||
* This method must return the type returned by {@link #value()},
|
|
||||||
* and have one parameter, being of type {@link java.nio.ByteBuffer}.*/
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
@Retention(RetentionPolicy.CLASS)
|
|
||||||
public @interface ReadClass {
|
|
||||||
Class<?> value();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum PacketPriority{
|
public enum PacketPriority{
|
||||||
/** Gets put in a queue and processed if not connected. */
|
/** Gets put in a queue and processed if not connected. */
|
||||||
normal,
|
normal,
|
||||||
@@ -67,7 +28,7 @@ public class Annotations {
|
|||||||
client(false, true),
|
client(false, true),
|
||||||
/** Method can be invoked from anywhere */
|
/** Method can be invoked from anywhere */
|
||||||
both(true, true),
|
both(true, true),
|
||||||
/**Neither server no client.*/
|
/** Neither server nor client. */
|
||||||
none(false, false);
|
none(false, false);
|
||||||
|
|
||||||
/** If true, this method can be invoked ON clients FROM servers. */
|
/** If true, this method can be invoked ON clients FROM servers. */
|
||||||
@@ -96,4 +57,52 @@ public class Annotations {
|
|||||||
this.isAll = isAll;
|
this.isAll = isAll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Marks a method as invokable remotely across a server/client connection. */
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.CLASS)
|
||||||
|
public @interface Remote{
|
||||||
|
/** Specifies the locations from which this method can be invoked. */
|
||||||
|
Loc targets() default Loc.server;
|
||||||
|
|
||||||
|
/** Specifies which methods are generated. Only affects server-to-client methods. */
|
||||||
|
Variant variants() default Variant.all;
|
||||||
|
|
||||||
|
/** The local locations where this method is called locally, when invoked. */
|
||||||
|
Loc called() default Loc.none;
|
||||||
|
|
||||||
|
/** Whether to forward this packet to all other clients upon recieval. Client only. */
|
||||||
|
boolean forward() default false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the packet for this method is sent with UDP instead of TCP.
|
||||||
|
* UDP is faster, but is prone to packet loss and duplication.
|
||||||
|
*/
|
||||||
|
boolean unreliable() default false;
|
||||||
|
|
||||||
|
/** Priority of this event. */
|
||||||
|
PacketPriority priority() default PacketPriority.normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that this method will be used to write classes of the type returned by {@link #value()}.<br>
|
||||||
|
* This method must return void and have two parameters, the first being of type {@link java.nio.ByteBuffer} and the second
|
||||||
|
* being the type returned by {@link #value()}.
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.CLASS)
|
||||||
|
public @interface WriteClass{
|
||||||
|
Class<?> value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that this method will be used to read classes of the type returned by {@link #value()}. <br>
|
||||||
|
* This method must return the type returned by {@link #value()},
|
||||||
|
* and have one parameter, being of type {@link java.nio.ByteBuffer}.
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.CLASS)
|
||||||
|
public @interface ReadClass{
|
||||||
|
Class<?> value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,16 @@ import javax.tools.Diagnostic.Kind;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**This class finds reader and writer methods annotated by the {@link io.anuke.annotations.Annotations.WriteClass}
|
/**
|
||||||
* and {@link io.anuke.annotations.Annotations.ReadClass} annotations.*/
|
* This class finds reader and writer methods annotated by the {@link io.anuke.annotations.Annotations.WriteClass}
|
||||||
|
* and {@link io.anuke.annotations.Annotations.ReadClass} annotations.
|
||||||
|
*/
|
||||||
public class IOFinder{
|
public class IOFinder{
|
||||||
|
|
||||||
/**Finds all class serializers for all types and returns them. Logs errors when necessary.
|
/**
|
||||||
* Maps fully qualified class names to their serializers.*/
|
* Finds all class serializers for all types and returns them. Logs errors when necessary.
|
||||||
|
* Maps fully qualified class names to their serializers.
|
||||||
|
*/
|
||||||
public HashMap<String, ClassSerializer> findSerializers(RoundEnvironment env){
|
public HashMap<String, ClassSerializer> findSerializers(RoundEnvironment env){
|
||||||
HashMap<String, ClassSerializer> result = new HashMap<>();
|
HashMap<String, ClassSerializer> result = new HashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ public class MethodEntry {
|
|||||||
public final String targetMethod;
|
public final String targetMethod;
|
||||||
/** Whether this method can be called on a client/server. */
|
/** Whether this method can be called on a client/server. */
|
||||||
public final Loc where;
|
public final Loc where;
|
||||||
/**Whether an additional 'one' and 'all' method variant is generated. At least one of these must be true.
|
/**
|
||||||
* Only applicable to client (server-invoked) methods.*/
|
* Whether an additional 'one' and 'all' method variant is generated. At least one of these must be true.
|
||||||
|
* Only applicable to client (server-invoked) methods.
|
||||||
|
*/
|
||||||
public final Variant target;
|
public final Variant target;
|
||||||
/** Whether this method is called locally as well as remotely. */
|
/** Whether this method is called locally as well as remotely. */
|
||||||
public final Loc local;
|
public final Loc local;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
|
|||||||
private static final String readServerName = "RemoteReadServer";
|
private static final String readServerName = "RemoteReadServer";
|
||||||
/** Name of class that handles reading and invoking packets on the client. */
|
/** Name of class that handles reading and invoking packets on the client. */
|
||||||
private static final String readClientName = "RemoteReadClient";
|
private static final String readClientName = "RemoteReadClient";
|
||||||
|
/**Simple class name of generated class name.*/
|
||||||
|
private static final String callLocation = "Call";
|
||||||
|
|
||||||
/** Processing round number. */
|
/** Processing round number. */
|
||||||
private int round;
|
private int round;
|
||||||
@@ -102,15 +104,15 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get and create class entry if needed
|
//get and create class entry if needed
|
||||||
if (!classMap.containsKey(annotation.in())) {
|
if(!classMap.containsKey(callLocation)){
|
||||||
ClassEntry clas = new ClassEntry(annotation.in());
|
ClassEntry clas = new ClassEntry(callLocation);
|
||||||
classMap.put(annotation.in(), clas);
|
classMap.put(callLocation, clas);
|
||||||
classes.add(clas);
|
classes.add(clas);
|
||||||
|
|
||||||
Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'.");
|
Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassEntry entry = classMap.get(annotation.in());
|
ClassEntry entry = classMap.get(callLocation);
|
||||||
|
|
||||||
//create and add entry
|
//create and add entry
|
||||||
MethodEntry method = new MethodEntry(entry.name, Utils.getMethodName(element), annotation.targets(), annotation.variants(),
|
MethodEntry method = new MethodEntry(entry.name, Utils.getMethodName(element), annotation.targets(), annotation.variants(),
|
||||||
|
|||||||
@@ -23,11 +23,14 @@ public class RemoteReadGenerator {
|
|||||||
this.serializers = serializers;
|
this.serializers = serializers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Generates a class for reading remote invoke packets.
|
/**
|
||||||
|
* Generates a class for reading remote invoke packets.
|
||||||
|
*
|
||||||
* @param entries List of methods to use/
|
* @param entries List of methods to use/
|
||||||
* @param className Simple target class name.
|
* @param className Simple target class name.
|
||||||
* @param packageName Full target package name.
|
* @param packageName Full target package name.
|
||||||
* @param needsPlayer Whether this read method requires a reference to the player sender.*/
|
* @param needsPlayer Whether this read method requires a reference to the player sender.
|
||||||
|
*/
|
||||||
public void generateFor(List<MethodEntry> entries, String className, String packageName, boolean needsPlayer)
|
public void generateFor(List<MethodEntry> entries, String className, String packageName, boolean needsPlayer)
|
||||||
throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException{
|
throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, IOException{
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class RemoteWriteGenerator {
|
|||||||
method.beginControlFlow("if(" + getCheckString(methodEntry.where) + ")");
|
method.beginControlFlow("if(" + getCheckString(methodEntry.where) + ")");
|
||||||
|
|
||||||
//add statement to create packet from pool
|
//add statement to create packet from pool
|
||||||
method.addStatement("$1N packet = $2N.obtain($1N.class)", "io.anuke.mindustry.net.Packets.InvokePacket", "com.badlogic.gdx.utils.Pools");
|
method.addStatement("$1N packet = $2N.obtain($1N.class)", "io.anuke.mindustry.net.Packets.InvokePacket", "io.anuke.ucore.util.Pooling");
|
||||||
//assign buffer
|
//assign buffer
|
||||||
method.addStatement("packet.writeBuffer = TEMP_BUFFER");
|
method.addStatement("packet.writeBuffer = TEMP_BUFFER");
|
||||||
//assign priority
|
//assign priority
|
||||||
|
|||||||
58
build.gradle
@@ -9,7 +9,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
|
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0'
|
||||||
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
|
||||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
classpath 'com.android.tools.build:gradle:3.1.3'
|
||||||
classpath "com.badlogicgames.gdx:gdx-tools:1.9.8"
|
classpath "com.badlogicgames.gdx:gdx-tools:1.9.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,7 @@ allprojects {
|
|||||||
appName = 'Mindustry'
|
appName = 'Mindustry'
|
||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
aiVersion = '1.8.1'
|
uCoreVersion = '76dc741b49'
|
||||||
uCoreVersion = '2241e5402e'
|
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
@@ -43,6 +42,17 @@ allprojects {
|
|||||||
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
return project.ext.mainClassName.substring(0, project.ext.mainClassName.indexOf("desktop") - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateLocales = {
|
||||||
|
def output = '["en",'
|
||||||
|
def bundles = new File('core/assets/bundles/')
|
||||||
|
bundles.listFiles().each { other ->
|
||||||
|
if(other.name == "bundle.properties") return;
|
||||||
|
output += '"' + other.name.substring("bundle".length() + 1, other.name.lastIndexOf('.')) + '",'
|
||||||
|
}
|
||||||
|
output = (output.substring(0, output.size() - 1) + "]")
|
||||||
|
new File(project(':core').projectDir, 'assets/locales.json').text = output;
|
||||||
|
}
|
||||||
|
|
||||||
writeVersion = {
|
writeVersion = {
|
||||||
def pfile = new File('core/assets/version.properties')
|
def pfile = new File('core/assets/version.properties')
|
||||||
def props = new Properties()
|
def props = new Properties()
|
||||||
@@ -86,7 +96,6 @@ project(":desktop") {
|
|||||||
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-controllers-lwjgl3:$gdxVersion"
|
||||||
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0'
|
compile 'com.github.MinnDevelopment:java-discord-rpc:v2.0.0'
|
||||||
compile 'com.yuvimasory:orange-extensions:1.3.0'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,13 +111,10 @@ project(":html") {
|
|||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
|
|
||||||
|
|
||||||
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-controllers:$gdxVersion:sources"
|
||||||
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"
|
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion"
|
||||||
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion:sources"
|
compile "com.badlogicgames.gdx:gdx-controllers-gwt:$gdxVersion:sources"
|
||||||
compile "com.sksamuel.gwt:gwt-websockets:1.0.4"
|
|
||||||
compile "com.sksamuel.gwt:gwt-websockets:1.0.4:sources"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs = [
|
compileJava.options.compilerArgs = [
|
||||||
@@ -120,6 +126,25 @@ project(":ios") {
|
|||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
apply plugin: "robovm"
|
apply plugin: "robovm"
|
||||||
|
|
||||||
|
task copyGen{
|
||||||
|
doFirst{
|
||||||
|
copy{
|
||||||
|
from ("../core/build/classes/java/main/io/anuke/mindustry/gen/"){
|
||||||
|
include "**/*.java"
|
||||||
|
}
|
||||||
|
|
||||||
|
into "../core/src/io/anuke/mindustry/gen"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
doLast{
|
||||||
|
delete{
|
||||||
|
delete "../core/src/io/anuke/mindustry/gen/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
build.finalizedBy(copyGen)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
@@ -135,16 +160,16 @@ project(":ios") {
|
|||||||
project(":core") {
|
project(":core") {
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
|
task finish {
|
||||||
|
generateLocales()
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly project(":annotations")
|
compileOnly project(":annotations")
|
||||||
|
build.finalizedBy(finish)
|
||||||
|
|
||||||
boolean comp = System.properties["release"] == null || System.properties["release"] == "false"
|
def comp = System.properties["release"] == null || System.properties["release"] == "false"
|
||||||
|
if(!comp) println("Note: Compiling release build.")
|
||||||
if(!comp){
|
|
||||||
println("NOTICE: Compiling release build.")
|
|
||||||
}else{
|
|
||||||
println("Compiling DEBUG build.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if(new File(projectDir.parent, '../uCore').exists() && comp){
|
if(new File(projectDir.parent, '../uCore').exists() && comp){
|
||||||
compile project(":uCore")
|
compile project(":uCore")
|
||||||
@@ -168,6 +193,10 @@ project(":core") {
|
|||||||
project(":server") {
|
project(":server") {
|
||||||
apply plugin: "java"
|
apply plugin: "java"
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compile.exclude module: android
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly project(":annotations")
|
compileOnly project(":annotations")
|
||||||
|
|
||||||
@@ -200,7 +229,6 @@ project(":kryonet") {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile project(":core")
|
compile project(":core")
|
||||||
compile 'com.github.crykn:kryonet:2.22.1'
|
compile 'com.github.crykn:kryonet:2.22.1'
|
||||||
compile "org.java-websocket:Java-WebSocket:1.3.7"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 215 B |
|
After Width: | Height: | Size: 215 B |
|
After Width: | Height: | Size: 212 B |
|
After Width: | Height: | Size: 212 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 225 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 233 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 228 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 248 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 281 B |
|
After Width: | Height: | Size: 246 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 258 B |
|
After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 296 B After Width: | Height: | Size: 296 B |
|
Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 789 B |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 532 B |
|
Before Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 298 B |
|
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 261 B |
|
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 286 B |
|
Before Width: | Height: | Size: 174 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 188 B After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 180 B |
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 168 B |
|
After Width: | Height: | Size: 176 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 175 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 163 B |
|
Before Width: | Height: | Size: 169 B |
|
Before Width: | Height: | Size: 149 B |
|
Before Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 162 B |
BIN
core/assets-raw/sprites/blocks/extra/shadow-corner.png
Normal file
|
After Width: | Height: | Size: 197 B |
BIN
core/assets-raw/sprites/blocks/extra/shadow-round-3.png
Normal file
|
After Width: | Height: | Size: 231 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-0.png
Normal file
|
After Width: | Height: | Size: 213 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-1.png
Normal file
|
After Width: | Height: | Size: 225 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-2.png
Normal file
|
After Width: | Height: | Size: 216 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-3.png
Normal file
|
After Width: | Height: | Size: 224 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-4.png
Normal file
|
After Width: | Height: | Size: 224 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-5.png
Normal file
|
After Width: | Height: | Size: 225 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-bottom-6.png
Normal file
|
After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 217 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-top-0.png
Normal file
|
After Width: | Height: | Size: 210 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-top-1.png
Normal file
|
After Width: | Height: | Size: 234 B |
BIN
core/assets-raw/sprites/blocks/liquid/conduit-top-2.png
Normal file
|
After Width: | Height: | Size: 235 B |