Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
32096e8d74 | ||
![]() |
b2e58d4462 | ||
![]() |
c0e90edc9e | ||
![]() |
e29648f328 | ||
![]() |
36e83cdd26 |
@ -6,4 +6,9 @@ key/publish_key
|
|||||||
key store pass: 7654321Kingsome_
|
key store pass: 7654321Kingsome_
|
||||||
key alias: release
|
key alias: release
|
||||||
key pass: 7654321Kingsome_
|
key pass: 7654321Kingsome_
|
||||||
|
|
||||||
|
vivo key alias: vivo
|
||||||
|
oppo key alias: oppo
|
||||||
|
xiaomi key alias: release
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -128,7 +128,7 @@ public class LaunchActivity extends Activity {
|
|||||||
*/
|
*/
|
||||||
private void getLocalVersionInfo() {
|
private void getLocalVersionInfo() {
|
||||||
String fileName = gameUrl.replace("index.html", "version.json");
|
String fileName = gameUrl.replace("index.html", "version.json");
|
||||||
String realPath = getFileDirByUrl(fileName);
|
String realPath = preloadPath + "/" + getFileDirByUrl(fileName) + "version.json" ;
|
||||||
File versionFile = new File(realPath);
|
File versionFile = new File(realPath);
|
||||||
if (versionFile.exists()) {
|
if (versionFile.exists()) {
|
||||||
JSONObject data = AssetsUtil.readJsonFromFile(this, realPath);
|
JSONObject data = AssetsUtil.readJsonFromFile(this, realPath);
|
||||||
@ -198,7 +198,7 @@ public class LaunchActivity extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void preloadGame() {
|
private void preloadGame() {
|
||||||
String dir = preloadPath + getFileDirByUrl(gameUrl);
|
String dir = preloadPath + "/" + getFileDirByUrl(gameUrl);
|
||||||
File dirFile = new File(dir);
|
File dirFile = new File(dir);
|
||||||
if (!dirFile.exists()) {
|
if (!dirFile.exists()) {
|
||||||
dirFile.mkdirs();
|
dirFile.mkdirs();
|
||||||
|
@ -17,6 +17,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.util.AssetsUtil;
|
||||||
|
import com.hnjc.wjtx.util.IdUtil;
|
||||||
import com.hnjc.wjtx.util.StorageUtil;
|
import com.hnjc.wjtx.util.StorageUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
import com.hnjc.wjtx.util.StringUtil;
|
||||||
|
|
||||||
@ -98,9 +99,11 @@ public class MainActivity extends Activity {
|
|||||||
builder.setPositiveButton("取消",null);
|
builder.setPositiveButton("取消",null);
|
||||||
//显示弹框
|
//显示弹框
|
||||||
builder.show();
|
builder.show();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.onKeyDown(keyCode, keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onKeyDown(keyCode, keyEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setExternalInterfaces() {
|
private void setExternalInterfaces() {
|
||||||
@ -161,6 +164,18 @@ public class MainActivity extends Activity {
|
|||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("getUid", message -> {
|
nativeAndroid.setExternalInterface("getUid", message -> {
|
||||||
//TODO: 平台的登陆
|
//TODO: 平台的登陆
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("openid", IdUtil.getUid(this));
|
||||||
|
obj.put("token", "");
|
||||||
|
// 如果其他登陆过程中的错误, 则传入一个大于0的errorcode
|
||||||
|
obj.put("errorcode", 1);
|
||||||
|
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", "");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("@onState", message -> {
|
nativeAndroid.setExternalInterface("@onState", message -> {
|
||||||
Log.e(TAG, "Get @onState: " + message);
|
Log.e(TAG, "Get @onState: " + message);
|
||||||
@ -184,6 +199,14 @@ public class MainActivity extends Activity {
|
|||||||
String productCode = jsonObject.getString("productCode");
|
String productCode = jsonObject.getString("productCode");
|
||||||
int count = jsonObject.getInt("count");
|
int count = jsonObject.getInt("count");
|
||||||
//TODO: 平台的支付
|
//TODO: 平台的支付
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("errcode", 0);
|
||||||
|
obj.put("errmsg", "");
|
||||||
|
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
|
@ -12,6 +12,7 @@ import org.json.JSONObject;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -187,12 +188,15 @@ public class AssetsUtil {
|
|||||||
*/
|
*/
|
||||||
public static String readFromFile(Context context, String path) {
|
public static String readFromFile(Context context, String path) {
|
||||||
try {
|
try {
|
||||||
InputStreamReader inputReader = new InputStreamReader(context.openFileInput(path));
|
FileInputStream fileInputStream = new FileInputStream(new File(path));
|
||||||
|
InputStreamReader inputReader = new InputStreamReader(fileInputStream);
|
||||||
BufferedReader bufReader = new BufferedReader(inputReader);
|
BufferedReader bufReader = new BufferedReader(inputReader);
|
||||||
|
|
||||||
String line="";
|
String line="";
|
||||||
StringBuilder result= new StringBuilder();
|
StringBuilder result= new StringBuilder();
|
||||||
while((line = bufReader.readLine()) != null)
|
while((line = bufReader.readLine()) != null)
|
||||||
result.append(line);
|
result.append(line);
|
||||||
|
fileInputStream.close();
|
||||||
inputReader.close();
|
inputReader.close();
|
||||||
bufReader.close();
|
bufReader.close();
|
||||||
return result.toString();
|
return result.toString();
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<string name="load_game">下载游戏资源</string>
|
<string name="load_game">下载游戏资源</string>
|
||||||
<string name="start_game">进入游戏</string>
|
<string name="start_game">进入游戏</string>
|
||||||
<string name="preload_path">preload</string>
|
<string name="preload_path">preload</string>
|
||||||
<string name="game_url">http://local/index.html?channel=7013</string>
|
<string name="game_url">http://local/index.html?channel=7103</string>
|
||||||
<string name="local_version">1.0.0</string>
|
<string name="local_version">1.0.0</string>
|
||||||
<string name="load_back">load_back</string>
|
<string name="load_back">load_back</string>
|
||||||
<string name="launch_version">获取游戏版本</string>
|
<string name="launch_version">获取游戏版本</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user