游戏详情,游戏设置,H5手柄.
This commit is contained in:
parent
68f414c9f0
commit
60aa2dec6e
|
|
@ -112,6 +112,9 @@ android {
|
||||||
//配置eventbus
|
//配置eventbus
|
||||||
implementation 'org.simple:androideventbus:1.0.5.1'
|
implementation 'org.simple:androideventbus:1.0.5.1'
|
||||||
|
|
||||||
|
//二维码
|
||||||
|
implementation 'com.google.zxing:core:3.3.0'
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -71,7 +72,7 @@
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.zjrx.common.reciver.UsbDeviceReciver"
|
android:name="com.zjrx.common.reciver.UsbDeviceReciver"
|
||||||
android:exported="false">
|
android:exported="true">
|
||||||
|
|
||||||
<intent-filter tools:node="removeAll">
|
<intent-filter tools:node="removeAll">
|
||||||
|
|
||||||
|
|
@ -83,7 +84,7 @@
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.zjrx.common.reciver.BluetoothReciver"
|
android:name="com.zjrx.common.reciver.BluetoothReciver"
|
||||||
android:exported="false">
|
android:exported="true">
|
||||||
|
|
||||||
<intent-filter tools:node="removeAll">
|
<intent-filter tools:node="removeAll">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,58 @@ public class HttpTool {
|
||||||
if (mListener != null && response.body() != null) {
|
if (mListener != null && response.body() != null) {
|
||||||
mListener.onResponse(response.body().string(), response.code(), response.message());
|
mListener.onResponse(response.body().string(), response.code(), response.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void httpGet(String url, final HttpResultListener mListener) {
|
||||||
|
Log.d("httpTool", "url:" + url);
|
||||||
|
|
||||||
|
OkHttpClient httpClient = null;
|
||||||
|
try {
|
||||||
|
TrustManagerFactory trustManagerFactory = null;
|
||||||
|
trustManagerFactory = TrustManagerFactory.getInstance(trustManagerFactory.getDefaultAlgorithm());
|
||||||
|
trustManagerFactory.init((KeyStore) null);
|
||||||
|
TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
|
||||||
|
if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
|
||||||
|
throw new IllegalStateException("Unexpected default trust managers:"
|
||||||
|
+ Arrays.toString(trustManagers));
|
||||||
|
}
|
||||||
|
X509TrustManager trustManager = (X509TrustManager) trustManagers[0];
|
||||||
|
httpClient = new OkHttpClient.Builder()
|
||||||
|
.addInterceptor(new LoggingInterceptor())
|
||||||
|
.sslSocketFactory(createSSLSocketFactory(trustManager), trustManager)
|
||||||
|
.hostnameVerifier(new TrustAllHostnameVerifier())//trust all?信任所有host
|
||||||
|
.build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.d("build okhttpclient error, " + e.getMessage());
|
||||||
|
}
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.header("Authorization", "Bearer " + Config.userToken)
|
||||||
|
.header("Channel", Config.Channel)
|
||||||
|
.header("Platform", Config.Platform)
|
||||||
|
.header("Version", Config.Version)
|
||||||
|
.header("Language", Config.Language)
|
||||||
|
.addHeader("accept", "text/plain")
|
||||||
|
.addHeader("Content-Type", "application/json-patch+json")
|
||||||
|
.url(url)
|
||||||
|
.build();
|
||||||
|
httpClient.newCall(request).enqueue(new Callback() {
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call call, IOException e) {
|
||||||
|
LogUtil.d("httpPost_onFailure=" + e.getMessage());
|
||||||
|
if (mListener != null)
|
||||||
|
mListener.onFailure(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call call, Response response) throws IOException {
|
||||||
|
Log.d("TAG", "onResponse: response.body()==" + response.body());
|
||||||
|
if (mListener != null && response.body() != null) {
|
||||||
|
mListener.onResponse(response.body().string(), response.code(), response.message());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String requestBodyToString(RequestBody requestBody) {
|
private static String requestBodyToString(RequestBody requestBody) {
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,38 @@ public class OpenApiRequest {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游戏设置
|
||||||
|
*
|
||||||
|
* @param mListener 回调
|
||||||
|
*/
|
||||||
|
public void gameSetting(final OnApiRequestListener mListener) {
|
||||||
|
String url = Config.url + "api/PlayGame/GameSetting?gameId=" + Config.gameId;
|
||||||
|
// final Map<String, String> map = new HashMap<>();
|
||||||
|
// map.put("gameId", Config.gameId);
|
||||||
|
// map.put("sign", sign(map, Config.sign_key));
|
||||||
|
// 将HashMap转换为JSONObject
|
||||||
|
// JSONObject jsonObject = new JSONObject(map);
|
||||||
|
//
|
||||||
|
// RequestBody requestBody = RequestBody.create(
|
||||||
|
// MediaType.parse("application/json"), jsonObject.toString());
|
||||||
|
HttpTool.httpGet(url, new HttpResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(String data, int code, String msg) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onResponse(data, code, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception err) {
|
||||||
|
LogUtil.d("err:" + err.getMessage());
|
||||||
|
if (mListener != null)
|
||||||
|
mListener.onFailure(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序加密
|
* 排序加密
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import android.os.Message;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
@ -49,6 +50,17 @@ public class MainActivity extends FlutterActivity {
|
||||||
WhaleCloud.getInstance().isShowLog(true);
|
WhaleCloud.getInstance().isShowLog(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||||
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
|
// 处理按键按下事件
|
||||||
|
int keyCode = event.getKeyCode();
|
||||||
|
// 根据keyCode进行相应处理
|
||||||
|
Log.d(TAG, "dispatchKeyEvent: keyCode==" + keyCode);
|
||||||
|
}
|
||||||
|
return super.dispatchKeyEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
|
|
||||||
|
|
@ -86,16 +86,15 @@ public class PlayGameActivity extends Activity {
|
||||||
private SurfaceView mVideoViewLegacy;
|
private SurfaceView mVideoViewLegacy;
|
||||||
private GameFrameLayOut gameLayout;
|
private GameFrameLayOut gameLayout;
|
||||||
private FrameLayout NetworkKeyboard, NetworkCursor, MNKeyboard;
|
private FrameLayout NetworkKeyboard, NetworkCursor, MNKeyboard;
|
||||||
private ImageView close_set;
|
private ImageView close_set, img_qr;
|
||||||
private MyButton menu_set, Move_show_hide;
|
private MyButton menu_set, Move_show_hide;
|
||||||
private ConstraintLayout menu, seting, custom_button;
|
private ConstraintLayout menu, seting, custom_button;
|
||||||
private Group seting_g1, seting_g2;
|
private Group seting_g1, seting_g2, seting_g3;
|
||||||
private TextView set_control, set_frame, wifi, custom_button_default, custom_button_yg, custom_button_close;
|
private TextView set_control, set_frame, set_GamePad, wifi, custom_button_default, custom_button_yg, custom_button_close;
|
||||||
private MyButton mImageCursor;
|
private MyButton mImageCursor;
|
||||||
/*进度条*/
|
/*进度条*/
|
||||||
private ConstraintLayout loadingCL;
|
private ConstraintLayout loadingCL;
|
||||||
private ImageView loading;
|
private ImageView loading;
|
||||||
|
|
||||||
private LottieAnimationView animationView;
|
private LottieAnimationView animationView;
|
||||||
private ProgressBar progressbar1;
|
private ProgressBar progressbar1;
|
||||||
private TextView fadenum;
|
private TextView fadenum;
|
||||||
|
|
@ -192,6 +191,7 @@ public class PlayGameActivity extends Activity {
|
||||||
private ConstraintLayout conBuy;
|
private ConstraintLayout conBuy;
|
||||||
private ImageView imgVipType;
|
private ImageView imgVipType;
|
||||||
private OpenApiRequest openApiRequest;
|
private OpenApiRequest openApiRequest;
|
||||||
|
private Bitmap qrCodeBitmap;
|
||||||
// private JoinMembershipDialog joinMembershipDialog;
|
// private JoinMembershipDialog joinMembershipDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -215,9 +215,6 @@ public class PlayGameActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
public void oneSecond() {
|
public void oneSecond() {
|
||||||
nounTime++;
|
nounTime++;
|
||||||
/*if (Config.gamePara.is_ShowOSD) {
|
|
||||||
runPingIPprocess(ipString);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private String pingNum = "";
|
private String pingNum = "";
|
||||||
|
|
@ -238,6 +235,43 @@ public class PlayGameActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
openApiRequest = new OpenApiRequest();
|
openApiRequest = new OpenApiRequest();
|
||||||
|
//获取游戏设置
|
||||||
|
openApiRequest.gameSetting(new OnApiRequestListener() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(String data, int code, String msg) {
|
||||||
|
Log.d(TAG, "onResponse: data==" + data);
|
||||||
|
Log.d(TAG, "onResponse: code==" + code);
|
||||||
|
Log.d(TAG, "onResponse: msg==" + msg);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject(data);
|
||||||
|
String jsonData = jsonObject.getString("data");
|
||||||
|
if (jsonData.equals("null")) {
|
||||||
|
Log.d(TAG, "onResponse: 游戏设置数据异常");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.d(TAG, "onResponse: jsonData==" + jsonData);
|
||||||
|
JSONObject heartData = new JSONObject(jsonData);
|
||||||
|
|
||||||
|
String handleQrCode = heartData.getString("handleQrCode");//H5手柄扫码二维码
|
||||||
|
|
||||||
|
Resources res = getResources();
|
||||||
|
Bitmap logoBitmap = BitmapFactory.decodeResource(res, R.mipmap.ic_launcher);
|
||||||
|
|
||||||
|
qrCodeBitmap = AppUtil.createQRCodeBitmap(handleQrCode, 200, 200, "UTF-8", "H", "1", R.color.black, Color.WHITE, logoBitmap, 0.2f);
|
||||||
|
|
||||||
|
Log.d(TAG, "onResponse: data=" + jsonObject);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Exception e) {
|
||||||
|
Log.d(TAG, "onResponse: e==" + e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//隐藏系统按钮
|
//隐藏系统按钮
|
||||||
hideBottomUIMenu();
|
hideBottomUIMenu();
|
||||||
|
|
@ -313,30 +347,18 @@ public class PlayGameActivity extends Activity {
|
||||||
sameTimerTask.cancel();
|
sameTimerTask.cancel();
|
||||||
sameTimerTask = null;
|
sameTimerTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valueAnimator != null) {
|
if (valueAnimator != null) {
|
||||||
valueAnimator.cancel();
|
valueAnimator.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mVideoView != null) {
|
if (mVideoView != null) {
|
||||||
mVideoView.release();
|
mVideoView.release();
|
||||||
mVideoView = null;
|
mVideoView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refresh != null) {
|
if (refresh != null) {
|
||||||
refresh.cancel();
|
refresh.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stopTime();
|
stopTime();
|
||||||
// Glide.with(getApplicationContext()).pauseRequests();
|
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean moveTaskToBack(boolean nonRoot) {
|
|
||||||
return super.moveTaskToBack(nonRoot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -413,15 +435,12 @@ public class PlayGameActivity extends Activity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
//onKeyEvent(keyCode, false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchGenericMotionEvent(MotionEvent event) {
|
public boolean dispatchGenericMotionEvent(MotionEvent event) {
|
||||||
boolean consumed;
|
boolean consumed;
|
||||||
LogUtil.d("...dispatchGenericMotionEvent:" + event);
|
LogUtil.d("...dispatchGenericMotionEvent:" + event);
|
||||||
//onKeyEvent(-999, true);
|
|
||||||
consumed = WhaleCloud.getInstance().dispatchGenericMotionEvent(event);
|
consumed = WhaleCloud.getInstance().dispatchGenericMotionEvent(event);
|
||||||
return consumed;
|
return consumed;
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +460,6 @@ public class PlayGameActivity extends Activity {
|
||||||
|
|
||||||
|
|
||||||
public void startKeyEventSchedule() {
|
public void startKeyEventSchedule() {
|
||||||
|
|
||||||
if (keyEventTimer != null) {
|
if (keyEventTimer != null) {
|
||||||
keyEventTimer.cancel();
|
keyEventTimer.cancel();
|
||||||
keyEventTimer = null;
|
keyEventTimer = null;
|
||||||
|
|
@ -516,12 +534,6 @@ public class PlayGameActivity extends Activity {
|
||||||
custom_button_default = findViewById(R.id.custom_button_default);
|
custom_button_default = findViewById(R.id.custom_button_default);
|
||||||
custom_button = findViewById(R.id.custom_button);
|
custom_button = findViewById(R.id.custom_button);
|
||||||
menu = findViewById(R.id.menu);
|
menu = findViewById(R.id.menu);
|
||||||
// menu_setting = findViewById(R.id.menu_setting);
|
|
||||||
// menu_exit = findViewById(R.id.menu_exit);
|
|
||||||
// menu_yincanganjian = findViewById(R.id.menu_yincanganjian);
|
|
||||||
// menu_huamianshezhi = findViewById(R.id.menu_huamianshezhi);
|
|
||||||
// menu_keyboard = findViewById(R.id.menu_keyboard);
|
|
||||||
// menu_return = findViewById(R.id.menu_return);
|
|
||||||
|
|
||||||
loadingCL = findViewById(R.id.loadingCL);
|
loadingCL = findViewById(R.id.loadingCL);
|
||||||
loading = findViewById(R.id.loading);
|
loading = findViewById(R.id.loading);
|
||||||
|
|
@ -548,23 +560,14 @@ public class PlayGameActivity extends Activity {
|
||||||
conDiamond = findViewById(R.id.con_diamonds);
|
conDiamond = findViewById(R.id.con_diamonds);
|
||||||
tvCountDown = findViewById(R.id.tv_count_down);
|
tvCountDown = findViewById(R.id.tv_count_down);
|
||||||
btRecharge = findViewById(R.id.bt_recharge);
|
btRecharge = findViewById(R.id.bt_recharge);
|
||||||
// imgShowHide = findViewById(R.id.img_show_hide);
|
|
||||||
|
|
||||||
// imgShowHide.setImageResource(R.mipmap.btn_shang);
|
|
||||||
|
|
||||||
imgKeySet = findViewById(R.id.img_key_set);
|
imgKeySet = findViewById(R.id.img_key_set);
|
||||||
imgSwitchKey = findViewById(R.id.img_switch_key);
|
imgSwitchKey = findViewById(R.id.img_switch_key);
|
||||||
imgSwitchRightRocker = findViewById(R.id.img_switch_right_rocker);
|
imgSwitchRightRocker = findViewById(R.id.img_switch_right_rocker);
|
||||||
imgSwitchKeyboard = findViewById(R.id.img_switch_keyboard);
|
imgSwitchKeyboard = findViewById(R.id.img_switch_keyboard);
|
||||||
imgSwitchShock = findViewById(R.id.img_switch_shock);
|
imgSwitchShock = findViewById(R.id.img_switch_shock);
|
||||||
// tvVipType = findViewById(R.id.tv_vip_type);
|
|
||||||
// tvDiamanteNum = findViewById(R.id.tv_diamante_num);
|
|
||||||
tvExitGame = findViewById(R.id.tv_exit_game);
|
tvExitGame = findViewById(R.id.tv_exit_game);
|
||||||
tvReturnApp = findViewById(R.id.tv_return_app);
|
tvReturnApp = findViewById(R.id.tv_return_app);
|
||||||
// conBuy = findViewById(R.id.con_buy);
|
|
||||||
// imgVipType = findViewById(R.id.img_vip_type);
|
|
||||||
|
|
||||||
|
|
||||||
tvReturnApp.setOnClickListener(view -> {
|
tvReturnApp.setOnClickListener(view -> {
|
||||||
if (menu != null) {
|
if (menu != null) {
|
||||||
menu.setVisibility(View.GONE);
|
menu.setVisibility(View.GONE);
|
||||||
|
|
@ -572,7 +575,7 @@ public class PlayGameActivity extends Activity {
|
||||||
returnAppMain();
|
returnAppMain();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//退出游戏按钮
|
||||||
tvExitGame.setOnClickListener(view -> {
|
tvExitGame.setOnClickListener(view -> {
|
||||||
if (menu != null) {
|
if (menu != null) {
|
||||||
menu.setVisibility(View.GONE);
|
menu.setVisibility(View.GONE);
|
||||||
|
|
@ -593,10 +596,8 @@ public class PlayGameActivity extends Activity {
|
||||||
// returnAppMain();
|
// returnAppMain();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
imgSwitchShock.setOnClickListener(view -> {
|
imgSwitchShock.setOnClickListener(view -> {
|
||||||
isShock = !isShock;
|
isShock = !isShock;
|
||||||
if (isShock) {
|
if (isShock) {
|
||||||
|
|
@ -680,25 +681,6 @@ public class PlayGameActivity extends Activity {
|
||||||
CustomButton(s_keyboard);
|
CustomButton(s_keyboard);
|
||||||
});
|
});
|
||||||
|
|
||||||
// imgShowHide.setOnClickListener(v -> {
|
|
||||||
// isShow = !isShow;
|
|
||||||
// if (isShow) {
|
|
||||||
// conDiamond.setVisibility(View.GONE);
|
|
||||||
// imgShowHide.setImageResource(R.mipmap.btn_xia);
|
|
||||||
// } else {
|
|
||||||
// conDiamond.setVisibility(View.VISIBLE);
|
|
||||||
// imgShowHide.setImageResource(R.mipmap.btn_shang);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// btRecharge.setOnClickListener(new View.OnClickListener() {
|
|
||||||
// @Override
|
|
||||||
// public void onClick(View v) {
|
|
||||||
// showbuyDialog();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
//判断屏幕大小
|
//判断屏幕大小
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
getWindowManager().getDefaultDisplay().getMetrics(dm);//display = getWindowManager().getDefaultDisplay();display.getMetrics(dm)(把屏幕尺寸信息赋值给DisplayMetrics dm);
|
getWindowManager().getDefaultDisplay().getMetrics(dm);//display = getWindowManager().getDefaultDisplay();display.getMetrics(dm)(把屏幕尺寸信息赋值给DisplayMetrics dm);
|
||||||
|
|
@ -931,14 +913,6 @@ public class PlayGameActivity extends Activity {
|
||||||
menu_set.setOnClickCallBackListener(new MyButton.OnClickCallBackListener() {
|
menu_set.setOnClickCallBackListener(new MyButton.OnClickCallBackListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onActionDown() {
|
public void onActionDown() {
|
||||||
// if (menu.getVisibility() == View.GONE) {
|
|
||||||
// menu.setVisibility(View.VISIBLE);
|
|
||||||
// wifi.setVisibility(View.VISIBLE);
|
|
||||||
// } else {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// wifi.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
seting.setVisibility(View.VISIBLE);
|
seting.setVisibility(View.VISIBLE);
|
||||||
if (keyboardUtil != null) {
|
if (keyboardUtil != null) {
|
||||||
textInput = keyboardUtil.isShow;
|
textInput = keyboardUtil.isShow;
|
||||||
|
|
@ -969,18 +943,11 @@ public class PlayGameActivity extends Activity {
|
||||||
}
|
}
|
||||||
Move_show_hide.setBackgroundResource(R.mipmap.ic_key_hide);
|
Move_show_hide.setBackgroundResource(R.mipmap.ic_key_hide);
|
||||||
imgSwitchKey.setImageResource(R.mipmap.switch_open);
|
imgSwitchKey.setImageResource(R.mipmap.switch_open);
|
||||||
// if (menu_yincanganjian != null) {
|
|
||||||
// menu_yincanganjian.setImageResource(R.mipmap.btn_yincanganjian);
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (HandleCL != null) {
|
if (HandleCL != null) {
|
||||||
HandleCL.setVisibility(View.GONE);
|
HandleCL.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
Move_show_hide.setBackgroundResource(R.mipmap.ic_key_show);
|
Move_show_hide.setBackgroundResource(R.mipmap.ic_key_show);
|
||||||
// if (menu_yincanganjian != null) {
|
|
||||||
// menu_yincanganjian.setImageResource(R.mipmap.btn_anjianxinashi);
|
|
||||||
// }
|
|
||||||
imgSwitchKey.setImageResource(R.mipmap.switch_close);
|
imgSwitchKey.setImageResource(R.mipmap.switch_close);
|
||||||
}
|
}
|
||||||
Config.is_immersion = !Config.is_immersion;
|
Config.is_immersion = !Config.is_immersion;
|
||||||
|
|
@ -1000,103 +967,6 @@ public class PlayGameActivity extends Activity {
|
||||||
});
|
});
|
||||||
menu.setOnClickListener(v -> {
|
menu.setOnClickListener(v -> {
|
||||||
});
|
});
|
||||||
// menu_exit.setOnClickListener(v -> {
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// showDialog("退出游戏", "确定退出游戏吗?", "退出游戏", "返回至APP", new IDialogTwoView() {
|
|
||||||
// @Override
|
|
||||||
// public void cancel() {
|
|
||||||
// hideBottomUIMenu();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onSure() {
|
|
||||||
// closeGame();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void returnApp() {
|
|
||||||
// returnAppMain();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// menu_setting.setOnClickListener(v -> {
|
|
||||||
// seting.setVisibility(View.VISIBLE);
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// selectSet(0);
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// menu_huamianshezhi.setOnClickListener(v -> {
|
|
||||||
// seting.setVisibility(View.VISIBLE);
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// selectSet(1);
|
|
||||||
// });
|
|
||||||
// menu_yincanganjian.setOnClickListener(v -> {
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// //显示隐藏键盘
|
|
||||||
// if (Config.is_immersion) {
|
|
||||||
//
|
|
||||||
// if (Move_show_hide != null) {
|
|
||||||
// Move_show_hide.setBackgroundResource(R.mipmap.yingcang);
|
|
||||||
// Move_show_hide.setText("按键隐藏");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (Ismode == 1) {
|
|
||||||
// if (HandleCL != null) {
|
|
||||||
// HandleCL.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
// } else if (Ismode == 2) {
|
|
||||||
// NetworkKeyboard.setVisibility(View.VISIBLE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (menu_yincanganjian != null) {
|
|
||||||
// menu_yincanganjian.setImageResource(R.mipmap.btn_yincanganjian);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// if (Ismode == 1) {
|
|
||||||
// if (HandleCL != null && select != null) {
|
|
||||||
// HandleCL.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// } else if (Ismode == 2) {
|
|
||||||
// NetworkKeyboard.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (Move_show_hide != null) {
|
|
||||||
// Move_show_hide.setBackgroundResource(R.mipmap.xianshi);
|
|
||||||
// Move_show_hide.setText("按键显示");
|
|
||||||
// }
|
|
||||||
// if (menu_yincanganjian != null) {
|
|
||||||
// menu_yincanganjian.setImageResource(R.mipmap.btn_anjianxinashi);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Config.is_immersion = !Config.is_immersion;
|
|
||||||
// });
|
|
||||||
// menu_keyboard.setOnClickListener(v -> {
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
// showKeyboard = true;
|
|
||||||
// new KeyboardUtil(PlayGameActivity.this, this).showKeyboard();
|
|
||||||
// });
|
|
||||||
// menu_return.setOnClickListener(v -> {
|
|
||||||
// if (menu != null) {
|
|
||||||
// menu.setVisibility(View.GONE);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// returnAppMain();
|
|
||||||
// //App.getInstance().push(map);
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (WhaleCloud.getInstance().isLegcyView()) {
|
if (WhaleCloud.getInstance().isLegcyView()) {
|
||||||
mVideoViewLegacy = findViewById(R.id.video_render_legacy);
|
mVideoViewLegacy = findViewById(R.id.video_render_legacy);
|
||||||
|
|
@ -1189,13 +1059,22 @@ public class PlayGameActivity extends Activity {
|
||||||
private void initSetView() {
|
private void initSetView() {
|
||||||
seting_g1 = findViewById(R.id.seting_g1);
|
seting_g1 = findViewById(R.id.seting_g1);
|
||||||
seting_g2 = findViewById(R.id.seting_g2);
|
seting_g2 = findViewById(R.id.seting_g2);
|
||||||
|
seting_g3 = findViewById(R.id.seting_g3);
|
||||||
set_control = findViewById(R.id.set_control);
|
set_control = findViewById(R.id.set_control);
|
||||||
set_frame = findViewById(R.id.set_frame);
|
set_frame = findViewById(R.id.set_frame);
|
||||||
|
set_GamePad = findViewById(R.id.set_GamePad);
|
||||||
custom_button = findViewById(R.id.custom_button);
|
custom_button = findViewById(R.id.custom_button);
|
||||||
|
img_qr = findViewById(R.id.img_qr);
|
||||||
|
|
||||||
|
img_qr.setImageBitmap(qrCodeBitmap);
|
||||||
|
|
||||||
set_control.setOnClickListener(v -> {
|
set_control.setOnClickListener(v -> {
|
||||||
selectSet(0);
|
selectSet(0);
|
||||||
});
|
});
|
||||||
set_frame.setOnClickListener(v -> {
|
set_frame.setOnClickListener(v -> {
|
||||||
|
selectSet(1);
|
||||||
|
});
|
||||||
|
set_GamePad.setOnClickListener(v -> {
|
||||||
selectSet(2);
|
selectSet(2);
|
||||||
});
|
});
|
||||||
custom_button_close.setOnClickListener(v -> {
|
custom_button_close.setOnClickListener(v -> {
|
||||||
|
|
@ -1228,46 +1107,70 @@ public class PlayGameActivity extends Activity {
|
||||||
|
|
||||||
//0控制 1画面
|
//0控制 1画面
|
||||||
private void selectSet(int type) {
|
private void selectSet(int type) {
|
||||||
if (type == 0) {
|
|
||||||
if (seting_g1 != null) {
|
|
||||||
seting_g1.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
if (seting_g2 != null) {
|
|
||||||
seting_g2.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
if (set_control != null) {
|
|
||||||
set_control.setBackgroundResource(R.drawable.shape_set_item_bg);
|
|
||||||
}
|
|
||||||
if (set_frame != null) {
|
|
||||||
set_frame.setBackgroundResource(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (type == 1) {
|
switch (type) {
|
||||||
if (seting_g1 != null) {
|
case 0:
|
||||||
seting_g1.setVisibility(View.GONE);
|
if (seting_g1 != null) {
|
||||||
}
|
seting_g1.setVisibility(View.GONE);
|
||||||
if (seting_g2 != null) {
|
}
|
||||||
seting_g2.setVisibility(View.GONE);
|
if (seting_g2 != null) {
|
||||||
}
|
seting_g2.setVisibility(View.VISIBLE);
|
||||||
if (set_control != null) {
|
}
|
||||||
set_control.setBackgroundResource(0);
|
if (seting_g3 != null) {
|
||||||
}
|
seting_g3.setVisibility(View.GONE);
|
||||||
if (set_frame != null) {
|
}
|
||||||
set_frame.setBackgroundResource(0);
|
if (set_control != null) {
|
||||||
}
|
set_control.setBackgroundResource(R.drawable.shape_set_item_bg);
|
||||||
} else {
|
}
|
||||||
if (seting_g1 != null) {
|
if (set_frame != null) {
|
||||||
seting_g1.setVisibility(View.VISIBLE);
|
set_frame.setBackgroundResource(0);
|
||||||
}
|
}
|
||||||
if (seting_g2 != null) {
|
if (set_GamePad != null) {
|
||||||
seting_g2.setVisibility(View.GONE);
|
set_GamePad.setBackgroundResource(0);
|
||||||
}
|
}
|
||||||
if (set_frame != null) {
|
break;
|
||||||
set_frame.setBackgroundResource(R.drawable.shape_set_item_bg);
|
|
||||||
}
|
case 1:
|
||||||
if (set_frame != null) {
|
if (seting_g1 != null) {
|
||||||
set_control.setBackgroundResource(0);
|
seting_g1.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
if (seting_g2 != null) {
|
||||||
|
seting_g2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (seting_g3 != null) {
|
||||||
|
seting_g3.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (set_control != null) {
|
||||||
|
set_control.setBackgroundResource(0);
|
||||||
|
}
|
||||||
|
if (set_frame != null) {
|
||||||
|
set_frame.setBackgroundResource(R.drawable.shape_set_item_bg);
|
||||||
|
}
|
||||||
|
if (set_GamePad != null) {
|
||||||
|
set_GamePad.setBackgroundResource(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if (seting_g1 != null) {
|
||||||
|
seting_g1.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (seting_g2 != null) {
|
||||||
|
seting_g2.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
if (seting_g3 != null) {
|
||||||
|
seting_g3.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (set_control != null) {
|
||||||
|
set_control.setBackgroundResource(0);
|
||||||
|
}
|
||||||
|
if (set_frame != null) {
|
||||||
|
set_frame.setBackgroundResource(0);
|
||||||
|
}
|
||||||
|
if (set_GamePad != null) {
|
||||||
|
set_GamePad.setBackgroundResource(R.drawable.shape_set_item_bg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Canvas;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
@ -19,6 +21,7 @@ import android.net.wifi.WifiManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
@ -30,6 +33,12 @@ import androidx.annotation.RequiresApi;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.google.zxing.EncodeHintType;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
|
import com.google.zxing.common.BitMatrix;
|
||||||
|
import com.google.zxing.qrcode.QRCodeWriter;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
@ -41,6 +50,7 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
@ -54,6 +64,119 @@ import co.steamcloud.game.App;
|
||||||
*/
|
*/
|
||||||
public class AppUtil {
|
public class AppUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param content 字符串内容
|
||||||
|
* @param width 二维码宽度
|
||||||
|
* @param height 二维码高度
|
||||||
|
* @param character_set 编码方式(一般使用UTF-8)
|
||||||
|
* @param error_correction_level 容错率 L:7% M:15% Q:25% H:35%
|
||||||
|
* @param margin 空白边距(二维码与边框的空白区域)
|
||||||
|
* @param color_black 黑色色块
|
||||||
|
* @param color_white 白色色块
|
||||||
|
* @param logoBitmap logo图片
|
||||||
|
* @param logoPercent logo所占百分比
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Bitmap createQRCodeBitmap(String content, int width, int height, String character_set,
|
||||||
|
String error_correction_level,String margin, int color_black,
|
||||||
|
int color_white,Bitmap logoBitmap, float logoPercent) {
|
||||||
|
// 字符串内容判空
|
||||||
|
if (TextUtils.isEmpty(content)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// 宽和高>=0
|
||||||
|
if (width < 0 || height < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
/** 1.设置二维码相关配置,生成BitMatrix(位矩阵)对象 */
|
||||||
|
Hashtable<EncodeHintType, String> hints = new Hashtable<>();
|
||||||
|
// 字符转码格式设置
|
||||||
|
if (!TextUtils.isEmpty(character_set)) {
|
||||||
|
hints.put(EncodeHintType.CHARACTER_SET, character_set);
|
||||||
|
}
|
||||||
|
// 容错率设置
|
||||||
|
if (!TextUtils.isEmpty(error_correction_level)) {
|
||||||
|
hints.put(EncodeHintType.ERROR_CORRECTION, error_correction_level);
|
||||||
|
}
|
||||||
|
// 空白边距设置
|
||||||
|
if (!TextUtils.isEmpty(margin)) {
|
||||||
|
hints.put(EncodeHintType.MARGIN, margin);
|
||||||
|
}
|
||||||
|
/** 2.将配置参数传入到QRCodeWriter的encode方法生成BitMatrix(位矩阵)对象 */
|
||||||
|
BitMatrix bitMatrix = new QRCodeWriter().encode(content, BarcodeFormat.QR_CODE, width, height, hints);
|
||||||
|
|
||||||
|
/** 3.创建像素数组,并根据BitMatrix(位矩阵)对象为数组元素赋颜色值 */
|
||||||
|
int[] pixels = new int[width * height];
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
//bitMatrix.get(x,y)方法返回true是黑色色块,false是白色色块
|
||||||
|
if (bitMatrix.get(x, y)) {
|
||||||
|
pixels[y * width + x] = color_black;//黑色色块像素设置
|
||||||
|
} else {
|
||||||
|
pixels[y * width + x] = color_white;// 白色色块像素设置
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 4.创建Bitmap对象,根据像素数组设置Bitmap每个像素点的颜色值,并返回Bitmap对象 */
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
|
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
|
||||||
|
|
||||||
|
/** 5.为二维码添加logo图标 */
|
||||||
|
if(logoBitmap != null){
|
||||||
|
return addLogo(bitmap, logoBitmap, logoPercent);
|
||||||
|
}
|
||||||
|
return bitmap;
|
||||||
|
} catch (WriterException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向二维码中间添加logo图片(图片合成)
|
||||||
|
*
|
||||||
|
* @param srcBitmap 原图片(生成的简单二维码图片)
|
||||||
|
* @param logoBitmap logo图片
|
||||||
|
* @param logoPercent 百分比 (用于调整logo图片在原图片中的显示大小, 取值范围[0,1] )
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static Bitmap addLogo(Bitmap srcBitmap, Bitmap logoBitmap, float logoPercent) {
|
||||||
|
if (srcBitmap == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (logoBitmap == null) {
|
||||||
|
return srcBitmap;
|
||||||
|
}
|
||||||
|
//传值不合法时使用0.2F
|
||||||
|
if (logoPercent < 0F || logoPercent > 1F) {
|
||||||
|
logoPercent = 0.2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 1. 获取原图片和Logo图片各自的宽、高值 */
|
||||||
|
int srcWidth = srcBitmap.getWidth();
|
||||||
|
int srcHeight = srcBitmap.getHeight();
|
||||||
|
int logoWidth = logoBitmap.getWidth();
|
||||||
|
int logoHeight = logoBitmap.getHeight();
|
||||||
|
|
||||||
|
/** 2. 计算画布缩放的宽高比 */
|
||||||
|
float scaleWidth = srcWidth * logoPercent / logoWidth;
|
||||||
|
float scaleHeight = srcHeight * logoPercent / logoHeight;
|
||||||
|
|
||||||
|
/** 3. 使用Canvas绘制,合成图片 */
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(srcWidth, srcHeight, Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
canvas.drawBitmap(srcBitmap, 0, 0, null);
|
||||||
|
canvas.scale(scaleWidth, scaleHeight, srcWidth / 2, srcHeight / 2);
|
||||||
|
canvas.drawBitmap(logoBitmap, srcWidth / 2 - logoWidth / 2, srcHeight / 2 - logoHeight / 2, null);
|
||||||
|
|
||||||
|
return bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean checkURL(String url) {
|
public static boolean checkURL(String url) {
|
||||||
boolean value = false;
|
boolean value = false;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,18 @@
|
||||||
app:layout_constraintLeft_toRightOf="@id/view_line"
|
app:layout_constraintLeft_toRightOf="@id/view_line"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/set_control" />
|
app:layout_constraintTop_toBottomOf="@+id/set_control" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/set_GamePad"
|
||||||
|
android:layout_width="83dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="手柄"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="18sp"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/view_line"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/set_frame" />
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_exit_game"
|
android:id="@+id/tv_exit_game"
|
||||||
|
|
@ -115,9 +127,16 @@
|
||||||
android:id="@+id/seting_g2"
|
android:id="@+id/seting_g2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="visible"
|
android:visibility="gone"
|
||||||
app:constraint_referenced_ids="scr_g2" />
|
app:constraint_referenced_ids="scr_g2" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Group
|
||||||
|
android:id="@+id/seting_g3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:constraint_referenced_ids="scr_g3" />
|
||||||
|
|
||||||
<!--g1-->
|
<!--g1-->
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/src_g1"
|
android:id="@+id/src_g1"
|
||||||
|
|
@ -547,6 +566,47 @@
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
<!--g3-->
|
||||||
|
<ScrollView
|
||||||
|
android:id="@+id/scr_g3"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="105dp"
|
||||||
|
android:layout_marginTop="60dp"
|
||||||
|
android:scrollbars="none"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="40dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_game_pad"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="模拟手柄"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="20dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img_qr"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="200dp"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_game_pad" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/wifi"
|
android:id="@+id/wifi"
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB |
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<color name="color_25282c">#25282c</color>
|
<color name="color_25282c">#25282c</color>
|
||||||
<color name="color_303237">#303237</color>
|
<color name="color_303237">#303237</color>
|
||||||
<color name="white">#ffffff</color>
|
<color name="white">#FFFFFF</color>
|
||||||
<color name="divide">#dddddd</color>
|
<color name="divide">#dddddd</color>
|
||||||
<color name="dialog_blue">#0094FE</color>
|
<color name="dialog_blue">#0094FE</color>
|
||||||
<color name="dialog_gray">#E3E3E3</color>
|
<color name="dialog_gray">#E3E3E3</color>
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,9 @@ class GameInfoBean {
|
||||||
String? gameIntroduce;
|
String? gameIntroduce;
|
||||||
String? gameShare;
|
String? gameShare;
|
||||||
String? gameShareUserIcon;
|
String? gameShareUserIcon;
|
||||||
bool? isCollect;
|
|
||||||
|
|
||||||
GameInfoBean(this.gameId, this.gameName, this.subtitle, this.gameDetailsofCharges, this.gameIcon, this.gameBg, this.gameTags, this.score,
|
GameInfoBean(this.gameId, this.gameName, this.subtitle, this.gameDetailsofCharges, this.gameIcon, this.gameBg, this.gameTags, this.score,
|
||||||
this.gameLoadTime, this.gameIntroduce, this.gameShare, this.gameShareUserIcon,this.isCollect);
|
this.gameLoadTime, this.gameIntroduce, this.gameShare, this.gameShareUserIcon);
|
||||||
|
|
||||||
factory GameInfoBean.fromJson(Map<String, dynamic> json) => _$GameInfoBeanFromJson(json);
|
factory GameInfoBean.fromJson(Map<String, dynamic> json) => _$GameInfoBeanFromJson(json);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ GameInfoBean _$GameInfoBeanFromJson(Map<String, dynamic> json) => GameInfoBean(
|
||||||
json['gameIntroduce'] as String?,
|
json['gameIntroduce'] as String?,
|
||||||
json['gameShare'] as String?,
|
json['gameShare'] as String?,
|
||||||
json['gameShareUserIcon'] as String?,
|
json['gameShareUserIcon'] as String?,
|
||||||
json['isCollect'] as bool?,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$GameInfoBeanToJson(GameInfoBean instance) =>
|
Map<String, dynamic> _$GameInfoBeanToJson(GameInfoBean instance) =>
|
||||||
|
|
@ -38,5 +37,4 @@ Map<String, dynamic> _$GameInfoBeanToJson(GameInfoBean instance) =>
|
||||||
'gameIntroduce': instance.gameIntroduce,
|
'gameIntroduce': instance.gameIntroduce,
|
||||||
'gameShare': instance.gameShare,
|
'gameShare': instance.gameShare,
|
||||||
'gameShareUserIcon': instance.gameShareUserIcon,
|
'gameShareUserIcon': instance.gameShareUserIcon,
|
||||||
'isCollect': instance.isCollect,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
15
lib/beans/game_user_info_bean.dart
Normal file
15
lib/beans/game_user_info_bean.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
|
|
||||||
|
part 'game_user_info_bean.g.dart';
|
||||||
|
|
||||||
|
///
|
||||||
|
@JsonSerializable(explicitToJson: true)
|
||||||
|
class GameUserInfoBean {
|
||||||
|
bool? isCollect;
|
||||||
|
|
||||||
|
GameUserInfoBean(this.isCollect);
|
||||||
|
|
||||||
|
factory GameUserInfoBean.fromJson(Map<String, dynamic> json) => _$GameUserInfoBeanFromJson(json);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => _$GameUserInfoBeanToJson(this);
|
||||||
|
}
|
||||||
17
lib/beans/game_user_info_bean.g.dart
Normal file
17
lib/beans/game_user_info_bean.g.dart
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'game_user_info_bean.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
GameUserInfoBean _$GameUserInfoBeanFromJson(Map<String, dynamic> json) =>
|
||||||
|
GameUserInfoBean(
|
||||||
|
json['isCollect'] as bool?,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GameUserInfoBeanToJson(GameUserInfoBean instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'isCollect': instance.isCollect,
|
||||||
|
};
|
||||||
|
|
@ -18,11 +18,14 @@ UserInfoBean _$UserInfoBeanFromJson(Map<String, dynamic> json) => UserInfoBean(
|
||||||
json['isJuveniles'] as bool?,
|
json['isJuveniles'] as bool?,
|
||||||
json['userName'] as String?,
|
json['userName'] as String?,
|
||||||
json['idCard'] as String?,
|
json['idCard'] as String?,
|
||||||
json['nightCard'] == null ? null : NightCardBean.fromJson(json['nightCard'] as Map<String, dynamic>),
|
json['nightCard'] == null
|
||||||
|
? null
|
||||||
|
: NightCardBean.fromJson(json['nightCard'] as Map<String, dynamic>),
|
||||||
(json['userPlayGameTime'] as num?)?.toInt(),
|
(json['userPlayGameTime'] as num?)?.toInt(),
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$UserInfoBeanToJson(UserInfoBean instance) => <String, dynamic>{
|
Map<String, dynamic> _$UserInfoBeanToJson(UserInfoBean instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
'nickName': instance.nickName,
|
'nickName': instance.nickName,
|
||||||
'userId': instance.userId,
|
'userId': instance.userId,
|
||||||
'phoneNum': instance.phoneNum,
|
'phoneNum': instance.phoneNum,
|
||||||
|
|
|
||||||
|
|
@ -114,4 +114,6 @@ class NetworkConfig {
|
||||||
|
|
||||||
static const String accountLogOff = "api/Account/AccountLogOff"; //注销账号
|
static const String accountLogOff = "api/Account/AccountLogOff"; //注销账号
|
||||||
|
|
||||||
|
static const String getGameUserInfo = "api/Game/GetGameUserInfo"; //获取用户游戏详情数据
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import 'package:game/network/NetworkConfig.dart';
|
||||||
|
|
||||||
import '../../beans/game_info_bean.dart';
|
import '../../beans/game_info_bean.dart';
|
||||||
import '../../beans/game_info_recommend_bean.dart';
|
import '../../beans/game_info_recommend_bean.dart';
|
||||||
|
import '../../beans/game_user_info_bean.dart';
|
||||||
import '../../common/EventBusUtil.dart';
|
import '../../common/EventBusUtil.dart';
|
||||||
import '../../common/func.dart';
|
import '../../common/func.dart';
|
||||||
import 'game_model.dart';
|
import 'game_model.dart';
|
||||||
|
|
@ -29,6 +30,7 @@ class _GameInfoPageState extends State<GameInfoPage> {
|
||||||
late GameInfoBean gameData;
|
late GameInfoBean gameData;
|
||||||
bool _isInitialized = false;
|
bool _isInitialized = false;
|
||||||
bool isCollect = false;
|
bool isCollect = false;
|
||||||
|
late GameUserInfoBean gameUserInfoBean;
|
||||||
|
|
||||||
List<GameInfoRecommendBean> infoRecommendList = [];
|
List<GameInfoRecommendBean> infoRecommendList = [];
|
||||||
|
|
||||||
|
|
@ -43,7 +45,6 @@ class _GameInfoPageState extends State<GameInfoPage> {
|
||||||
case "getGameInfo":
|
case "getGameInfo":
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
gameData = event['data'];
|
gameData = event['data'];
|
||||||
isCollect = gameData.isCollect!;
|
|
||||||
_isInitialized = true;
|
_isInitialized = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -54,6 +55,11 @@ class _GameInfoPageState extends State<GameInfoPage> {
|
||||||
case "gameCollect":
|
case "gameCollect":
|
||||||
isCollect = event['data'];
|
isCollect = event['data'];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "getGameUserInfo":
|
||||||
|
gameUserInfoBean = event['data'];
|
||||||
|
isCollect = gameUserInfoBean.isCollect!;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
@ -63,6 +69,7 @@ class _GameInfoPageState extends State<GameInfoPage> {
|
||||||
FunctionUtil.loading();
|
FunctionUtil.loading();
|
||||||
_viewModel.getGameInfo(widget.gameId);
|
_viewModel.getGameInfo(widget.gameId);
|
||||||
_viewModel.gameRecommendations(widget.gameId);
|
_viewModel.gameRecommendations(widget.gameId);
|
||||||
|
_viewModel.getGameUserInfo(widget.gameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
///开始游戏
|
///开始游戏
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import '../../beans/game_info_recommend_bean.dart';
|
||||||
import '../../beans/game_list_bean.dart';
|
import '../../beans/game_list_bean.dart';
|
||||||
import '../../beans/game_play_time_bean.dart';
|
import '../../beans/game_play_time_bean.dart';
|
||||||
import '../../beans/game_type_bean.dart';
|
import '../../beans/game_type_bean.dart';
|
||||||
|
import '../../beans/game_user_info_bean.dart';
|
||||||
import '../../network/BaseEntity.dart';
|
import '../../network/BaseEntity.dart';
|
||||||
import '../../network/NetworkConfig.dart';
|
import '../../network/NetworkConfig.dart';
|
||||||
import '../../network/RequestCenter.dart';
|
import '../../network/RequestCenter.dart';
|
||||||
|
|
@ -151,4 +152,26 @@ class GameModel {
|
||||||
print("errorEntity==${errorEntity.message}");
|
print("errorEntity==${errorEntity.message}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///获取用户游戏详情数据
|
||||||
|
Future<void> getGameUserInfo(gameId) async {
|
||||||
|
RequestCenter.instance.requestGet(NetworkConfig.getGameUserInfo, {"gameId": gameId}, (BaseEntity dataEntity) {
|
||||||
|
if (dataEntity.code == 0) {
|
||||||
|
|
||||||
|
GameUserInfoBean gameUserInfoBean = GameUserInfoBean.fromJson(dataEntity.data);
|
||||||
|
|
||||||
|
streamController.sink.add({
|
||||||
|
'code': "getGameUserInfo", //有数据
|
||||||
|
'data': gameUserInfoBean
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
streamController.sink.add({
|
||||||
|
'code': "-1", //有数据
|
||||||
|
'data': dataEntity.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, (ErrorEntity errorEntity) {
|
||||||
|
print("errorEntity==${errorEntity.message}");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ class _MyPageState extends State<MyPage> with AutomaticKeepAliveClientMixin {
|
||||||
left: l23,
|
left: l23,
|
||||||
top: t22,
|
top: t22,
|
||||||
child: Text(
|
child: Text(
|
||||||
"我的游戏时长",
|
"已游玩时长",
|
||||||
style: TextStyle(fontSize: l11, color: Color(0xFFE2F3FF)),
|
style: TextStyle(fontSize: l11, color: Color(0xFFE2F3FF)),
|
||||||
)),
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user