Skip to content

Commit

Permalink
添加英语支持
Browse files Browse the repository at this point in the history
  • Loading branch information
StArrayJaN committed Oct 12, 2023
1 parent 29cb6dd commit 8451264
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 19 deletions.
14 changes: 8 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<!-- 修改或删除 SD 卡中的内容 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<!-- MANAGE_EXTERNAL_STORAGE -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

<supports-screens
android:anyDensity="true"
android:largeScreens="true"
Expand All @@ -32,7 +35,7 @@
android:allowBackup="false"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:name="GlobalApplication"
android:name="GlobalApplication"
android:resizeableActivity="false"
android:roundIcon="@drawable/icon">

Expand Down Expand Up @@ -92,10 +95,9 @@
</intent-filter>

</activity>

<activity
android:name="com.disney.WMW.WMWActivity"/>


<activity android:name="com.disney.WMW.WMWActivity"/>

<meta-data
android:name="com.google.android.play.billingclient.version"
android:value="4.0.0"/>
Expand All @@ -107,4 +109,4 @@

</application>

</manifest>
</manifest>
26 changes: 25 additions & 1 deletion app/src/main/java/com/disney/WMW/WMWActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.disney.WMW;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
Expand Down Expand Up @@ -29,7 +31,7 @@
import java.util.UUID;
import org.fmod.FMODAudioDevice;
import thercn.wmw.MainActivity;
import android.content.pm.PackageManager.NameNotFoundException;
import thercn.wmw.R;

public class WMWActivity extends BaseActivity {
private static GlobalPurchaseHandler globalIapHandler;
Expand Down Expand Up @@ -89,6 +91,28 @@ public void handleMessage(Message paramMessage) {

class FinishActivityArgs {}

@Override
public void onBackPressed() {
Log.e("WMW","返回被按下");
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle("")
.setMessage(getString(R.string.exit_str))
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dia, int which) {
System.exit(0);
}
})
.setNegativeButton(android.R.string.cancel, null)
.create();
dialog.show();
super.onBackPressed();
}




static /* synthetic */ void access$100(WMWActivity wMWActivity) {
wMWActivity.initIap();
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/thercn/wmw/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import com.disney.WMW.WMWActivity;
import java.io.File;
import java.io.IOException;
Expand All @@ -21,6 +22,7 @@ public class MainActivity extends Activity {

public static String appDataDir = Environment.getExternalStorageDirectory().toString() + "/WMW";
public static boolean isIPadScreen = false;

static
{
System.loadLibrary("wmw");
Expand All @@ -30,14 +32,19 @@ public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Permission.申请(this);

File obbdir = getObbDir();

File dataDir = new File(appDataDir);
File extraDataFile = new File(appDataDir + "/wmw-extra.zip");
if (!obbdir.exists() || !dataDir.exists()) {
obbdir.mkdirs();
dataDir.mkdirs();
} else{
TextView checkObb = findViewById(R.id.checkObb);
checkObb.setText(getString(R.string.have_obb));
}
String obbPath = getObbPath();
if (!extraDataFile.exists()) {
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,23 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/resetSize"
android:text="开启4:3屏幕比例"/>
android:text="4:3"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="开始游戏"
android:text="@string/start_game"
android:id="@+id/startGame"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/have_not_obb"
android:id="@+id/checkObb"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tip"/>
</LinearLayout>

9 changes: 0 additions & 9 deletions app/src/main/res/values-v21/styles.xml

This file was deleted.

10 changes: 10 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="no">否</string>

<string name="have_obb">检测到OBB</string>
<string name="have_not_obb">未检测到OBB</string>
<string name="start_game">开始游戏</string>
<string name="exit_str">是否退出?</string>
<string name="tip">提示:你可以修改/sdcard/WMW/wmw-extra.zip里的内容来添加关卡,应用会自动复制到obb目录</string>
</resources>
8 changes: 7 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_id">110024032444757</string>
<string name="app_name">Water?</string>
<string name="app_name">"Where's My Water?"</string>
<string name="app_name_free">"Where's My Water? Free"</string>
<string name="error_title">Connection Error</string>
<string name="link_japanese_market_help">Help</string>
Expand All @@ -12,4 +12,10 @@
<string name="ok">OK</string>
<string name="want_to_download">Do you want to download?</string>
<string name="yes">Yes</string>

<string name="have_not_obb">No obb found</string>
<string name="have_obb">obb found</string>
<string name="start_game">Start Game</string>
<string name="exit_str">Exit?</string>
<string name="tip">Tip: You can modify the content in /sdcard/WMW/wmw-extra.zip to add levels, and the application will automatically copy to the obb directory</string>
</resources>

0 comments on commit 8451264

Please sign in to comment.