mirror of
https://github.com/AndorsTrailRelease/andors-trail.git
synced 2025-12-30 00:03:37 +01:00
Compare commits
415 Commits
AT_refacto
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1a62f38e3 | ||
|
|
4d73d67cda | ||
|
|
c850033410 | ||
|
|
b7d58ef93f | ||
|
|
b08430f0ec | ||
|
|
68c6afafa3 | ||
|
|
a73984370b | ||
|
|
4cfa0b5746 | ||
|
|
5cb13482d6 | ||
|
|
bd72dd0e6b | ||
|
|
5460fea6eb | ||
|
|
f5f21f1146 | ||
|
|
86efd9704a | ||
|
|
24205cebf0 | ||
|
|
6b64a8df6b | ||
|
|
ffcc342568 | ||
|
|
3670a8e8f2 | ||
|
|
ef0a689037 | ||
|
|
39f50ee372 | ||
|
|
fcf34e1e40 | ||
|
|
97b349326f | ||
|
|
3175af1436 | ||
|
|
89e36ad505 | ||
|
|
88b817961d | ||
|
|
fc66726d3f | ||
|
|
a6e6c2a6a0 | ||
|
|
47f65b6617 | ||
|
|
f802a2a7a4 | ||
|
|
d91e2191c4 | ||
|
|
7c592b6d31 | ||
|
|
44c8323b0f | ||
|
|
b8323988db | ||
|
|
e35624741c | ||
|
|
88f131b610 | ||
|
|
bb05a6342c | ||
|
|
d56204fed9 | ||
|
|
995e0eae45 | ||
|
|
638f53953d | ||
|
|
599c4125b9 | ||
|
|
59560e25a9 | ||
|
|
eb05c9a137 | ||
|
|
e4a3060214 | ||
|
|
3f4b40564f | ||
|
|
1be5921ac9 | ||
|
|
c2584be0f0 | ||
|
|
825b2ddb04 | ||
|
|
d33083b4c4 | ||
|
|
8a9fe29259 | ||
|
|
557b066a72 | ||
|
|
0ad4e5c701 | ||
|
|
c21e2313c3 | ||
|
|
9abec9d873 | ||
|
|
b2eccfa823 | ||
|
|
d5def64e4a | ||
|
|
a264624a2f | ||
|
|
1d5a3d1fe0 | ||
|
|
34f00c043c | ||
|
|
e5f433c143 | ||
|
|
740eb2d963 | ||
|
|
5ace9336d3 | ||
|
|
6e23098cd4 | ||
|
|
e9ec25a7a5 | ||
|
|
b88a4b4c38 | ||
|
|
d02a2ea596 | ||
|
|
bc3ae1c030 | ||
|
|
e8343925d4 | ||
|
|
27e6214293 | ||
|
|
5c518cfd40 | ||
|
|
38954dd68d | ||
|
|
bb861d612d | ||
|
|
110f8014dd | ||
|
|
aa04017596 | ||
|
|
328612cce8 | ||
|
|
5b1e994941 | ||
|
|
ba7c077fe7 | ||
|
|
cf3069f919 | ||
|
|
9693ecbe27 | ||
|
|
1aad9229d9 | ||
|
|
5a480f0c9c | ||
|
|
0fbcc19916 | ||
|
|
80a2f11a40 | ||
|
|
83a7ceab8a | ||
|
|
598f1458d2 | ||
|
|
3282688d37 | ||
|
|
2b4ac1ad71 | ||
|
|
5f71026da9 | ||
|
|
f61bf8607e | ||
|
|
a2ae78664c | ||
|
|
d6e5a8763c | ||
|
|
8a0aefeecf | ||
|
|
c4c72c4b10 | ||
|
|
3d93553083 | ||
|
|
49e451329c | ||
|
|
8f73d39716 | ||
|
|
4cdda40373 | ||
|
|
92d9f8e4ae | ||
|
|
0f688f555b | ||
|
|
0f5757baeb | ||
|
|
d994e81c70 | ||
|
|
c1b4343eb5 | ||
|
|
0c5c7ac30c | ||
|
|
0da64a6cbd | ||
|
|
4cc0e7c1f1 | ||
|
|
917b72282d | ||
|
|
bac3e55ada | ||
|
|
6089c67333 | ||
|
|
c5795046f4 | ||
|
|
e9d1272c1e | ||
|
|
af994a15ce | ||
|
|
0119f296cb | ||
|
|
424402ae52 | ||
|
|
fe27fd303d | ||
|
|
1cb18db38a | ||
|
|
aa05f73961 | ||
|
|
64450dca3a | ||
|
|
18288a5338 | ||
|
|
dcf96d1a07 | ||
|
|
d2c73ad07a | ||
|
|
3fd1b5904a | ||
|
|
a9861b1c41 | ||
|
|
07bd912056 | ||
|
|
36b963628a | ||
|
|
fb97c80bc4 | ||
|
|
f45f4ac5d8 | ||
|
|
dc47e6e73f | ||
|
|
6c4f5b1488 | ||
|
|
e08457d646 | ||
|
|
8b9d1c725d | ||
|
|
601bd747d0 | ||
|
|
563a3b16c5 | ||
|
|
6c52850d1d | ||
|
|
80da982d4f | ||
|
|
0bfca92eaa | ||
|
|
86a7af6d5b | ||
|
|
83a58c1113 | ||
|
|
c3d607981e | ||
|
|
51d563435a | ||
|
|
1aa4b13809 | ||
|
|
2e4a1d0d7f | ||
|
|
1be14557d6 | ||
|
|
e1a42d6dbf | ||
|
|
6a264d6a8d | ||
|
|
d70f269c39 | ||
|
|
030eb9edb1 | ||
|
|
8c8902bb70 | ||
|
|
b63b3ec63f | ||
|
|
246501c2d6 | ||
|
|
48a67c3951 | ||
|
|
c3bcaf9827 | ||
|
|
1e6907349a | ||
|
|
211018d297 | ||
|
|
d8aa0ecdab | ||
|
|
84f30525bd | ||
|
|
f6fcbb111f | ||
|
|
2b6e9f9eca | ||
|
|
eb25cb5757 | ||
|
|
e4abe957b1 | ||
|
|
3ea586090b | ||
|
|
c068fb1742 | ||
|
|
524e48b0fc | ||
|
|
fbfee0fb22 | ||
|
|
c761689bb6 | ||
|
|
07f7346cd6 | ||
|
|
127b897156 | ||
|
|
5857b88dcb | ||
|
|
86cbac0096 | ||
|
|
bdfbb70a40 | ||
|
|
73f5ede48e | ||
|
|
a2fccb3b72 | ||
|
|
b824357bcb | ||
|
|
62cacf81ac | ||
|
|
0050f70f1e | ||
|
|
fd2c9c2b12 | ||
|
|
b0dd54801b | ||
|
|
9e0546bae2 | ||
|
|
342cbd7f43 | ||
|
|
091aa8b73a | ||
|
|
071354c21e | ||
|
|
520f6c2d2e | ||
|
|
9164e9a900 | ||
|
|
e53172d18f | ||
|
|
cf7dd4d0f4 | ||
|
|
fe329e1ed2 | ||
|
|
53f315dfe7 | ||
|
|
152816e3ca | ||
|
|
e4230b5f51 | ||
|
|
ff65ec3023 | ||
|
|
786a772998 | ||
|
|
b2c10b60c7 | ||
|
|
04db088df3 | ||
|
|
cdfa3e532a | ||
|
|
c454cda3e1 | ||
|
|
59c6f7e642 | ||
|
|
d7d2c8629f | ||
|
|
1bb7397d9e | ||
|
|
caca48752f | ||
|
|
9c3bb73cd5 | ||
|
|
b2db0c406b | ||
|
|
1b22562602 | ||
|
|
807cd43a25 | ||
|
|
6da895e910 | ||
|
|
90eeab54d5 | ||
|
|
e7f3022244 | ||
|
|
f64981a0a6 | ||
|
|
7b290271ce | ||
|
|
70c9822475 | ||
|
|
3a6158c1b0 | ||
|
|
71601ccf8a | ||
|
|
66eafdd3d7 | ||
|
|
609ae07f3c | ||
|
|
bbb6847f73 | ||
|
|
4d8c3e669a | ||
|
|
75ebcbcac8 | ||
|
|
24bb835dd5 | ||
|
|
0d4e757af5 | ||
|
|
d576094221 | ||
|
|
c574a1be19 | ||
|
|
f49bb528c0 | ||
|
|
829a8f31a0 | ||
|
|
4344ad09fb | ||
|
|
509af373f9 | ||
|
|
edc83e4943 | ||
|
|
fd3dfbb500 | ||
|
|
3e80a5421e | ||
|
|
c866b2b555 | ||
|
|
f652ec300a | ||
|
|
2a6ffe882b | ||
|
|
0e207fe63d | ||
|
|
bdfa2ce4b1 | ||
|
|
b7c1239508 | ||
|
|
15365cfd76 | ||
|
|
b3ae501e67 | ||
|
|
e49828a549 | ||
|
|
91c21b6ae6 | ||
|
|
87e579b67c | ||
|
|
a105a8e399 | ||
|
|
23cb379df8 | ||
|
|
496323efe0 | ||
|
|
d422ccb6d5 | ||
|
|
1d9dae18ff | ||
|
|
361a9fd5e6 | ||
|
|
810f5a2fc8 | ||
|
|
a4fbe20871 | ||
|
|
c2f8074968 | ||
|
|
ee0b609df5 | ||
|
|
a7be2c7995 | ||
|
|
da1c1e3339 | ||
|
|
e68b637140 | ||
|
|
0d73ee10fa | ||
|
|
f20529df62 | ||
|
|
ffef76b28b | ||
|
|
cd49473e86 | ||
|
|
363a395169 | ||
|
|
a09176d344 | ||
|
|
f884af20b8 | ||
|
|
a2859fbc56 | ||
|
|
11d5966a51 | ||
|
|
fd169e9f40 | ||
|
|
149ad3ae1c | ||
|
|
6e74243ea8 | ||
|
|
9c4009034f | ||
|
|
0422beb855 | ||
|
|
2cc12b3530 | ||
|
|
80997ddc36 | ||
|
|
c244ba1390 | ||
|
|
8a74ffd2ef | ||
|
|
57f7a0dc91 | ||
|
|
c51eecc7c6 | ||
|
|
1cf60ba813 | ||
|
|
e1a4f44824 | ||
|
|
c8ba52bd7c | ||
|
|
376037daa6 | ||
|
|
78cf59c90c | ||
|
|
ec0d1b0775 | ||
|
|
f9bdc0a0ab | ||
|
|
cb3f60ae02 | ||
|
|
e2db3ca914 | ||
|
|
c4ac6b1046 | ||
|
|
d0b93854e5 | ||
|
|
a5ed53a763 | ||
|
|
e70302d39f | ||
|
|
10345d814d | ||
|
|
e56748ea79 | ||
|
|
62ab2c128e | ||
|
|
5df6d4038d | ||
|
|
e92a2f60e9 | ||
|
|
d6b11d8242 | ||
|
|
d9e7509daa | ||
|
|
e15583e3c5 | ||
|
|
d03f6bda43 | ||
|
|
0d858efb4e | ||
|
|
530b0b6c8f | ||
|
|
9a71461b93 | ||
|
|
a54e70c539 | ||
|
|
33f76fc970 | ||
|
|
d081af6385 | ||
|
|
7a41390c4c | ||
|
|
1ddd03aad3 | ||
|
|
b1ce0f2c40 | ||
|
|
3166dc5708 | ||
|
|
2d5bd55733 | ||
|
|
c21f23a377 | ||
|
|
e236d6d025 | ||
|
|
487dfa76db | ||
|
|
cc7e6b57b8 | ||
|
|
18929a47c0 | ||
|
|
57481e1ba2 | ||
|
|
0ece679db0 | ||
|
|
8b51be44db | ||
|
|
19689c1edf | ||
|
|
b8c082f06c | ||
|
|
7b4a01767f | ||
|
|
f268e284c3 | ||
|
|
8533bcefb6 | ||
|
|
0fa29efd97 | ||
|
|
fc91f8e21b | ||
|
|
d36825377b | ||
|
|
55dd4950e0 | ||
|
|
fe23eb4e6f | ||
|
|
cc45029502 | ||
|
|
5ce621a5e2 | ||
|
|
8770f936c6 | ||
|
|
af818c2d4f | ||
|
|
1a6d694331 | ||
|
|
11cfe5a29f | ||
|
|
61a3024c9a | ||
|
|
fbcd8826d8 | ||
|
|
3335db78d8 | ||
|
|
4c67b7f43f | ||
|
|
a79b7ed228 | ||
|
|
b543000eae | ||
|
|
a8f84da60e | ||
|
|
28ab26a191 | ||
|
|
8a2b7cf1d5 | ||
|
|
5642aaaccc | ||
|
|
94229dcaec | ||
|
|
3b025b759b | ||
|
|
ff554e95b7 | ||
|
|
31deb90ba3 | ||
|
|
d0a9ec69d1 | ||
|
|
4b54cba1fd | ||
|
|
da9aafc9cd | ||
|
|
23be00403c | ||
|
|
d434dba616 | ||
|
|
b2aac53c5a | ||
|
|
4408163218 | ||
|
|
00a2eb7623 | ||
|
|
25b70ae818 | ||
|
|
1aa98de579 | ||
|
|
c925bfadc7 | ||
|
|
3b8aa60676 | ||
|
|
c4e0a896a8 | ||
|
|
be027bb303 | ||
|
|
d2fe192466 | ||
|
|
8ed9c1cd30 | ||
|
|
469d2bfc46 | ||
|
|
ce399ffe1f | ||
|
|
054c6e5d23 | ||
|
|
dce00a76a1 | ||
|
|
70f4d591df | ||
|
|
6f3b6074b1 | ||
|
|
f6a8988598 | ||
|
|
0ed1c53e3e | ||
|
|
cd83e4cac3 | ||
|
|
a2eef713d8 | ||
|
|
3a7c1c9e9a | ||
|
|
7699ac6dd1 | ||
|
|
7ea5823c37 | ||
|
|
437e0e1e09 | ||
|
|
f98c591838 | ||
|
|
bf4c7e56cc | ||
|
|
3a669c8f32 | ||
|
|
f8e9675d43 | ||
|
|
ba645ba4c2 | ||
|
|
4b5a744b89 | ||
|
|
3f6ac7c783 | ||
|
|
02d7c569cb | ||
|
|
863bfebeb7 | ||
|
|
0b5dc81038 | ||
|
|
4f00fb386f | ||
|
|
9a3c96f4cf | ||
|
|
ca29f8e08a | ||
|
|
5278c7bf32 | ||
|
|
8e01fed388 | ||
|
|
debdc8279e | ||
|
|
095fa8d06d | ||
|
|
bdcde78881 | ||
|
|
3a28703e88 | ||
|
|
967325abe9 | ||
|
|
9c3fff1337 | ||
|
|
090aedc638 | ||
|
|
eee3805b50 | ||
|
|
9954e9d802 | ||
|
|
bc34c1107a | ||
|
|
5d468c812b | ||
|
|
3eb9d6188a | ||
|
|
679e3dea6f | ||
|
|
56f5703e72 | ||
|
|
a38dc3d4c6 | ||
|
|
b86f29b0a3 | ||
|
|
2724253013 | ||
|
|
93c0330d27 | ||
|
|
2cddfec594 | ||
|
|
8c46e16019 | ||
|
|
6a29fff72c | ||
|
|
ef0475b9dc | ||
|
|
18e573c2ef | ||
|
|
6c0678295b | ||
|
|
4f13d98652 | ||
|
|
0c5811cf66 | ||
|
|
e78a79e544 | ||
|
|
c2cfefa01f | ||
|
|
f3bff7b1ba | ||
|
|
006d3854db | ||
|
|
868cf6aa32 |
3
AndorsTrail/.gitignore
vendored
3
AndorsTrail/.gitignore
vendored
@@ -5,6 +5,7 @@ local.properties
|
||||
app/build/intermediates/
|
||||
build/
|
||||
debug/
|
||||
beta/
|
||||
release/
|
||||
.gradle/
|
||||
|
||||
@@ -49,4 +50,6 @@ gradle-app.setting
|
||||
/AndorsTrail/gradle/wrapper
|
||||
/AndorsTrail/app/build/
|
||||
/AndorsTrail/app/debug/
|
||||
/AndorsTrail/app/beta/
|
||||
/AndorsTrail/app/release/
|
||||
/AndorsTrail/app/beta/
|
||||
|
||||
@@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
|
||||
compileSdkVersion 34
|
||||
compileSdkVersion 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.gpl.rpg.AndorsTrail"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 34
|
||||
targetSdkVersion 35
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -19,8 +19,15 @@ android {
|
||||
debug {
|
||||
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||
applicationIdSuffix 'beta2'
|
||||
versionNameSuffix = "dev"
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
beta {
|
||||
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||
applicationIdSuffix 'beta2'
|
||||
versionNameSuffix = "beta"
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
namespace 'com.gpl.rpg.AndorsTrail'
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.gpl.rpg.AndorsTrail"
|
||||
android:versionCode="81"
|
||||
android:versionName="0.8.14dev"
|
||||
android:versionCode="82"
|
||||
android:versionName="0.8.15"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
|
||||
|
||||
@@ -8,31 +8,41 @@ 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.util.AndroidStorage;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Insets;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowInsets;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
|
||||
public final class AndorsTrailApplication extends Application {
|
||||
public static final String CURRENT_VERSION_DISPLAY = BuildConfig.VERSION_NAME;
|
||||
public static final boolean IS_DEV_VERSION = CURRENT_VERSION_DISPLAY.endsWith("dev");
|
||||
public static final boolean IS_BETA_VERSION = CURRENT_VERSION_DISPLAY.endsWith("beta");
|
||||
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-zA-Z].*");
|
||||
|
||||
public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;
|
||||
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;
|
||||
public static final boolean DEVELOPMENT_DEBUGBUTTONS = IS_DEV_VERSION;
|
||||
public static final boolean DEVELOPMENT_FASTSPEED = false;
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = true;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = true;
|
||||
public static final String CURRENT_VERSION_DISPLAY = "0.8.14dev";
|
||||
public static final boolean IS_RELEASE_VERSION = !CURRENT_VERSION_DISPLAY.matches(".*[a-d].*");
|
||||
public static final boolean DEVELOPMENT_VALIDATEDATA = IS_BETA_VERSION;
|
||||
public static final boolean DEVELOPMENT_DEBUGMESSAGES = IS_DEV_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 CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : 81;
|
||||
public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? DEVELOPMENT_INCOMPATIBLE_SAVEGAME_VERSION : BuildConfig.VERSION_CODE;
|
||||
|
||||
private final AndorsTrailPreferences preferences = new AndorsTrailPreferences();
|
||||
private WorldContext world = new WorldContext();
|
||||
@@ -57,13 +67,45 @@ public final class AndorsTrailApplication extends Application {
|
||||
|
||||
public void setWindowParameters(Activity activity) {
|
||||
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
if (preferences.fullscreen) {
|
||||
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
|
||||
public void setFullscreenMode(Activity activity) {
|
||||
setFullscreenMode(preferences.fullscreen, activity.getWindow());
|
||||
}
|
||||
public static void setFullscreenMode(boolean fullscreen, Window window) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
|
||||
final WindowInsetsController insetsController = window.getInsetsController();
|
||||
if (insetsController != null) {
|
||||
insetsController.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
|
||||
int insetType = WindowInsets.Type.statusBars();
|
||||
if (fullscreen) {
|
||||
insetsController.hide(insetType);
|
||||
} else {
|
||||
insetsController.show(insetType);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
activity.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
if (fullscreen) {
|
||||
window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
|
||||
} else {
|
||||
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
public int getUsableTouchAreaInsetMask(){
|
||||
int i = 0;
|
||||
i |= WindowInsets.Type.displayCutout();
|
||||
i |= WindowInsets.Type.navigationBars();
|
||||
if (!preferences.fullscreen) {
|
||||
i |= WindowInsets.Type.statusBars();
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
//Get default locale at startup, as somehow it seems that changing the app's
|
||||
//configured locale impacts the value returned by Locale.getDefault() nowadays.
|
||||
private final Locale defaultLocale = Locale.getDefault();
|
||||
@@ -166,4 +208,18 @@ public final class AndorsTrailApplication extends Application {
|
||||
controllers = new ControllerContext(this, world);
|
||||
setup = new WorldSetup(world, controllers, getApplicationContext());
|
||||
}
|
||||
|
||||
public void setUsablePadding(View root) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
root.setOnApplyWindowInsetsListener((v, insets) -> {
|
||||
Insets bars = insets.getInsets(getUsableTouchAreaInsetMask());
|
||||
int left = Math.max(bars.left, v.getPaddingLeft());
|
||||
int top = Math.max(bars.top, v.getPaddingTop());
|
||||
int right = Math.max(bars.right, v.getPaddingRight());
|
||||
int bottom = Math.max(bars.bottom, v.getPaddingBottom());
|
||||
v.setPadding(left, top, right, bottom);
|
||||
return WindowInsets.CONSUMED;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,6 @@ public final class Dialogs {
|
||||
CustomDialogFactory.show(d);
|
||||
}
|
||||
|
||||
@TargetApi(23)
|
||||
private static boolean hasPermissions(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|
||||
|
||||
@@ -24,9 +24,7 @@ public final class AboutActivity extends AndorsTrailBaseActivity implements Imag
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.about);
|
||||
initializeView(this, R.layout.about, R.id.about_root);
|
||||
final Resources res = getResources();
|
||||
|
||||
final TextView tv = (TextView) findViewById(R.id.about_contents);
|
||||
|
||||
@@ -30,9 +30,7 @@ public final class ActorConditionInfoActivity extends AndorsTrailBaseActivity {
|
||||
|
||||
String conditionTypeID = getIntent().getData().getLastPathSegment();
|
||||
ActorConditionType conditionType = world.actorConditionsTypes.getActorConditionType(conditionTypeID);
|
||||
|
||||
setContentView(R.layout.actorconditioninfo);
|
||||
|
||||
initializeView(this, R.layout.actorconditioninfo, R.id.actorconditioninfo_root);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.actorconditioninfo_title);
|
||||
tv.setText(conditionType.name);
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
|
||||
@@ -19,5 +23,13 @@ public abstract class AndorsTrailBaseActivity extends Activity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setLocale(this);
|
||||
}
|
||||
protected void initializeView(Activity activity, @LayoutRes int layoutId, @IdRes int rootViewId) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(activity);
|
||||
app.setWindowParameters(activity);
|
||||
activity.setContentView(layoutId);
|
||||
View root = activity.findViewById(rootViewId);
|
||||
app.setUsablePadding(root);
|
||||
app.setFullscreenMode(activity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
@@ -19,4 +24,13 @@ public abstract class AndorsTrailBaseFragmentActivity extends FragmentActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setLocale(this);
|
||||
}
|
||||
|
||||
protected void initializeView(Activity activity, @LayoutRes int layoutId, @IdRes int rootViewId) {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(activity);
|
||||
app.setWindowParameters(activity);
|
||||
activity.setContentView(layoutId);
|
||||
View root = activity.findViewById(rootViewId);
|
||||
app.setUsablePadding(root);
|
||||
app.setFullscreenMode(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,8 +89,7 @@ public final class BulkSelectionInterface extends AndorsTrailBaseActivity implem
|
||||
interfaceType = BulkInterfaceType.valueOf(params.getString("interfaceType"));
|
||||
|
||||
int intialSelection = 1;
|
||||
|
||||
setContentView(R.layout.bulkselection);
|
||||
initializeView(this, R.layout.bulkselection, R.id.bulkselection_root);
|
||||
|
||||
// initialize UI variables
|
||||
TextView bulkselection_action_type = (TextView)findViewById(R.id.bulkselection_action_type);
|
||||
|
||||
@@ -75,13 +75,11 @@ public final class ConversationActivity
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.conversation);
|
||||
initializeView(this, R.layout.conversation, R.id.conversation_root);
|
||||
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
setFinishOnTouchOutside(false);
|
||||
}
|
||||
setFinishOnTouchOutside(false);
|
||||
|
||||
replyGroup = new RadioGroup(this);
|
||||
replyGroup = new RadioGroup(this);
|
||||
replyGroup.setLayoutParams(new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, ListView.LayoutParams.WRAP_CONTENT));
|
||||
statementList = (ListView) findViewById(R.id.conversation_statements);
|
||||
statementList.addFooterView(replyGroup);
|
||||
|
||||
@@ -365,7 +365,7 @@ public final class DebugInterface {
|
||||
,new DebugButton("#2", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "crackshot_hideout3", "South", 0, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "undertell_3_lava_01", "west", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -373,21 +373,21 @@ public final class DebugInterface {
|
||||
,new DebugButton("#3", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "fallhaven_derelict2", "up", 0, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_cavea", "up", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#4", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "loneford4", "south", 0, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_35", "south", 11, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#5", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "waytogalmore1", "entrance2", 0, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "way_to_sullengard_west_5", "east", 0, 5);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -408,7 +408,7 @@ public final class DebugInterface {
|
||||
,new DebugButton("#8", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_86", "west", 0, 5);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "wayto_feygard_duleian_2", "south", 0, 5);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -422,10 +422,32 @@ public final class DebugInterface {
|
||||
,new DebugButton("#10", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "laerothprison3", "south", 2, 0);
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "moesforest_03", "north1", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#11", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_17", "outside", 0, 0);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#12", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "galmore_48", "west", 0, 10);
|
||||
}
|
||||
})
|
||||
|
||||
,new DebugButton("#13", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "feygard_outside1", "south", 6, 0);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}));
|
||||
buttonList.addAll(tpButtons3);
|
||||
|
||||
|
||||
@@ -38,10 +38,7 @@ public final class DisplayWorldMapActivity extends AndorsTrailBaseActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
this.world = app.getWorld();
|
||||
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.displayworldmap);
|
||||
initializeView(this, R.layout.displayworldmap, R.id.worldmap_root);
|
||||
|
||||
displayworldmap_webview = (WebView) findViewById(R.id.displayworldmap_webview);
|
||||
displayworldmap_webview.setBackgroundColor(ThemeHelper.getThemeColor(this, R.attr.ui_theme_displayworldmap_bg_color));
|
||||
|
||||
@@ -29,10 +29,7 @@ public final class HeroinfoActivity extends AndorsTrailBaseFragmentActivity {
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
this.world = app.getWorld();
|
||||
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.tabbedlayout);
|
||||
initializeView(this, R.layout.tabbedlayout, android.R.id.tabhost);
|
||||
|
||||
Resources res = getResources();
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.widget.TextView;
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
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.util.ThemeHelper;
|
||||
import com.gpl.rpg.AndorsTrail.view.ItemEffectsView;
|
||||
@@ -45,7 +46,7 @@ public final class ItemInfoActivity extends AndorsTrailBaseActivity {
|
||||
boolean buttonEnabled = params.getBoolean("buttonEnabled");
|
||||
boolean moreButtonEnabled = params.getBoolean("moreActions");
|
||||
|
||||
setContentView(R.layout.iteminfo);
|
||||
initializeView(this, R.layout.iteminfo, R.id.iteminfo_root);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.iteminfo_title);
|
||||
tv.setText(itemType.getName(world.model.player));
|
||||
@@ -54,7 +55,7 @@ public final class ItemInfoActivity extends AndorsTrailBaseActivity {
|
||||
tv = (TextView) findViewById(R.id.iteminfo_description);
|
||||
String description = itemType.getDescription();
|
||||
if (description != null) {
|
||||
tv.setText(description);
|
||||
tv.setText(description.replace(Constants.PLACEHOLDER_PLAYERNAME, world.model.player.getName()));
|
||||
tv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tv.setVisibility(View.GONE);
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class LevelUpActivity extends AndorsTrailBaseActivity {
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.levelup);
|
||||
initializeView(this, R.layout.levelup, R.id.levelup_root);
|
||||
|
||||
levelup_title = (TextView) findViewById(R.id.levelup_title);
|
||||
levelup_description = (TextView) findViewById(R.id.levelup_description);
|
||||
|
||||
@@ -70,7 +70,7 @@ public final class LoadSaveActivity extends AndorsTrailBaseActivity implements O
|
||||
String loadsave = getIntent().getData().getLastPathSegment();
|
||||
isLoading = (loadsave.equalsIgnoreCase("load"));
|
||||
|
||||
setContentView(R.layout.loadsave);
|
||||
initializeView(this, R.layout.loadsave, R.id.loadsave_root);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.loadsave_title);
|
||||
if (isLoading) {
|
||||
|
||||
@@ -36,8 +36,7 @@ public final class LoadingActivity extends AndorsTrailBaseActivity implements On
|
||||
setTheme(ThemeHelper.getBaseTheme());
|
||||
super.onCreate(savedInstanceState);
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
app.setWindowParameters(this);
|
||||
setContentView(R.layout.startscreen);
|
||||
initializeView(this, R.layout.startscreen, R.id.startscreen_fragment_container);
|
||||
|
||||
TextView tv = (TextView) findViewById(R.id.startscreen_version);
|
||||
tv.setVisibility(View.GONE);
|
||||
|
||||
@@ -91,9 +91,9 @@ public final class MainActivity
|
||||
AndorsTrailPreferences preferences = app.getPreferences();
|
||||
this.world = app.getWorld();
|
||||
this.controllers = app.getControllerContext();
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.main);
|
||||
initializeView(this, R.layout.main, R.id.main_container);
|
||||
|
||||
mainview = (MainView) findViewById(R.id.main_mainview);
|
||||
statusview = (StatusView) findViewById(R.id.main_statusview);
|
||||
combatview = (CombatView) findViewById(R.id.main_combatview);
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class MonsterEncounterActivity extends AndorsTrailBaseActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.monsterencounter);
|
||||
initializeView(this, R.layout.monsterencounter, R.id.monsterencounter_root);
|
||||
|
||||
CharSequence difficulty = getText(MonsterInfoActivity.getMonsterDifficultyResource(controllers, monster));
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class MonsterInfoActivity extends AndorsTrailBaseActivity {
|
||||
this.controllers = app.getControllerContext();
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
setContentView(R.layout.monsterinfo);
|
||||
initializeView(this, R.layout.monsterinfo, R.id.monsterinfo_root);
|
||||
|
||||
monsterinfo_title = (TextView) findViewById(R.id.monsterinfo_title);
|
||||
monsterinfo_difficulty = (TextView) findViewById(R.id.monsterinfo_difficulty);
|
||||
|
||||
@@ -13,17 +13,16 @@ public final class Preferences extends PreferenceActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(ThemeHelper.getBaseTheme());
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
super.onCreate(savedInstanceState);
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (app.getPreferences().fullscreen) {
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
} else {
|
||||
getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
app.setWindowParameters(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
app.setFullscreenMode(this);
|
||||
|
||||
|
||||
app.setLocale(this);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,9 +23,8 @@ public final class ShopActivity extends AndorsTrailBaseFragmentActivity {
|
||||
|
||||
AndorsTrailApplication app = AndorsTrailApplication.getApplicationFromActivity(this);
|
||||
if (!app.isInitialized()) { finish(); return; }
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.tabbedlayout);
|
||||
initializeView(this, R.layout.tabbedlayout, android.R.id.tabhost);
|
||||
|
||||
final Resources res = getResources();
|
||||
|
||||
|
||||
@@ -31,9 +31,7 @@ public final class SkillInfoActivity extends AndorsTrailBaseActivity {
|
||||
final WorldContext world = app.getWorld();
|
||||
final Player player = world.model.player;
|
||||
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.skill_info_view);
|
||||
initializeView(this, R.layout.skill_info_view, R.id.skillinfo_root);
|
||||
|
||||
final Resources res = getResources();
|
||||
final Intent intent = getIntent();
|
||||
|
||||
@@ -21,6 +21,8 @@ import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager.OnBackStackChangedListener;
|
||||
import android.view.KeyEvent;
|
||||
@@ -49,9 +51,9 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
final Resources res = getResources();
|
||||
TileManager tileManager = app.getWorld().tileManager;
|
||||
tileManager.setDensity(res);
|
||||
app.setWindowParameters(this);
|
||||
|
||||
setContentView(R.layout.startscreen);
|
||||
initializeView(this, R.layout.startscreen, R.id.startscreen_fragment_container);
|
||||
app.setFullscreenMode(this);
|
||||
|
||||
if (findViewById(R.id.startscreen_fragment_container) != null) {
|
||||
StartScreenActivity_MainMenu mainMenu = new StartScreenActivity_MainMenu();
|
||||
@@ -67,9 +69,11 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
|
||||
|
||||
tv = (TextView) findViewById(R.id.startscreen_version);
|
||||
app.setUsablePadding(tv);
|
||||
tv.setText('v' + AndorsTrailApplication.CURRENT_VERSION_DISPLAY);
|
||||
|
||||
development_version = (TextView) findViewById(R.id.startscreen_dev_version);
|
||||
app.setUsablePadding((View) development_version.getParent());
|
||||
if (AndorsTrailApplication.DEVELOPMENT_INCOMPATIBLE_SAVEGAMES) {
|
||||
development_version.setText(R.string.startscreen_incompatible_savegames);
|
||||
development_version.setVisibility(View.VISIBLE);
|
||||
@@ -96,6 +100,10 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
}
|
||||
});
|
||||
}
|
||||
View titleLogo = findViewById(R.id.title_logo);
|
||||
if (titleLogo != null) {
|
||||
app.setUsablePadding(titleLogo);
|
||||
}
|
||||
|
||||
if (development_version.getVisibility() == View.VISIBLE) {
|
||||
development_version.setText(development_version.getText()
|
||||
@@ -112,7 +120,7 @@ public final class StartScreenActivity extends AndorsTrailBaseFragmentActivity i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, int[] grantResults) {
|
||||
if (grantResults.length > 0 && grantResults[0] != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
final CustomDialog d = CustomDialogFactory.createDialog(this,
|
||||
|
||||
@@ -24,7 +24,7 @@ public final class ShopActivity_Buy extends ShopActivityFragment {
|
||||
@Override
|
||||
public void onItemInfoClicked(int position, ItemType itemType) {
|
||||
int price = ItemController.getBuyingPrice(player, itemType);
|
||||
boolean enableButton = ItemController.canAfford(player, price);
|
||||
boolean enableButton = (price > 0 && ItemController.canAfford(player, price));
|
||||
String text = getResources().getString(R.string.shop_buyitem, price);
|
||||
Intent intent = Dialogs.getIntentForItemInfo(getActivity(), itemType.id, ItemInfoActivity.ItemInfoAction.buy, text, enableButton, null);
|
||||
startActivityForResult(intent, INTENTREQUEST_ITEMINFO);
|
||||
|
||||
@@ -59,7 +59,6 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
updatePreferences(false);
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
|
||||
if (container != null) {
|
||||
container.removeAllViews();
|
||||
}
|
||||
@@ -196,7 +195,6 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
|
||||
}
|
||||
|
||||
@TargetApi(29)
|
||||
public void migrateDataOnDemand(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
|
||||
@@ -232,7 +230,6 @@ public class StartScreenActivity_MainMenu extends Fragment {
|
||||
private static final int READ_EXTERNAL_STORAGE_REQUEST=1;
|
||||
private static final int WRITE_EXTERNAL_STORAGE_REQUEST=2;
|
||||
|
||||
@TargetApi(23)
|
||||
public static void checkAndRequestPermissions(final Activity activity) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
|
||||
if (activity.getApplicationContext().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.gpl.rpg.AndorsTrail.activity.fragment;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -39,8 +40,7 @@ public class StartScreenActivity_NewGame extends Fragment {
|
||||
}
|
||||
|
||||
View root = inflater.inflate(R.layout.startscreen_newgame, container, false);
|
||||
|
||||
|
||||
|
||||
startscreen_enterheroname = (TextView) root.findViewById(R.id.startscreen_enterheroname);
|
||||
|
||||
new SpinnerEmulator(root, R.id.startscreen_mode_selector_button, R.array.startscreen_mode_selector, R.string.startscreen_game_mode) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import static com.gpl.rpg.AndorsTrail.controller.SkillController.canLevelupSkillWithQuest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.res.Resources;
|
||||
@@ -334,6 +336,16 @@ public final class ConversationController {
|
||||
case timeEquals:
|
||||
result = world.model.worldData.getTime(requirement.requireID) == requirement.value;
|
||||
break;
|
||||
case skillIncrease:
|
||||
int levels;
|
||||
if (requirement.value <= 0){
|
||||
levels = 1;
|
||||
}else{
|
||||
levels = requirement.value;
|
||||
}
|
||||
SkillInfo skill = world.skills.getSkill(SkillCollection.SkillID.valueOf(requirement.requireID));
|
||||
result = canLevelupSkillWithQuest(player, skill, levels);
|
||||
break;
|
||||
default:
|
||||
result = true;
|
||||
}
|
||||
|
||||
@@ -91,17 +91,17 @@ public final class SkillController {
|
||||
}
|
||||
|
||||
|
||||
private static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill) {
|
||||
static boolean canLevelupSkillWithQuest(Player player, SkillInfo skill, int levels) {
|
||||
final int playerSkillLevel = player.getSkillLevel(skill.id);
|
||||
if (skill.hasMaxLevel()) {
|
||||
if (playerSkillLevel >= skill.maxLevel) return false;
|
||||
if (playerSkillLevel + levels > skill.maxLevel) return false;
|
||||
}
|
||||
if (!skill.canLevelUpSkillTo(player, playerSkillLevel + 1)) return false;
|
||||
if (!skill.canLevelUpSkillTo(player, playerSkillLevel + levels)) return false;
|
||||
return true;
|
||||
}
|
||||
public static boolean canLevelupSkillManually(Player player, SkillInfo skill) {
|
||||
if (!player.hasAvailableSkillpoints()) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill)) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill, 1)) return false;
|
||||
if (skill.levelupVisibility == SkillInfo.LevelUpType.onlyByQuests) return false;
|
||||
if (skill.levelupVisibility == SkillInfo.LevelUpType.firstLevelRequiresQuest) {
|
||||
if (!player.hasSkill(skill.id)) return false;
|
||||
@@ -114,7 +114,7 @@ public final class SkillController {
|
||||
addSkillLevel(skill.id);
|
||||
}
|
||||
public boolean levelUpSkillByQuest(Player player, SkillInfo skill) {
|
||||
if (!canLevelupSkillWithQuest(player, skill)) return false;
|
||||
if (!canLevelupSkillWithQuest(player, skill, 1)) return false;
|
||||
addSkillLevel(skill.id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,14 @@ public final class Monster extends Actor {
|
||||
public final MonsterType monsterType;
|
||||
public final MonsterSpawnArea area;
|
||||
|
||||
public final boolean isFlippedX;
|
||||
|
||||
public Monster(MonsterType monsterType, MonsterSpawnArea area) {
|
||||
super(monsterType.tileSize, false, monsterType.isImmuneToCriticalHits());
|
||||
this.monsterType = monsterType;
|
||||
this.area = area;
|
||||
this.iconID = monsterType.iconID;
|
||||
this.isFlippedX = Constants.roll100(monsterType.horizontalFlipChance);
|
||||
this.nextPosition = new CoordRect(new Coord(), monsterType.tileSize);
|
||||
resetStatsToBaseTraits();
|
||||
this.ap.setMax();
|
||||
|
||||
@@ -37,6 +37,7 @@ public final class MonsterType {
|
||||
|
||||
public final Size tileSize;
|
||||
public final int iconID;
|
||||
public final int horizontalFlipChance;
|
||||
public final int maxAP;
|
||||
public final int maxHP;
|
||||
public final int moveCost;
|
||||
@@ -64,6 +65,7 @@ public final class MonsterType {
|
||||
, AggressionType aggressionType
|
||||
, Size tileSize
|
||||
, int iconID
|
||||
, int horizontalFlipChance
|
||||
, int maxAP
|
||||
, int maxHP
|
||||
, int moveCost
|
||||
@@ -90,6 +92,7 @@ public final class MonsterType {
|
||||
this.aggressionType = aggressionType;
|
||||
this.tileSize = tileSize;
|
||||
this.iconID = iconID;
|
||||
this.horizontalFlipChance = horizontalFlipChance;
|
||||
this.maxAP = maxAP;
|
||||
this.maxHP = maxHP;
|
||||
this.moveCost = moveCost;
|
||||
|
||||
@@ -25,6 +25,7 @@ public final class Requirement {
|
||||
,dateEquals
|
||||
,time
|
||||
,timeEquals
|
||||
,skillIncrease // Check if possible to increase
|
||||
}
|
||||
|
||||
public final RequirementType requireType;
|
||||
@@ -85,6 +86,7 @@ public final class Requirement {
|
||||
case questProgress:
|
||||
return requireID != null && value >= 0;
|
||||
case skillLevel:
|
||||
case skillIncrease:
|
||||
return requireID != null && value >= 0;
|
||||
case spentGold:
|
||||
case date:
|
||||
|
||||
@@ -262,6 +262,7 @@ public final class ResourceLoader {
|
||||
final Size sz7x1 = new Size(7, 1);
|
||||
final Size sz7x4 = new Size(7, 4);
|
||||
final Size sz8x3 = new Size(8, 3);
|
||||
final Size sz8x4 = new Size(8, 4);
|
||||
final Size sz16x8 = new Size(16, 8);
|
||||
final Size sz16x10 = new Size(16, 10);
|
||||
final Size sz20x12 = new Size(20, 12);
|
||||
@@ -381,10 +382,11 @@ public final class ResourceLoader {
|
||||
loader.prepareTileset(R.drawable.monsters_fatboy73, "monsters_fatboy73", sz20x12, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_giantbasilisk, "monsters_giantbasilisk", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_gisons, "monsters_gisons", new Size(8, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_bosses_2x2, "monsters_bosses_2x2", sz1x1, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_bosses_2x2, "monsters_bosses_2x2", sz8x4, sz2x2, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_omi2, "monsters_omi2", sz8x3, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_phoenix01, "monsters_phoenix01", sz16x8, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_cats, "monsters_cats", new Size(10, 2), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.monsters_1x2, "monsters_1x2", new Size(10, 5), sz1x2, mTileSize);
|
||||
/*INSERT_NPCS_TILESETS_HERE*/
|
||||
|
||||
loader.prepareTileset(R.drawable.map_bed_1, "map_bed_1", sz16x10, sz1x1, mTileSize);
|
||||
@@ -399,6 +401,7 @@ public final class ResourceLoader {
|
||||
loader.prepareTileset(R.drawable.map_cavewall_3, "map_cavewall_3", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_4, "map_cavewall_4", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_5, "map_cavewall_5", new Size(6, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_cavewall_6, "map_cavewall_6", new Size(18, 6), sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_chair_table_1, "map_chair_table_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_chair_table_2, "map_chair_table_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_crate_1, "map_crate_1", mapTileSize, sz1x1, mTileSize);
|
||||
@@ -425,8 +428,10 @@ public final class ResourceLoader {
|
||||
loader.prepareTileset(R.drawable.map_house_2, "map_house_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_indoor_1, "map_indoor_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_indoor_2, "map_indoor_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_items, "map_items", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_kitchen_1, "map_kitchen_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_outdoor_1, "map_outdoor_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_outdoor_2, "map_outdoor_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_1, "map_pillar_1", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_2, "map_pillar_2", mapTileSize, sz1x1, mTileSize);
|
||||
loader.prepareTileset(R.drawable.map_pillar_3, "map_pillar_3", new Size(16, 10), sz1x1, mTileSize);
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gpl.rpg.AndorsTrail.resource.DynamicTileLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class ActorConditionsTypeParser extends JsonCollectionParserFor<ActorConditionType> {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class ConversationListParser extends JsonCollectionParserFor<Phrase> {
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class DropListParser extends JsonCollectionParserFor<DropList> {
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.gpl.rpg.AndorsTrail.model.item.ItemCategory;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class ItemCategoryParser extends JsonCollectionParserFor<ItemCategory> {
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.gpl.rpg.AndorsTrail.resource.DynamicTileLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
|
||||
|
||||
@@ -53,7 +53,7 @@ public final class ItemTypeParser extends JsonCollectionParserFor<ItemType> {
|
||||
, ResourceParserUtils.parseImageID(tileLoader, o.getString(JsonFieldNames.ItemType.iconID))
|
||||
, itemTypeName
|
||||
, description
|
||||
, itemCategories.getItemCategory(o.getString(JsonFieldNames.ItemType.category))
|
||||
, itemCategories.getItemCategory(o.optString(JsonFieldNames.ItemType.category, "other"))
|
||||
, ItemType.DisplayType.fromString(o.optString(JsonFieldNames.ItemType.displaytype, null), ItemType.DisplayType.ordinary)
|
||||
, hasManualPrice
|
||||
, baseMarketCost
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.ConstRange;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.Size;
|
||||
|
||||
public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType> {
|
||||
@@ -55,6 +55,8 @@ public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType
|
||||
|
||||
final int exp = getExpectedMonsterExperience(attackCost, attackChance, damagePotential, criticalSkill, criticalMultiplier, blockChance, damageResistance, hitEffect, maxHP, maxAP);
|
||||
|
||||
final int horizontalFlipChance = o.optInt(JsonFieldNames.Monster.horizontalFlipChance, 0);
|
||||
|
||||
return new Pair<String, MonsterType>(monsterTypeID, new MonsterType(
|
||||
monsterTypeID
|
||||
, translationLoader.translateMonsterTypeName(o.getString(JsonFieldNames.Monster.name))
|
||||
@@ -68,6 +70,7 @@ public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType
|
||||
, MonsterType.AggressionType.fromString(o.optString(JsonFieldNames.Monster.movementAggressionType, null), MonsterType.AggressionType.none)
|
||||
, ResourceParserUtils.parseTilesetTileSize(tileLoader, o.optString(JsonFieldNames.Monster.iconID, null), size1x1)
|
||||
, ResourceParserUtils.parseImageID(tileLoader, o.getString(JsonFieldNames.Monster.iconID))
|
||||
, horizontalFlipChance
|
||||
, maxAP
|
||||
, maxHP
|
||||
, o.optInt(JsonFieldNames.Monster.moveCost, 10)
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonArrayParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonCollectionParserFor;
|
||||
import com.gpl.rpg.AndorsTrail.resource.parsers.json.JsonFieldNames;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public final class QuestParser extends JsonCollectionParserFor<Quest> {
|
||||
private final TranslationLoader translationLoader;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.gpl.rpg.AndorsTrail.model.map.WorldMapSegment.WorldMapSegmentMap;
|
||||
import com.gpl.rpg.AndorsTrail.resource.TranslationLoader;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
import com.gpl.rpg.AndorsTrail.util.XmlResourceParserUtils;
|
||||
|
||||
public final class WorldMapParser {
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.json.JSONException;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
import com.gpl.rpg.AndorsTrail.util.Pair;
|
||||
import android.util.Pair;
|
||||
|
||||
public abstract class JsonCollectionParserFor<T> extends JsonParserFor<Pair<String, T>> {
|
||||
public HashSet<String> parseRows(String input, HashMap<String, T> dest) {
|
||||
|
||||
@@ -105,6 +105,7 @@ public final class JsonFieldNames {
|
||||
public static final class Monster {
|
||||
public static final String monsterTypeID = "id";
|
||||
public static final String iconID = "iconID";
|
||||
public static final String horizontalFlipChance = "horizontalFlipChance";
|
||||
public static final String name = "name";
|
||||
public static final String spawnGroup = "spawnGroup";
|
||||
public static final String monsterClass = "monsterClass";
|
||||
|
||||
@@ -2,14 +2,20 @@ package com.gpl.rpg.AndorsTrail.resource.tiles;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class TileCollection {
|
||||
private final Bitmap[] bitmaps;
|
||||
private final Map<Integer, Bitmap> flippedBitmaps;
|
||||
public final int maxTileID;
|
||||
|
||||
public TileCollection(int maxTileID) {
|
||||
this.bitmaps = new Bitmap[maxTileID+1];
|
||||
this.flippedBitmaps = new HashMap<>();
|
||||
this.maxTileID = maxTileID;
|
||||
}
|
||||
|
||||
@@ -19,9 +25,30 @@ public final class TileCollection {
|
||||
|
||||
public void setBitmap(int tileID, Bitmap bitmap) {
|
||||
bitmaps[tileID] = bitmap;
|
||||
flippedBitmaps.remove(tileID); // Remove cached flipped version if it exists
|
||||
}
|
||||
|
||||
public void drawTile(Canvas canvas, int tile, int px, int py, Paint mPaint) {
|
||||
canvas.drawBitmap(bitmaps[tile], px, py, mPaint);
|
||||
drawTile(canvas, tile, px, py, mPaint, false);
|
||||
}
|
||||
public void drawTile(Canvas canvas, int tile, int px, int py, Paint mPaint, boolean isFlippedX) {
|
||||
if (isFlippedX) {
|
||||
canvas.drawBitmap(getFlippedBitmap(tile), px, py, mPaint);
|
||||
} else canvas.drawBitmap(bitmaps[tile], px, py, mPaint);
|
||||
}
|
||||
|
||||
private Bitmap getFlippedBitmap(int tile) {
|
||||
if (flippedBitmaps.containsKey(tile)) {
|
||||
return flippedBitmaps.get(tile);
|
||||
}
|
||||
Bitmap flipped = flipBitmapX(bitmaps[tile]);
|
||||
flippedBitmaps.put(tile, flipped);
|
||||
return flipped;
|
||||
}
|
||||
|
||||
private static Bitmap flipBitmapX(Bitmap source) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(-1, 1, source.getWidth() / 2f, source.getHeight() / 2f);
|
||||
return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
// Should really use android.util.Pair<> instead, but it is not available for API level 4 (Android 1.6).
|
||||
public final class Pair<T1, T2> {
|
||||
public final T1 first;
|
||||
public final T2 second;
|
||||
public Pair(T1 a, T2 b) {
|
||||
this.first = a;
|
||||
this.second = b;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -76,11 +75,8 @@ public class CustomDialogFactory {
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
dialog.setContentView(R.layout.custom_dialog_title_icon);
|
||||
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
if (((AndorsTrailApplication)context.getApplicationContext()).getPreferences().fullscreen) {
|
||||
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
} else {
|
||||
dialog.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
boolean fullscreen = ((AndorsTrailApplication) context.getApplicationContext()).getPreferences().fullscreen;
|
||||
AndorsTrailApplication.setFullscreenMode(fullscreen, dialog.getWindow());
|
||||
|
||||
setTitle(dialog, title, icon);
|
||||
|
||||
|
||||
@@ -431,13 +431,13 @@ public final class MainView extends SurfaceView
|
||||
for (MonsterSpawnArea a : currentMap.spawnAreas) {
|
||||
for (Monster m : a.monsters) {
|
||||
if (!m.hasVFXRunning) {
|
||||
drawFromMapPosition(canvas, area, m.rectPosition, m.iconID);
|
||||
drawFromMapPosition(canvas, area, m.rectPosition, m.iconID, m.isFlippedX);
|
||||
} else if (area.intersects(m.rectPosition) || area.intersects(new CoordRect(m.lastPosition,m.rectPosition.size))) {
|
||||
int vfxElapsedTime = (int) (System.currentTimeMillis() - m.vfxStartTime);
|
||||
if (vfxElapsedTime > m.vfxDuration) vfxElapsedTime = m.vfxDuration;
|
||||
int x = ((m.position.x - mapViewArea.topLeft.x) * tileSize * vfxElapsedTime + ((m.lastPosition.x - mapViewArea.topLeft.x) * tileSize * (m.vfxDuration - vfxElapsedTime))) / m.vfxDuration;
|
||||
int y = ((m.position.y - mapViewArea.topLeft.y) * tileSize * vfxElapsedTime + ((m.lastPosition.y - mapViewArea.topLeft.y) * tileSize * (m.vfxDuration - vfxElapsedTime))) / m.vfxDuration;
|
||||
tiles.drawTile(canvas, m.iconID, x, y, mPaint);
|
||||
tiles.drawTile(canvas, m.iconID, x, y, mPaint, m.isFlippedX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -503,16 +503,27 @@ public final class MainView extends SurfaceView
|
||||
if (!area.contains(p)) return;
|
||||
_drawFromMapPosition(canvas, area, p.x, p.y, tile);
|
||||
}
|
||||
private void drawFromMapPosition(Canvas canvas, final CoordRect area, final Coord p, final int tile, final boolean isFlippedX) {
|
||||
if (!area.contains(p)) return;
|
||||
_drawFromMapPosition(canvas, area, p.x, p.y, tile, isFlippedX);
|
||||
}
|
||||
private void drawFromMapPosition(Canvas canvas, final CoordRect area, final CoordRect p, final int tile) {
|
||||
if (!area.intersects(p)) return;
|
||||
_drawFromMapPosition(canvas, area, p.topLeft.x, p.topLeft.y, tile);
|
||||
}
|
||||
private void drawFromMapPosition(Canvas canvas, final CoordRect area, final CoordRect p, final int tile, final boolean isFlippedX) {
|
||||
if (!area.intersects(p)) return;
|
||||
_drawFromMapPosition(canvas, area, p.topLeft.x, p.topLeft.y, tile, isFlippedX);
|
||||
}
|
||||
private void _drawFromMapPosition(Canvas canvas, final CoordRect area, int x, int y, final int tile) {
|
||||
_drawFromMapPosition(canvas, area, x, y, tile, false);
|
||||
}
|
||||
private void _drawFromMapPosition(Canvas canvas, final CoordRect area, int x, int y, final int tile, final boolean isFlippedX) {
|
||||
x -= mapViewArea.topLeft.x;
|
||||
y -= mapViewArea.topLeft.y;
|
||||
// if ( (x >= 0 && x < mapViewArea.size.width)
|
||||
// && (y >= 0 && y < mapViewArea.size.height)) {
|
||||
tiles.drawTile(canvas, tile, x * tileSize, y * tileSize, mPaint);
|
||||
tiles.drawTile(canvas, tile, x * tileSize, y * tileSize, mPaint, isFlippedX);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class ShopItemContainerAdapter extends ArrayAdapter<ItemEntry> {
|
||||
} else {
|
||||
int price = ItemController.getBuyingPrice(player, itemType);
|
||||
b.setText(r.getString(R.string.shop_buyitem, price));
|
||||
b.setEnabled(ItemController.canAfford(player, price));
|
||||
b.setEnabled(price > 0 && ItemController.canAfford(player, price));
|
||||
}
|
||||
b.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user