mirror of
https://github.com/AndorsTrailRelease/andors-trail.git
synced 2025-12-28 15:27:49 +01:00
Compare commits
1 Commits
v0.8.2
...
Chriz76-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08a54c5635 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/AndorsTrail/.idea/workspace.xml
|
||||
14
.travis.yml
14
.travis.yml
@@ -1,14 +0,0 @@
|
||||
dist: bionic
|
||||
sudo: required
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/pbuilder-bases
|
||||
matrix:
|
||||
include:
|
||||
- env: TARGET_OS=stretch
|
||||
before_install:
|
||||
- "$TRAVIS_BUILD_DIR/travis/$TRAVIS_OS_NAME.$TARGET_OS.before_install"
|
||||
install:
|
||||
- "$TRAVIS_BUILD_DIR/travis/$TRAVIS_OS_NAME.$TARGET_OS.install"
|
||||
script:
|
||||
- "$TRAVIS_BUILD_DIR/travis/$TRAVIS_OS_NAME.$TARGET_OS.script"
|
||||
9
AndorsTrail/.classpath
Normal file
9
AndorsTrail/.classpath
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
39
AndorsTrail/.gitignore
vendored
39
AndorsTrail/.gitignore
vendored
@@ -1,15 +1,8 @@
|
||||
# Android ignores
|
||||
app/src/main/res
|
||||
app/src/main/assets
|
||||
gen/
|
||||
bin/
|
||||
target/
|
||||
local.properties
|
||||
app/build/intermediates/
|
||||
build/
|
||||
debug/
|
||||
release/
|
||||
.gradle/
|
||||
|
||||
#IntelliJ
|
||||
.idea/
|
||||
@@ -21,35 +14,3 @@ out/test/
|
||||
# Other
|
||||
.metadata
|
||||
.svn/
|
||||
|
||||
|
||||
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
|
||||
.gradle
|
||||
**/build/
|
||||
!src/**/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Avoid ignore Gradle wrappper properties
|
||||
!gradle-wrapper.properties
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# Eclipse Gradle plugin generated files
|
||||
# Eclipse Core
|
||||
.project
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
#copied from https://github.com/github/gitignore/blob/main/Gradle.gitignore
|
||||
|
||||
|
||||
/AndorsTrail/.gradle
|
||||
/AndorsTrail/gradle/wrapper
|
||||
/AndorsTrail/app/build/
|
||||
/AndorsTrail/app/debug/
|
||||
/AndorsTrail/app/release/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
6
AndorsTrail/.idea/compiler.xml
generated
6
AndorsTrail/.idea/compiler.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
20
AndorsTrail/.idea/gradle.xml
generated
20
AndorsTrail/.idea/gradle.xml
generated
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
25
AndorsTrail/.idea/jarRepositories.xml
generated
25
AndorsTrail/.idea/jarRepositories.xml
generated
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="BintrayJCenter" />
|
||||
<option name="name" value="BintrayJCenter" />
|
||||
<option name="url" value="https://jcenter.bintray.com/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="Google" />
|
||||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
10
AndorsTrail/.idea/misc.xml
generated
10
AndorsTrail/.idea/misc.xml
generated
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
6
AndorsTrail/.idea/vcs.xml
generated
6
AndorsTrail/.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
33
AndorsTrail/.project
Normal file
33
AndorsTrail/.project
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>AndorsTrail</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
36
AndorsTrail/AndorsTrail.iml
Normal file
36
AndorsTrail/AndorsTrail.iml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="EclipseModuleManager" forced_jdk="true">
|
||||
<conelement value="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" />
|
||||
<conelement value="com.android.ide.eclipse.adt.LIBRARIES" />
|
||||
<src_description expected_position="1">
|
||||
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
|
||||
<src_folder value="file://$MODULE_DIR$/gen" expected_position="1" />
|
||||
</src_description>
|
||||
</component>
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration />
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/bin/classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/libs/android-support-v4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
|
||||
68
AndorsTrail/AndroidManifest.xml
Normal file
68
AndorsTrail/AndroidManifest.xml
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.gpl.rpg.AndorsTrail"
|
||||
android:versionCode="49"
|
||||
android:versionName="0.7.8"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="28"
|
||||
/>
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_LOGS"/>
|
||||
|
||||
|
||||
<application
|
||||
android:name=".AndorsTrailApplication"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:description="@string/app_description"
|
||||
android:allowBackup="true"
|
||||
android:theme="@style/AndorsTrailTheme_Blue"
|
||||
>
|
||||
<activity
|
||||
android:name=".activity.StartScreenActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AndorsTrailTheme_Blue.NoBackground"
|
||||
/>
|
||||
<activity android:name=".activity.HeroinfoActivity" />
|
||||
<activity android:name=".activity.MonsterInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.ItemInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.LevelUpActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.MonsterEncounterActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.ConversationActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.ShopActivity" />
|
||||
<activity android:name=".activity.AboutActivity" />
|
||||
<activity android:name=".activity.LoadingActivity" />
|
||||
<activity android:name=".activity.Preferences" />
|
||||
<activity android:name=".activity.LoadSaveActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.ActorConditionInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.BulkSelectionInterface" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.SkillInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name=".activity.DisplayWorldMapActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,52 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.gpl.rpg.AndorsTrail"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 30
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
manifestPlaceholders icon_name: 'icon', fileproviderPath: 'AndorsTrail'
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
debug {
|
||||
manifestPlaceholders icon_name: 'icon_beta', fileproviderPath: 'AndorsTrail.beta2'
|
||||
applicationIdSuffix 'beta2'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
}
|
||||
|
||||
task copyRes(type: Copy) {
|
||||
description "Copies the res folder to the modules res folder (& renames .tmx to .xml)"
|
||||
from "${rootDir}/res"
|
||||
into "${projectDir}/src/main/res"
|
||||
rename "(.*)\\.tmx", "\$1.xml"
|
||||
}
|
||||
|
||||
task copyTranslation(type: Copy) {
|
||||
description("Copies the translation files to the modules translations folder")
|
||||
from "${rootDir}/assets/translation"
|
||||
into "${projectDir}/src/main/assets/translation"
|
||||
}
|
||||
|
||||
task cleanup(type: Delete) {
|
||||
description("Deletes the assets/translation and the res folder from the modules folder")
|
||||
delete "${projectDir}/src/main/res", "${projectDir}/src/main/assets/translation"
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
preBuild.dependsOn project.tasks.copyRes
|
||||
preBuild.dependsOn project.tasks.copyTranslation
|
||||
clean.dependsOn project.tasks.cleanup
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.gpl.rpg.AndorsTrail"
|
||||
android:versionCode="66"
|
||||
android:versionName="0.8.2"
|
||||
android:installLocation="auto"
|
||||
>
|
||||
<uses-sdk
|
||||
android:minSdkVersion="4"
|
||||
android:targetSdkVersion="30"
|
||||
/>
|
||||
|
||||
<supports-screens
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"
|
||||
android:anyDensity="true"
|
||||
/>
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
|
||||
|
||||
<application
|
||||
android:name="com.gpl.rpg.AndorsTrail.AndorsTrailApplication"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@drawable/${icon_name}"
|
||||
android:description="@string/app_description"
|
||||
android:allowBackup="true"
|
||||
android:theme="@style/AndorsTrailTheme_Blue"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:hasFragileUserData="true"
|
||||
android:preserveLegacyExternalStorage="true"
|
||||
>
|
||||
<activity
|
||||
android:name="com.gpl.rpg.AndorsTrail.activity.StartScreenActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.gpl.rpg.AndorsTrail.activity.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AndorsTrailTheme_Blue.NoBackground"
|
||||
/>
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.HeroinfoActivity" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.MonsterInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ItemInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LevelUpActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.MonsterEncounterActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ConversationActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ShopActivity" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.AboutActivity" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LoadingActivity" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.Preferences" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.LoadSaveActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.ActorConditionInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.BulkSelectionInterface" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.SkillInfoActivity" android:theme="@style/AndorsTrailDialogTheme_Blue" />
|
||||
<activity android:name="com.gpl.rpg.AndorsTrail.activity.DisplayWorldMapActivity" />
|
||||
|
||||
<provider
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:grantUriPermissions="true"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/fileprovider" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,341 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.activity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.AndorsTrailApplication;
|
||||
import com.gpl.rpg.AndorsTrail.R;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.MapObject;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.view.MainView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
public final class DebugInterface {
|
||||
private final ControllerContext controllerContext;
|
||||
private final MainActivity mainActivity;
|
||||
private final Resources res;
|
||||
private final WorldContext world;
|
||||
|
||||
private DebugButton[] buttons;
|
||||
private List<DebugButton> tpButtons = new ArrayList<DebugButton>();
|
||||
private List<DebugButton> tpButtons2 = new ArrayList<DebugButton>();
|
||||
|
||||
public DebugInterface(ControllerContext controllers, WorldContext world, MainActivity mainActivity) {
|
||||
this.controllerContext = controllers;
|
||||
this.world = world;
|
||||
this.res = mainActivity.getResources();
|
||||
this.mainActivity = mainActivity;
|
||||
}
|
||||
|
||||
public void addDebugButtons() {
|
||||
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||
|
||||
List<DebugButton> buttonList = new ArrayList<DebugButton>();
|
||||
buttonList.addAll(Arrays.asList(new DebugButton[] {
|
||||
new DebugButton("dbg", new OnClickListener() {
|
||||
boolean hidden = false;
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
hidden = !hidden;
|
||||
for (int i = 1; i < buttons.length; i++) {
|
||||
buttons[i].b.setVisibility(hidden ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
for (DebugButton b : tpButtons) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton b : tpButtons2) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("teleport", new OnClickListener() {
|
||||
public void onClick(View arg0) {
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
buttons[i].b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons) {
|
||||
tpButton.b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("dmg", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.damagePotential.set(500, 500);
|
||||
world.model.player.attackChance = 500;
|
||||
world.model.player.attackCost = 1;
|
||||
showToast(mainActivity, "DEBUG: damagePotential=500, chance=500%, cost=1", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
/*,new DebugButton("dmg=1", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.damagePotential.set(1, 1);
|
||||
showToast(mainActivity, "DEBUG: damagePotential=1", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})*/
|
||||
,new DebugButton("itm", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for (ItemType item : world.itemTypes.UNITTEST_getAllItemTypes().values()) {
|
||||
world.model.player.inventory.addItem(item, 10);
|
||||
}
|
||||
world.model.player.inventory.gold += 50000;
|
||||
showToast(mainActivity, "DEBUG: added items", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("xp", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.actorStatsController.addExperience(10000);
|
||||
showToast(mainActivity, "DEBUG: given 10000 exp", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("rst", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for(PredefinedMap map : world.maps.getAllMaps()) {
|
||||
map.resetTemporaryData();
|
||||
}
|
||||
showToast(mainActivity, "DEBUG: maps respawned", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("hp", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.baseTraits.maxHP = 500;
|
||||
world.model.player.health.max = world.model.player.baseTraits.maxHP;
|
||||
controllerContext.actorStatsController.setActorMaxHealth(world.model.player);
|
||||
world.model.player.conditions.clear();
|
||||
showToast(mainActivity, "DEBUG: hp set to max", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("skl", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
world.model.player.availableSkillIncreases += 10;
|
||||
showToast(mainActivity, "DEBUG: 10 skill points", Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
,new DebugButton("spd", new OnClickListener() {
|
||||
boolean fast = Constants.MINIMUM_INPUT_INTERVAL == Constants.MINIMUM_INPUT_INTERVAL_FAST;
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
fast = !fast;
|
||||
if (fast) {
|
||||
Constants.MINIMUM_INPUT_INTERVAL = Constants.MINIMUM_INPUT_INTERVAL_FAST;
|
||||
} else {
|
||||
Constants.MINIMUM_INPUT_INTERVAL = Constants.MINIMUM_INPUT_INTERVAL_STD;
|
||||
}
|
||||
MainView.SCROLL_DURATION = Constants.MINIMUM_INPUT_INTERVAL;
|
||||
AndorsTrailApplication.getApplicationFromActivity(mainActivity).getControllerContext().movementController.resetMovementHandler();
|
||||
}
|
||||
})
|
||||
,new DebugButton("map", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
showToast(mainActivity, "DEBUG: map=" + world.model.currentMaps.map.name , Toast.LENGTH_SHORT);
|
||||
}
|
||||
})
|
||||
}));
|
||||
|
||||
tpButtons.addAll(Arrays.asList(new DebugButton[] {
|
||||
new DebugButton("teleport", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for (DebugButton tpButton : tpButtons2) {
|
||||
tpButton.b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("cg", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "crossglen", "hall", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("vg", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "vilegard_s", "tavern", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("cr", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "houseatcrossroads4", "down", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("lf", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "loneford9", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("fh", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "fallhaven_ne", "clothes", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("prm", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "blackwater_mountain29", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("bwm", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "blackwater_mountain43", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("rmg", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "remgard0", "east", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("chr", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "waytolostmine2", "minerhouse4", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("ldr", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "lodarhouse0", "lodarhouse", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("sf", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "wild20", "south2", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("gm", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "guynmart_wood_1", "farmhouse", 0, 0);
|
||||
}
|
||||
})
|
||||
}));
|
||||
buttonList.addAll(tpButtons);
|
||||
|
||||
tpButtons2.addAll(Arrays.asList(new DebugButton[] {
|
||||
new DebugButton("teleport", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
buttons[i].b.setVisibility(View.VISIBLE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton tpButton : tpButtons2) {
|
||||
tpButton.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
})
|
||||
,new DebugButton("brv", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "brimhaven4", "south2", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("aru", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "mountainlake5", "north", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("ws", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "woodsettlement0", "east", 0, 0);
|
||||
}
|
||||
})
|
||||
,new DebugButton("sul", new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
controllerContext.movementController.placePlayerAsyncAt(MapObject.MapObjectType.newmap, "sullengard2", "south", 0, 0);
|
||||
}
|
||||
})
|
||||
}));
|
||||
buttonList.addAll(tpButtons2);
|
||||
|
||||
buttons = buttonList.toArray(new DebugButton[buttonList.size()]);
|
||||
addDebugButtons(buttons);
|
||||
|
||||
for (DebugButton b : tpButtons) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
for (DebugButton b : tpButtons2) {
|
||||
b.b.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showToast(Context context, String msg, int duration) {
|
||||
Toast.makeText(context, msg, duration).show();
|
||||
}
|
||||
|
||||
private static class DebugButton {
|
||||
public final String text;
|
||||
public final OnClickListener listener;
|
||||
public Button b = null;
|
||||
public DebugButton(String text, OnClickListener listener) {
|
||||
this.text = text;
|
||||
this.listener = listener;
|
||||
}
|
||||
public void makeButton(Context c, int id) {
|
||||
b = new Button(c);
|
||||
b.setText(text);
|
||||
b.setTextSize(10);//res.getDimension(R.dimen.actionbar_text));
|
||||
b.setId(id);
|
||||
b.setOnClickListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
private void addDebugButton(DebugButton button, int id, RelativeLayout layout) {
|
||||
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||
|
||||
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, res.getDimensionPixelSize(R.dimen.smalltext_buttonheight));
|
||||
if (id == 1)
|
||||
lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||
else
|
||||
lp.addRule(RelativeLayout.RIGHT_OF, id - 1);
|
||||
lp.addRule(RelativeLayout.ABOVE, R.id.main_statusview);
|
||||
button.makeButton(mainActivity, id);
|
||||
button.b.setLayoutParams(lp);
|
||||
layout.addView(button.b);
|
||||
}
|
||||
|
||||
private void addDebugButtons(DebugButton[] buttons) {
|
||||
if (!AndorsTrailApplication.DEVELOPMENT_DEBUGBUTTONS) return;
|
||||
|
||||
if (buttons == null || buttons.length <= 0) return;
|
||||
RelativeLayout layout = (RelativeLayout) mainActivity.findViewById(R.id.main_container);
|
||||
|
||||
int id = 1;
|
||||
for (DebugButton b : buttons) {
|
||||
addDebugButton(b, id, layout);
|
||||
++id;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnLongClickListener;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.activity.HeroinfoActivity;
|
||||
import com.gpl.rpg.AndorsTrail.context.ControllerContext;
|
||||
import com.gpl.rpg.AndorsTrail.context.WorldContext;
|
||||
import com.gpl.rpg.AndorsTrail.util.Coord;
|
||||
import com.gpl.rpg.AndorsTrail.util.L;
|
||||
|
||||
public final class InputController implements OnClickListener, OnLongClickListener{
|
||||
private final ControllerContext controllers;
|
||||
private final WorldContext world;
|
||||
|
||||
private final Coord lastTouchPosition_tileCoords = new Coord();
|
||||
private int lastTouchPosition_dx = 0;
|
||||
private int lastTouchPosition_dy = 0;
|
||||
private long lastTouchEventTime = 0;
|
||||
private boolean isDpadActive = false;
|
||||
|
||||
private int keyState_dx = 0;
|
||||
private int keyState_dy = 0;
|
||||
private boolean keyState_attack = false;
|
||||
private boolean keyState_flee = false;
|
||||
private boolean keyState_endturn = false;
|
||||
|
||||
final private int KEY_UNHANDLED = 0; // Default, for unhandled keycodes
|
||||
final private int KEY_MOVE_UP = 1;
|
||||
final private int KEY_MOVE_DOWN = 2;
|
||||
final private int KEY_MOVE_LEFT = 3;
|
||||
final private int KEY_MOVE_RIGHT = 4;
|
||||
final private int KEY_MOVE_UP_LEFT = 5;
|
||||
final private int KEY_MOVE_UP_RIGHT = 6;
|
||||
final private int KEY_MOVE_DOWN_LEFT = 7;
|
||||
final private int KEY_MOVE_DOWN_RIGHT = 8;
|
||||
final private int KEY_ATTACK = 9;
|
||||
final private int KEY_FLEE = 10;
|
||||
final private int KEY_END_TURN = 11;
|
||||
final private int KEY_HERO_INFO = 12;
|
||||
final private int KEY_TOOLBOX = 13;
|
||||
|
||||
private SparseIntArray keyMap = new SparseIntArray(); // Android keycode to internal key event mapping. TODO: Configure via preferences
|
||||
|
||||
public InputController(ControllerContext controllers, WorldContext world) {
|
||||
this.controllers = controllers;
|
||||
this.world = world;
|
||||
initializeKeyMap();
|
||||
|
||||
}
|
||||
|
||||
/* New keyboard handler. Both Key Down and Key Up events handled here to allow conditional behaviours.
|
||||
On 4-way dpad controllers, cursor keys, and WASD, diagonals are generated by chording two keys.
|
||||
Single-key diagonals are supported on numeric keypad and 8-way dpads (not seen/tested in the wild).
|
||||
|
||||
Because two-key combos initially generate a ordinal movement (one key comes in first), which can
|
||||
be dangerous in tight spaces, modifiers are provided to "lock" the input until both keys are down.
|
||||
TODO: Use delay timer to enable chorded diagonals on first move without locking kludge?
|
||||
*/
|
||||
|
||||
// Map key codes to spectic internal actions
|
||||
// TODO: Move mapping out of code to JSON/XML file, or maybe player prefs
|
||||
private void initializeKeyMap() {
|
||||
int key;
|
||||
|
||||
// Keys mapping to UP
|
||||
key = KEY_MOVE_UP;
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_8, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_8, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_W, key);
|
||||
|
||||
// Keys mapping to DOWN
|
||||
key = KEY_MOVE_DOWN;
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_2, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_2, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_S, key);
|
||||
|
||||
// Keys mapping to LEFT
|
||||
key = KEY_MOVE_LEFT;
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_LEFT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_4, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_4, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_A, key);
|
||||
|
||||
// Keys mapping to RIGHT
|
||||
key = KEY_MOVE_RIGHT;
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_RIGHT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_6, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_6, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_D, key);
|
||||
|
||||
// Keys mapping to UP_LEFT
|
||||
key = KEY_MOVE_UP_LEFT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_LEFT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_7, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_7, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_MOVE_HOME, key);
|
||||
|
||||
// Keys mapping to UP_RIGHT
|
||||
key = KEY_MOVE_UP_RIGHT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_UP_RIGHT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_9, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_9, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_PAGE_UP, key);
|
||||
|
||||
// Keys mapping to DOWN_LEFT
|
||||
key = KEY_MOVE_DOWN_LEFT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_LEFT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_MOVE_END, key);
|
||||
|
||||
// Keys mapping to DOWN_RIGHT
|
||||
key = KEY_MOVE_DOWN_RIGHT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_DOWN_RIGHT, key);
|
||||
}
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_3, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_3, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_PAGE_DOWN, key);
|
||||
|
||||
// Keys mapping to ATTACK
|
||||
key = KEY_ATTACK;
|
||||
keyMap.put(KeyEvent.KEYCODE_DPAD_CENTER, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_BUTTON_A, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_SPACE, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_5, key);
|
||||
|
||||
// Keys mapping to FLEE
|
||||
key = KEY_FLEE;
|
||||
keyMap.put(KeyEvent.KEYCODE_BUTTON_X, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_F, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_ENTER, key);
|
||||
|
||||
// Keys mapping to END_TURN
|
||||
key = KEY_END_TURN;
|
||||
keyMap.put(KeyEvent.KEYCODE_BUTTON_Y, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_E, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_FORWARD_DEL, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, key);
|
||||
|
||||
// Keys mapping to HERO_INFO
|
||||
key = KEY_HERO_INFO;
|
||||
//keyMap.put(KeyEvent.KEYCODE_BUTTON_SELECT, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_BUTTON_L1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUM_LOCK, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_C, key);
|
||||
|
||||
// Keys mapping to TOOLBOX
|
||||
key = KEY_TOOLBOX;
|
||||
keyMap.put(KeyEvent.KEYCODE_BUTTON_R1, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, key);
|
||||
keyMap.put(KeyEvent.KEYCODE_B, key);
|
||||
}
|
||||
|
||||
// Generate game actions based on mapped keys
|
||||
public boolean onKeyboardAction(Context context, KeyEvent event, boolean acceptInput) {
|
||||
//L.log("onKeyboardAction(): Processing action " + event.getAction() + " for keyCode " + event.getKeyCode());
|
||||
|
||||
if (event.getAction() != KeyEvent.ACTION_DOWN && event.getAction() != KeyEvent.ACTION_UP) return false; // don't handle other actions
|
||||
boolean keydown = (event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
boolean inihbit = (keyState_attack || keyState_flee); // used to inhibit movement if an action key is held down
|
||||
|
||||
switch (keyMap.get(event.getKeyCode())) {
|
||||
|
||||
// Ordinal directional keys - only modify one direction register; registers are combined when
|
||||
// keys used simultaneously to create synthetic diagonals
|
||||
case KEY_MOVE_UP:
|
||||
keyState_dy = keydown ? -1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_DOWN:
|
||||
keyState_dy = keydown ? 1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_LEFT:
|
||||
keyState_dx = keydown ? -1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_RIGHT:
|
||||
keyState_dx = keydown ? 1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
|
||||
// Diagonal directional keys. Modify both direction registers, can't be combined
|
||||
// TODO: store individual key position to allow combinations. May not be worth the trouble.
|
||||
case KEY_MOVE_UP_LEFT:
|
||||
keyState_dx = keydown ? -1 : 0;
|
||||
keyState_dy = keydown ? -1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_UP_RIGHT:
|
||||
keyState_dx = keydown ? 1 : 0;
|
||||
keyState_dy = keydown ? -1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_DOWN_LEFT:
|
||||
keyState_dx = keydown ? -1 : 0;
|
||||
keyState_dy = keydown ? 1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
case KEY_MOVE_DOWN_RIGHT:
|
||||
keyState_dx = keydown ? 1 : 0;
|
||||
keyState_dy = keydown ? 1 : 0;
|
||||
if (acceptInput && !inihbit) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
break;
|
||||
|
||||
// Special key handling below - some combat/movement stuff done here because it's too
|
||||
// specific for logic in onRelativeMovement
|
||||
|
||||
// "Attack" shortcut - freeze movement to allow chorded direction when key is released.
|
||||
// if in combat, executes an attack on key release
|
||||
case KEY_ATTACK:
|
||||
if (keydown && !keyState_attack) { // key pressed - pause any movement
|
||||
if(!world.model.uiSelections.isInCombat) controllers.movementController.stopMovement();
|
||||
} else if (!keydown && keyState_attack) { // key released - execute attack / move in direction
|
||||
if (acceptInput) onRelativeMovement(keyState_dx, keyState_dy);
|
||||
}
|
||||
keyState_attack = keydown;
|
||||
break;
|
||||
|
||||
// "Flee" shortcut. Intitiates flee when pressed. If a direction is held, moves in chosen direction when released
|
||||
case KEY_FLEE:
|
||||
if (world.model.uiSelections.isInCombat) {
|
||||
if (keydown && !keyState_flee) { // button pressed - set flee; movement locked while pressed
|
||||
if(acceptInput) controllers.combatController.startFlee();
|
||||
} else if (!keydown && keyState_flee) { // button released - move flee direction, if held
|
||||
// We need to do a special call because the movement key may already be down, and if the device
|
||||
// doesn't generate repeat keystrokes, this handler won't get another event
|
||||
if ((keyState_dx != 0 || keyState_dy != 0) && allowInputInterval()) {
|
||||
if(acceptInput) controllers.combatController.executeMoveAttack(keyState_dx, keyState_dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
keyState_flee = keydown;
|
||||
break;
|
||||
|
||||
// "End Turn" shortcut. Flag prevents repeated end turn if key is held down.
|
||||
case KEY_END_TURN:
|
||||
if (acceptInput && keydown && !keyState_endturn) {
|
||||
if (world.model.uiSelections.isInCombat) controllers.combatController.endPlayerTurn();
|
||||
}
|
||||
keyState_endturn = keydown;
|
||||
break;
|
||||
|
||||
// "Hero Info" screen shortcut. New activity takes focus, so we don't need to worry about repeats.
|
||||
case KEY_HERO_INFO:
|
||||
if (acceptInput && keydown) context.startActivity(new Intent(context, HeroinfoActivity.class));
|
||||
break;
|
||||
|
||||
case KEY_TOOLBOX:
|
||||
// ??? ToolboxView toolboxview = context.getApplicationContext(). findViewById(R.id.main_toolboxview);
|
||||
|
||||
break;
|
||||
|
||||
case KEY_UNHANDLED: // Unhandled keycode
|
||||
return false;
|
||||
|
||||
default: // unhandled keymap code entry (should not happen)
|
||||
L.log("onKeyboardAction(): Unhandled keyMap code constant " + keyMap.get(event.getKeyCode()) + " for keyCode " + event.getKeyCode());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onRelativeMovement(int dx, int dy) {
|
||||
//L.log("onRelativeMovement(): dx=" + dx + " dy=" + dy + " combat: " + world.model.uiSelections.isInCombat);
|
||||
if (world.model.uiSelections.isInCombat) {
|
||||
if (allowInputInterval()) controllers.combatController.executeMoveAttack(dx, dy);
|
||||
} else if (dx == 0 && dy == 0) {
|
||||
controllers.movementController.stopMovement();
|
||||
} else {
|
||||
controllers.movementController.startMovement(dx, dy, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void onKeyboardCancel() {
|
||||
controllers.movementController.stopMovement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
if (!world.model.uiSelections.isInCombat) return;
|
||||
onRelativeMovement(lastTouchPosition_dx, lastTouchPosition_dy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View arg0) {
|
||||
if (world.model.uiSelections.isInCombat) {
|
||||
//TODO: Should be able to mark positions far away (mapwalk / ranged combat)
|
||||
if (lastTouchPosition_dx == 0 && lastTouchPosition_dy == 0) return false;
|
||||
if (Math.abs(lastTouchPosition_dx) > 1) return false;
|
||||
if (Math.abs(lastTouchPosition_dy) > 1) return false;
|
||||
|
||||
controllers.combatController.setCombatSelection(lastTouchPosition_tileCoords);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean allowInputInterval() {
|
||||
final long now = System.currentTimeMillis();
|
||||
if ((now - lastTouchEventTime) < Constants.MINIMUM_INPUT_INTERVAL) return false;
|
||||
lastTouchEventTime = now;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setDpadActive(boolean isDpadActive) {
|
||||
this.isDpadActive = isDpadActive;
|
||||
}
|
||||
|
||||
public void onTouchCancel() {
|
||||
controllers.movementController.stopMovement();
|
||||
}
|
||||
|
||||
public boolean onTouchedTile(int tile_x, int tile_y) {
|
||||
lastTouchPosition_tileCoords.set(tile_x, tile_y);
|
||||
lastTouchPosition_dx = tile_x - world.model.player.position.x;
|
||||
lastTouchPosition_dy = tile_y - world.model.player.position.y;
|
||||
|
||||
if (world.model.uiSelections.isInCombat || isDpadActive) return false;
|
||||
|
||||
controllers.movementController.startMovement(lastTouchPosition_dx, lastTouchPosition_dy, lastTouchPosition_tileCoords);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.model;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.map.LayeredTileMap;
|
||||
import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
|
||||
import com.gpl.rpg.AndorsTrail.resource.tiles.TileCollection;
|
||||
|
||||
public final class MapBundle {
|
||||
public PredefinedMap map;
|
||||
public LayeredTileMap tileMap;
|
||||
public TileCollection tiles;
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.content.FileProvider;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.controller.Constants;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public final class AndroidStorage {
|
||||
public static File getStorageDirectory(Context context, String name) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
return context.getExternalFilesDir(name);
|
||||
}
|
||||
else {
|
||||
File root = Environment.getExternalStorageDirectory();
|
||||
return new File(root, name);
|
||||
}
|
||||
}
|
||||
public static boolean shouldMigrateToInternalStorage(Context context) {
|
||||
boolean ret = false;
|
||||
File externalSaveGameDirectory = new File(Environment.getExternalStorageDirectory(), Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
File internalSaveGameDirectory = getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY);
|
||||
|
||||
if (externalSaveGameDirectory.exists()
|
||||
&& externalSaveGameDirectory.isDirectory()
|
||||
&& externalSaveGameDirectory.listFiles().length > 0
|
||||
&& (
|
||||
!internalSaveGameDirectory.exists()
|
||||
|| internalSaveGameDirectory.isDirectory() && internalSaveGameDirectory.listFiles().length < 2)
|
||||
) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static boolean migrateToInternalStorage(Context context) {
|
||||
try {
|
||||
copy(new File(Environment.getExternalStorageDirectory(), Constants.CHEAT_DETECTION_FOLDER),
|
||||
getStorageDirectory(context, Constants.CHEAT_DETECTION_FOLDER));
|
||||
copy(new File(Environment.getExternalStorageDirectory(), Constants.FILENAME_SAVEGAME_DIRECTORY),
|
||||
getStorageDirectory(context, Constants.FILENAME_SAVEGAME_DIRECTORY));
|
||||
} catch (IOException e) {
|
||||
L.log("Error migrating data: " + e.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void copy(File sourceLocation, File targetLocation) throws IOException {
|
||||
if (!sourceLocation.exists()) {
|
||||
return;
|
||||
}
|
||||
if (sourceLocation.isDirectory()) {
|
||||
copyDirectory(sourceLocation, targetLocation);
|
||||
} else {
|
||||
copyFile(sourceLocation, targetLocation);
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyDirectory(File source, File target) throws IOException {
|
||||
if (!target.exists()) {
|
||||
target.mkdir();
|
||||
}
|
||||
|
||||
for (String f : source.list()) {
|
||||
copy(new File(source, f), new File(target, f));
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyFile(File source, File target) throws IOException {
|
||||
InputStream in = null;
|
||||
OutputStream out = null;
|
||||
try {
|
||||
in = new FileInputStream(source);
|
||||
out = new FileOutputStream(target);
|
||||
byte[] buf = new byte[1024];
|
||||
int length;
|
||||
while ((length = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, length);
|
||||
}
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUrlForFile(Context context, File worldmap) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
String applicationId = context.getPackageName();
|
||||
// Uri uri = FileProvider.getUriForFile(context, "com.gpl.rpg.AndorsTrail.fileprovider", worldmap);
|
||||
Uri uri = FileProvider.getUriForFile(context, applicationId + ".fileprovider", worldmap);
|
||||
return uri.toString();
|
||||
} else {
|
||||
return "file://" + worldmap.getAbsolutePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public final class HashMapHelper {
|
||||
public static <K,V> V getOrDefault(HashMap<K,V> map, K key, V defaultValue) {
|
||||
V v = map.get(key);
|
||||
return v == null ? defaultValue : v;
|
||||
}
|
||||
public static <K> Integer sumIntegerValues(HashMap<K,Integer> map) {
|
||||
int sum = 0;
|
||||
for (Integer v : map.values()) sum += v;
|
||||
return sum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.gpl.rpg.AndorsTrail.controller;
|
||||
|
||||
import com.gpl.rpg.AndorsTrail.model.actor.Actor;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class CombatControllerTest {
|
||||
@Test
|
||||
public void getAverageDamagePerHit() throws Exception {
|
||||
Actor attacker = new Actor(null, false, false);
|
||||
attacker.attackChance = 100;
|
||||
attacker.damagePotential.set(5, 3);
|
||||
|
||||
Actor target = new Actor(null, false, false);
|
||||
target.damageResistance = 3;
|
||||
target.blockChance = 50;
|
||||
|
||||
float averageDamagePerHit = CombatController.getAverageDamagePerHit(attacker, target);
|
||||
assertEquals(0.5, averageDamagePerHit, 0.01);
|
||||
|
||||
attacker.criticalSkill = 30;
|
||||
attacker.criticalMultiplier = 2.5f;
|
||||
|
||||
averageDamagePerHit = CombatController.getAverageDamagePerHit(attacker, target);
|
||||
assertEquals(1.038, averageDamagePerHit, 0.01);
|
||||
}
|
||||
|
||||
}
|
||||
1
AndorsTrail/assets/translation/.gitignore
vendored
1
AndorsTrail/assets/translation/.gitignore
vendored
@@ -0,0 +1 @@
|
||||
*.mo
|
||||
|
||||
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
Binary file not shown.
File diff suppressed because it is too large
Load Diff
0
AndorsTrail/assets/translation/createMo.sh
Normal file → Executable file
0
AndorsTrail/assets/translation/createMo.sh
Normal file → Executable file
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
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.
21714
AndorsTrail/assets/translation/fi.po
Normal file → Executable file
21714
AndorsTrail/assets/translation/fi.po
Normal file → Executable file
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.
21712
AndorsTrail/assets/translation/gl.po
Normal file → Executable file
21712
AndorsTrail/assets/translation/gl.po
Normal file → Executable file
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
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
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
0
AndorsTrail/assets/translation/reformatPo.sh
Normal file → Executable file
0
AndorsTrail/assets/translation/reformatPo.sh
Normal file → Executable file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user