Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
da724adfff | ||
![]() |
e611a5b4f4 | ||
![]() |
9e534c5184 | ||
![]() |
e8189a5a50 | ||
![]() |
cbf94cb747 | ||
![]() |
1ca516b7e1 | ||
![]() |
d0c31fda51 | ||
![]() |
098cc65123 | ||
![]() |
b1726e94ce | ||
![]() |
fe6c516a8f | ||
![]() |
63a15b11eb | ||
![]() |
2059939f80 | ||
![]() |
a8a1e954f3 | ||
![]() |
fc1aafadbf | ||
![]() |
7101599a6b | ||
![]() |
0078dfec2c | ||
![]() |
ffa2eff144 | ||
![]() |
e11f2b0c1b |
@ -6,4 +6,6 @@ key/publish_key
|
|||||||
key store pass: 7654321Kingsome_
|
key store pass: 7654321Kingsome_
|
||||||
key alias: release
|
key alias: release
|
||||||
key pass: 7654321Kingsome_
|
key pass: 7654321Kingsome_
|
||||||
|
|
||||||
|
oppo使用alias: oppo
|
||||||
```
|
```
|
||||||
|
@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.hnjc.wjtx.mi"
|
applicationId 'com.hnjc.wjtx.nearme.gamecenter'
|
||||||
minSdkVersion 18
|
minSdkVersion 19
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1
|
versionCode 9
|
||||||
versionName "1.0.0"
|
versionName "1.0.9"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
}
|
}
|
||||||
|
BIN
app/libs/gamesdk-20210810.aar
Executable file
BIN
app/libs/gamesdk-20210810.aar
Executable file
Binary file not shown.
BIN
app/libs/gamesdk-common-20210810.aar
Executable file
BIN
app/libs/gamesdk-common-20210810.aar
Executable file
Binary file not shown.
6
app/proguard-rules.pro
vendored
6
app/proguard-rules.pro
vendored
@ -83,9 +83,11 @@
|
|||||||
-dontwarn android.support.**
|
-dontwarn android.support.**
|
||||||
-keep class **.R$styleable{*;}
|
-keep class **.R$styleable{*;}
|
||||||
|
|
||||||
-keep class com.hnjc.wjtx.mi.** { *; }
|
-keep class com.hnjc.wjtx.** { *; }
|
||||||
-dontwarn com.hnjc.wjtx.mi.**
|
-dontwarn com.hnjc.wjtx.**
|
||||||
|
|
||||||
|
|
||||||
-keep class org.egret.** { *; }
|
-keep class org.egret.** { *; }
|
||||||
-dontwarn org.egret.**
|
-dontwarn org.egret.**
|
||||||
|
|
||||||
|
-keep class com.nearme.** { *; }
|
@ -5,14 +5,13 @@
|
|||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<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_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@drawable/icon"
|
||||||
android:name=".JCApplication"
|
android:name=".JCApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
@ -38,19 +37,12 @@
|
|||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
<!-- nearme game sdk config goes here -->
|
||||||
<!-- <activity android:name=".MainActivity"-->
|
<uses-library android:name="org.apache.http.legacy" android:required="false" />
|
||||||
<!-- android:launchMode="singleTask"-->
|
<!-- <meta-data android:name="app_type" android:value="1" /> <!–app_type:1 表示应用,应用必须设为1–>-->
|
||||||
<!-- android:screenOrientation="portrait"-->
|
<meta-data android:name="debug_mode" android:value="false" /> <!-- 日志开关,发布时候设置为false -->
|
||||||
<!-- android:windowSoftInputMode="adjustPan|stateAlwaysVisible"-->
|
<meta-data android:name="is_offline_game" android:value="false" /> <!-- true:单机游戏 false:网游 。应用设置true-->
|
||||||
<!-- android:configChanges="orientation|keyboardHidden|screenSize|screenLayout"-->
|
<meta-data android:name="app_key" android:value="c8d0bd98ecda441993df181cdf23663a" /> <!-- appKey -->
|
||||||
<!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen">-->
|
|
||||||
<!-- <intent-filter>-->
|
|
||||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
|
||||||
|
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
|
||||||
<!-- </intent-filter>-->
|
|
||||||
<!-- </activity>-->
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -3,10 +3,14 @@ package com.hnjc.wjtx;
|
|||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.nearme.game.sdk.GameCenterSDK;
|
||||||
|
|
||||||
public class JCApplication extends Application {
|
public class JCApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
Log.i("JCApplication", "JCApplication onCreate");
|
Log.i("JCApplication", "JCApplication onCreate");
|
||||||
|
String appSecret = "4225d8b8b9fa49ed8686c9e325a05d7b";
|
||||||
|
GameCenterSDK.init(appSecret, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,7 @@ public class LaunchActivity extends Activity {
|
|||||||
int check = checkSelfPermission(permissions[0]);
|
int check = checkSelfPermission(permissions[0]);
|
||||||
if (check != PackageManager.PERMISSION_GRANTED) {
|
if (check != PackageManager.PERMISSION_GRANTED) {
|
||||||
requestPermissions(permissions, 111);
|
requestPermissions(permissions, 111);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compareVersions();
|
compareVersions();
|
||||||
@ -128,7 +129,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 +199,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();
|
||||||
@ -278,4 +279,14 @@ public class LaunchActivity extends Activity {
|
|||||||
overridePendingTransition(0, 0);
|
overridePendingTransition(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||||
|
int[] grantResults) {
|
||||||
|
switch (requestCode) {
|
||||||
|
case 111:
|
||||||
|
compareVersions();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,10 @@ import android.os.VibrationEffect;
|
|||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -19,6 +23,13 @@ import android.widget.Toast;
|
|||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.util.AssetsUtil;
|
||||||
import com.hnjc.wjtx.util.StorageUtil;
|
import com.hnjc.wjtx.util.StorageUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
import com.hnjc.wjtx.util.StringUtil;
|
||||||
|
import com.nearme.game.sdk.GameCenterSDK;
|
||||||
|
import com.nearme.game.sdk.callback.ApiCallback;
|
||||||
|
import com.nearme.game.sdk.callback.GameExitCallback;
|
||||||
|
import com.nearme.game.sdk.callback.SinglePayCallback;
|
||||||
|
import com.nearme.game.sdk.common.model.biz.PayInfo;
|
||||||
|
import com.nearme.game.sdk.common.util.AppUtil;
|
||||||
|
import com.nearme.platform.opensdk.pay.PayResponse;
|
||||||
|
|
||||||
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -32,11 +43,15 @@ public class MainActivity extends Activity {
|
|||||||
private ImageView launchScreenImageView = null;
|
private ImageView launchScreenImageView = null;
|
||||||
private FrameLayout rootLayout = null;
|
private FrameLayout rootLayout = null;
|
||||||
private Vibrator vibrator;
|
private Vibrator vibrator;
|
||||||
|
private boolean alterShowed;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
|
||||||
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
||||||
String gameUrl = this.getString(R.string.game_url);
|
String gameUrl = this.getString(R.string.game_url);
|
||||||
@ -86,21 +101,30 @@ public class MainActivity extends Activity {
|
|||||||
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
//声明并初始化弹出对象
|
//声明并初始化弹出对象
|
||||||
AlertDialog.Builder builder=new AlertDialog.Builder(this);
|
// AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle("提示:");
|
// builder.setTitle("提示:");
|
||||||
builder.setMessage("是否退出");
|
// builder.setMessage("是否退出");
|
||||||
//设置确认按钮
|
// //设置确认按钮
|
||||||
builder.setNegativeButton("确定", (dialog, which) -> {
|
// builder.setNegativeButton("确定", (dialog, which) -> {
|
||||||
|
// nativeAndroid.exitGame();
|
||||||
|
// finish();//退出程序
|
||||||
|
// });
|
||||||
|
// //设置取消按钮
|
||||||
|
// builder.setPositiveButton("取消", null);
|
||||||
|
// //显示弹框
|
||||||
|
// builder.show();
|
||||||
|
GameCenterSDK.getInstance().onExit(this, new GameExitCallback() {
|
||||||
|
public void exitGame() {
|
||||||
|
AppUtil.exitGameProcess(MainActivity.this);
|
||||||
nativeAndroid.exitGame();
|
nativeAndroid.exitGame();
|
||||||
finish();//退出程序
|
finish();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//设置取消按钮
|
return true;
|
||||||
builder.setPositiveButton("取消",null);
|
} else {
|
||||||
//显示弹框
|
return super.onKeyDown(keyCode, keyEvent);
|
||||||
builder.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onKeyDown(keyCode, keyEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setExternalInterfaces() {
|
private void setExternalInterfaces() {
|
||||||
@ -120,8 +144,7 @@ public class MainActivity extends Activity {
|
|||||||
String val = jsonObject.getString("val");
|
String val = jsonObject.getString("val");
|
||||||
SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
|
SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
|
||||||
StorageUtil.writeString(sharedPref, key, val);
|
StorageUtil.writeString(sharedPref, key, val);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.e(TAG, " onState message failed to analyze");
|
Log.e(TAG, " onState message failed to analyze");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +182,26 @@ public class MainActivity extends Activity {
|
|||||||
Log.d(TAG, "showToast: " + message);
|
Log.d(TAG, "showToast: " + message);
|
||||||
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
|
nativeAndroid.setExternalInterface("showPrivacy", message -> {
|
||||||
|
Log.d(TAG, "showPrivacy: " + message);
|
||||||
|
runOnUiThread(this::showPrivacy);
|
||||||
|
});
|
||||||
|
nativeAndroid.setExternalInterface("showAgreement", message -> {
|
||||||
|
Log.d(TAG, "showAgreement: " + message);
|
||||||
|
runOnUiThread(this::showAgreement);
|
||||||
|
});
|
||||||
nativeAndroid.setExternalInterface("getUid", message -> {
|
nativeAndroid.setExternalInterface("getUid", message -> {
|
||||||
//TODO: 平台的登陆
|
GameCenterSDK.getInstance().doLogin(this, new ApiCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String arg0) {
|
||||||
|
doGetTokenAndSsoid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String arg0, int arg1) {
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("@onState", message -> {
|
nativeAndroid.setExternalInterface("@onState", message -> {
|
||||||
Log.e(TAG, "Get @onState: " + message);
|
Log.e(TAG, "Get @onState: " + message);
|
||||||
@ -168,8 +209,7 @@ public class MainActivity extends Activity {
|
|||||||
JSONObject jsonObject = new JSONObject(message);
|
JSONObject jsonObject = new JSONObject(message);
|
||||||
String state = jsonObject.getString("state");
|
String state = jsonObject.getString("state");
|
||||||
handleStateEvent(state);
|
handleStateEvent(state);
|
||||||
}
|
} catch (JSONException e) {
|
||||||
catch (JSONException e) {
|
|
||||||
Log.e(TAG, " onState message failed to analyze");
|
Log.e(TAG, " onState message failed to analyze");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,10 +220,61 @@ public class MainActivity extends Activity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject(message);
|
JSONObject jsonObject = new JSONObject(message);
|
||||||
String cpOrderId = jsonObject.getString("orderId");
|
String cpOrderId = jsonObject.getString("order");
|
||||||
String productCode = jsonObject.getString("productCode");
|
String attach = jsonObject.getString("attach");
|
||||||
int count = jsonObject.getInt("count");
|
int money = jsonObject.getInt("amount"); // 未传
|
||||||
//TODO: 平台的支付
|
String notifyUrl = jsonObject.getString("notifyUrl"); // 未传
|
||||||
|
String productName = jsonObject.getString("productName"); // 未传
|
||||||
|
String productDesc = jsonObject.getString("productDesc"); //未传
|
||||||
|
// String sign = jsonObject.getString("sign"); // 未传
|
||||||
|
PayInfo payInfo = new PayInfo(cpOrderId, attach, money );
|
||||||
|
payInfo.setProductDesc(productDesc);
|
||||||
|
payInfo.setProductName(productName);
|
||||||
|
payInfo.setAmount(money);
|
||||||
|
// payInfo.setType(PayInfo.TYPE_AUTO_ORDER_WXPAY);
|
||||||
|
payInfo.setUseCachedChannel(false);
|
||||||
|
// 支付结果服务器回调地址,不通过服务端回调发货的应用可以不用填写~
|
||||||
|
payInfo.setCallbackUrl(notifyUrl);
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
|
||||||
|
GameCenterSDK.getInstance().doPay(this, payInfo,
|
||||||
|
new SinglePayCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String resultMsg) {
|
||||||
|
// add OPPO 支付成功处理逻辑~
|
||||||
|
try {
|
||||||
|
obj.put("errcode", 0);
|
||||||
|
obj.put("errmsg", "");
|
||||||
|
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String resultMsg, int resultCode) {
|
||||||
|
// add OPPO 支付失败处理逻辑~
|
||||||
|
try {
|
||||||
|
if (PayResponse.CODE_CANCEL != resultCode) {
|
||||||
|
obj.put("errmsg", "支付失败");
|
||||||
|
} else {
|
||||||
|
// 取消支付处理
|
||||||
|
obj.put("errmsg", "支付取消");
|
||||||
|
}
|
||||||
|
obj.put("errcode", resultCode);
|
||||||
|
nativeAndroid.callExternalInterface("payResult", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCallCarrierPay(PayInfo payInfo, boolean bySelectSMSPay) {
|
||||||
|
// Toast.makeText(this, "运营商支付", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.i(TAG, "运营商支付");
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -210,6 +301,31 @@ public class MainActivity extends Activity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void doGetTokenAndSsoid() {
|
||||||
|
GameCenterSDK.getInstance().doGetTokenAndSsoid(new ApiCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String resultMsg) {
|
||||||
|
try {
|
||||||
|
JSONObject json = new JSONObject(resultMsg);
|
||||||
|
String token = json.getString("token");
|
||||||
|
String ssoid = json.getString("ssoid");
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("openid", ssoid);
|
||||||
|
obj.put("token", token);
|
||||||
|
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(String content, int resultCode) {
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
@ -226,6 +342,7 @@ public class MainActivity extends Activity {
|
|||||||
FrameLayout.LayoutParams.MATCH_PARENT);
|
FrameLayout.LayoutParams.MATCH_PARENT);
|
||||||
rootLayout.addView(launchScreenImageView, params);
|
rootLayout.addView(launchScreenImageView, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleStateEvent(String state) {
|
private void handleStateEvent(String state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case "running":
|
case "running":
|
||||||
@ -235,6 +352,7 @@ public class MainActivity extends Activity {
|
|||||||
Log.i(TAG, state);
|
Log.i(TAG, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hideLoadingView() {
|
private void hideLoadingView() {
|
||||||
rootLayout.removeView(launchScreenImageView);
|
rootLayout.removeView(launchScreenImageView);
|
||||||
Drawable drawable = launchScreenImageView.getDrawable();
|
Drawable drawable = launchScreenImageView.getDrawable();
|
||||||
@ -242,5 +360,41 @@ public class MainActivity extends Activity {
|
|||||||
drawable.setCallback(null);
|
drawable.setCallback(null);
|
||||||
launchScreenImageView = null;
|
launchScreenImageView = null;
|
||||||
}
|
}
|
||||||
|
private void showPrivacy() {
|
||||||
|
String url = "https://privacy3.kingsome.cn/";
|
||||||
|
alertWebview(url);
|
||||||
|
}
|
||||||
|
private void showAgreement() {
|
||||||
|
String url = "https://privacy2.kingsome.cn/user_agreement.html";
|
||||||
|
alertWebview(url);
|
||||||
|
}
|
||||||
|
private void alertWebview(String url) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
WebView mwebView = new WebView(this);
|
||||||
|
this.alterShowed = false;
|
||||||
|
mwebView.loadUrl(url);
|
||||||
|
mwebView.setWebViewClient( new WebViewClient() {
|
||||||
|
//设置结束加载函数
|
||||||
|
@Override
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
|
if (!alterShowed) {
|
||||||
|
alterShowed = true;
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
builder.setPositiveButton( "取消", null );
|
||||||
|
builder.setView( mwebView );
|
||||||
|
builder.setPositiveButton("确定", (dialog, which) -> {
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
// builder.setNegativeButton("拒绝", (dialog, which) -> {
|
||||||
|
// //用户不同意隐私协议,不通过,Demo在此处退出游戏,接入方可按自己要求处理,但不能调用MiCommplatform.getInstance().onUserAgreed(this);
|
||||||
|
// dialog.dismiss();
|
||||||
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class WebApi {
|
|||||||
|
|
||||||
public void getVersionInfo(BaseInterface iFace) {
|
public void getVersionInfo(BaseInterface iFace) {
|
||||||
this.mInterface = iFace;
|
this.mInterface = iFace;
|
||||||
// String versionUrl = "http://10.0.1.3:7021/game/zip/version.json";
|
// String versionUrl = "https://test.kingsome.cn/wjtx/config/version_native.json";
|
||||||
String versionUrl = "https://h5games-al.kingsome.cn/wjtx/config/version_native.json";
|
String versionUrl = "https://h5games-al.kingsome.cn/wjtx/config/version_native.json";
|
||||||
AppRequestUtil.getInstance().getRequest(context, versionUrl, new RequestListener() {
|
AppRequestUtil.getInstance().getRequest(context, versionUrl, new RequestListener() {
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 195 KiB |
@ -3,10 +3,11 @@
|
|||||||
<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=7105</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>
|
||||||
<string name="launch_download">正在更新游戏资源</string>
|
<string name="launch_download">正在更新游戏资源</string>
|
||||||
<string name="launch_unzip">正在解压游戏资源</string>
|
<string name="launch_unzip">正在解压游戏资源</string>
|
||||||
|
<string name="app_id">30414659</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
BIN
assets/nearme.apk
Executable file
BIN
assets/nearme.apk
Executable file
Binary file not shown.
BIN
assets/nearme/oppo_game_service_301004.so
Executable file
BIN
assets/nearme/oppo_game_service_301004.so
Executable file
Binary file not shown.
BIN
assets/opay_version
Executable file
BIN
assets/opay_version
Executable file
Binary file not shown.
BIN
key/publish_key
BIN
key/publish_key
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user