Merge branch 'master' into dev_6.5.5_语聊
# Conflicts: # Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java # Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java # app/proguard-rules.pro # app/src/main/AndroidManifest.xml # build.gradle # common/build.gradle # common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java # common/src/main/java/com/yunbao/common/utils/ToastUtil.java # common/src/main/java/com/yunbao/common/utils/WordUtil.java # config.gradle
This commit is contained in:
@@ -198,6 +198,16 @@ dependencies {
|
||||
api 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.1.11'
|
||||
//自定义圆角图片
|
||||
api 'com.makeramen:roundedimageview:2.3.0'
|
||||
// 友盟统计SDK
|
||||
api 'com.umeng.umsdk:common:9.6.3'// 必选
|
||||
api 'com.umeng.umsdk:asms:1.8.0'// 必选
|
||||
api 'com.umeng.umsdk:uyumao:1.1.2'
|
||||
//高级运营分析功能依赖库,使用卸载分析、开启反作弊能力请务必集成,以免影响高级功能使用。common需搭配v9.6.3及以上版本,asms需搭配v1.7.0及以上版本。需更新隐私声明。
|
||||
// 标准版本SudMGP SDK
|
||||
api 'tech.sud.mgp:SudMGP:1.3.3.1158'
|
||||
|
||||
// 多语言语音识别扩展库(可选)
|
||||
api 'tech.sud.mgp:SudASR:1.3.3.1158'
|
||||
api 'com.google.android.gms:play-services-auth:15.0.0'
|
||||
api 'com.google.android.material:material:1.4.0'
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.yunbao.common">
|
||||
|
||||
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.READ_PHONE_STATE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.INTERNET" />-->
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-->
|
||||
|
||||
<application android:allowBackup="true">
|
||||
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="com.google.ar.core"-->
|
||||
<!-- android:value="optional" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="com.google.ar.core"-->
|
||||
<!-- android:value="optional" />-->
|
||||
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.WebViewActivity"
|
||||
@@ -24,23 +23,23 @@
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<!--
|
||||
|
||||
支付宝
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5PayActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"></activity>
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5AuthActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"></activity>
|
||||
支付宝 end
|
||||
-->
|
||||
支付宝
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5PayActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation|screenSize"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"></activity>
|
||||
<activity
|
||||
android:name="com.alipay.sdk.app.H5AuthActivity"
|
||||
android:configChanges="orientation|keyboardHidden|navigation"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden"></activity>
|
||||
支付宝 end
|
||||
-->
|
||||
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.ErrorActivity"
|
||||
@@ -49,6 +48,9 @@
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.SelectImageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.SudGameActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.yunbao.common.activity.PreviewImageActivity"
|
||||
|
||||
@@ -188,8 +188,15 @@ public class CommonAppConfig {
|
||||
}
|
||||
}
|
||||
|
||||
private String[][] liveType = null;
|
||||
|
||||
public String[][] getLiveType() {
|
||||
return liveType;
|
||||
}
|
||||
|
||||
public void setConfig(ConfigBean config) {
|
||||
mConfig = config;
|
||||
liveType = config.getLiveType();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,9 +56,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
//设置新加坡融云服务器 有时候国内收不到推送是因为这个
|
||||
RongIMClient.setServerInfo("navsg01.cn.ronghub.com", null);
|
||||
//谷歌推送
|
||||
PushConfig gconfig = new PushConfig.Builder()
|
||||
.enableFCM(true)
|
||||
.build();
|
||||
PushConfig gconfig = new PushConfig.Builder().enableFCM(true).build();
|
||||
RongPushClient.setPushConfig(gconfig);
|
||||
//初始化友盟统计
|
||||
// UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
|
||||
@@ -86,6 +84,9 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
}
|
||||
|
||||
public static Activity getTopActivity() {
|
||||
if (activityWeakReference == null) {
|
||||
return null;
|
||||
}
|
||||
return activityWeakReference.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -185,6 +185,7 @@ public class Constants {
|
||||
public static final String LIVE_PK_END = "endPK";//结束PK,以这个PK获取到的参数为准
|
||||
public static final String RED_PACKET = "RedPacket";//红包通知
|
||||
public static final String RED_PACKET_SUPER_JACKPOT = "RedPacketSuperJackpot";//超级红包通知
|
||||
public static final String SOCKET_LIVE_MSG_TO_USER = "SendMsgToUser";//七日用户主播提示语
|
||||
|
||||
//游戏socket
|
||||
public static final String SOCKET_GAME_ZJH = "startGame";//炸金花
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.LifeCycleListener;
|
||||
@@ -178,11 +179,15 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
}
|
||||
//友盟统计
|
||||
// MobclickAgent.onResume(this);
|
||||
MobclickAgent.onPageStart(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onResume_"+this.mTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
MobclickAgent.onPageEnd(this.mTag);
|
||||
Log.e("MobclickAgent","MobclickAgent:_onPause_"+this.mTag);
|
||||
if (mLifeCycleListeners != null) {
|
||||
for (LifeCycleListener listener : mLifeCycleListeners) {
|
||||
listener.onPause();
|
||||
@@ -376,4 +381,5 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yunbao.common.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -19,6 +20,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.android.billingclient.api.BillingResult;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.PurchasesResponseListener;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.fragment.GoogleFragment;
|
||||
@@ -118,34 +120,89 @@ public class MyWalletActivity extends AbsActivity {
|
||||
});
|
||||
});
|
||||
|
||||
WalletFragment walletFragment;
|
||||
GoogleFragment googleFragment1;
|
||||
GoogleFragment googleFragment2;
|
||||
|
||||
final String[] titles = {mContext.getString(R.string.diamond), mContext.getString(R.string.coins), mContext.getString(R.string.golden_beans)};
|
||||
if (getIntent().getStringExtra("tag") != null) {
|
||||
Log.i("tss", "首充");
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
//链接版本
|
||||
fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"))};
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&first_page=1&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
} else {
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"))};
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
}
|
||||
} else {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == false) {
|
||||
Log.i("tss", "不是首充");
|
||||
//链接版本
|
||||
fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"))};
|
||||
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletcoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=walletgold&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
|
||||
} else {
|
||||
rView.setVisibility(View.VISIBLE);
|
||||
fragments = new Fragment[]{new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new GoogleFragment(CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0")),
|
||||
new WalletFragment(this, CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"))};
|
||||
|
||||
walletFragment = new WalletFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&first_page=1&a=walletbean&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
walletFragment.setArguments(bundle);
|
||||
|
||||
googleFragment1 = new GoogleFragment();
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaycoin&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment1.setArguments(bundle1);
|
||||
|
||||
googleFragment2 = new GoogleFragment();
|
||||
Bundle bundle2 = new Bundle();
|
||||
bundle2.putString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=googlepaygole&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&package_name=pd" + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0"));
|
||||
googleFragment2.setArguments(bundle2);
|
||||
}
|
||||
}
|
||||
|
||||
fragments = new Fragment[]{googleFragment1,
|
||||
googleFragment2,
|
||||
walletFragment};
|
||||
|
||||
MagicIndicator magicIndicator = (MagicIndicator) findViewById(R.id.magic_indicator);
|
||||
CommonNavigator commonNavigator = new CommonNavigator(this);
|
||||
commonNavigator.setAdjustMode(true);
|
||||
@@ -167,6 +224,13 @@ public class MyWalletActivity extends AbsActivity {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
vp_content.setCurrentItem(index);
|
||||
if (index == 0) {
|
||||
MobclickAgent.onEvent(mContext, "recharge_zs", "用户在充值页面选择左右切换到钻石或者点到钻石");
|
||||
} else if (index == 1) {
|
||||
MobclickAgent.onEvent(mContext, "recharge_xb", "用户在充值页面选择左右切换到星币或者点到星币");
|
||||
} else if (index == 2) {
|
||||
MobclickAgent.onEvent(mContext, "recharge_jd", "用户在充值页面选择左右切换到金豆或者点到金豆");
|
||||
}
|
||||
}
|
||||
});
|
||||
return colorTransitionPagerTitleView;
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.yunbao.common.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.lifecycle.Observer;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.event.CheckRemainingBalanceEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.QuickStartGameViewModel;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class SudGameActivity extends AbsActivity {
|
||||
private FrameLayout gameContainer;
|
||||
private long mInteractionID;
|
||||
private String mLiveUid;
|
||||
private final QuickStartGameViewModel gameViewModel = new QuickStartGameViewModel(); // 创建ViewModel
|
||||
|
||||
private CreateSudRoomModel mCreateSudRoomModel;
|
||||
private TextView gameTitle, roomName, roomNumber;
|
||||
private RoundedImageView mAvatar;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_sud_game;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Bus.getOn(this);
|
||||
super.main();
|
||||
initView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Bus.getOff(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
String createSudRoomJson = getIntent().getStringExtra("CreateSudRoom");
|
||||
mCreateSudRoomModel = new Gson().fromJson(createSudRoomJson, CreateSudRoomModel.class);
|
||||
mInteractionID = mCreateSudRoomModel.getLongSudGameId();
|
||||
mLiveUid = mCreateSudRoomModel.getSudGameRoomId();
|
||||
|
||||
gameContainer = findViewById(R.id.game_container);
|
||||
gameTitle = findViewById(R.id.game_title);
|
||||
roomName = findViewById(R.id.room_name);
|
||||
roomNumber = findViewById(R.id.room_number);
|
||||
mAvatar = findViewById(R.id.avatar);
|
||||
if (mCreateSudRoomModel != null) {
|
||||
gameTitle.setText(mCreateSudRoomModel.getSudGameName());
|
||||
roomName.setText(mCreateSudRoomModel.getRoomName());
|
||||
roomNumber.setText(mCreateSudRoomModel.getSudGameRoomId());
|
||||
ImgLoader.display(mContext, mCreateSudRoomModel.getAvatar(), mAvatar);
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
gameViewModel.onDestroy();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
gameViewModel.gameViewLiveData.observe(this, new Observer<View>() {
|
||||
@Override
|
||||
public void onChanged(View view) {
|
||||
if (view == null) { // 在关闭游戏时,把游戏View给移除
|
||||
gameContainer.removeAllViews();
|
||||
} else { // 把游戏View添加到容器内
|
||||
gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 加载游戏,参数定义可查看BaseGameViewModel.switchGame()方法注释
|
||||
// 游戏配置
|
||||
GameConfigModel gameConfigModel = gameViewModel.getGameConfigModel();
|
||||
gameConfigModel.ui.ping.hide = true; // 配置不隐藏ping值
|
||||
gameConfigModel.ui.level.hide = true; // 配置不隐藏ping值
|
||||
|
||||
gameConfigModel.ui.lobby_players.custom = true;
|
||||
gameConfigModel.ui.join_btn.custom = true;
|
||||
gameConfigModel.ui.lobby_game_setting.hide = true; // 配置不隐藏ping值
|
||||
|
||||
// SudMGP平台64bit游戏ID
|
||||
gameViewModel.switchGame((Activity) mContext, mLiveUid, mInteractionID);
|
||||
// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, -1, true, 1);
|
||||
// gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfCaptain(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
// ViewClicksAntiShake.clicksAntiShake(gameTitle, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
// @Override
|
||||
// public void onViewClicks() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
|
||||
if (event.getResults().size() > 0) {
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(false, event.getSeatIndex(), true, 1);
|
||||
} else {
|
||||
LiveNetManager.get(mContext).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback<CheckRemainingBalance>() {
|
||||
@Override
|
||||
public void onSuccess(CheckRemainingBalance data) {
|
||||
if (data.getGoldenBeanRemainingBalance() == 1) {
|
||||
gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1);
|
||||
} else {
|
||||
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("金豆不够 ");
|
||||
}else {
|
||||
ToastUtil.show("Insufficient money ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("金豆不够 ");
|
||||
}else {
|
||||
ToastUtil.show("Insufficient money ");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
@@ -47,6 +48,7 @@ import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.MicStatusManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.HintCustomPopup;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -111,7 +113,13 @@ public class WebViewActivity extends AbsActivity {
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
setTitle(view.getTitle());
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setTitle(view.getTitle());
|
||||
}
|
||||
}, 500);
|
||||
|
||||
if (url.contains("for")) {
|
||||
mWebView.loadUrl("javascript:goAnchorTab()");
|
||||
}
|
||||
@@ -254,7 +262,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
mIsLive = isLive;
|
||||
if (Constants.LoginKefu) {
|
||||
if (addArgs) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(context, WebViewActivity.class);
|
||||
@@ -262,7 +270,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url,boolean isLive) {
|
||||
public static void forward(Context context, String url, boolean isLive) {
|
||||
forward(context, url, true, isLive);
|
||||
}
|
||||
|
||||
@@ -330,6 +338,7 @@ public class WebViewActivity extends AbsActivity {
|
||||
if (Constants.isShowPage != -1) {
|
||||
finish();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -434,4 +443,11 @@ public class WebViewActivity extends AbsActivity {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.playerObject;
|
||||
import com.yunbao.common.views.AvatarListViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AvatarListAdapter extends RecyclerView.Adapter {
|
||||
private List<playerObject> playerObjects = new ArrayList<>();
|
||||
|
||||
public AvatarListAdapter(List<playerObject> playerObjects) {
|
||||
this.playerObjects = playerObjects;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_sud_avatar_list_view, parent, false);
|
||||
return new AvatarListViewHolder(runGamesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
AvatarListViewHolder avatarListViewHolder = (AvatarListViewHolder) holder;
|
||||
avatarListViewHolder.setData(playerObjects.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return playerObjects.size();
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,14 @@ import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.DrawerRecommendViewHolder;
|
||||
import com.yunbao.common.views.DrawerTaskViewHolder;
|
||||
import com.yunbao.common.views.FunGamesViewHolder;
|
||||
import com.yunbao.common.views.InteractionGamesViewHolder;
|
||||
import com.yunbao.common.views.RecommendViewHolder;
|
||||
import com.yunbao.common.views.RigtsInterestsViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 新侧边栏适配器
|
||||
@@ -72,9 +75,12 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
case RIGHTS_INTERESTS:
|
||||
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_rights_interests, parent, false);
|
||||
return new RigtsInterestsViewHolder(rightsInterestsView);
|
||||
default:
|
||||
case RECOMMEND:
|
||||
View recommendView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_recommend, parent, false);
|
||||
return new RecommendViewHolder(recommendView);
|
||||
default:
|
||||
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_interaction_games_view, parent, false);
|
||||
return new InteractionGamesViewHolder(gamesView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +98,9 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
} else if (holder instanceof RigtsInterestsViewHolder) {
|
||||
RigtsInterestsViewHolder rigtsInterestsViewHolder = (RigtsInterestsViewHolder) holder;
|
||||
rigtsInterestsViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof InteractionGamesViewHolder) {
|
||||
InteractionGamesViewHolder interactionGamesViewHolder = (InteractionGamesViewHolder) holder;
|
||||
interactionGamesViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof RecommendViewHolder) {
|
||||
|
||||
RecommendViewHolder recommendViewHolder = (RecommendViewHolder) holder;
|
||||
@@ -101,9 +110,13 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
recommendViewHolder.setListener(new RecommendViewHolder.RecommendViewListener() {
|
||||
@Override
|
||||
public void changeOneBatch() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("num", "9");
|
||||
map.put("live_recommend", "sidebar");
|
||||
map.put("refresh", "1");
|
||||
//推荐位
|
||||
MainNetManager.get((Activity) mContext)
|
||||
.anchorRecommend("9", new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
.anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback<AnchorRecommendModel>() {
|
||||
@Override
|
||||
public void onSuccess(AnchorRecommendModel anchorRecommendModel) {
|
||||
|
||||
@@ -122,7 +135,7 @@ public class CustomDrawerPopupAdapter extends RecyclerView.Adapter {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(mContext.getString(R.string.net_error));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.InteractionGamesChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public InteractionGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
this.rigts = rigts;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view3, parent, false);
|
||||
return new InteractionGamesChildViewHolder(runGamesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
InteractionGamesChildViewHolder childViewHolder = (InteractionGamesChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position), rigts);
|
||||
childViewHolder.setItemViewClicks(new InteractionGamesChildViewHolder.InteractionGamesCallBack() {
|
||||
@Override
|
||||
public void onItemViewClicks(CustomSidebarChildModel model, boolean rigts) {
|
||||
|
||||
long activityID = TextUtils.isEmpty(model.getSrc()) ? 0 : Long.parseLong(model.getSrc());
|
||||
if (activityID != 0) {
|
||||
Bus.get().post(new CustomDrawerPopupEvent()
|
||||
.setDisMiss(true).setInteractionID(activityID).setInteraction(true).setChild(child));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void selectAll(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.views.FunGamesChildViewHolder;
|
||||
import com.yunbao.common.views.NewRoleFunGamesChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewRoleFunGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
private boolean showRed = false;
|
||||
public LiveNewRoleFunGamesAdapter(Context mContext, boolean rigts,boolean showRed) {
|
||||
this.mContext = mContext;
|
||||
this.rigts = rigts;
|
||||
this.showRed = showRed;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view, parent, false);
|
||||
return new NewRoleFunGamesChildViewHolder(runGamesView,showRed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position), rigts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void selectAll(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CustomDrawerPopupEvent;
|
||||
import com.yunbao.common.event.LiveNewRoleEvent;
|
||||
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.InteractionGamesChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewRoleInteractionGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
private boolean rigts;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public LiveNewRoleInteractionGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
this.rigts = rigts;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view3, parent, false);
|
||||
return new InteractionGamesChildViewHolder(runGamesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
InteractionGamesChildViewHolder childViewHolder = (InteractionGamesChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position), rigts);
|
||||
childViewHolder.setItemViewClicks(new InteractionGamesChildViewHolder.InteractionGamesCallBack() {
|
||||
@Override
|
||||
public void onItemViewClicks(CustomSidebarChildModel model, boolean rigts) {
|
||||
|
||||
long activityID = TextUtils.isEmpty(model.getSrc()) ? 0 : Long.parseLong(model.getSrc());
|
||||
if (activityID != 0) {
|
||||
Bus.get().post(new NewRoleCustomDrawerPopupEvent()
|
||||
.setDisMiss(true)
|
||||
.setInteractionID(activityID)
|
||||
.setChild(child)
|
||||
.setInteraction(true));
|
||||
}
|
||||
|
||||
|
||||
Bus.get().post(new LiveNewRoleEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void selectAll(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.AnchorRecommendItemModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.views.LiveNewRoleFunGamesViewHolder;
|
||||
import com.yunbao.common.views.LiveNewRoleInteractionGamesViewHolder;
|
||||
import com.yunbao.common.views.LiveNewRoleRigtsInterestsViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class LiveNewRolerPopupAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
// "type": 1,//模块类型 1 充值送好礼类型2 任务中心类型 3趣味游戏类4 权益 ,5为你推荐
|
||||
private final int FUN_GAMES = 3;
|
||||
private final int RIGHTS_INTERESTS = 4;
|
||||
private List<CustomSidebarInfoModel> infoModels = new ArrayList<>();
|
||||
private boolean showRed = false;
|
||||
public LiveNewRolerPopupAdapter(Context mContext,boolean showRed) {
|
||||
this.mContext = mContext;
|
||||
this.showRed = showRed;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (viewType) {
|
||||
case FUN_GAMES:
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_new_roler_fun_games_view, parent, false);
|
||||
return new LiveNewRoleFunGamesViewHolder(runGamesView);
|
||||
case RIGHTS_INTERESTS:
|
||||
View rightsInterestsView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_roler_ights_interests, parent, false);
|
||||
return new LiveNewRoleRigtsInterestsViewHolder(rightsInterestsView,showRed);
|
||||
default:
|
||||
View gamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_interaction_games_view, parent, false);
|
||||
return new LiveNewRoleInteractionGamesViewHolder(gamesView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof LiveNewRoleFunGamesViewHolder) {
|
||||
LiveNewRoleFunGamesViewHolder funGamesViewHolder = (LiveNewRoleFunGamesViewHolder) holder;
|
||||
funGamesViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof LiveNewRoleRigtsInterestsViewHolder) {
|
||||
LiveNewRoleRigtsInterestsViewHolder rigtsInterestsViewHolder = (LiveNewRoleRigtsInterestsViewHolder) holder;
|
||||
rigtsInterestsViewHolder.setData(infoModels.get(position));
|
||||
} else if (holder instanceof LiveNewRoleInteractionGamesViewHolder) {
|
||||
LiveNewRoleInteractionGamesViewHolder interactionGamesViewHolder = (LiveNewRoleInteractionGamesViewHolder) holder;
|
||||
interactionGamesViewHolder.setData(infoModels.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return infoModels.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
CustomSidebarInfoModel model = infoModels.get(position);
|
||||
switch (model.getType()) {
|
||||
|
||||
case "3":
|
||||
return FUN_GAMES;
|
||||
case "4":
|
||||
return RIGHTS_INTERESTS;
|
||||
|
||||
}
|
||||
return super.getItemViewType(position);
|
||||
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarInfoModel> mInfoModels) {
|
||||
infoModels.clear();
|
||||
infoModels.addAll(mInfoModels);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private CustomDrawerListener listener;
|
||||
|
||||
public LiveNewRolerPopupAdapter setListener(CustomDrawerListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface CustomDrawerListener {
|
||||
void goToLive(AnchorRecommendItemModel model);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.event.LiveNewWishListCloseEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.DayWishItemViewHolder;
|
||||
import com.yunbao.common.views.LunarWishItemViewHolder;
|
||||
import com.yunbao.common.views.SeasonalWishItemViewHolder;
|
||||
@@ -53,7 +54,7 @@ public class LiveNewWishAdapter extends RecyclerView.Adapter {
|
||||
if (wishList.get(i)!=null){
|
||||
if (!TextUtils.isEmpty(wishList.get(i).getLid()) && !TextUtils.isEmpty(model.getLid())
|
||||
&& TextUtils.equals(wishList.get(i).getLid(), model.getLid())) {
|
||||
ToastUtil.show(R.string.too_many_gifts);
|
||||
ToastUtil.show(WordUtil.isNewZh()?"重複添加禮物":"Too many gifts");
|
||||
isAdd = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class MsgFollowAdapter extends RecyclerView.Adapter<MsgFollowAdapter.Vh>
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show( R.string.net_error);
|
||||
ToastUtil.show( mContext.getString(R.string.net_error));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.views.NewRoleFunGamesChildViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewRoleFunGamesAdapter extends RecyclerView.Adapter {
|
||||
private Context mContext;
|
||||
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
private boolean rigts;
|
||||
|
||||
public NewRoleFunGamesAdapter(Context mContext, boolean rigts) {
|
||||
this.mContext = mContext;
|
||||
this.rigts = rigts;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_live_new_role_fun_games_child_view2, parent, false);
|
||||
return new NewRoleFunGamesChildViewHolder(runGamesView,false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
NewRoleFunGamesChildViewHolder childViewHolder = (NewRoleFunGamesChildViewHolder) holder;
|
||||
childViewHolder.setData(child.get(position), rigts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return child.size();
|
||||
}
|
||||
|
||||
public void updateData(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
if (mChild.size() > 8) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
child.add(mChild.get(i));
|
||||
}
|
||||
} else {
|
||||
child.addAll(mChild);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void selectAll(List<CustomSidebarChildModel> mChild) {
|
||||
child.clear();
|
||||
child.addAll(mChild);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.views.SudGameListViewHolder;
|
||||
|
||||
public class SudGameListAdapter extends RefreshAdapter<SudRoomListModel> {
|
||||
private boolean isHome = false;
|
||||
|
||||
public SudGameListAdapter(Context context, boolean isHome) {
|
||||
super(context);
|
||||
this.isHome = isHome;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (isHome){
|
||||
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_home_sud_game_list, parent, false));
|
||||
}else {
|
||||
return new SudGameListViewHolder(mInflater.inflate(R.layout.item_sud_game_list, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
SudGameListViewHolder sudGameListViewHolder = (SudGameListViewHolder) holder;
|
||||
sudGameListViewHolder.setData(mList.get(position),isHome);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameSearchHistoryListAdapter extends RecyclerView.Adapter<SudGameSearchHistoryListAdapter.ViewHolder> {
|
||||
private List<String> mList;
|
||||
private Context mContext;
|
||||
private OnItemClickListener<String> onItemClickListener;
|
||||
private boolean isHome = false;
|
||||
|
||||
public SudGameSearchHistoryListAdapter(Context mContext, boolean isHome) {
|
||||
this.isHome = isHome;
|
||||
this.mContext = mContext;
|
||||
mList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setList(List<String> list) {
|
||||
this.mList = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (isHome) {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_search_history, parent, false));
|
||||
} else {
|
||||
return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_search_history, parent, false));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return Math.min(mList.size(), 5);
|
||||
}
|
||||
|
||||
public List<String> getList() {
|
||||
return mList;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView nameView;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
nameView = itemView.findViewById(R.id.history);
|
||||
|
||||
}
|
||||
|
||||
public void setData(String name) {
|
||||
nameView.setText(name);
|
||||
nameView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(name, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class SudGameSearchRoomListAdapter extends RecyclerView.Adapter<SudGameSearchRoomListAdapter.ViewHolder> {
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.views.SudGameListViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudHomeGameListAdapter extends RecyclerView.Adapter<SudGameListViewHolder> {
|
||||
private Context mContext;
|
||||
private List<SudRoomListModel> mList;
|
||||
private boolean isHome = false;
|
||||
|
||||
public SudHomeGameListAdapter(Context mContext, boolean isHome) {
|
||||
this.mContext = mContext;
|
||||
this.isHome = isHome;
|
||||
mList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setList(List<SudRoomListModel> mList) {
|
||||
this.mList = mList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public SudGameListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (isHome) {
|
||||
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_home_sud_game_list, parent, false));
|
||||
} else {
|
||||
return new SudGameListViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_sud_game_list, parent, false));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull SudGameListViewHolder holder, int position) {
|
||||
holder.setData(mList.get(position),isHome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.yunbao.common.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.views.SudTitleSelectViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudTitleSelectAdapter extends RecyclerView.Adapter {
|
||||
|
||||
private List<String> selectString = new ArrayList<>();
|
||||
|
||||
private int mIndex;
|
||||
private int mType;
|
||||
|
||||
public SudTitleSelectAdapter(List<String> selectString, int index, int type) {
|
||||
this.selectString = selectString;
|
||||
mIndex = index;
|
||||
mType = type;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View runGamesView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_sud_title_select_view, parent, false);
|
||||
return new SudTitleSelectViewHolder(runGamesView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
SudTitleSelectViewHolder childViewHolder = (SudTitleSelectViewHolder) holder;
|
||||
childViewHolder.setData(selectString.get(position), mIndex == position, position, new SudTitleSelectViewHolder.SudTitleSelectListener() {
|
||||
@Override
|
||||
public void onSudTitleSelectCallBack(int index) {
|
||||
if (sudTitleSelectCallBack != null) {
|
||||
sudTitleSelectCallBack.onSudTitleSelectCallBack(index);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return selectString.size();
|
||||
}
|
||||
|
||||
private SudTitleSelectCallBack sudTitleSelectCallBack;
|
||||
|
||||
public void setSudTitleSelectCallBack(SudTitleSelectCallBack sudTitleSelectCallBack) {
|
||||
this.sudTitleSelectCallBack = sudTitleSelectCallBack;
|
||||
}
|
||||
|
||||
public interface SudTitleSelectCallBack {
|
||||
void onSudTitleSelectCallBack(int index);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
/**
|
||||
* 活动
|
||||
@@ -105,7 +106,7 @@ public class ActiveModel extends BaseModel {
|
||||
"?uid=" + userInfo.getId() +
|
||||
"&token=" + userInfo.getToken()
|
||||
+ "&anchorUid=" + liveUid
|
||||
+ "&active_id=" + activeId;
|
||||
+ "&active_id=" + activeId+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CheckRemainingBalance extends BaseModel{
|
||||
|
||||
@SerializedName("golden_bean_remaining_balance")
|
||||
private int goldenBeanRemainingBalance;
|
||||
|
||||
public int getGoldenBeanRemainingBalance() {
|
||||
return goldenBeanRemainingBalance;
|
||||
}
|
||||
|
||||
public void setGoldenBeanRemainingBalance(int goldenBeanRemainingBalance) {
|
||||
this.goldenBeanRemainingBalance = goldenBeanRemainingBalance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class CreateSudRoomModel extends BaseModel {
|
||||
|
||||
@SerializedName("sud_game_room_id")
|
||||
private String sudGameRoomId;
|
||||
@SerializedName("sud_game_id")
|
||||
private String sudGameId;
|
||||
@SerializedName("room_holder_id")
|
||||
private int roomHolderId;
|
||||
@SerializedName("room_holder_name")
|
||||
private String roomHolderName;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("room_holder_type")
|
||||
private int roomHolderType;
|
||||
@SerializedName("sud_game_name")
|
||||
private String sudGameName;
|
||||
@SerializedName("room_name")
|
||||
private String roomName;
|
||||
@SerializedName("room_status")
|
||||
private String roomStatus;
|
||||
@SerializedName("player_total")
|
||||
private String playerTotal;
|
||||
@SerializedName("ob_total")
|
||||
private String obTotal;
|
||||
@SerializedName("mg_id")
|
||||
private String mgId;
|
||||
@SerializedName("sud_game_icon")
|
||||
private String sudGameIcon;
|
||||
|
||||
public String getSudGameRoomId() {
|
||||
return sudGameRoomId;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setSudGameRoomId(String sudGameRoomId) {
|
||||
this.sudGameRoomId = sudGameRoomId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameId() {
|
||||
return sudGameId;
|
||||
}
|
||||
|
||||
public long getLongSudGameId() {
|
||||
try {
|
||||
if (TextUtils.isEmpty(sudGameId)) {
|
||||
return 0;
|
||||
} else {
|
||||
return Long.parseLong(sudGameId);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setSudGameId(String sudGameId) {
|
||||
this.sudGameId = sudGameId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRoomHolderId() {
|
||||
return roomHolderId;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setRoomHolderId(int roomHolderId) {
|
||||
this.roomHolderId = roomHolderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderName() {
|
||||
return roomHolderName;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setRoomHolderName(String roomHolderName) {
|
||||
this.roomHolderName = roomHolderName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRoomHolderType() {
|
||||
return roomHolderType;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setRoomHolderType(int roomHolderType) {
|
||||
this.roomHolderType = roomHolderType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameName() {
|
||||
return sudGameName;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setSudGameName(String sudGameName) {
|
||||
this.sudGameName = sudGameName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomStatus() {
|
||||
return roomStatus;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setRoomStatus(String roomStatus) {
|
||||
this.roomStatus = roomStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPlayerTotal() {
|
||||
return playerTotal;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setPlayerTotal(String playerTotal) {
|
||||
this.playerTotal = playerTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getObTotal() {
|
||||
return obTotal;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setObTotal(String obTotal) {
|
||||
this.obTotal = obTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMgId() {
|
||||
return mgId;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setMgId(String mgId) {
|
||||
this.mgId = mgId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameIcon() {
|
||||
return sudGameIcon;
|
||||
}
|
||||
|
||||
public CreateSudRoomModel setSudGameIcon(String sudGameIcon) {
|
||||
this.sudGameIcon = sudGameIcon;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,17 @@ public class CustomSidebarChildModel extends BaseModel {
|
||||
private String flag = "";
|
||||
@SerializedName("is_show")
|
||||
private String isShow;
|
||||
@SerializedName("sud_game_is_new")
|
||||
private String sudGameIsNew;
|
||||
|
||||
public String getSudGameIsNew() {
|
||||
return sudGameIsNew;
|
||||
}
|
||||
|
||||
public CustomSidebarChildModel setSudGameIsNew(String sudGameIsNew) {
|
||||
this.sudGameIsNew = sudGameIsNew;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsShow() {
|
||||
return isShow;
|
||||
|
||||
@@ -26,6 +26,8 @@ public class CustomSidebarInfoModel extends BaseModel {
|
||||
private String src;
|
||||
@SerializedName("type")
|
||||
private String type;
|
||||
@SerializedName("sud_game_is_new")
|
||||
private String sudGameIsNew;
|
||||
@SerializedName("child")
|
||||
private List<CustomSidebarChildModel> child;
|
||||
|
||||
@@ -38,6 +40,15 @@ public class CustomSidebarInfoModel extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameIsNew() {
|
||||
return sudGameIsNew;
|
||||
}
|
||||
|
||||
public CustomSidebarInfoModel setSudGameIsNew(String sudGameIsNew) {
|
||||
this.sudGameIsNew = sudGameIsNew;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,40 @@ public class EnterRoomNewModel extends BaseModel {
|
||||
@SerializedName("wishListProgress")
|
||||
private WishModel wishListProgress;
|
||||
|
||||
@SerializedName("sud_game_room_status")
|
||||
private String sudGameRoomStatus;
|
||||
@SerializedName("sud_game_room_name")
|
||||
private String sudGameRoomName;
|
||||
@SerializedName("sud_gameDate")
|
||||
private SudGameDateModel sudGameDateModel;
|
||||
|
||||
public SudGameDateModel getSudGameDateModel() {
|
||||
return sudGameDateModel;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setSudGameDateModel(SudGameDateModel sudGameDateModel) {
|
||||
this.sudGameDateModel = sudGameDateModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameRoomName() {
|
||||
return sudGameRoomName;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setSudGameRoomName(String sudGameRoomName) {
|
||||
this.sudGameRoomName = sudGameRoomName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameRoomStatus() {
|
||||
return sudGameRoomStatus;
|
||||
}
|
||||
|
||||
public EnterRoomNewModel setSudGameRoomStatus(String sudGameRoomStatus) {
|
||||
this.sudGameRoomStatus = sudGameRoomStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WishModel getWishListProgress() {
|
||||
return wishListProgress;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,45 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class LinkMicUserBean extends BaseModel {
|
||||
@SerializedName("user_nicename")
|
||||
private String uname;
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("dress_avatar")
|
||||
private String dress_avatar;
|
||||
private String uid = "";
|
||||
private String action;
|
||||
@SerializedName("id")
|
||||
private String id;//连麦显示右侧头像时要用
|
||||
@SerializedName("user_nicename")
|
||||
private String userNicename;
|
||||
@SerializedName("uname")
|
||||
private String uname;
|
||||
@SerializedName("level")
|
||||
private int level;
|
||||
@SerializedName("sex")
|
||||
private int sex;
|
||||
@SerializedName("dress_avatar")
|
||||
private String dressAvatar;
|
||||
|
||||
public String getUname() {
|
||||
return uname;
|
||||
if (TextUtils.isEmpty(uname)){
|
||||
return userNicename;
|
||||
}else {
|
||||
return uname;
|
||||
}
|
||||
}
|
||||
|
||||
public void setUname(String uname) {
|
||||
public LinkMicUserBean setUname(String uname) {
|
||||
this.uname = uname;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
@@ -34,28 +50,17 @@ public class LinkMicUserBean extends BaseModel {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
public String getUserNicename() {
|
||||
if (TextUtils.isEmpty(uname)){
|
||||
return userNicename;
|
||||
}else {
|
||||
return uname;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getDress_avatar() {
|
||||
return dress_avatar;
|
||||
}
|
||||
|
||||
public void setDress_avatar(String dress_avatar) {
|
||||
this.dress_avatar = dress_avatar;
|
||||
public void setUserNicename(String userNicename) {
|
||||
this.userNicename = userNicename;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
@@ -74,25 +79,11 @@ public class LinkMicUserBean extends BaseModel {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
public String getDressAvatar() {
|
||||
return dressAvatar;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LinkMicUserBean{" +
|
||||
"uname='" + uname + '\'' +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", dress_avatar='" + dress_avatar + '\'' +
|
||||
", uid='" + uid + '\'' +
|
||||
", action='" + action + '\'' +
|
||||
", id='" + id + '\'' +
|
||||
", level=" + level +
|
||||
", sex=" + sex +
|
||||
'}';
|
||||
public void setDressAvatar(String dressAvatar) {
|
||||
this.dressAvatar = dressAvatar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ public class LiveBean implements Parcelable {
|
||||
private String recommendCardIconSizeThree = "";
|
||||
@SerializedName("red_packet_status")
|
||||
private int redPacketStatus;
|
||||
|
||||
@SerializedName("giftId")
|
||||
private String giftId;
|
||||
private Map<String,String> params;//用于跳转Activity时扩展参数,例:从首页Banner跳转到直播间时需要根据携带参数判断是否弹出新人特惠对话框
|
||||
|
||||
public String getRecommendCardIconSizeTwo() {
|
||||
@@ -66,6 +67,14 @@ public class LiveBean implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public void setGiftId(String giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
public String getRecommendCardIcon() {
|
||||
if (TextUtils.isEmpty(recommendCardIconSizeThree)) {
|
||||
if (!TextUtils.isEmpty(recommendCardIconSizeTwo)) {
|
||||
@@ -444,6 +453,7 @@ public class LiveBean implements Parcelable {
|
||||
this.recommendCardtype = in.readString();
|
||||
this.recommendCardIconSizeTwo = in.readString();
|
||||
this.recommendCardIconSizeThree = in.readString();
|
||||
this.giftId = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -488,6 +498,7 @@ public class LiveBean implements Parcelable {
|
||||
dest.writeString(this.recommendCardtype);
|
||||
dest.writeString(this.recommendCardIconSizeTwo);
|
||||
dest.writeString(this.recommendCardIconSizeThree);
|
||||
dest.writeString(this.giftId);
|
||||
}
|
||||
|
||||
public static final Creator<LiveBean> CREATOR = new Creator<LiveBean>() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
@@ -16,6 +17,8 @@ public class LiveClassBean {
|
||||
private boolean checked;
|
||||
private String chinese;
|
||||
private String english;
|
||||
@SerializedName("channel_show")
|
||||
private int channel_show;
|
||||
|
||||
public String getChinese() {
|
||||
return chinese;
|
||||
@@ -92,4 +95,12 @@ public class LiveClassBean {
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
public int getChannel_show() {
|
||||
return channel_show;
|
||||
}
|
||||
|
||||
public void setChannel_show(int channel_show) {
|
||||
this.channel_show = channel_show;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,28 @@ public class LiveGiftBean {
|
||||
private String namingCoin;
|
||||
@JSONField(name = "naming_user_coin")
|
||||
private String namingUserCoin;
|
||||
@JSONField(name = "blind_box_ticket")
|
||||
private int blindBoxTicket;
|
||||
@JSONField(name = "blind_box_ticket_id")
|
||||
private int blindBoxTicketId;
|
||||
|
||||
public int getBlindBoxTicketId() {
|
||||
return blindBoxTicketId;
|
||||
}
|
||||
|
||||
public LiveGiftBean setBlindBoxTicketId(int blindBoxTicketId) {
|
||||
this.blindBoxTicketId = blindBoxTicketId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getBlindBoxTicket() {
|
||||
return blindBoxTicket;
|
||||
}
|
||||
|
||||
public LiveGiftBean setBlindBoxTicket(int blindBoxTicket) {
|
||||
this.blindBoxTicket = blindBoxTicket;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNamingUserCoin() {
|
||||
return namingUserCoin;
|
||||
@@ -202,7 +224,7 @@ public class LiveGiftBean {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int fansGiftLevel=0;//粉丝团礼物等级要求
|
||||
private int fansGiftLevel = 0;//粉丝团礼物等级要求
|
||||
|
||||
public int getFansGiftLevel() {
|
||||
return fansGiftLevel;
|
||||
|
||||
@@ -5,6 +5,7 @@ import androidx.annotation.NonNull;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
public class LiveUserMailBoxModel extends BaseModel {
|
||||
@SerializedName("id")
|
||||
@@ -127,7 +128,7 @@ public class LiveUserMailBoxModel extends BaseModel {
|
||||
url += "?";
|
||||
}
|
||||
url += "uid=" + CommonAppConfig.getInstance().getUid() + "&token="
|
||||
+ CommonAppConfig.getInstance().getToken();
|
||||
+ CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
169
common/src/main/java/com/yunbao/common/bean/OpenAdModel.java
Normal file
169
common/src/main/java/com/yunbao/common/bean/OpenAdModel.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class OpenAdModel extends BaseModel {
|
||||
public static final int TYPE_HOME = 1;//主页
|
||||
public static final int TYPE_LIVE = 2;//直播间
|
||||
public static final int TYPE_LIVE_DELAY = 3;//直播间延迟
|
||||
public static final int MODEL_SQUARE = 1;//正方形
|
||||
public static final int MODEL_RECTANGLE = 2;//长方形
|
||||
public static final int MODEL_BOTTOM = 3;//底部
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
@SerializedName("popup_location")
|
||||
private int type = TYPE_HOME;
|
||||
@SerializedName("activity_url")
|
||||
private String url;
|
||||
@SerializedName("image_url")
|
||||
private String imageUrl;
|
||||
@SerializedName("display_time")
|
||||
private int showTime; //持续展示时间
|
||||
@SerializedName("delay_show_time")
|
||||
private int delayShowTime;//延迟展示时间
|
||||
@SerializedName("popup_model")
|
||||
private int model = MODEL_SQUARE;
|
||||
@SerializedName("start_show_time")
|
||||
private String startTime;//活动开始时间
|
||||
@SerializedName("end_show_time")
|
||||
private String endTime;//活动结束时间
|
||||
@SerializedName("popup_permission")
|
||||
private int permission;
|
||||
|
||||
|
||||
public OpenAdModel() {
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (!url.startsWith("http://") || !url.startsWith("https://")) {
|
||||
url = CommonAppConfig.HOST + url;
|
||||
}
|
||||
return url + "?t=" + System.currentTimeMillis() / 1000;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public int getShowTime() {
|
||||
return showTime * 1000;
|
||||
}
|
||||
|
||||
public void setShowTime(int showTime) {
|
||||
this.showTime = showTime;
|
||||
}
|
||||
|
||||
public int getDelayShowTime() {
|
||||
return delayShowTime * 1000;
|
||||
}
|
||||
|
||||
public void setDelayShowTime(int delayShowTime) {
|
||||
this.delayShowTime = delayShowTime;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
this.imageUrl = imageUrl;
|
||||
}
|
||||
|
||||
public int getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public void setModel(int model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(int permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public boolean isInTime() {
|
||||
if (StringUtil.isEmpty(startTime, endTime)) {
|
||||
return true;
|
||||
}
|
||||
Date startTime = null;
|
||||
Date endTime = null;
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
|
||||
|
||||
try {
|
||||
startTime = sdf.parse(this.startTime);
|
||||
endTime = sdf.parse(this.endTime);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
return startTime.getTime() <= time && time <= endTime.getTime();
|
||||
}
|
||||
|
||||
public boolean userIsPermission(boolean isGuard) {
|
||||
if (permission == 4 && !isGuard) {//守护不可见
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OpenAdModel{" +
|
||||
"id=" + id +
|
||||
", type=" + type +
|
||||
", url='" + url + '\'' +
|
||||
", imageUrl='" + imageUrl + '\'' +
|
||||
", showTime=" + showTime +
|
||||
", delayShowTime=" + delayShowTime +
|
||||
", model=" + model +
|
||||
", startTime='" + startTime + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
", permission='" + permission + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public class PkRankBean extends BaseModel {
|
||||
public String clickUrl;
|
||||
@SerializedName("vs_img")
|
||||
public String vsImgUrl;
|
||||
@SerializedName("new_rank_name_en")
|
||||
public String newRankNameEn;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@@ -94,6 +96,14 @@ public class PkRankBean extends BaseModel {
|
||||
this.vsImgUrl = vsImgUrl;
|
||||
}
|
||||
|
||||
public String getNewRankNameEn() {
|
||||
return newRankNameEn;
|
||||
}
|
||||
|
||||
public void setNewRankNameEn(String newRankNameEn) {
|
||||
this.newRankNameEn = newRankNameEn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PkRankBean{" +
|
||||
@@ -105,6 +115,7 @@ public class PkRankBean extends BaseModel {
|
||||
", pkTopImgUrl='" + pkTopImgUrl + '\'' +
|
||||
", clickUrl='" + clickUrl + '\'' +
|
||||
", vsImgUrl='" + vsImgUrl + '\'' +
|
||||
", newRankNameEn='" + newRankNameEn + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ public class RedPacketInfoModel extends BaseModel {
|
||||
private String redPacketMoney;
|
||||
@SerializedName("red_packet_quantity")
|
||||
private String redPacketQuantity;
|
||||
@SerializedName("is_fans")
|
||||
private String isFans;
|
||||
@SerializedName("conditions")
|
||||
private String conditions;
|
||||
@SerializedName("create_time")
|
||||
@@ -270,4 +272,12 @@ public class RedPacketInfoModel extends BaseModel {
|
||||
this.userGoldenBean = userGoldenBean;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean getIsFans() {
|
||||
return isFans.equals("1");
|
||||
}
|
||||
|
||||
public void setIsFans(String isFans) {
|
||||
this.isFans = isFans;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SudGameDateModel extends BaseModel{
|
||||
|
||||
@SerializedName("room_holder_id")
|
||||
private String roomHolderId;
|
||||
@SerializedName("sex")
|
||||
private String sex;
|
||||
@SerializedName("golden_bean_number")
|
||||
private String goldenBeanNumber;
|
||||
|
||||
@SerializedName("room_holder_type")
|
||||
private String roomHolderType;
|
||||
@SerializedName("sud_game_id")
|
||||
private String sudGameId;
|
||||
@SerializedName("room_status")
|
||||
private String roomStatus;
|
||||
@SerializedName("sud_game_name")
|
||||
private String sudGameName;
|
||||
@SerializedName("sud_game_name_en")
|
||||
private String sud_game_name_en;
|
||||
@SerializedName("room_name")
|
||||
private String roomName;
|
||||
@SerializedName("player_total")
|
||||
private String playerTotal;
|
||||
@SerializedName("sud_game_icon")
|
||||
private String sudGameIcon;
|
||||
@SerializedName("room_holder_name")
|
||||
private String roomHolderName;
|
||||
@SerializedName("sud_game_room_id")
|
||||
private String sudGameRoomId;
|
||||
@SerializedName("ob_total")
|
||||
private String obTotal;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("liveuid")
|
||||
private String liveuid;
|
||||
|
||||
public String getRoomHolderId() {
|
||||
return roomHolderId;
|
||||
}
|
||||
|
||||
public String getSud_game_name_en() {
|
||||
return sud_game_name_en;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSud_game_name_en(String sud_game_name_en) {
|
||||
this.sud_game_name_en = sud_game_name_en;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SudGameDateModel setRoomHolderId(String roomHolderId) {
|
||||
this.roomHolderId = roomHolderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSex(String sex) {
|
||||
this.sex = sex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGoldenBeanNumber() {
|
||||
return goldenBeanNumber;
|
||||
}
|
||||
|
||||
public SudGameDateModel setGoldenBeanNumber(String goldenBeanNumber) {
|
||||
this.goldenBeanNumber = goldenBeanNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getRoomHolderType() {
|
||||
return roomHolderType;
|
||||
}
|
||||
|
||||
public SudGameDateModel setRoomHolderType(String roomHolderType) {
|
||||
this.roomHolderType = roomHolderType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameId() {
|
||||
return sudGameId;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSudGameId(String sudGameId) {
|
||||
this.sudGameId = sudGameId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomStatus() {
|
||||
return roomStatus;
|
||||
}
|
||||
|
||||
public SudGameDateModel setRoomStatus(String roomStatus) {
|
||||
this.roomStatus = roomStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameName() {
|
||||
return sudGameName;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSudGameName(String sudGameName) {
|
||||
this.sudGameName = sudGameName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public SudGameDateModel setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPlayerTotal() {
|
||||
return playerTotal;
|
||||
}
|
||||
|
||||
public SudGameDateModel setPlayerTotal(String playerTotal) {
|
||||
this.playerTotal = playerTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameIcon() {
|
||||
return sudGameIcon;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSudGameIcon(String sudGameIcon) {
|
||||
this.sudGameIcon = sudGameIcon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderName() {
|
||||
return roomHolderName;
|
||||
}
|
||||
|
||||
public SudGameDateModel setRoomHolderName(String roomHolderName) {
|
||||
this.roomHolderName = roomHolderName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameRoomId() {
|
||||
return sudGameRoomId;
|
||||
}
|
||||
|
||||
public SudGameDateModel setSudGameRoomId(String sudGameRoomId) {
|
||||
this.sudGameRoomId = sudGameRoomId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getObTotal() {
|
||||
return obTotal;
|
||||
}
|
||||
|
||||
public SudGameDateModel setObTotal(String obTotal) {
|
||||
this.obTotal = obTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public SudGameDateModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public SudGameDateModel setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudRoomListModel extends BaseModel {
|
||||
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("room_holder_id")
|
||||
private String roomHolderId;
|
||||
@SerializedName("room_name")
|
||||
private String roomName;
|
||||
@SerializedName("room_holder_type")
|
||||
private String roomHolderType;
|
||||
@SerializedName("sud_game_id")
|
||||
private String sudGameId;
|
||||
@SerializedName("golden_bean_number")
|
||||
private String goldenBeanNumber;
|
||||
@SerializedName("room_status")
|
||||
private String roomStatus;
|
||||
@SerializedName("sud_game_room_id")
|
||||
private String sudGameRoomId;
|
||||
@SerializedName("room_holder_name")
|
||||
private String roomHolderName;
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("sud_game_name")
|
||||
private String sudGameName;
|
||||
@SerializedName("player_total")
|
||||
private String playerTotal;
|
||||
@SerializedName("ob_total")
|
||||
private String obTotal;
|
||||
@SerializedName("liveuid")
|
||||
private String liveUid;
|
||||
@SerializedName("sex")
|
||||
private String sex;
|
||||
@SerializedName("sud_game_icon")
|
||||
private String sudgameicon;
|
||||
|
||||
public String getSudgameicon() {
|
||||
return sudgameicon;
|
||||
}
|
||||
|
||||
public SudRoomListModel setSudgameicon(String sudgameicon) {
|
||||
this.sudgameicon = sudgameicon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLiveUid() {
|
||||
return liveUid;
|
||||
}
|
||||
|
||||
public SudRoomListModel setLiveUid(String liveUid) {
|
||||
this.liveUid = liveUid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public SudRoomListModel setSex(String sex) {
|
||||
this.sex = sex;
|
||||
return this;
|
||||
}
|
||||
|
||||
@SerializedName("player_object")
|
||||
private List<playerObject> playerObjects = new ArrayList<>();
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public SudRoomListModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderId() {
|
||||
return roomHolderId;
|
||||
}
|
||||
|
||||
public SudRoomListModel setRoomHolderId(String roomHolderId) {
|
||||
this.roomHolderId = roomHolderId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
|
||||
public SudRoomListModel setRoomName(String roomName) {
|
||||
this.roomName = roomName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderType() {
|
||||
return roomHolderType;
|
||||
}
|
||||
|
||||
public SudRoomListModel setRoomHolderType(String roomHolderType) {
|
||||
this.roomHolderType = roomHolderType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameId() {
|
||||
return sudGameId;
|
||||
}
|
||||
|
||||
public SudRoomListModel setSudGameId(String sudGameId) {
|
||||
this.sudGameId = sudGameId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGoldenBeanNumber() {
|
||||
return goldenBeanNumber;
|
||||
}
|
||||
|
||||
public SudRoomListModel setGoldenBeanNumber(String goldenBeanNumber) {
|
||||
this.goldenBeanNumber = goldenBeanNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomStatus() {
|
||||
return roomStatus;
|
||||
}
|
||||
|
||||
public SudRoomListModel setRoomStatus(String roomStatus) {
|
||||
this.roomStatus = roomStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameRoomId() {
|
||||
return sudGameRoomId;
|
||||
}
|
||||
|
||||
public SudRoomListModel setSudGameRoomId(String sudGameRoomId) {
|
||||
this.sudGameRoomId = sudGameRoomId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderName() {
|
||||
return roomHolderName;
|
||||
}
|
||||
|
||||
public SudRoomListModel setRoomHolderName(String roomHolderName) {
|
||||
this.roomHolderName = roomHolderName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public SudRoomListModel setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSudGameName() {
|
||||
return sudGameName;
|
||||
}
|
||||
|
||||
public SudRoomListModel setSudGameName(String sudGameName) {
|
||||
this.sudGameName = sudGameName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPlayerTotal() {
|
||||
return playerTotal;
|
||||
}
|
||||
|
||||
public SudRoomListModel setPlayerTotal(String playerTotal) {
|
||||
this.playerTotal = playerTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getObTotal() {
|
||||
return obTotal;
|
||||
}
|
||||
|
||||
public SudRoomListModel setObTotal(String obTotal) {
|
||||
this.obTotal = obTotal;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<playerObject> getPlayerObjects() {
|
||||
return playerObjects;
|
||||
}
|
||||
|
||||
public SudRoomListModel setPlayerObjects(List<playerObject> playerObjects) {
|
||||
this.playerObjects = playerObjects;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
if (TextUtils.isEmpty(obTotal)&&TextUtils.isEmpty(playerTotal)){
|
||||
return "0";
|
||||
}else {
|
||||
int obT = Integer.parseInt(obTotal);
|
||||
int playerO = Integer.parseInt(playerTotal);
|
||||
return String.valueOf(obT + playerO);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SudgameCodeModel extends BaseModel {
|
||||
@SerializedName("code")
|
||||
private String code;
|
||||
@SerializedName("expireDate")
|
||||
private long expireDate;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public SudgameCodeModel setCode(String code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getExpireDate() {
|
||||
return expireDate;
|
||||
}
|
||||
|
||||
public SudgameCodeModel setExpireDate(long expireDate) {
|
||||
this.expireDate = expireDate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,38 @@ public class UserBean implements Parcelable {
|
||||
//粉丝团等级
|
||||
private int fansLevel;
|
||||
//粉丝团进场皮肤
|
||||
protected int typeMic;
|
||||
private boolean isMicList = false;
|
||||
|
||||
private boolean isRequest = false;
|
||||
|
||||
public boolean isRequest() {
|
||||
return isRequest;
|
||||
}
|
||||
|
||||
public UserBean setRequest(boolean request) {
|
||||
isRequest = request;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isMicList() {
|
||||
return isMicList;
|
||||
}
|
||||
|
||||
public UserBean setMicList(boolean micList) {
|
||||
isMicList = micList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getTypeMic() {
|
||||
return typeMic;
|
||||
}
|
||||
|
||||
public UserBean setTypeMic(int typeMic) {
|
||||
this.typeMic = typeMic;
|
||||
return this;
|
||||
}
|
||||
|
||||
private String fansEnterRoomUrl;
|
||||
|
||||
public int getUserInfoComplete() {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class playerObject extends BaseModel {
|
||||
@SerializedName("avatar")
|
||||
private String avatar;
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
public boolean isChange = false;
|
||||
|
||||
public boolean isChange() {
|
||||
return isChange;
|
||||
}
|
||||
|
||||
public playerObject setChange(boolean change) {
|
||||
isChange = change;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public playerObject setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public playerObject setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.footer.ClassicsFooter;
|
||||
import com.scwang.smartrefresh.layout.header.ClassicsHeader;
|
||||
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
||||
import com.yunbao.common.R;
|
||||
@@ -188,7 +187,7 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
if (mRecyclerView != null) {
|
||||
RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
|
||||
if (adapter != null && adapter.getItemCount() > 0) {
|
||||
ToastUtil.show(R.string.load_failure);
|
||||
ToastUtil.show(mContext.getString(R.string.load_failure));
|
||||
} else {
|
||||
mLoadFailureView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -196,7 +195,7 @@ public class CommonRefreshView extends FrameLayout implements View.OnClickListen
|
||||
mLoadFailureView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(R.string.load_failure);
|
||||
ToastUtil.show(mContext.getString(R.string.load_failure));
|
||||
}
|
||||
}
|
||||
if (mDataHelper != null) {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.impl.FullScreenPopupView;
|
||||
|
||||
/**
|
||||
* 居中弹窗
|
||||
*/
|
||||
public abstract class AbsDialogFullScreenPopupWindow extends FullScreenPopupView {
|
||||
public final Context mContext;
|
||||
|
||||
public AbsDialogFullScreenPopupWindow(@NonNull Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* <a href="https://github.com/li-xiaojun/XPopup/wiki/5.-%E5%B8%B8%E7%94%A8%E8%AE%BE%E7%BD%AE">参考配置</a>
|
||||
*/
|
||||
public abstract void buildDialog(XPopup.Builder builder);
|
||||
public abstract int bindLayoutId();
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return bindLayoutId();
|
||||
}
|
||||
|
||||
public void showDialog() {
|
||||
XPopup.Builder builder = new XPopup.Builder(mContext);
|
||||
builder.isDestroyOnDismiss(true);
|
||||
builder.enableDrag(false);
|
||||
buildDialog(builder);
|
||||
builder.asCustom(this).show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getSystemService;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.SudGameActivity;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CreateSudGameEvent;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.LiveSudGamePopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CreateSudGamePopup extends BottomPopupView {
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private TextView createGameType;
|
||||
private EditText roomName, gameSill;
|
||||
private long interactionID = 0;
|
||||
private String id;
|
||||
private boolean isHomeView;
|
||||
private boolean isHome = false;
|
||||
|
||||
public CreateSudGamePopup(@NonNull Context context, List<CustomSidebarChildModel> child, boolean isHome) {
|
||||
super(context);
|
||||
customSidebarChildModels = child;
|
||||
this.isHome = isHome;
|
||||
}
|
||||
|
||||
public CreateSudGamePopup setHomeView(boolean homeView) {
|
||||
isHomeView = homeView;
|
||||
return this;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
if (isHomeView) {
|
||||
return R.layout.dialog_home_create_sud_game;
|
||||
}
|
||||
return R.layout.dialog_create_sud_game;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
createGameType = findViewById(R.id.create_game_type);
|
||||
roomName = findViewById(R.id.room_name);
|
||||
gameSill = findViewById(R.id.game_sill);
|
||||
ViewClicksAntiShake.clicksAntiShake(createGameType, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
if (hasMoveUp) {
|
||||
InputMethodManager imm = getSystemService(getContext(), InputMethodManager.class);
|
||||
if (imm != null) {
|
||||
imm.hideSoftInputFromWindow(roomName.getWindowToken(), 0);
|
||||
imm.hideSoftInputFromWindow(gameSill.getWindowToken(), 0);
|
||||
}
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(createGameType);
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 4, customSidebarChildModels, interactionID))
|
||||
.show();
|
||||
}
|
||||
}, 500);
|
||||
} else {
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(createGameType);
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 4, customSidebarChildModels, interactionID))
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_back),
|
||||
new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.create_room), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
String sill = gameSill.getText().toString();
|
||||
String name = roomName.getText().toString();
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
if (name.length() > 10) {
|
||||
ToastUtil.show("房間名长度为[1-10]");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() != Locale.SIMPLIFIED_CHINESE) {
|
||||
if (name.length() > 15) {
|
||||
ToastUtil.show("Room name length is [1-15]");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("房间名不能为空");
|
||||
} else {
|
||||
ToastUtil.show("The room name cannot be empty");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("还未选择游戏");
|
||||
} else {
|
||||
ToastUtil.show("No game has been selected");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(sill)) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sill.length() > 6 ){
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
}else {
|
||||
int sillNumber = Integer.parseInt(sill);
|
||||
if (sillNumber < 100 || sillNumber > 50000) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("数量区间为100--5W");
|
||||
} else {
|
||||
ToastUtil.show("The quantity range is 100 to 5 W");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sillNumber%10!=0){
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("金豆數量必須為10的倍數");
|
||||
} else {
|
||||
ToastUtil.show("The number of golden beans must be a multiple of 10");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LiveNetManager.get(getContext())
|
||||
.createSudRoom(name, sill, id, new HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (isHome) {
|
||||
dialog.dismiss();
|
||||
Intent intent = new Intent(getContext(), SudGameActivity.class);
|
||||
intent.putExtra("CreateSudRoom", new Gson().toJson(data));
|
||||
getContext().startActivity(intent);
|
||||
} else {
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
|
||||
|
||||
dialog.dismiss();
|
||||
Bus.get().post(new SudGameListDissMissEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
Bus.getOff(this);
|
||||
super.onDismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListEvent(CreateSudGameEvent event) {
|
||||
interactionID = event.getInteractionID();
|
||||
createGameType.setText(event.getTitle());
|
||||
id = event.getId();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.LiveNewRolerPopupAdapter;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.event.LiveNewRoleEvent;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LiveNewRolePopup extends BottomPopupView {
|
||||
private boolean showRed = false;
|
||||
|
||||
public LiveNewRolePopup(@NonNull Context context, boolean showRed) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
this.showRed = showRed;
|
||||
}
|
||||
|
||||
private RecyclerView drawerList;
|
||||
private LiveNewRolerPopupAdapter adapter;
|
||||
private Context mContext;
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_live_new_role;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
LiveNetManager.get(mContext)
|
||||
.getCustomSidebarInfo("1", new com.yunbao.common.http.base.HttpCallback<List<CustomSidebarInfoModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<CustomSidebarInfoModel> data) {
|
||||
adapter.updateData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
drawerList = findViewById(R.id.drawerList);
|
||||
adapter = new LiveNewRolerPopupAdapter(mContext, showRed);
|
||||
drawerList.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
drawerList.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
Bus.getOff(this);
|
||||
|
||||
super.onDismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveNewRoleEvent(LiveNewRoleEvent event) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
|
||||
private ImageView mImageView;
|
||||
private ImageView mClose;
|
||||
private OpenAdModel model;
|
||||
private OnItemClickListener<OpenAdModel> mListener;
|
||||
|
||||
public OpenAdBottomDialogPopup(@NonNull Context context, OpenAdModel model) {
|
||||
super(context);
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_open_bottom_ad;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
if (mListener != null) {
|
||||
mListener.onItemClick(model, 0);
|
||||
mListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
public OpenAdBottomDialogPopup setListener(OnItemClickListener<OpenAdModel> mListener) {
|
||||
this.mListener = mListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
mImageView = findViewById(R.id.img);
|
||||
mClose = findViewById(R.id.close);
|
||||
mImageView.setOnClickListener(v -> {
|
||||
WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME);
|
||||
if (mListener != null) {
|
||||
mListener.onItemClick(model, 1);
|
||||
mListener = null;
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(this::dismiss, model.getShowTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
|
||||
public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
|
||||
private ImageView mImageView;
|
||||
private ImageView mClose;
|
||||
private OpenAdModel model;
|
||||
private OnItemClickListener<OpenAdModel> mListener;
|
||||
|
||||
public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) {
|
||||
super(context);
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public OpenAdCenterDialogPopup setListener(OnItemClickListener<OpenAdModel> mListener) {
|
||||
this.mListener = mListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
return R.layout.dialog_open_center_ad;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
if (mListener != null) {
|
||||
mListener.onItemClick(model, 0);
|
||||
mListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
mImageView = findViewById(R.id.img);
|
||||
mClose = findViewById(R.id.close);
|
||||
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
|
||||
mImageView.setOnClickListener(v -> {
|
||||
WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME);
|
||||
if (mListener != null) {
|
||||
mListener.onItemClick(model, 1);
|
||||
mListener = null;
|
||||
}
|
||||
dismiss();
|
||||
});
|
||||
mClose.setOnClickListener(v -> dismiss());
|
||||
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
|
||||
int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(40);
|
||||
int height = (int) (width * 1.4);
|
||||
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
|
||||
height = width;
|
||||
}
|
||||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mImageView.getLayoutParams();
|
||||
params.width = width;
|
||||
params.height = height;
|
||||
mImageView.setLayoutParams(params);
|
||||
if (model.getShowTime() > 0) {
|
||||
mClose.postDelayed(this::dismiss, model.getShowTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BottomPopupView;
|
||||
import com.lxj.xpopup.enums.PopupPosition;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.adapter.SudGameListAdapter;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListRefreshEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.LiveSudGamePopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class SudGameListPopup extends BottomPopupView {
|
||||
private long interactionID = 0;
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private ImageView roomGameArrow, roomSillArrow, houseOwnerArrow;
|
||||
|
||||
private TextView gameTitle, sillTitle, houseOwnerTitle;
|
||||
private String id = "0", mLiveUid;
|
||||
private int page = 0;
|
||||
private String mSill = "0,0", mSillName, roomHolderType = "0", roomHolderTypeName;
|
||||
private CommonRefreshView mRefreshView;
|
||||
private SudGameListAdapter sudGameListAdapter;
|
||||
|
||||
public SudGameListPopup(@NonNull Context context, long interactionID, List<CustomSidebarChildModel> child, String liveUid) {
|
||||
super(context);
|
||||
this.interactionID = interactionID;
|
||||
customSidebarChildModels = child;
|
||||
mLiveUid = liveUid;
|
||||
}
|
||||
|
||||
// 返回自定义弹窗的布局
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.dialog_sud_game_list;
|
||||
}
|
||||
|
||||
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
initView();
|
||||
initDate();
|
||||
|
||||
}
|
||||
|
||||
private void initDate() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
roomGameArrow = findViewById(R.id.room_game_arrow);
|
||||
roomSillArrow = findViewById(R.id.room_sill_arrow);
|
||||
houseOwnerArrow = findViewById(R.id.house_owner_arrow);
|
||||
gameTitle = findViewById(R.id.game_title);
|
||||
sillTitle = findViewById(R.id.room_sill_text);
|
||||
houseOwnerTitle = findViewById(R.id.house_owner_text);
|
||||
|
||||
mRefreshView = findViewById(R.id.refreshView);
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
sudGameListAdapter = new SudGameListAdapter(getContext(), false);
|
||||
mRefreshView.setLoadMoreEnable(true);
|
||||
mRefreshView.setRecyclerViewAdapter(sudGameListAdapter);
|
||||
|
||||
for (CustomSidebarChildModel model : customSidebarChildModels) {
|
||||
if (TextUtils.equals(String.valueOf(interactionID), model.getSrc())) {
|
||||
gameTitle.setText(model.getTitle().substring(0, 2));
|
||||
id = model.getId();
|
||||
}
|
||||
}
|
||||
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<SudRoomListModel>() {
|
||||
@Override
|
||||
public RefreshAdapter<SudRoomListModel> getAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
page = p;
|
||||
LiveHttpUtil.getRoomList(id, mSill, roomHolderType, mLiveUid, p - 1, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SudRoomListModel> processData(String[] info) {
|
||||
if (info.length > 0) {
|
||||
List<SudRoomListModel> sudRoomListModels = new ArrayList<>();
|
||||
for (String json : info) {
|
||||
SudRoomListModel model = new Gson().fromJson(json, SudRoomListModel.class);
|
||||
sudRoomListModels.add(model);
|
||||
}
|
||||
return sudRoomListModels;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<SudRoomListModel> list, int listCount) {
|
||||
Log.i("onRefreshSuccess", listCount + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<SudRoomListModel> loadItemList, int loadItemCount) {
|
||||
sudGameListAdapter.insertList(loadItemList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
mRefreshView.setEmptyLayoutId(R.layout.sud_no_data1);
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.random_start), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
LiveNetManager.get(getContext())
|
||||
.randomRoom(id, mSill, roomHolderType,new com.yunbao.common.http.base.HttpCallback<CreateSudRoomModel>() {
|
||||
@Override
|
||||
public void onSuccess(CreateSudRoomModel data) {
|
||||
if (data != null) {
|
||||
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(data));
|
||||
dialog.dismiss();
|
||||
}else {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("当前没有可加入的房间");
|
||||
} else {
|
||||
ToastUtil.show("There are currently no rooms to join");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
ToastUtil.show("当前没有可加入的房间");
|
||||
} else {
|
||||
ToastUtil.show("There are currently no rooms to join");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.search), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new SudGameSearchDialogPopup(getContext(), false).showDialog();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_room_game), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.interactive_game_room_game));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 0, customSidebarChildModels, interactionID))
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.room_sill), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.room_sill));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 1, mSillName))
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.house_owner), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 0f, 90f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
XPopup.Builder builder = new XPopup.Builder(getContext()).atView(findViewById(R.id.house_owner));
|
||||
builder.hasShadowBg(false)
|
||||
.isDestroyOnDismiss(true)
|
||||
.isLightStatusBar(false)
|
||||
.popupPosition(PopupPosition.Bottom)
|
||||
.asCustom(new SudGameListSelectPopup(getContext(), 2, roomHolderTypeName))
|
||||
.show();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.interactive_game_add), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
new XPopup.Builder(getContext())
|
||||
.enableDrag(false)
|
||||
.moveUpToKeyboard(true)
|
||||
.asCustom(new CreateSudGamePopup(getContext(), customSidebarChildModels, false))
|
||||
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
Bus.getOff(this);
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
|
||||
|
||||
super.onDismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListEvent(SudGameListEvent event) {
|
||||
interactionID = event.getInteractionID();
|
||||
if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
gameTitle.setText(event.getTitle().substring(0, 2));
|
||||
} else {
|
||||
if (event.getTitle().contains("All")) {
|
||||
gameTitle.setText("All");
|
||||
} else {
|
||||
if ((event.getTitle().length() > 6)) {
|
||||
gameTitle.setText(event.getTitle().substring(0, 5));
|
||||
} else {
|
||||
gameTitle.setText(event.getTitle());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
id = event.getId();
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomGameArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListSillEvent(SudGameListSillEvent event) {
|
||||
mSill = event.getSill();
|
||||
mSillName = event.getSillName();
|
||||
if (TextUtils.equals("0,0", mSill)) {
|
||||
sillTitle.setText(mSillName);
|
||||
} else {
|
||||
sillTitle.setText(mSillName.substring(0, mSillName.length() - 2));
|
||||
}
|
||||
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(roomSillArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRoomHolderTypeEvent(RoomHolderTypeEvent event) {
|
||||
roomHolderType = event.getRoomHolderType();
|
||||
roomHolderTypeName = event.getRoomHolderTypeName();
|
||||
houseOwnerTitle.setText(roomHolderTypeName);
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(houseOwnerArrow, "rotation", 90f, 0f);
|
||||
animator.setDuration(500);
|
||||
animator.setInterpolator(new LinearInterpolator());
|
||||
animator.start();
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListDissMissEvent(SudGameListDissMissEvent event) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListRefreshEvent(SudGameListRefreshEvent event) {
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lxj.xpopup.core.AttachPopupView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.SudTitleSelectAdapter;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
import com.yunbao.common.event.CreateSudGameEvent;
|
||||
import com.yunbao.common.event.RoomHolderTypeEvent;
|
||||
import com.yunbao.common.event.SudGameListEvent;
|
||||
import com.yunbao.common.event.SudGameListSillEvent;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SudGameListSelectPopup extends AttachPopupView {
|
||||
private int mType;
|
||||
private List<CustomSidebarChildModel> customSidebarChildModels = new ArrayList<>();
|
||||
private List<String> selectString = new ArrayList<>();
|
||||
private Map<String, String> selectSill = new HashMap<>();
|
||||
private TextView topSelect;
|
||||
|
||||
private RecyclerView sudTitleSelect;
|
||||
|
||||
private SudTitleSelectAdapter sudTitleSelectAdapter;
|
||||
private long interactionID = 0;
|
||||
private DialogInterface.OnDismissListener onDismissListener;
|
||||
private String mSill;
|
||||
|
||||
public SudGameListSelectPopup(@NonNull Context context, int type, List<CustomSidebarChildModel> child, long interactionID) {
|
||||
super(context);
|
||||
customSidebarChildModels = child;
|
||||
mType = type;
|
||||
this.interactionID = interactionID;
|
||||
}
|
||||
|
||||
public SudGameListSelectPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
|
||||
this.onDismissListener = onDismissListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SudGameListSelectPopup(@NonNull Context context, int mType, String sill) {
|
||||
super(context);
|
||||
this.mType = mType;
|
||||
mSill = sill;
|
||||
}
|
||||
|
||||
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_sud_game_slelect;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
topSelect = findViewById(R.id.top_select);
|
||||
sudTitleSelect = findViewById(R.id.sud_title_select);
|
||||
int index = -1;
|
||||
if (mType == 0 || mType == 4) {
|
||||
topSelect.setText(getContext().getString(R.string.interactive_game_room_all));
|
||||
for (int i = 0; i < customSidebarChildModels.size(); i++) {
|
||||
selectString.add(customSidebarChildModels.get(i).getTitle());
|
||||
if (TextUtils.equals(String.valueOf(interactionID), customSidebarChildModels.get(i).getSrc())) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
|
||||
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
|
||||
if (interactionID == 0) {
|
||||
topSelect.setSelected(true);
|
||||
}
|
||||
if (mType == 4) {
|
||||
topSelect.setVisibility(GONE);
|
||||
}
|
||||
|
||||
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
|
||||
@Override
|
||||
public void onSudTitleSelectCallBack(int index) {
|
||||
if (mType == 0) {
|
||||
Bus.get().post(new SudGameListEvent()
|
||||
.setInteractionID(Long.parseLong(customSidebarChildModels.get(index).getSrc()))
|
||||
.setId(customSidebarChildModels.get(index).getId())
|
||||
.setTitle(customSidebarChildModels.get(index).getTitle()));
|
||||
} else {
|
||||
Bus.get().post(new CreateSudGameEvent()
|
||||
.setInteractionID(Long.parseLong(customSidebarChildModels.get(index).getSrc()))
|
||||
.setId(customSidebarChildModels.get(index).getId())
|
||||
.setTitle(customSidebarChildModels.get(index).getTitle()));
|
||||
}
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (mType == 1) {
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_unlimited));
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_0_1));
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_1_2));
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_2_5));
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_5));
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0,0");
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_0_1), "0,1");
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_1_2), "1,2");
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_2_5), "2,5");
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_5), "5,0");
|
||||
index = 0;
|
||||
for (int i = 0; i < selectString.size(); i++) {
|
||||
if (TextUtils.equals(mSill, selectString.get(i))) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
|
||||
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
|
||||
topSelect.setVisibility(GONE);
|
||||
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
|
||||
@Override
|
||||
public void onSudTitleSelectCallBack(int index) {
|
||||
String sillName = selectString.get(index);
|
||||
String sill = selectSill.get(sillName);
|
||||
Bus.get().post(new SudGameListSillEvent().setSill(sill).setSillName(sillName));
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
} else if (mType == 2) {
|
||||
selectString.add(getContext().getString(R.string.interactive_game_create_unlimited));
|
||||
selectString.add(getContext().getString(R.string.live_anchor));
|
||||
selectString.add(getContext().getString(R.string.interactive_game_player));
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_create_unlimited), "0");
|
||||
selectSill.put(getContext().getString(R.string.live_anchor), "1");
|
||||
selectSill.put(getContext().getString(R.string.interactive_game_player), "2");
|
||||
index = 0;
|
||||
for (int i = 0; i < selectString.size(); i++) {
|
||||
if (TextUtils.equals(mSill, selectString.get(i))) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
sudTitleSelectAdapter = new SudTitleSelectAdapter(selectString, index, mType);
|
||||
sudTitleSelect.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
sudTitleSelect.setAdapter(sudTitleSelectAdapter);
|
||||
topSelect.setVisibility(GONE);
|
||||
sudTitleSelectAdapter.setSudTitleSelectCallBack(new SudTitleSelectAdapter.SudTitleSelectCallBack() {
|
||||
@Override
|
||||
public void onSudTitleSelectCallBack(int index) {
|
||||
String roomHolderTypeName = selectString.get(index);
|
||||
String roomHolderType = selectSill.get(roomHolderTypeName);
|
||||
Bus.get().post(new RoomHolderTypeEvent().setRoomHolderType(roomHolderType).setRoomHolderTypeName(roomHolderTypeName));
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
ViewClicksAntiShake.clicksAntiShake(topSelect, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
Bus.get().post(new SudGameListEvent().setInteractionID(0L).setTitle(getContext().getString(R.string.interactive_game_room_all)).setId("0"));
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
if(onDismissListener!=null){
|
||||
onDismissListener.onDismiss(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.adapter.SudHomeGameListAdapter;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent;
|
||||
import com.yunbao.common.event.SudGameListDissMissEvent;
|
||||
import com.yunbao.common.event.SudRoomListModelEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.views.FlowLayout;
|
||||
import com.yunbao.common.views.LiveSudGamePopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SudGameSearchDialogPopup extends AbsDialogPopupWindow {
|
||||
private static final String SP_HISTORY = "sud_game_search_history";
|
||||
private EditText editSearch;
|
||||
private RecyclerView listRoom;//listHistory, ;
|
||||
private View history;
|
||||
private FlowLayout searchHistory;
|
||||
// private SudGameSearchHistoryListAdapter historyListAdapter;
|
||||
private SudHomeGameListAdapter sudGameListAdapter;
|
||||
private boolean isHome = false;
|
||||
|
||||
public SudGameSearchDialogPopup(@NonNull Context context, boolean isHome) {
|
||||
super(context);
|
||||
this.isHome = isHome;
|
||||
}
|
||||
@Override
|
||||
public void dismiss() {
|
||||
Bus.getOff(this);
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildDialog(XPopup.Builder builder) {
|
||||
builder.moveUpToKeyboard(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int bindLayoutId() {
|
||||
if (isHome) {
|
||||
return R.layout.dialog_home_search_sud_game;
|
||||
} else {
|
||||
return R.layout.dialog_search_sud_game;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
Bus.getOn(this);
|
||||
editSearch = findViewById(R.id.edit_search);
|
||||
// listHistory = findViewById(R.id.list_history);
|
||||
listRoom = findViewById(R.id.list_room);
|
||||
history = findViewById(R.id.layout_history);
|
||||
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
||||
searchHistory = findViewById(R.id.search_history);
|
||||
searchHistory.removeAllViews();
|
||||
sudGameListAdapter = new SudHomeGameListAdapter(mContext, isHome);
|
||||
listRoom.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
listRoom.setAdapter(sudGameListAdapter);
|
||||
initHistoryData();
|
||||
switchList(true);
|
||||
|
||||
editSearch.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String value = s.toString();
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
search(value);
|
||||
|
||||
} else {
|
||||
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
||||
switchList(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_back), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> historyList;
|
||||
|
||||
private void addHistoryData(String str) {
|
||||
LinearLayout.LayoutParams layoutParams =
|
||||
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
layoutParams.setMargins(15, 10, 15, 7);
|
||||
TextView chip = new TextView(mContext);
|
||||
chip.setText(str);
|
||||
chip.setMaxEms(10);
|
||||
chip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
|
||||
chip.setSingleLine();
|
||||
if (isHome) {
|
||||
|
||||
chip.setBackgroundResource(R.drawable.bg_item_search_history);
|
||||
chip.setTextColor(Color.parseColor("#FF999999"));
|
||||
} else {
|
||||
|
||||
chip.setBackgroundResource(R.drawable.bg_item_home_search_history);
|
||||
chip.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
}
|
||||
|
||||
chip.setLayoutParams(layoutParams);
|
||||
searchHistory.addView(chip, layoutParams);
|
||||
|
||||
chip.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
editSearch.setText(str);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initHistoryData() {
|
||||
searchHistory.removeAllViews();
|
||||
String value = SpUtil.getStringValue(SP_HISTORY);
|
||||
historyList = new ArrayList<>();
|
||||
if (!StringUtil.isEmpty(value)) {
|
||||
historyList = JSONArray.parseArray(value, String.class);
|
||||
}
|
||||
|
||||
|
||||
for (String str : historyList) {
|
||||
addHistoryData(str);
|
||||
}
|
||||
}
|
||||
|
||||
private void search(String value) {
|
||||
|
||||
LiveNetManager.get(mContext)
|
||||
.searchRoomList("0", "0,0", "0", value, 0, new HttpCallback<List<SudRoomListModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SudRoomListModel> data) {
|
||||
if (data.size() > 0) {
|
||||
switchList(false);
|
||||
sudGameListAdapter.setList(data);
|
||||
|
||||
findViewById(R.id.layout_history_empty).setVisibility(GONE);
|
||||
boolean isValue = false;
|
||||
for (String str : historyList) {
|
||||
if (!isValue) {
|
||||
isValue = TextUtils.equals(value, str);
|
||||
}
|
||||
|
||||
}
|
||||
if (!isValue) {
|
||||
|
||||
if (historyList.size() < 6) {
|
||||
if (historyList.size() == 5) {
|
||||
historyList.remove(0);
|
||||
}
|
||||
historyList.add(value);
|
||||
SpUtil.setStringValue(SP_HISTORY, JSONArray.toJSONString(historyList));
|
||||
searchHistory.removeAllViews();
|
||||
|
||||
for (String str : historyList) {
|
||||
addHistoryData(str);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
findViewById(R.id.layout_history_empty).setVisibility(VISIBLE);
|
||||
listRoom.setVisibility(GONE);
|
||||
history.setVisibility(GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
findViewById(R.id.layout_history_empty).setVisibility(VISIBLE);
|
||||
switchList(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void switchList(boolean isHistory) {
|
||||
if (isHistory) {
|
||||
history.setVisibility(VISIBLE);
|
||||
listRoom.setVisibility(GONE);
|
||||
} else {
|
||||
listRoom.setVisibility(VISIBLE);
|
||||
history.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListDissMissEvent(SudGameListDissMissEvent event) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onSudGameListEvent(SudRoomListModelEvent event) {
|
||||
CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel();
|
||||
createSudRoomModel.setSudGameId(event.getModel().getSudGameId());
|
||||
createSudRoomModel.setSudGameRoomId(event.getModel().getSudGameRoomId());
|
||||
createSudRoomModel.setAvatar(event.getModel().getAvatar());
|
||||
createSudRoomModel.setRoomName(event.getModel().getRoomName());
|
||||
createSudRoomModel.setSudGameName(event.getModel().getSudGameName());
|
||||
dialog.dismiss();
|
||||
Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public class AllServerNotifyEvent extends BaseModel {
|
||||
//礼物名称
|
||||
@SerializedName("giftname")
|
||||
private String giftName;
|
||||
|
||||
//盲盒名称
|
||||
@SerializedName("box_type_name")
|
||||
private String boxTypeName;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CheckRemainingBalanceEvent extends BaseModel {
|
||||
public int seatIndex;
|
||||
public List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results = new ArrayList<>();
|
||||
|
||||
public List<SudMGPMGState.MGCommonGameSettle.PlayerResult> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setResults(List<SudMGPMGState.MGCommonGameSettle.PlayerResult> results) {
|
||||
this.results = results;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getSeatIndex() {
|
||||
return seatIndex;
|
||||
}
|
||||
|
||||
public CheckRemainingBalanceEvent setSeatIndex(int seatIndex) {
|
||||
this.seatIndex = seatIndex;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class CreateSudGameEvent extends BaseModel {
|
||||
private long interactionID = 0;
|
||||
private String title;
|
||||
private String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public CreateSudGameEvent setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CreateSudGameEvent setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getInteractionID() {
|
||||
return interactionID;
|
||||
}
|
||||
|
||||
public CreateSudGameEvent setInteractionID(long interactionID) {
|
||||
this.interactionID = interactionID;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomDrawerPopupEvent extends BaseModel {
|
||||
//是否关闭弹窗
|
||||
@@ -28,6 +32,37 @@ public class CustomDrawerPopupEvent extends BaseModel {
|
||||
//畫質選擇
|
||||
private boolean qualitySelection = false;
|
||||
private boolean fontSize = false;
|
||||
private boolean interaction = false;
|
||||
private long interactionID;
|
||||
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public List<CustomSidebarChildModel> getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setChild(List<CustomSidebarChildModel> child) {
|
||||
this.child = child;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isInteraction() {
|
||||
return interaction;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setInteraction(boolean interaction) {
|
||||
this.interaction = interaction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getInteractionID() {
|
||||
return interactionID;
|
||||
}
|
||||
|
||||
public CustomDrawerPopupEvent setInteractionID(long interactionID) {
|
||||
this.interactionID = interactionID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSmallWindow() {
|
||||
return smallWindow;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class HideShowEvent extends BaseModel {
|
||||
private boolean isClose = false;
|
||||
private boolean hide = false;
|
||||
|
||||
public boolean isHide() {
|
||||
return hide;
|
||||
}
|
||||
|
||||
public HideShowEvent setHide(boolean hide) {
|
||||
this.hide = hide;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isClose() {
|
||||
return isClose;
|
||||
}
|
||||
|
||||
public HideShowEvent setClose(boolean close) {
|
||||
isClose = close;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
public class LiveNewRoleEvent {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
|
||||
public class LiveOpenSudRoomEvent extends BaseModel {
|
||||
private CreateSudRoomModel createSudRoomModel = null;
|
||||
|
||||
public CreateSudRoomModel getCreateSudRoomModel() {
|
||||
return createSudRoomModel;
|
||||
}
|
||||
|
||||
public LiveOpenSudRoomEvent setCreateSudRoomModel(CreateSudRoomModel createSudRoomModel) {
|
||||
this.createSudRoomModel = createSudRoomModel;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
|
||||
public class LiveSudGamePopupShowOrHideEvent {
|
||||
private int type = 0;//0展示,1hide隱藏,2dismiss關閉
|
||||
private CreateSudRoomModel createSudRoomModel;
|
||||
|
||||
public CreateSudRoomModel getCreateSudRoomModel() {
|
||||
return createSudRoomModel;
|
||||
}
|
||||
|
||||
public LiveSudGamePopupShowOrHideEvent setCreateSudRoomModel(CreateSudRoomModel createSudRoomModel) {
|
||||
this.createSudRoomModel = createSudRoomModel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public LiveSudGamePopupShowOrHideEvent setType(int type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.CustomSidebarChildModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewRoleCustomDrawerPopupEvent extends BaseModel {
|
||||
//是否关闭弹窗
|
||||
private boolean isDisMiss = false;
|
||||
//权益的名字
|
||||
private String rightsInterests = "";
|
||||
//活动的id
|
||||
private int activityId = 0;
|
||||
//跳转网页地址
|
||||
private String htmlUrl;
|
||||
//是否半屏展示
|
||||
private boolean screen = false;
|
||||
//系统消息
|
||||
private boolean systemNotice = false;
|
||||
//在线客服
|
||||
private boolean online = false;
|
||||
//举报
|
||||
private boolean reportLayout = false;
|
||||
//刷新
|
||||
private boolean refresh = false;
|
||||
//特效設置
|
||||
private boolean effects = false;
|
||||
//小窗播放
|
||||
private boolean smallWindow = false;
|
||||
//畫質選擇
|
||||
private boolean qualitySelection = false;
|
||||
private boolean fontSize = false;
|
||||
private boolean interaction = false;
|
||||
private long interactionID;
|
||||
private List<CustomSidebarChildModel> child = new ArrayList<>();
|
||||
|
||||
public List<CustomSidebarChildModel> getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setChild(List<CustomSidebarChildModel> child) {
|
||||
this.child = child;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isInteraction() {
|
||||
return interaction;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setInteraction(boolean interaction) {
|
||||
this.interaction = interaction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getInteractionID() {
|
||||
return interactionID;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setInteractionID(long interactionID) {
|
||||
this.interactionID = interactionID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSmallWindow() {
|
||||
return smallWindow;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setSmallWindow(boolean smallWindow) {
|
||||
this.smallWindow = smallWindow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isQualitySelection() {
|
||||
return qualitySelection;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setQualitySelection(boolean qualitySelection) {
|
||||
this.qualitySelection = qualitySelection;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setRefresh(boolean refresh) {
|
||||
this.refresh = refresh;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSystemNotice() {
|
||||
return systemNotice;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setSystemNotice(boolean systemNotice) {
|
||||
this.systemNotice = systemNotice;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return online;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setOnline(boolean online) {
|
||||
this.online = online;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isReportLayout() {
|
||||
return reportLayout;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setReportLayout(boolean reportLayout) {
|
||||
this.reportLayout = reportLayout;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getHtmlUrl() {
|
||||
return htmlUrl;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setHtmlUrl(String htmlUrl) {
|
||||
this.htmlUrl = htmlUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isScreen() {
|
||||
return screen;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setScreen(boolean screen) {
|
||||
this.screen = screen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setActivityId(int activityId) {
|
||||
this.activityId = activityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRightsInterests() {
|
||||
return rightsInterests;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setRightsInterests(String rightsInterests) {
|
||||
this.rightsInterests = rightsInterests;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isDisMiss() {
|
||||
return isDisMiss;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setDisMiss(boolean disMiss) {
|
||||
isDisMiss = disMiss;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEffects() {
|
||||
return effects;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setEffects(boolean effects) {
|
||||
this.effects = effects;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFontSize() {
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
public NewRoleCustomDrawerPopupEvent setFontSize(boolean fontSize) {
|
||||
this.fontSize = fontSize;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class RoomHolderTypeEvent extends BaseModel {
|
||||
private String roomHolderType;
|
||||
private String roomHolderTypeName;
|
||||
|
||||
public String getRoomHolderType() {
|
||||
return roomHolderType;
|
||||
}
|
||||
|
||||
public RoomHolderTypeEvent setRoomHolderType(String roomHolderType) {
|
||||
this.roomHolderType = roomHolderType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRoomHolderTypeName() {
|
||||
return roomHolderTypeName;
|
||||
}
|
||||
|
||||
public RoomHolderTypeEvent setRoomHolderTypeName(String roomHolderTypeName) {
|
||||
this.roomHolderTypeName = roomHolderTypeName;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
@@ -21,6 +23,8 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private String totalcoin;
|
||||
@SerializedName("giftname")
|
||||
private String giftname;
|
||||
@SerializedName("giftname_en")
|
||||
private String giftname_en;
|
||||
@SerializedName("giftnameen")
|
||||
private String giftnameen;
|
||||
@SerializedName("gifticon")
|
||||
@@ -69,6 +73,8 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private String needcoin;
|
||||
@SerializedName("gift_msg")
|
||||
private String giftMsg;
|
||||
@SerializedName("gift_msg_en")
|
||||
private String giftMsgen;
|
||||
@SerializedName("gift_colour")
|
||||
private String giftColour;
|
||||
@SerializedName("box_type")
|
||||
@@ -85,6 +91,8 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private Object dressId;
|
||||
@SerializedName("dress_name")
|
||||
private String dressName;
|
||||
@SerializedName("dress_nameen")
|
||||
private String dress_nameen;
|
||||
@SerializedName("display_src")
|
||||
private Object displaySrc;
|
||||
@SerializedName("effect_src")
|
||||
@@ -95,6 +103,8 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
private Object nobleDress;
|
||||
@SerializedName("dress_msg")
|
||||
private String dressMsg;
|
||||
@SerializedName("dress_msg_en")
|
||||
private String dressMsgEN;
|
||||
@SerializedName("dress_colour")
|
||||
private String dressColour;
|
||||
@SerializedName("dress_threshold_value")
|
||||
@@ -119,11 +129,29 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftMsgen() {
|
||||
return giftMsgen;
|
||||
}
|
||||
|
||||
public SendBlindGiftEvent setGiftMsgen(String giftMsgen) {
|
||||
this.giftMsgen = giftMsgen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SendBlindGiftEvent setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDress_nameen() {
|
||||
return dress_nameen;
|
||||
}
|
||||
|
||||
public SendBlindGiftEvent setDress_nameen(String dress_nameen) {
|
||||
this.dress_nameen = dress_nameen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
@@ -530,6 +558,15 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressMsgEN() {
|
||||
return dressMsgEN;
|
||||
}
|
||||
|
||||
public SendBlindGiftEvent setDressMsgEN(String dressMsgEN) {
|
||||
this.dressMsgEN = dressMsgEN;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDressColour() {
|
||||
return dressColour;
|
||||
}
|
||||
@@ -556,4 +593,13 @@ public class SendBlindGiftEvent extends BaseModel {
|
||||
this.liveGiftNotify = liveGiftNotify;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getGiftname_en() {
|
||||
return TextUtils.isEmpty(giftname_en)?giftnameen:giftname_en;
|
||||
}
|
||||
|
||||
public SendBlindGiftEvent setGiftname_en(String giftname_en) {
|
||||
this.giftname_en = giftname_en;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class ShowHideEvent extends BaseModel {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SudGameListDissMissEvent extends BaseModel {
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SudGameListEvent extends BaseModel {
|
||||
private long interactionID = 0;
|
||||
private String title;
|
||||
private String id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public SudGameListEvent setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public SudGameListEvent setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getInteractionID() {
|
||||
return interactionID;
|
||||
}
|
||||
|
||||
public SudGameListEvent setInteractionID(long interactionID) {
|
||||
this.interactionID = interactionID;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SudGameListRefreshEvent extends BaseModel {
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class SudGameListSillEvent extends BaseModel {
|
||||
private String sillName;
|
||||
private String sill;
|
||||
|
||||
public String getSillName() {
|
||||
return sillName;
|
||||
}
|
||||
|
||||
public SudGameListSillEvent setSillName(String sillName) {
|
||||
this.sillName = sillName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSill() {
|
||||
return sill;
|
||||
}
|
||||
|
||||
public SudGameListSillEvent setSill(String sill) {
|
||||
this.sill = sill;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
|
||||
public class SudRoomListModelEvent extends BaseModel {
|
||||
private SudRoomListModel model;
|
||||
|
||||
public SudRoomListModel getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public SudRoomListModelEvent setModel(SudRoomListModel model) {
|
||||
this.model = model;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -46,16 +46,16 @@ public class GoogleFragment extends Fragment {
|
||||
public GoogleFragment() {
|
||||
}
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public GoogleFragment(String urls) {
|
||||
url = urls;
|
||||
Log.e("google", "111aa");
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
//通过参数中的布局填充获取对应布局
|
||||
view = inflater.inflate(R.layout.activity_recharge, container, false);
|
||||
|
||||
assert getArguments() != null;
|
||||
url = getArguments().getString("url");
|
||||
|
||||
|
||||
if(StringUtil.isEmpty(url)){
|
||||
Log.e(TAG, "URL为空" );
|
||||
return view;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.common.views.HintCustomPopup;
|
||||
import com.yunbao.common.views.LiveNewWishGiftPopup;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
@@ -82,7 +83,7 @@ public class LiveNewWishListFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(getActivity().getString(R.string.net_error));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -149,12 +150,12 @@ public class LiveNewWishListFragment extends BaseFragment {
|
||||
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
ToastUtil.show("修改成功");
|
||||
ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
} else if (wishList2.size() == 1) {
|
||||
@@ -174,38 +175,38 @@ public class LiveNewWishListFragment extends BaseFragment {
|
||||
public void onCancel() {
|
||||
|
||||
if (wishList2.size() > 10) {
|
||||
ToastUtil.show(R.string.must_hint);
|
||||
ToastUtil.show(getActivity().getString(R.string.must_hint));
|
||||
return;
|
||||
}
|
||||
LiveNetManager.get(getContext()).
|
||||
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
ToastUtil.show("修改成功");
|
||||
ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
}
|
||||
})).show();
|
||||
} else {
|
||||
if (wishList2.size() > 10) {
|
||||
ToastUtil.show(R.string.must_hint);
|
||||
ToastUtil.show(getContext().getString(R.string.must_hint));
|
||||
return;
|
||||
}
|
||||
LiveNetManager.get(getContext()).
|
||||
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
ToastUtil.show("修改成功");
|
||||
ToastUtil.show(WordUtil.isNewZh()?"修改成功":"Success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -81,20 +81,20 @@ public class ProcessFragment extends Fragment {
|
||||
switch (permission) {
|
||||
case Manifest.permission.READ_EXTERNAL_STORAGE:
|
||||
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
|
||||
ToastUtil.show(R.string.permission_storage_refused);
|
||||
ToastUtil.show(getActivity().getString(R.string.permission_storage_refused));
|
||||
break;
|
||||
case Manifest.permission.CAMERA:
|
||||
ToastUtil.show(R.string.permission_camera_refused);
|
||||
ToastUtil.show(getActivity().getString(R.string.permission_camera_refused));
|
||||
break;
|
||||
case Manifest.permission.RECORD_AUDIO:
|
||||
ToastUtil.show(R.string.permission_record_audio_refused);
|
||||
ToastUtil.show(getActivity().getString(R.string.permission_record_audio_refused));
|
||||
break;
|
||||
case Manifest.permission.ACCESS_COARSE_LOCATION:
|
||||
ToastUtil.show(R.string.permission_location_refused);
|
||||
ToastUtil.show(getActivity().getString(R.string.permission_location_refused));
|
||||
CommonAppConfig.getInstance().clearLocationInfo();
|
||||
break;
|
||||
case Manifest.permission.READ_PHONE_STATE:
|
||||
ToastUtil.show(R.string.permission_read_phone_state_refused);
|
||||
ToastUtil.show(getActivity().getString(R.string.permission_read_phone_state_refused));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,24 +26,23 @@ public class WalletFragment extends Fragment {
|
||||
|
||||
private WebView rlWebview;
|
||||
private String url;
|
||||
private Activity mContext;
|
||||
|
||||
@SuppressLint("ValidFragment")
|
||||
public WalletFragment(Activity context, String urls) {
|
||||
Log.e("google", "222aa");
|
||||
url = urls;
|
||||
mContext = context;
|
||||
public WalletFragment() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
//通过参数中的布局填充获取对应布局
|
||||
|
||||
assert getArguments() != null;
|
||||
url = getArguments().getString("url");
|
||||
|
||||
view = inflater.inflate(R.layout.activity_recharge, container, false);
|
||||
rlWebview = (WebView) view.findViewById(R.id.rlWebview);
|
||||
Log.e("ttt", url);
|
||||
rlWebview.loadUrl(url);
|
||||
|
||||
|
||||
WebSettings webSettings = rlWebview.getSettings();
|
||||
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
@@ -54,7 +53,7 @@ public class WalletFragment extends Fragment {
|
||||
webSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
|
||||
|
||||
|
||||
rlWebview.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(mContext, rlWebview).setPageClose(true), "androidObject");
|
||||
rlWebview.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext(getActivity(), rlWebview).setPageClose(true), "androidObject");
|
||||
|
||||
TestWebViewClient testWebViewClient = new TestWebViewClient(getActivity(), rlWebview);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.lzy.okgo.callback.StringCallback;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.ErrorActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
@@ -162,7 +163,7 @@ public class CommonHttpUtil {
|
||||
} else {
|
||||
locale = IMLoginManager.get(context).getLocaleLanguage();
|
||||
}
|
||||
if (locale.getLanguage().equals("zh")) {
|
||||
if (WordUtil.isNewZh()) {
|
||||
lang = "chinese";
|
||||
|
||||
} else {
|
||||
@@ -260,6 +261,8 @@ public class CommonHttpUtil {
|
||||
AppManager.getInstance().AppExit();
|
||||
}
|
||||
}).build().show();
|
||||
} else {
|
||||
ToastUtil.show(context.getString(R.string.net_error) + "code:" + code + " msg:" + msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import com.google.gson.Gson;
|
||||
import com.lzy.okgo.callback.AbsCallback;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.base.Request;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketException;
|
||||
@@ -36,7 +36,7 @@ public abstract class HttpCallback extends AbsCallback<JsonBean> {
|
||||
public void onSuccess(Response<JsonBean> response) {
|
||||
JsonBean bean = response.body();
|
||||
String gson = new Gson().toJson(bean);
|
||||
Log.e("onSuccess",gson);
|
||||
Log.e("onSuccess", gson);
|
||||
if (bean != null) {
|
||||
if (200 == bean.getRet()) {
|
||||
Data data = bean.getData();
|
||||
@@ -65,7 +65,7 @@ public abstract class HttpCallback extends AbsCallback<JsonBean> {
|
||||
t.printStackTrace();
|
||||
L.e("网络请求错误---->" + t.getClass() + " : " + t.getMessage());
|
||||
if (t instanceof SocketTimeoutException || t instanceof ConnectException || t instanceof UnknownHostException || t instanceof UnknownServiceException || t instanceof SocketException) {
|
||||
ToastUtil.show(R.string.load_failure);
|
||||
ToastUtil.show(WordUtil.isNewZh() ? "網絡請求失敗" : "Network request failed");
|
||||
}
|
||||
// if (showLoadingDialog() && mLoadingDialog != null) {
|
||||
// mLoadingDialog.dismiss();
|
||||
|
||||
@@ -6,10 +6,6 @@ import com.lzy.okgo.request.GetRequest;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
@@ -292,6 +288,7 @@ public class LiveHttpUtil {
|
||||
|
||||
/**
|
||||
* 主播或管理员禁言
|
||||
*
|
||||
* @param time 禁言时间 (分)
|
||||
*/
|
||||
public static void setShutUp(String liveUid, String stream, int type, String touid, String time, HttpCallback callback) {
|
||||
@@ -619,17 +616,19 @@ public class LiveHttpUtil {
|
||||
* 观众给主播送礼物
|
||||
*/
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, HttpCallback callback) {
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, 0, false,callback);
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, 0, false, callback);
|
||||
}
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false,callback);
|
||||
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, HttpCallback callback) {
|
||||
sendGift(by, liveUid, stream, giftId, giftCount, isContactGift, false, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 观众给主播送礼物
|
||||
*
|
||||
* @param isContactGift 是否为联系方式礼物
|
||||
*/
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift,HttpCallback callback) {
|
||||
public static void sendGift(String by, String liveUid, String stream, int giftId, String giftCount, int isContactGift, boolean isFansGroupGift, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.sendGift", LiveHttpConsts.SEND_GIFT)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
@@ -637,7 +636,20 @@ public class LiveHttpUtil {
|
||||
.params("isContactGift", isContactGift)
|
||||
.params("giftcount", giftCount)
|
||||
.params("isprank", by)
|
||||
.params("fans_exclusive_pack",isFansGroupGift?"1":"0")
|
||||
.params("fans_exclusive_pack", isFansGroupGift ? "1" : "0")
|
||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
public static void sendBlindBoxTicket(String by, String liveUid, String stream, int giftId, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Live.sendBlindBoxTicket", LiveHttpConsts.SEND_GIFT)
|
||||
.params("liveuid", liveUid)
|
||||
.params("stream", stream)
|
||||
.params("giftid", giftId)
|
||||
.params("isContactGift", 0)
|
||||
.params("giftcount", "1")
|
||||
.params("isprank", by)
|
||||
.params("fans_exclusive_pack", "0")
|
||||
.params("appVersion", CommonAppConfig.getInstance().getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
@@ -955,6 +967,16 @@ public class LiveHttpUtil {
|
||||
HttpClient.getInstance().get("Home.getFollow", "Home.getFollow")
|
||||
.params("p", p)
|
||||
.execute(callback);
|
||||
|
||||
}
|
||||
|
||||
public static void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid,int page,HttpCallback callback ) {
|
||||
HttpClient.getInstance().get("Sudgameserver.getRoomList", "Sudgameserver.getRoomList")
|
||||
.params("sud_game_id",sudGameId)
|
||||
.params("threshold",threshold)
|
||||
.params("room_holder_type",roomHolderType)
|
||||
.params("liveuid",liveUid)
|
||||
.params("page",page)
|
||||
.execute(callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.yunbao.common.bean.AnchorRecommendModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.ContributeModel;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
@@ -40,6 +42,7 @@ import com.yunbao.common.bean.MsgSwitchDetailModel;
|
||||
import com.yunbao.common.bean.NewPeopleInfo;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
@@ -53,6 +56,8 @@ import com.yunbao.common.bean.SearchModel;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.SlideInBannerModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
@@ -158,18 +163,23 @@ public interface PDLiveApi {
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Home.anchorRecommend ")
|
||||
@GET("/api/public/?service=Home.anchorRecommend")
|
||||
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
|
||||
@Query("num") String num
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Home.anchorRecommend")
|
||||
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
|
||||
@QueryMap Map<String, Object> map
|
||||
);
|
||||
|
||||
/**
|
||||
* 直播间上下滚动列表
|
||||
*
|
||||
* @param num 请求数量
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Home.anchorRecommend ")
|
||||
@GET("/api/public/?service=Home.anchorRecommend")
|
||||
Observable<ResponseModel<AnchorRecommendModel>> anchorRecommend(
|
||||
@Query("num") String num, @Query("type") String type
|
||||
);
|
||||
@@ -182,7 +192,7 @@ public interface PDLiveApi {
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getLiveInfo")
|
||||
Observable<ResponseModel<List<LiveInfoModel>>> getLiveInfo(
|
||||
@Query("liveuid") String liveuid
|
||||
@Query("liveuid") String liveui
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -296,7 +306,7 @@ public interface PDLiveApi {
|
||||
* 新侧边栏请求
|
||||
*/
|
||||
@GET("/api/public/?service=Live.getCustomSidebarInfo")
|
||||
Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo();
|
||||
Observable<ResponseModel<List<CustomSidebarInfoModel>>> getCustomSidebarInfo(@Query("type") String type);
|
||||
|
||||
/**
|
||||
* 任务领取接口
|
||||
@@ -766,18 +776,19 @@ public interface PDLiveApi {
|
||||
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
* 创建红包
|
||||
*/
|
||||
@GET("/api/public/?service=Live.createRedPacket")
|
||||
Observable<ResponseModel<Object>> createRedPacket(
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("is_fans") int needFansGroup,
|
||||
@Query("red_packet_money") String redPacketMoney,
|
||||
@Query("red_packet_quantity") String redPacketQuantity,
|
||||
@Query("conditions") String conditions
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取盲盒礼物当前数据
|
||||
* 获取红包数据
|
||||
*/
|
||||
@GET("/api/public/?service=Live.redPacketInfo")
|
||||
Observable<ResponseModel<RedPacketInfoModel>> redPacketInfo(
|
||||
@@ -968,5 +979,74 @@ public interface PDLiveApi {
|
||||
@GET("/api/public/?service=gift.getGiftNamingInfo")
|
||||
Observable<ResponseModel<GiftNamingInfoModel>> getGiftNamingInfo(@Query("gift_id") String giftId);
|
||||
|
||||
/**
|
||||
* 获取游戏code
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgame.getCode")
|
||||
Observable<ResponseModel<List<SudgameCodeModel>>> getCode();
|
||||
|
||||
/**
|
||||
* 创建游戏房
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.createSudRoom")
|
||||
Observable<ResponseModel<CreateSudRoomModel>> createSudRoom(
|
||||
@Query("room_name") String roomName,
|
||||
@Query("golden_bean_number") String goldenBeanNumber,
|
||||
@Query("game_id") String gameId);
|
||||
|
||||
/**
|
||||
* 获取游戏房列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.getRoomList")
|
||||
Observable<ResponseModel<List<SudRoomListModel>>> getRoomList(
|
||||
@Query("sud_game_id") String sudGameId,
|
||||
@Query("threshold") String threshold,
|
||||
@Query("room_holder_type") String roomHolderType,
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("page") int page
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取游戏房列表 - 搜索
|
||||
*/
|
||||
@GET("/api/public/?service=Sudgameserver.getRoomList")
|
||||
Observable<ResponseModel<List<SudRoomListModel>>> searchRoomList(
|
||||
@Query("sud_game_id") String sudGameId,
|
||||
@Query("threshold") String threshold,
|
||||
@Query("room_holder_type") String roomHolderType,
|
||||
@Query("liveuid") String liveUid,
|
||||
@Query("search") String search,
|
||||
@Query("page") int page
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.checkRemainingBalance")
|
||||
Observable<ResponseModel<CheckRemainingBalance>> checkRemainingBalance(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.randomRoom")
|
||||
Observable<ResponseModel<CreateSudRoomModel>> randomRoom(
|
||||
@Query("sud_game_id") String sudGameId,
|
||||
@Query("threshold") String threshold,
|
||||
@Query("room_holder_type") String roomHolderType
|
||||
);
|
||||
|
||||
@GET("/api/public/?service=Sudgameserver.checkRoomStatus")
|
||||
Observable<ResponseModel<CreateSudRoomModel>> checkRoomStatus(
|
||||
@Query("room_id") String roomId
|
||||
);
|
||||
|
||||
/**
|
||||
* 活动弹窗
|
||||
*/
|
||||
@GET("/api/public/?service=Home.activityPopup")
|
||||
Observable<ResponseModel<List<OpenAdModel>>> activityPopup();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.yunbao.common.bean.ActiveModel;
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
import com.yunbao.common.bean.BlindBoxInfoModel;
|
||||
import com.yunbao.common.bean.CheckLiveModel;
|
||||
import com.yunbao.common.bean.CheckRemainingBalance;
|
||||
import com.yunbao.common.bean.CreateSudRoomModel;
|
||||
import com.yunbao.common.bean.CustomSidebarInfoModel;
|
||||
import com.yunbao.common.bean.DiscountsModel;
|
||||
import com.yunbao.common.bean.EnterRoomNewModel;
|
||||
@@ -29,7 +31,6 @@ import com.yunbao.common.bean.LiveAiRobotBean;
|
||||
import com.yunbao.common.bean.LiveAnchorCallMeModel;
|
||||
import com.yunbao.common.bean.LiveAnchorSayModel;
|
||||
import com.yunbao.common.bean.LiveDataInfoModel;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveInfoModel;
|
||||
import com.yunbao.common.bean.LiveRoomActivityBanner;
|
||||
import com.yunbao.common.bean.LiveRoomVoteModel;
|
||||
@@ -39,6 +40,7 @@ import com.yunbao.common.bean.LiveUserMailBoxModel;
|
||||
import com.yunbao.common.bean.MedalAchievementModel;
|
||||
import com.yunbao.common.bean.NobleRankHideUserListModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.bean.PkRankBean;
|
||||
import com.yunbao.common.bean.PrankGiftBean;
|
||||
import com.yunbao.common.bean.PrankHttpTurntableBean;
|
||||
@@ -50,6 +52,8 @@ import com.yunbao.common.bean.RedPacketInfoModel;
|
||||
import com.yunbao.common.bean.RedPacketListBean;
|
||||
import com.yunbao.common.bean.SetAttentsModel;
|
||||
import com.yunbao.common.bean.StarChallengeStatusModel;
|
||||
import com.yunbao.common.bean.SudRoomListModel;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserAvatarSelectBean;
|
||||
import com.yunbao.common.bean.VipModel;
|
||||
@@ -314,9 +318,9 @@ public class LiveNetManager {
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
public void getCustomSidebarInfo(HttpCallback<List<CustomSidebarInfoModel>> callback) {
|
||||
public void getCustomSidebarInfo(String type, HttpCallback<List<CustomSidebarInfoModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getCustomSidebarInfo()
|
||||
.getCustomSidebarInfo(type)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(listResponseModel -> callback.onSuccess(listResponseModel.getData().getInfo()), throwable -> {
|
||||
@@ -1631,10 +1635,11 @@ public class LiveNetManager {
|
||||
* @param redPacketMoney 红包金额
|
||||
* @param redPacketQuantity 红包数量
|
||||
* @param conditions 红包领取条件 0.无 1.关注主播
|
||||
* @param needFansGroup 是否需要加入粉丝团条件
|
||||
*/
|
||||
public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, HttpCallback<String> callback) {
|
||||
public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, boolean needFansGroup, HttpCallback<String> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createRedPacket(liveUid, redPacketMoney, redPacketQuantity, conditions)
|
||||
.createRedPacket(liveUid, needFansGroup ? 1 : 0, redPacketMoney, redPacketQuantity, conditions)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<Object>>() {
|
||||
@@ -1931,7 +1936,7 @@ public class LiveNetManager {
|
||||
|
||||
public void giftDetail(String liveUid, String giftId, String toUid, HttpCallback<GiftWallGiftDetail> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.giftDetail(liveUid, giftId,toUid)
|
||||
.giftDetail(liveUid, giftId, toUid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<GiftWallGiftDetail>>() {
|
||||
@@ -2171,7 +2176,7 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getGiftNamingInfo(String giftId,HttpCallback<GiftNamingInfoModel> callback) {
|
||||
public void getGiftNamingInfo(String giftId, HttpCallback<GiftNamingInfoModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getGiftNamingInfo(giftId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -2179,7 +2184,7 @@ public class LiveNetManager {
|
||||
.subscribe(new Consumer<ResponseModel<GiftNamingInfoModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<GiftNamingInfoModel> liveGiftBeanResponseModel) throws Exception {
|
||||
if (callback!=null){
|
||||
if (callback != null) {
|
||||
callback.onSuccess(liveGiftBeanResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
@@ -2193,6 +2198,190 @@ public class LiveNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void activityPopup(HttpCallback<List<OpenAdModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.activityPopup()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<OpenAdModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<OpenAdModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getCode(HttpCallback<List<SudgameCodeModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getCode()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudgameCodeModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SudgameCodeModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void createSudRoom(String roomName, String goldenBeanNumber, String gameId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.createSudRoom(roomName, goldenBeanNumber, gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
if (createSudRoomModelResponseModel.getData().getCode() == 0) {
|
||||
callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo());
|
||||
} else {
|
||||
callback.onError(createSudRoomModelResponseModel.getData().getMsg());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void randomRoom(String sudGameId, String threshold, String roomHolderType, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.randomRoom(sudGameId, threshold, roomHolderType)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkRoomStatus(String roomId, HttpCallback<CreateSudRoomModel> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkRoomStatus(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CreateSudRoomModel>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CreateSudRoomModel> createSudRoomModelResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void getRoomList(String sudGameId, String threshold, String roomHolderType, String liveUid, int page, HttpCallback<List<SudRoomListModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.getRoomList(sudGameId, threshold, roomHolderType, liveUid, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudRoomListModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SudRoomListModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void searchRoomList(String sudGameId, String threshold, String roomHolderType, String search, int page, HttpCallback<List<SudRoomListModel>> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.searchRoomList(sudGameId, threshold, roomHolderType, "0", search, page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<List<SudRoomListModel>>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<List<SudRoomListModel>> listResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(listResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void checkRemainingBalance(String roomId, HttpCallback<CheckRemainingBalance> callback) {
|
||||
API.get().pdLiveApi(mContext)
|
||||
.checkRemainingBalance(roomId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseModel<CheckRemainingBalance>>() {
|
||||
@Override
|
||||
public void accept(ResponseModel<CheckRemainingBalance> checkRemainingBalanceResponseModel) throws Exception {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo());
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
throwable.printStackTrace();
|
||||
if (callback != null) {
|
||||
callback.onError(mContext.getString(R.string.net_error));
|
||||
}
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播间取消网络请求
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,9 @@ import com.yunbao.common.http.ResponseData;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
@@ -115,6 +117,22 @@ public class MainNetManager {
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
public void anchorRecommend(Map<String, Object> map, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(anchorRecommendModelResponseModel -> {
|
||||
if (httpCallback != null) {
|
||||
AnchorRecommendModel model = anchorRecommendModelResponseModel.getData().getInfo();
|
||||
httpCallback.onSuccess(model);
|
||||
}
|
||||
}, throwable -> {
|
||||
if (httpCallback != null) {
|
||||
httpCallback.onError(throwable.getMessage());
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 猜你喜欢
|
||||
*
|
||||
@@ -122,7 +140,11 @@ public class MainNetManager {
|
||||
* @return
|
||||
*/
|
||||
public void anchorRecommendType(String num, HttpCallback<AnchorRecommendModel> httpCallback) {
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(num, "1")
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("num", num);
|
||||
map.put("live_recommend", "slide");
|
||||
map.put("type", "1");
|
||||
API.get().pdLiveApi(mContext).anchorRecommend(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(anchorRecommendModelResponseModel -> {
|
||||
@@ -266,6 +288,7 @@ public class MainNetManager {
|
||||
}
|
||||
}).isDisposed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间上下滑动红包集合
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.umeng.analytics.MobclickAgent;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
@@ -50,6 +51,32 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
private final String LIVE_NOTIFY_SETTINGS = "liveNotifySettings";//开播通知
|
||||
|
||||
private final String KEY_LANGUAGE = "language";
|
||||
private final String KEY_GAME = "key_game";
|
||||
|
||||
public void setRedPoint() {
|
||||
put("RedPoint", "1");
|
||||
}
|
||||
|
||||
public boolean getRedPoint() {
|
||||
return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1");
|
||||
}
|
||||
|
||||
public void setSudGameMin() {
|
||||
put("SudGameMin", "0");
|
||||
}
|
||||
|
||||
public boolean getSudGameMin() {
|
||||
return !TextUtils.isEmpty(getString("SudGameMin")) && !TextUtils.equals(getString("SudGameMin"), "1");
|
||||
}
|
||||
|
||||
public void setSudGame(String sudGameJson) {
|
||||
put(KEY_GAME, sudGameJson);
|
||||
}
|
||||
|
||||
|
||||
public String getSudGame() {
|
||||
return getString(KEY_GAME);
|
||||
}
|
||||
|
||||
public void setLanguage(boolean isEnglish) {
|
||||
put(KEY_LANGUAGE, isEnglish);
|
||||
@@ -301,6 +328,8 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
* @param model
|
||||
*/
|
||||
public void setupLoginUser(@NonNull IMLoginModel model) {
|
||||
//当用户使用自有账号登录时,可以这样统计:
|
||||
MobclickAgent.onProfileSignIn(String.valueOf(model.getId()));
|
||||
this.userInfo = model;
|
||||
if (userInfo != null && !TextUtils.isEmpty(userInfo.getToken())) {
|
||||
token = userInfo.getToken();
|
||||
@@ -430,6 +459,8 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
// IMCenter.getInstance().clearConversations(null, Conversation.ConversationType.PRIVATE);
|
||||
RongcloudIMManager.logoutIM();
|
||||
MessageIMManager.get(activity).logout();
|
||||
//登出
|
||||
MobclickAgent.onProfileSignOff();
|
||||
put(IS_HINT, 0);
|
||||
APPEasyFloat.getInstance().dismiss(activity);
|
||||
if (EasyFloat.isShow("LiveFloatView")) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -100,7 +101,11 @@ public class IMRTCManager {
|
||||
public void onSuccess() {
|
||||
callback.onSuccess();
|
||||
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||
ToastUtil.show("发起邀请成功");
|
||||
if(WordUtil.isNewZh()) {
|
||||
ToastUtil.show("发起邀请成功");
|
||||
}else{
|
||||
ToastUtil.show("successful");
|
||||
}
|
||||
}
|
||||
requestUid.add(liveUid);
|
||||
startRequestTimeoutTask(liveUid);
|
||||
@@ -109,7 +114,11 @@ public class IMRTCManager {
|
||||
@Override
|
||||
public void onFailed(RTCErrorCode errorCode) {
|
||||
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||
ToastUtil.show("邀请失败 " + errorCode.getValue());
|
||||
if(WordUtil.isNewZh()) {
|
||||
ToastUtil.show("邀请失败 " + errorCode.getValue());
|
||||
}else{
|
||||
ToastUtil.show("invite failed:" +errorCode.getValue());
|
||||
}
|
||||
}
|
||||
if (RandomPkManager.getInstance().isRequestPk()) {
|
||||
RandomPkManager.getInstance().setPkStatus(RandomPkManager.PK_STATUS_REFUSE);
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 连麦用户申请列表维护
|
||||
*/
|
||||
public class MicUserManager extends BaseCacheManager {
|
||||
private String micKey = "TYPE_MIC_REQUEST";
|
||||
private List<UserBean> micUsers = new ArrayList<>();
|
||||
private static MicUserManager manager;
|
||||
|
||||
public MicUserManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public static MicUserManager get() {
|
||||
if (null == manager) {
|
||||
manager = new MicUserManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void upDataMicUser(JSONObject map) {
|
||||
boolean isHave = false;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), map.getString("uid"))) {
|
||||
isHave = true;
|
||||
}
|
||||
}
|
||||
if (!isHave){
|
||||
UserBean userModel = new UserBean();
|
||||
|
||||
UserBean.DressBean dressAvatar = null;
|
||||
if (!TextUtils.isEmpty(map.getString("dress_avatar"))) {
|
||||
dressAvatar = new UserBean.DressBean();
|
||||
dressAvatar.setAvatar_frame(map.getString("dress_avatar"));
|
||||
}
|
||||
|
||||
userModel.setAvatar(map.getString("avatar"));
|
||||
userModel.setId(map.getString("uid"));
|
||||
userModel.setUserNiceName(map.getString("uname"));
|
||||
userModel.setDress(dressAvatar);
|
||||
userModel.setSex(map.getIntValue("sex"));
|
||||
userModel.setLevel(map.getIntValue("level"));
|
||||
userModel.setTypeMic(2);
|
||||
micUsers.add(userModel);
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<UserBean> getMicUserList() {
|
||||
if (micUsers.size() < 1) {
|
||||
micUsers = getList(micKey, new TypeToken<List<UserBean>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
return micUsers;
|
||||
}
|
||||
|
||||
public void removeMiscUser(JSONObject map) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), map.getString("uid"))) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeMiscUser(String uid) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), uid)) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeAllMicUserList() {
|
||||
deleteByKey(micKey);
|
||||
micUsers.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.LinkMicUserBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 处于连麦中的人员维护列表
|
||||
*/
|
||||
public class MicedUserManager extends BaseCacheManager {
|
||||
private String micKey = "TYPE_MIC_LIST";
|
||||
private List<UserBean> micUsers = new ArrayList<>();
|
||||
|
||||
public MicedUserManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private static MicedUserManager manager;
|
||||
|
||||
|
||||
public static MicedUserManager get() {
|
||||
if (null == manager) {
|
||||
manager = new MicedUserManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
||||
public void upDataMicUserList(List<LinkMicUserBean> list) {
|
||||
micUsers.clear();
|
||||
if (list == null || list.size() < 1) return;
|
||||
for (LinkMicUserBean linkMicUserBean : list) {
|
||||
if (!TextUtils.equals(linkMicUserBean.getId(),
|
||||
String.valueOf(IMLoginManager.get(
|
||||
CommonAppContext.sInstance.getBaseContext()).
|
||||
getUserInfo().getId()))) {
|
||||
|
||||
UserBean userModel = new UserBean();
|
||||
UserBean.DressBean dressAvatar = null;
|
||||
if (!TextUtils.isEmpty(linkMicUserBean.getDressAvatar())) {
|
||||
dressAvatar = new UserBean.DressBean();
|
||||
dressAvatar.setAvatar_frame(linkMicUserBean.getDressAvatar());
|
||||
}
|
||||
|
||||
userModel.setAvatar(linkMicUserBean.getAvatar());
|
||||
userModel.setId(linkMicUserBean.getId());
|
||||
userModel.setUserNiceName(linkMicUserBean.getUserNicename());
|
||||
userModel.setSex(linkMicUserBean.getSex());
|
||||
userModel.setDress(dressAvatar);
|
||||
userModel.setLevel(linkMicUserBean.getLevel());
|
||||
userModel.setTypeMic(1);
|
||||
micUsers.add(userModel);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public void removeMiscUser(String uid) {
|
||||
micUsers = getMicUserList();
|
||||
if (micUsers == null) return;
|
||||
for (int i = 0; i < micUsers.size(); i++) {
|
||||
if (TextUtils.equals(micUsers.get(i).getId(), uid)) {
|
||||
micUsers.remove(i);
|
||||
}
|
||||
}
|
||||
put(micKey, micUsers);
|
||||
}
|
||||
|
||||
public List<UserBean> getMicUserList() {
|
||||
if (micUsers.size() < 1) {
|
||||
micUsers = getList(micKey, new TypeToken<List<UserBean>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
return micUsers;
|
||||
}
|
||||
|
||||
public void removeAllMicUserList() {
|
||||
deleteByKey(micKey);
|
||||
micUsers.clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.OpenAdModel;
|
||||
import com.yunbao.common.dialog.OpenAdBottomDialogPopup;
|
||||
import com.yunbao.common.dialog.OpenAdCenterDialogPopup;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class OpenAdManager {
|
||||
public static final int TYPE_HOME = 1;
|
||||
public static final int TYPE_LIVE = 2;
|
||||
private static final String TAG = "-----弹窗-----";
|
||||
private Map<Integer, Boolean> showMap;
|
||||
private List<OpenAdModel> list = null;
|
||||
private Handler handler = new Handler(Looper.getMainLooper());
|
||||
private Map<Integer, AdRunnable> runnableMap = new HashMap<>();
|
||||
private int showType;
|
||||
|
||||
private OpenAdManager() {
|
||||
showMap = new HashMap<>();
|
||||
init(false);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
dismiss();
|
||||
runnableMap.clear();
|
||||
showMap.clear();
|
||||
list.clear();
|
||||
}
|
||||
|
||||
private static final class MInstanceHolder {
|
||||
static final OpenAdManager mInstance = new OpenAdManager();
|
||||
}
|
||||
|
||||
public static OpenAdManager getInstance() {
|
||||
return MInstanceHolder.mInstance;
|
||||
}
|
||||
|
||||
private void init(boolean isShow) {
|
||||
if (list != null && list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Context context = CommonAppContext.getTopActivity();
|
||||
if (context == null) {
|
||||
context = CommonAppContext.sInstance;
|
||||
}
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
LiveNetManager.get(context).activityPopup(new HttpCallback<List<OpenAdModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<OpenAdModel> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
Log.i(TAG, "onSuccess: 没有数据");
|
||||
list = new ArrayList<>();
|
||||
return;
|
||||
}
|
||||
list = data;
|
||||
if (isShow) {
|
||||
show(TYPE_HOME, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
System.err.println("弹框列表:" + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public synchronized void show(int type, boolean isGuard) {
|
||||
if (list == null) {
|
||||
init(true);
|
||||
return;
|
||||
}
|
||||
showType = type;
|
||||
for (OpenAdModel model : list) {
|
||||
if (model.getType() == type) {
|
||||
if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
|
||||
continue;
|
||||
}
|
||||
if (runnableMap.containsKey(model.getId())) {
|
||||
AdRunnable runnable = runnableMap.get(model.getId());
|
||||
if (runnable != null) {
|
||||
Log.d(TAG, "reset: " + model);
|
||||
handler.removeCallbacks(runnable);
|
||||
runnableMap.remove(model.getId());
|
||||
}
|
||||
}
|
||||
|
||||
if (!isShow(model)) {
|
||||
Log.i(TAG, "show: " + model);
|
||||
handler.postDelayed(new AdRunnable(model), model.getDelayShowTime());
|
||||
} else {
|
||||
Log.i(TAG, "notshow: " + model);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "------------------------------");
|
||||
|
||||
}
|
||||
|
||||
public synchronized void dismiss() {
|
||||
Log.d(TAG, "准备dismiss:" + runnableMap.size());
|
||||
for (Integer model : runnableMap.keySet()) {
|
||||
AdRunnable runnable = runnableMap.get(model);
|
||||
Log.d(TAG, "dismiss:" + runnable);
|
||||
if (runnable != null) {
|
||||
runnable.dismiss();
|
||||
handler.removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
runnableMap.clear();
|
||||
}
|
||||
|
||||
private synchronized boolean isShow(OpenAdModel type) {
|
||||
if (showMap.containsKey(type.getId()) && showMap.get(type.getId()) != null) {
|
||||
return Boolean.TRUE.equals(showMap.get(type.getId()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class AdRunnable implements Runnable {
|
||||
OpenAdModel model;
|
||||
|
||||
public AdRunnable(OpenAdModel model) {
|
||||
this.model = model;
|
||||
runnableMap.put(model.getId(), this);
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
Log.e(TAG, "dismiss: " + model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
Log.i(TAG, "run: " + model);
|
||||
if (model == null) {
|
||||
ToastUtil.showDebug("model为空");
|
||||
return;
|
||||
}
|
||||
if (!model.isInTime()) {
|
||||
ToastUtil.showDebug("不在展示时间内:" + model.getStartTime() + "|" + model.getEndTime());
|
||||
return;
|
||||
}
|
||||
if (isShow(model)) {
|
||||
ToastUtil.showDebug(model.getId() + "|model展示过了");
|
||||
return;
|
||||
}
|
||||
if (model.getType() != showType) {
|
||||
return;
|
||||
}
|
||||
showMap.put(model.getId(), true);
|
||||
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
|
||||
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
}).showDialog();
|
||||
} else {
|
||||
new OpenAdCenterDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
|
||||
}).showDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.yunbao.common.bean.RankPkInfoBean;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -342,7 +343,7 @@ public class RandomPkManager {
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.yunbao.common.pay;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
@@ -18,13 +18,14 @@ import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.event.CoinChangeEvent;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.pay.ali.AliPayBuilder;
|
||||
import com.yunbao.common.pay.wx.WxPayBuilder;
|
||||
import com.yunbao.common.utils.GoogleBillingUtil;
|
||||
import com.yunbao.common.utils.OnGoogleBillingListener;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -48,16 +49,16 @@ public class PayPresenter {
|
||||
|
||||
|
||||
private GoogleBillingUtil googleBillingUtil;
|
||||
private String TAG="PayPresenter";
|
||||
private String [] arrPro = {"1"};
|
||||
private String TAG = "PayPresenter";
|
||||
private String[] arrPro = {"1"};
|
||||
private String mOrderid;
|
||||
|
||||
public PayPresenter(Activity activity) {
|
||||
mActivity = new WeakReference<>(activity).get();
|
||||
}
|
||||
|
||||
public void setPayCallback(PayCallback callback){
|
||||
mPayCallback=callback;
|
||||
public void setPayCallback(PayCallback callback) {
|
||||
mPayCallback = callback;
|
||||
}
|
||||
|
||||
public long getBalanceValue() {
|
||||
@@ -96,9 +97,10 @@ public class PayPresenter {
|
||||
public void setAliCallbackUrl(String aliCallbackUrl) {
|
||||
mAliCallbackUrl = aliCallbackUrl;
|
||||
}
|
||||
|
||||
public void pay(String payType, String money, String goodsName, String orderParams) {
|
||||
if (TextUtils.isEmpty(payType)) {
|
||||
ToastUtil.show(R.string.wallet_tip_5);
|
||||
ToastUtil.show(mActivity.getString(R.string.wallet_tip_5));
|
||||
return;
|
||||
}
|
||||
//L.e("《==》支付按钮4--->" +payType);
|
||||
@@ -128,40 +130,42 @@ public class PayPresenter {
|
||||
case Constants.PAY_TYPE_GOOGLE://google支付
|
||||
googlePay(orderParams);
|
||||
break;
|
||||
default:
|
||||
otherPay(orderParams,payType);
|
||||
break;
|
||||
default:
|
||||
otherPay(orderParams, payType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//谷歌支付
|
||||
private void googlePay(String orderParams) {
|
||||
mOrderid="1";
|
||||
String pid="2";
|
||||
if (pid != null && !pid.isEmpty()){
|
||||
arrPro[0]=pid;
|
||||
mOrderid = "1";
|
||||
String pid = "2";
|
||||
if (pid != null && !pid.isEmpty()) {
|
||||
arrPro[0] = pid;
|
||||
initGooglePay();
|
||||
}
|
||||
|
||||
String newParm= StringUtil.contact("Charge.getGoogleOrder",orderParams,"&type=android",
|
||||
"&appname=",mActivity.getString(R.string.app_name),
|
||||
"&desc="+mActivity.getPackageName()+"&source=android"
|
||||
String newParm = StringUtil.contact("Charge.getGoogleOrder", orderParams, "&type=android",
|
||||
"&appname=", mActivity.getString(R.string.app_name),
|
||||
"&desc=" + mActivity.getPackageName() + "&source=android"
|
||||
);
|
||||
CommonHttpUtil.getWxH5Order(newParm, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code==0){
|
||||
if (code == 0) {
|
||||
try {
|
||||
ToastUtil.show("开始支付,请稍后");
|
||||
org.json.JSONObject jsonObject=new org.json.JSONObject(info[0]);
|
||||
mOrderid=jsonObject.getString("orderid");
|
||||
String pid=jsonObject.getString("pid");
|
||||
if (pid != null && !pid.isEmpty()){
|
||||
arrPro[0]=pid;
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(info[0]);
|
||||
mOrderid = jsonObject.getString("orderid");
|
||||
String pid = jsonObject.getString("pid");
|
||||
if (pid != null && !pid.isEmpty()) {
|
||||
arrPro[0] = pid;
|
||||
initGooglePay();
|
||||
}
|
||||
}catch (Exception e){ e.printStackTrace(); }
|
||||
}else {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show("无法支付,请联系客服");
|
||||
}
|
||||
|
||||
@@ -171,7 +175,7 @@ public class PayPresenter {
|
||||
|
||||
private void initGooglePay() {
|
||||
GoogleBillingUtil.isDebug(true);
|
||||
GoogleBillingUtil.setSkus(arrPro,null);
|
||||
GoogleBillingUtil.setSkus(arrPro, null);
|
||||
GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买
|
||||
googleBillingUtil = GoogleBillingUtil.getInstance()
|
||||
.addOnGoogleBillingListener(mActivity, mOnMyGoogleBillingListener)
|
||||
@@ -179,35 +183,35 @@ public class PayPresenter {
|
||||
}
|
||||
|
||||
private void paypalPay(String orderParams) {
|
||||
String url1="/index.php?m=App&a=paypal" +orderParams +"&source=android";
|
||||
String url2= CommonAppConfig.HOST+url1;
|
||||
String url1 = "/index.php?m=App&a=paypal" + orderParams + "&source=android";
|
||||
String url2 = CommonAppConfig.HOST + url1;
|
||||
open(url2);
|
||||
}
|
||||
|
||||
private void payssionPay(String orderParams) {
|
||||
String url1="/index.php?m=App&a=pay" +orderParams +"&source=android";
|
||||
String url2= CommonAppConfig.HOST+url1;
|
||||
String url1 = "/index.php?m=App&a=pay" + orderParams + "&source=android";
|
||||
String url2 = CommonAppConfig.HOST + url1;
|
||||
open(url2);
|
||||
|
||||
}
|
||||
|
||||
private void yunquPay(String orderParams) {
|
||||
String newParm= StringUtil.contact("Charge.getYunquOrder",orderParams,"&type=android",
|
||||
"&appname=",mActivity.getString(R.string.app_name),
|
||||
"&desc="+mActivity.getPackageName()+"&source=android"
|
||||
String newParm = StringUtil.contact("Charge.getYunquOrder", orderParams, "&type=android",
|
||||
"&appname=", mActivity.getString(R.string.app_name),
|
||||
"&desc=" + mActivity.getPackageName() + "&source=android"
|
||||
);
|
||||
//L.e("《==》支付URL--->" +newParm);
|
||||
CommonHttpUtil.getWxH5Order(newParm, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code==0){
|
||||
if (code == 0) {
|
||||
try {
|
||||
org.json.JSONObject jsonObject=new org.json.JSONObject(info[0]);
|
||||
String payment_url=jsonObject.getString("payment_url");
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(info[0]);
|
||||
String payment_url = jsonObject.getString("payment_url");
|
||||
open(payment_url);
|
||||
// L.e("《==》支付URL--->" +payment_url);
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -216,20 +220,20 @@ public class PayPresenter {
|
||||
}
|
||||
|
||||
private void hfbPay(String orderParams) {
|
||||
String newParm= StringUtil.contact("Charge.getWxH5Order",orderParams,"&type=android",
|
||||
"&appname=",mActivity.getString(R.string.app_name),
|
||||
"&desc="+mActivity.getPackageName()
|
||||
);
|
||||
String newParm = StringUtil.contact("Charge.getWxH5Order", orderParams, "&type=android",
|
||||
"&appname=", mActivity.getString(R.string.app_name),
|
||||
"&desc=" + mActivity.getPackageName()
|
||||
);
|
||||
|
||||
CommonHttpUtil.getCashierOrder(newParm, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code==0){
|
||||
if (code == 0) {
|
||||
try {
|
||||
org.json.JSONObject jsonObject=new org.json.JSONObject(info[0]);
|
||||
String redirectUrl=jsonObject.getString("redirectUrl");
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(info[0]);
|
||||
String redirectUrl = jsonObject.getString("redirectUrl");
|
||||
open(redirectUrl);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -237,66 +241,68 @@ public class PayPresenter {
|
||||
});
|
||||
}
|
||||
|
||||
public void open(String url){
|
||||
public void open(String url) {
|
||||
//支付时内部跳转 false要添加
|
||||
WebViewActivity.forward(mActivity,url,false,false);
|
||||
WebViewActivity.forward(mActivity, url, false, false);
|
||||
}
|
||||
|
||||
|
||||
private void hwPay(String orderParams) {
|
||||
String newParm= StringUtil.contact("Charge.getCashierOrder",orderParams,"&type=android",
|
||||
"&appname=",mActivity.getString(R.string.app_name),
|
||||
"&desc="+mActivity.getPackageName()+"&source=android"
|
||||
String newParm = StringUtil.contact("Charge.getCashierOrder", orderParams, "&type=android",
|
||||
"&appname=", mActivity.getString(R.string.app_name),
|
||||
"&desc=" + mActivity.getPackageName() + "&source=android"
|
||||
);
|
||||
//L.e("《==》支付URL--->" +newParm);
|
||||
CommonHttpUtil.getWxH5Order(newParm, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code==0){
|
||||
if (code == 0) {
|
||||
try {
|
||||
org.json.JSONObject jsonObject=new org.json.JSONObject(info[0]);
|
||||
String payment_url=jsonObject.getString("payment_url");
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(info[0]);
|
||||
String payment_url = jsonObject.getString("payment_url");
|
||||
open(payment_url);
|
||||
// L.e("《==》支付URL--->" +payment_url);
|
||||
// L.e("《==》支付URL--->" +payment_url);
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private void otherPay(String orderParams,String payType) {
|
||||
String newParm= StringUtil.contact("Charge.getOtherPayOrder",orderParams,"&type=android",
|
||||
"&appname=",mActivity.getString(R.string.app_name),
|
||||
"&desc="+mActivity.getPackageName()+"&source=android&payType="+payType
|
||||
|
||||
private void otherPay(String orderParams, String payType) {
|
||||
String newParm = StringUtil.contact("Charge.getOtherPayOrder", orderParams, "&type=android",
|
||||
"&appname=", mActivity.getString(R.string.app_name),
|
||||
"&desc=" + mActivity.getPackageName() + "&source=android&payType=" + payType
|
||||
);
|
||||
CommonHttpUtil.getWxH5Order(newParm, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code==0){
|
||||
if (code == 0) {
|
||||
try {
|
||||
org.json.JSONObject jsonObject=new org.json.JSONObject(info[0]);
|
||||
String payment_url=jsonObject.getString("payment_url");
|
||||
org.json.JSONObject jsonObject = new org.json.JSONObject(info[0]);
|
||||
String payment_url = jsonObject.getString("payment_url");
|
||||
open(payment_url);
|
||||
// L.e("《==》支付URL--->" +payment_url);
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝支付
|
||||
*/
|
||||
private void aliPay(String money, String goodsName, String orderParams) {
|
||||
if (mActivity == null || TextUtils.isEmpty(mServiceNameAli)|| TextUtils.isEmpty(mAliCallbackUrl)) {
|
||||
if (mActivity == null || TextUtils.isEmpty(mServiceNameAli) || TextUtils.isEmpty(mAliCallbackUrl)) {
|
||||
return;
|
||||
}
|
||||
// if (!CommonAppConfig.isAppExist(Constants.PACKAGE_NAME_ALI)) {
|
||||
// ToastUtil.show(R.string.coin_ali_not_install);
|
||||
// ToastUtil.show(mContext.getString(R.string.coin_ali_not_install);
|
||||
// return;
|
||||
// }
|
||||
if (TextUtils.isEmpty(mAliPartner) || TextUtils.isEmpty(mAliSellerId) || TextUtils.isEmpty(mAliPrivateKey)) {
|
||||
@@ -321,7 +327,7 @@ public class PayPresenter {
|
||||
return;
|
||||
}
|
||||
if (!CommonAppConfig.isAppExist(Constants.PACKAGE_NAME_WX)) {
|
||||
ToastUtil.show(R.string.coin_wx_not_install);
|
||||
ToastUtil.show(mActivity.getString(R.string.coin_wx_not_install));
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(mWxAppID)) {
|
||||
@@ -351,12 +357,12 @@ public class PayPresenter {
|
||||
long goldValue = Long.parseLong(goldCoin);
|
||||
if (balanceValue > mBalanceValue) {
|
||||
mBalanceValue = balanceValue;
|
||||
ToastUtil.show(R.string.coin_charge_success);
|
||||
ToastUtil.show(mActivity.getString(R.string.coin_charge_success));
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
if (u != null) {
|
||||
u.setCoin(coin);
|
||||
}
|
||||
EventBus.getDefault().post(new CoinChangeEvent(coin,goldCoin, true));
|
||||
EventBus.getDefault().post(new CoinChangeEvent(coin, goldCoin, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,11 +370,11 @@ public class PayPresenter {
|
||||
}
|
||||
|
||||
|
||||
private OnGoogleBillingListener mOnMyGoogleBillingListener=new OnGoogleBillingListener(){
|
||||
private OnGoogleBillingListener mOnMyGoogleBillingListener = new OnGoogleBillingListener() {
|
||||
@Override
|
||||
public void onSetupSuccess(boolean isSelf) {
|
||||
super.onSetupSuccess(isSelf);
|
||||
Log.d(TAG,"内购服务初始化完成");
|
||||
Log.d(TAG, "内购服务初始化完成");
|
||||
checkSubs();
|
||||
}
|
||||
|
||||
@@ -393,30 +399,30 @@ public class PayPresenter {
|
||||
// }
|
||||
// googleBillingUtil.purchaseInApp(mActivity,"zs640");
|
||||
|
||||
googleBillingUtil.purchaseInApp(mActivity,googleBillingUtil.getInAppSkuByPosition(0));
|
||||
googleBillingUtil.purchaseInApp(mActivity, googleBillingUtil.getInAppSkuByPosition(0));
|
||||
|
||||
// Log.d(TAG,tempBuffer.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPurchaseSuccess(@NonNull Purchase purchase, boolean isSelf) {
|
||||
StringBuffer tempBuffer =new StringBuffer();
|
||||
if(purchase.getPurchaseState()==Purchase.PurchaseState.PURCHASED){
|
||||
StringBuffer tempBuffer = new StringBuffer();
|
||||
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
||||
tempBuffer.append("购买成功:");
|
||||
//通知自己服务器
|
||||
if (mOrderid == null || purchase.getOrderId() == null){
|
||||
if (mOrderid == null || purchase.getOrderId() == null) {
|
||||
return false;
|
||||
}
|
||||
String allData="";
|
||||
allData="OrderId=" +purchase.getOrderId()+
|
||||
",PackageName="+purchase.getPackageName() +
|
||||
",Sku=" +"purchase.getSku()"+
|
||||
",PurchaseTime=" +purchase.getPurchaseTime()+
|
||||
",PurchaseToken=" +purchase.getPurchaseToken()+
|
||||
",DeveloperPayload=" +purchase.getDeveloperPayload()+
|
||||
",OriginalJson=" +purchase.getOriginalJson()+
|
||||
",PurchaseState=" +purchase.getPurchaseState()+
|
||||
",Signature="+purchase.getSignature();
|
||||
String allData = "";
|
||||
allData = "OrderId=" + purchase.getOrderId() +
|
||||
",PackageName=" + purchase.getPackageName() +
|
||||
",Sku=" + "purchase.getSku()" +
|
||||
",PurchaseTime=" + purchase.getPurchaseTime() +
|
||||
",PurchaseToken=" + purchase.getPurchaseToken() +
|
||||
",DeveloperPayload=" + purchase.getDeveloperPayload() +
|
||||
",OriginalJson=" + purchase.getOriginalJson() +
|
||||
",PurchaseState=" + purchase.getPurchaseState() +
|
||||
",Signature=" + purchase.getSignature();
|
||||
// CommonHttpUtil.notifyGoogle("1",mOrderid,purchase.getOrderId(),allData, new HttpCallback() {
|
||||
// @Override
|
||||
// public void onSuccess(int code, String msg, String[] info) {
|
||||
@@ -433,22 +439,21 @@ public class PayPresenter {
|
||||
// });
|
||||
|
||||
|
||||
}else{
|
||||
} else {
|
||||
tempBuffer.append("暂未支付:");
|
||||
}
|
||||
String details = String.format(Locale.getDefault(),"%s \n"," purchase.getSku()");
|
||||
String details = String.format(Locale.getDefault(), "%s \n", " purchase.getSku()");
|
||||
tempBuffer.append(details);
|
||||
Log.d(TAG,tempBuffer.toString());
|
||||
return true ;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时,该值才会生效)
|
||||
Log.d(TAG, tempBuffer.toString());
|
||||
return true;//自动消耗(只有当isSelf为true,并且支付状态为PURCHASED时,该值才会生效)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onRecheck(@NonNull String skuType, @NonNull Purchase purchase, boolean isSelf) {
|
||||
StringBuffer tempBuffer =new StringBuffer();
|
||||
StringBuffer tempBuffer = new StringBuffer();
|
||||
tempBuffer.append("检测到未处理的订单($skuType):${purchase.sku}()");
|
||||
Log.d(TAG,tempBuffer.toString());
|
||||
Log.d(TAG, tempBuffer.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -459,43 +464,43 @@ public class PayPresenter {
|
||||
|
||||
@Override
|
||||
public void onConsumeSuccess(@NonNull String purchaseToken, boolean isSelf) {
|
||||
Log.d(TAG,"消耗商品成功:$purchaseToken");
|
||||
Log.d(TAG, "消耗商品成功:$purchaseToken");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAcknowledgePurchaseSuccess(boolean isSelf) {
|
||||
Log.d(TAG,"确认购买商品成功");
|
||||
Log.d(TAG, "确认购买商品成功");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, int responseCode, boolean isSelf) {
|
||||
Log.d(TAG,"操作失败:tag=${" + tag.name() + "responseCode=" + responseCode);
|
||||
Log.d(TAG, "操作失败:tag=${" + tag.name() + "responseCode=" + responseCode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull GoogleBillingUtil.GoogleBillingListenerTag tag, boolean isSelf) {
|
||||
Log.d(TAG,"发生错误:tag="+tag.name());
|
||||
Log.d(TAG, "发生错误:tag=" + tag.name());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private void checkSubs() {
|
||||
int size = googleBillingUtil.getPurchasesSizeSubs(mActivity);
|
||||
switch (size){
|
||||
switch (size) {
|
||||
case 0:
|
||||
//不具备有效订阅
|
||||
Log.d(TAG,"有效订阅数:0(无有效订阅)");
|
||||
Log.d(TAG, "有效订阅数:0(无有效订阅)");
|
||||
break;
|
||||
case -1:
|
||||
//查询失败
|
||||
Log.d(TAG,"有效订阅数:-1(查询失败)");
|
||||
Log.d(TAG, "有效订阅数:-1(查询失败)");
|
||||
break;
|
||||
default:
|
||||
//具有有效订阅
|
||||
Log.d(TAG,"有效订阅数:$size(具备有效订阅)");
|
||||
Log.d(TAG, "有效订阅数:$size(具备有效订阅)");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -504,7 +509,7 @@ public class PayPresenter {
|
||||
mActivity = null;
|
||||
mPayCallback = null;
|
||||
|
||||
if (googleBillingUtil != null){
|
||||
if (googleBillingUtil != null) {
|
||||
googleBillingUtil.onDestroy(mActivity);
|
||||
//退出程序的时候可以调用(实验性)
|
||||
GoogleBillingUtil.endConnection();
|
||||
|
||||
@@ -80,12 +80,12 @@ public class WxPayBuilder {
|
||||
// req.sign = sign;
|
||||
// IWXAPI wxApi = WxApiWrapper.getInstance().getWxApi();
|
||||
// if (wxApi == null) {
|
||||
// ToastUtil.show(R.string.coin_charge_failed);
|
||||
// ToastUtil.show(mContext.getString(R.string.coin_charge_failed);
|
||||
// return;
|
||||
// }
|
||||
// boolean result = wxApi.sendReq(req);
|
||||
// if (!result) {
|
||||
// ToastUtil.show(R.string.coin_charge_failed);
|
||||
// ToastUtil.show(mContext.getString(R.string.coin_charge_failed);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
package com.yunbao.common.sud;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGCache;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGDecorator;
|
||||
import com.yunbao.common.sud.decorator.SudFSMMGListener;
|
||||
import com.yunbao.common.sud.decorator.SudFSTAPPDecorator;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.model.GameViewInfoModel;
|
||||
import com.yunbao.common.sud.state.MGStateResponse;
|
||||
import com.yunbao.common.utils.SudJsonUtils;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
import tech.sud.mgp.core.ISudFSTAPP;
|
||||
import tech.sud.mgp.core.ISudListenerInitSDK;
|
||||
import tech.sud.mgp.core.SudMGP;
|
||||
|
||||
/**
|
||||
* 游戏业务逻辑抽象类
|
||||
* 1.定自义ViewModel继承此类,实现对应方法。(注意:onAddGameView()与onRemoveGameView()与页面有交互)
|
||||
* 2.外部调用switchGame()方法启动游戏
|
||||
* 3.页面销毁时调用onDestroy()
|
||||
*/
|
||||
public abstract class BaseGameViewModel implements SudFSMMGListener {
|
||||
|
||||
private String gameRoomId; // 游戏房间id
|
||||
private long playingGameId; // 当前使用的游戏id
|
||||
public final SudFSTAPPDecorator sudFSTAPPDecorator = new SudFSTAPPDecorator(); // app调用sdk的封装类
|
||||
private final SudFSMMGDecorator sudFSMMGDecorator = new SudFSMMGDecorator(); // 用于处理游戏SDK部分回调业务
|
||||
|
||||
private boolean isRunning = true; // 业务是否还在运行
|
||||
public View gameView; // 游戏View
|
||||
public GameConfigModel gameConfigModel = new GameConfigModel(); // 游戏配置
|
||||
protected final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
/**
|
||||
* 外部调用切换游戏,传不同的gameId即可加载不同的游戏
|
||||
* gameId传0 等同于关闭游戏
|
||||
*
|
||||
* @param activity 游戏所在页面,用作于生命周期判断
|
||||
* @param gameRoomId 游戏房间id,房间隔离,同一房间才能一起游戏
|
||||
* @param gameId 游戏id,传入不同的游戏id,即可加载不同的游戏,传0等同于关闭游戏
|
||||
*/
|
||||
public void switchGame(Activity activity, String gameRoomId, long gameId) {
|
||||
if (TextUtils.isEmpty(gameRoomId)) {
|
||||
Toast.makeText(activity, "gameRoomId can not be empty", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
if (!isRunning) {
|
||||
return;
|
||||
}
|
||||
if (playingGameId == gameId && gameRoomId.equals(this.gameRoomId)) {
|
||||
return;
|
||||
}
|
||||
destroyMG();
|
||||
this.gameRoomId = gameRoomId;
|
||||
playingGameId = gameId;
|
||||
login(activity, gameId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第1步,获取短期令牌code,用于换取游戏Server访问APP Server的长期ssToken
|
||||
* 接入方客户端 调用 接入方服务端 login 获取 短期令牌code
|
||||
* 参考文档时序图:sud-mgp-doc(https://docs.sud.tech/zh-CN/app/Client/StartUp-Android.html)
|
||||
*
|
||||
* @param activity 游戏所在页面
|
||||
* @param gameId 游戏id
|
||||
*/
|
||||
private void login(Activity activity, long gameId) {
|
||||
if (activity.isDestroyed() || gameId <= 0) {
|
||||
return;
|
||||
}
|
||||
// 请求登录code
|
||||
getCode(activity, getUserId(), getAppId(), new GameGetCodeListener() {
|
||||
@Override
|
||||
public void onSuccess(String code) {
|
||||
if (!isRunning || gameId != playingGameId) {
|
||||
return;
|
||||
}
|
||||
initSdk(activity, gameId, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
delayLoadGame(activity, gameId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 第2步,初始化SudMGP sdk
|
||||
*
|
||||
* @param activity 游戏所在页面
|
||||
* @param gameId 游戏id
|
||||
* @param code 令牌
|
||||
*/
|
||||
private void initSdk(Activity activity, long gameId, String code) {
|
||||
String appId = getAppId();
|
||||
String appKey = getAppKey();
|
||||
boolean testEnv = isTestEnv();
|
||||
// 初始化sdk
|
||||
SudMGP.initSDK(activity, appId, appKey,testEnv, new ISudListenerInitSDK() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
loadGame(activity, code, gameId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(int errCode, String errMsg) {
|
||||
// TODO: 2022/6/13 下面toast可以根据业务需要决定是否保留
|
||||
if (isTestEnv()) {
|
||||
Toast.makeText(activity, "initSDK onFailure:" + errMsg + "(" + errCode + ")", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
delayLoadGame(activity, gameId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 第3步,加载游戏
|
||||
* APP和游戏的相互调用
|
||||
* ISudFSTAPP:APP调用游戏的接口
|
||||
* ISudFSMMG:游戏调APP的响应回调
|
||||
*
|
||||
* @param activity 游戏所在页面
|
||||
* @param code 登录令牌
|
||||
* @param gameId 游戏id
|
||||
*/
|
||||
private void loadGame(Activity activity, String code, long gameId) {
|
||||
if (activity.isDestroyed() || !isRunning || gameId != playingGameId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 给装饰类设置回调
|
||||
sudFSMMGDecorator.setSudFSMMGListener(this);
|
||||
|
||||
// 调用游戏sdk加载游戏
|
||||
ISudFSTAPP iSudFSTAPP = SudMGP.loadMG(activity, getUserId(), gameRoomId, code, gameId, getLanguageCode(), sudFSMMGDecorator);
|
||||
|
||||
// 如果返回空,则代表参数问题或者非主线程
|
||||
if (iSudFSTAPP == null) {
|
||||
Toast.makeText(activity, "loadMG params error", Toast.LENGTH_LONG).show();
|
||||
delayLoadGame(activity, gameId);
|
||||
return;
|
||||
}
|
||||
|
||||
// APP调用游戏接口的装饰类设置
|
||||
sudFSTAPPDecorator.setISudFSTAPP(iSudFSTAPP);
|
||||
|
||||
// 获取游戏视图,将其抛回Activity进行展示
|
||||
// Activity调用:gameContainer.addView(view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
gameView = iSudFSTAPP.getGameView();
|
||||
onAddGameView(gameView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏加载失败的时候,延迟一会再重新加载
|
||||
*
|
||||
* @param activity 游戏所在页面
|
||||
* @param gameId 游戏id
|
||||
*/
|
||||
private void delayLoadGame(Activity activity, long gameId) {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
login(activity, gameId);
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// region 生命周期相关
|
||||
|
||||
/**
|
||||
* 页面销毁的时候调用
|
||||
*/
|
||||
public void onDestroy() {
|
||||
isRunning = false;
|
||||
destroyMG();
|
||||
}
|
||||
// endregion 生命周期相关
|
||||
|
||||
|
||||
/**
|
||||
* 销毁游戏
|
||||
*/
|
||||
private void destroyMG() {
|
||||
if (playingGameId > 0) {
|
||||
sudFSTAPPDecorator.destroyMG();
|
||||
sudFSMMGDecorator.destroyMG();
|
||||
playingGameId = 0;
|
||||
gameView = null;
|
||||
onRemoveGameView();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前游戏房id
|
||||
*/
|
||||
public String getGameRoomId() {
|
||||
return gameRoomId;
|
||||
}
|
||||
|
||||
// region 子类需要实现的方法
|
||||
|
||||
/**
|
||||
* 向接入方服务器获取code
|
||||
*/
|
||||
protected abstract void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener);
|
||||
|
||||
/**
|
||||
* 设置当前用户id(接入方定义)
|
||||
*
|
||||
* @return 返回用户id
|
||||
*/
|
||||
protected abstract String getUserId();
|
||||
|
||||
/**
|
||||
* 设置游戏所用的appId
|
||||
*
|
||||
* @return 返回游戏服务appId
|
||||
*/
|
||||
protected abstract String getAppId();
|
||||
|
||||
/**
|
||||
* 设置游戏所用的appKey
|
||||
*
|
||||
* @return 返回游戏服务appKey
|
||||
*/
|
||||
protected abstract String getAppKey();
|
||||
|
||||
/**
|
||||
* 设置游戏的语言代码
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/Languages/
|
||||
*
|
||||
* @return 返回语言代码
|
||||
*/
|
||||
protected abstract String getLanguageCode();
|
||||
|
||||
/**
|
||||
* 设置游戏的安全操作区域
|
||||
*
|
||||
* @param gameViewInfoModel 游戏视图大小
|
||||
*/
|
||||
protected abstract void getGameRect(GameViewInfoModel gameViewInfoModel);
|
||||
|
||||
/**
|
||||
* true 加载游戏时为测试环境
|
||||
* false 加载游戏时为生产环境
|
||||
*/
|
||||
protected abstract boolean isTestEnv();
|
||||
|
||||
/**
|
||||
* 将游戏View添加到页面中
|
||||
*
|
||||
* @param gameView
|
||||
*/
|
||||
protected abstract void onAddGameView(View gameView);
|
||||
|
||||
/**
|
||||
* 将页面中的游戏View移除
|
||||
*/
|
||||
protected abstract void onRemoveGameView();
|
||||
|
||||
// endregion 子类需要实现的方法
|
||||
|
||||
// region 游戏侧回调
|
||||
|
||||
/**
|
||||
* 游戏日志
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
@Override
|
||||
public void onGameLog(String str) {
|
||||
SudFSMMGListener.super.onGameLog(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏开始
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
@Override
|
||||
public void onGameStarted() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏销毁
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
@Override
|
||||
public void onGameDestroyed() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Code过期,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param dataJson {"code":"value"}
|
||||
*/
|
||||
@Override
|
||||
public void onExpireCode(ISudFSMStateHandle handle, String dataJson) {
|
||||
processOnExpireCode(sudFSTAPPDecorator, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏View信息,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param handle handle
|
||||
* @param dataJson {}
|
||||
*/
|
||||
@Override
|
||||
public void onGetGameViewInfo(ISudFSMStateHandle handle, String dataJson) {
|
||||
processOnGetGameViewInfo(gameView, handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏Config,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param handle handle
|
||||
* @param dataJson {}
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
@Override
|
||||
public void onGetGameCfg(ISudFSMStateHandle handle, String dataJson) {
|
||||
processOnGetGameCfg(handle, dataJson);
|
||||
}
|
||||
// endregion 游戏侧回调
|
||||
|
||||
|
||||
/**
|
||||
* 处理code过期
|
||||
*/
|
||||
public void processOnExpireCode(SudFSTAPPDecorator sudFSTAPPDecorator, ISudFSMStateHandle handle) {
|
||||
// code过期,刷新code
|
||||
getCode(null, getUserId(), getAppId(), new GameGetCodeListener() {
|
||||
@Override
|
||||
public void onSuccess(String code) {
|
||||
if (!isRunning) return;
|
||||
MGStateResponse mgStateResponse = new MGStateResponse();
|
||||
mgStateResponse.ret_code = MGStateResponse.SUCCESS;
|
||||
sudFSTAPPDecorator.updateCode(code, null);
|
||||
handle.success(SudJsonUtils.toJson(mgStateResponse));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
MGStateResponse mgStateResponse = new MGStateResponse();
|
||||
mgStateResponse.ret_code = -1;
|
||||
handle.failure(SudJsonUtils.toJson(mgStateResponse));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理游戏视图信息(游戏安全区)
|
||||
* 文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameViewInfo.html
|
||||
*/
|
||||
public void processOnGetGameViewInfo(View gameView, ISudFSMStateHandle handle) {
|
||||
//拿到游戏View的宽高
|
||||
int gameViewWidth = gameView.getMeasuredWidth();
|
||||
int gameViewHeight = gameView.getMeasuredHeight();
|
||||
if (gameViewWidth > 0 && gameViewHeight > 0) {
|
||||
notifyGameViewInfo(handle, gameViewWidth, gameViewHeight);
|
||||
return;
|
||||
}
|
||||
|
||||
//如果游戏View未加载完成,则监听加载完成时回调
|
||||
gameView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gameView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
int width = gameView.getMeasuredWidth();
|
||||
int height = gameView.getMeasuredHeight();
|
||||
notifyGameViewInfo(handle, width, height);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知游戏,游戏视图信息
|
||||
*/
|
||||
private void notifyGameViewInfo(ISudFSMStateHandle handle, int gameViewWidth, int gameViewHeight) {
|
||||
GameViewInfoModel gameViewInfoModel = new GameViewInfoModel();
|
||||
gameViewInfoModel.ret_code = 0;
|
||||
// 游戏View大小
|
||||
gameViewInfoModel.view_size.width = gameViewWidth;
|
||||
gameViewInfoModel.view_size.height = gameViewHeight;
|
||||
gameViewInfoModel.view_game_rect.bottom = gameViewHeight / 10;
|
||||
// 游戏安全操作区域
|
||||
getGameRect(gameViewInfoModel);
|
||||
|
||||
// 给游戏侧进行返回
|
||||
String json = SudJsonUtils.toJson(gameViewInfoModel);
|
||||
// 如果设置安全区有疑问,可将下面的日志打印出来,分析json数据
|
||||
// 正确的格式为:{"ret_code":0,"view_game_rect":{"bottom":156,"left":0,"right":0,"top":196},"view_size":{"height":1920,"width":1080}}
|
||||
// 如果发生debug版本游戏正常,release版本游戏不正常,请检查是否混淆了GameViewInfoModel类,导致json序列化类的成员发生了变化
|
||||
// Log.d("SudBaseGameViewModel", "notifyGameViewInfo:" + json);
|
||||
handle.success(json);
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
// playMG和pauseMG要配对
|
||||
sudFSTAPPDecorator.pauseMG();
|
||||
}
|
||||
|
||||
public void onResume() {
|
||||
// playMG和pauseMG要配对
|
||||
sudFSTAPPDecorator.playMG();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理游戏配置
|
||||
* 文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameCfg.html
|
||||
*/
|
||||
public void processOnGetGameCfg(ISudFSMStateHandle handle, String dataJson) {
|
||||
handle.success(SudJsonUtils.toJson(gameConfigModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏login(getCode)监听
|
||||
*/
|
||||
public interface GameGetCodeListener {
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
void onSuccess(String code);
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
void onFailed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏状态缓存
|
||||
*/
|
||||
public SudFSMMGCache getSudFSMMGCache() {
|
||||
return sudFSMMGDecorator.getSudFSMMGCache();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
package com.yunbao.common.sud;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.SudgameCodeModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.sud.model.GameConfigModel;
|
||||
import com.yunbao.common.sud.model.GameViewInfoModel;
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMMG;
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
|
||||
/**
|
||||
* 游戏业务逻辑
|
||||
* 1.自定义ViewModel继承此类,实现对应方法。(注意:onAddGameView()与onRemoveGameView()与页面有交互)
|
||||
* 2.外部调用switchGame(activity,gameRoomId,gameId)方法启动游戏,参数定义可查看方法注释。
|
||||
* 3.页面销毁时调用onDestroy()
|
||||
*/
|
||||
public class QuickStartGameViewModel extends BaseGameViewModel {
|
||||
|
||||
/**
|
||||
* Sud平台申请的appId
|
||||
*/
|
||||
public static String SudMGP_APP_ID = "1701178631292395522";
|
||||
/**
|
||||
* Sud平台申请的appKey
|
||||
*/
|
||||
public static String SudMGP_APP_KEY = "E3Eokfq58ZklwR8fM7iKWYGzarbIOkyh";
|
||||
/**
|
||||
* true 加载游戏时为测试环境 false 加载游戏时为生产环境
|
||||
*/
|
||||
|
||||
/**
|
||||
* 使用的UserId。这里随机生成作演示,开发者将其修改为业务使用的唯一userId
|
||||
*/
|
||||
public static String userId = QuickStartUtils.genUserID(CommonAppContext.sInstance.getApplicationContext());
|
||||
|
||||
/**
|
||||
* 游戏自定义安全操作区域
|
||||
*/
|
||||
public GameViewInfoModel.GameViewRectModel gameViewRectModel;
|
||||
|
||||
/**
|
||||
* 游戏的语言代码
|
||||
*/
|
||||
public String languageCode = "zh-CN";
|
||||
|
||||
public final MutableLiveData<View> gameViewLiveData = new MutableLiveData<>(); // 游戏View回调
|
||||
|
||||
/**
|
||||
* 向接入方服务器获取code
|
||||
*/
|
||||
@Override
|
||||
protected void getCode(Activity activity, String userId, String appId, GameGetCodeListener listener) {
|
||||
if (IMLoginManager.get(activity).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) {
|
||||
languageCode = "zh-CN";
|
||||
}else {
|
||||
languageCode = "en-US";
|
||||
}
|
||||
// TODO: 2022/6/10 注意,这里是演示使用OkHttpClient请求hello-sud服务
|
||||
// TODO: 2022/6/10 开发者在与后端联调时需将其改成自己的网络请求方式向自己的服务器获取code
|
||||
LiveNetManager.get(activity)
|
||||
.getCode(new HttpCallback<List<SudgameCodeModel>>() {
|
||||
@Override
|
||||
public void onSuccess(List<SudgameCodeModel> data) {
|
||||
|
||||
listener.onSuccess(data.get(0).getCode());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
listener.onFailed();
|
||||
}
|
||||
});
|
||||
// OkHttpClient client = new OkHttpClient();
|
||||
// String req;
|
||||
// try {
|
||||
// JSONObject reqJsonObj = new JSONObject();
|
||||
// reqJsonObj.put("user_id", userId);
|
||||
// req = reqJsonObj.toString();
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// req = "";
|
||||
// }
|
||||
//
|
||||
// RequestBody body = RequestBody.create(req, MediaType.get("application/json; charset=utf-8"));
|
||||
// Request request = new Request.Builder()
|
||||
// .url("https://mgp-hello.sudden.ltd/login/v3")
|
||||
// .post(body)
|
||||
// .build();
|
||||
// client.newCall(request).enqueue(new Callback() {
|
||||
// @Override
|
||||
// public void onFailure(Call call, IOException e) {
|
||||
// handler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// listener.onFailed();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResponse(Call call, Response response) {
|
||||
// try {
|
||||
// String dataJson = Objects.requireNonNull(response.body()).string();
|
||||
// JSONObject jsonObject = new JSONObject(dataJson);
|
||||
// int ret_code = jsonObject.getInt("ret_code");
|
||||
// JSONObject dataObject = jsonObject.getJSONObject("data");
|
||||
// String code = dataObject.getString("code");
|
||||
// handler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (ret_code == MGStateResponse.SUCCESS) {
|
||||
// listener.onSuccess(code);
|
||||
// } else {
|
||||
// listener.onFailed();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// handler.post(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// listener.onFailed();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前用户id(接入方定义)
|
||||
*/
|
||||
@Override
|
||||
protected String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Sud平台申请的appId
|
||||
*/
|
||||
@Override
|
||||
protected String getAppId() {
|
||||
return SudMGP_APP_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Sud平台申请的appKey
|
||||
*/
|
||||
@Override
|
||||
protected String getAppKey() {
|
||||
return SudMGP_APP_KEY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置游戏的语言代码
|
||||
*/
|
||||
@Override
|
||||
protected String getLanguageCode() {
|
||||
return languageCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置游戏的安全操作区域,{@link ISudFSMMG}.onGetGameViewInfo()的实现。
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameViewInfo.html
|
||||
*
|
||||
* @param gameViewInfoModel 游戏视图模型
|
||||
*/
|
||||
@Override
|
||||
protected void getGameRect(GameViewInfoModel gameViewInfoModel) {
|
||||
// 相对于view_size(左、上、右、下)边框偏移(单位像素)
|
||||
// 开发者可自定义gameViewRectModel来控制安全区域
|
||||
if (gameViewRectModel != null) {
|
||||
gameViewInfoModel.view_game_rect = gameViewRectModel;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏配置对象,{@link ISudFSMMG}.onGetGameCfg()的实现。
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameCfg.html
|
||||
* 开发者拿到此对象之后,可修改自己需要的配置
|
||||
* 注意:在加载游戏之前配置才有效
|
||||
*
|
||||
* @return 游戏配置对象
|
||||
*/
|
||||
public GameConfigModel getGameConfigModel() {
|
||||
return gameConfigModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* true 加载游戏时为测试环境
|
||||
* false 加载游戏时为生产环境
|
||||
*/
|
||||
@Override
|
||||
protected boolean isTestEnv() {
|
||||
return CommonAppConfig.HOST.contains("ceshi");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将游戏View添加到页面中
|
||||
*/
|
||||
@Override
|
||||
protected void onAddGameView(View gameView) {
|
||||
gameViewLiveData.setValue(gameView);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将页面中的游戏View移除
|
||||
*/
|
||||
@Override
|
||||
protected void onRemoveGameView() {
|
||||
gameViewLiveData.setValue(null);
|
||||
}
|
||||
|
||||
// ************ 上面是基础能力以及必要配置,下面讲解状态交互
|
||||
// ************ 主要有:1.App向游戏发送状态;2.游戏向App回调状态
|
||||
|
||||
/**
|
||||
* 1.App向游戏发送状态
|
||||
* 这里演示的是发送:1. 加入状态;
|
||||
* 开发者可自由定义方法,能发送的状态都封装在{@link SudFSTAPPDecorator}
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/
|
||||
* 注意:
|
||||
* 1,App向游戏发送状态,因为需要走网络,所以向游戏发送状态之后,不能马上销毁游戏或者finish Activity,否则状态无法发送成功。
|
||||
* 2,要保证状态能到达,可以发送之后,delay 500ms再销毁游戏或者finish Activity。
|
||||
*/
|
||||
public void notifyAPPCommonSelfIn(boolean isIn, int seatIndex, boolean isSeatRandom, int teamId) {
|
||||
sudFSTAPPDecorator.notifyAPPCommonSelfIn(isIn, seatIndex, isSeatRandom, teamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.游戏向App回调状态
|
||||
* 这里演示的是接收游戏回调状态:10. 游戏状态 mg_common_game_state
|
||||
* 游戏回调的每个状态都对应着一个方法,方法定义在:{@link SudFSMMGListener}
|
||||
*/
|
||||
@Override
|
||||
public void onGameMGCommonGameState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameState model) {
|
||||
super.onGameMGCommonGameState(handle, model);
|
||||
Log.e("QuickStartGameViewModel",model.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.yunbao.common.sud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class QuickStartUtils {
|
||||
|
||||
/**
|
||||
* 随机生成一个userId,用于演示
|
||||
*/
|
||||
public static String genUserID(Context mContext) {
|
||||
return md5Hex8(String.valueOf(IMLoginManager.get(mContext).getUserInfo().getId()));
|
||||
}
|
||||
|
||||
public static String md5Hex8(String plainText) {
|
||||
byte[] secretBytes;
|
||||
try {
|
||||
secretBytes = MessageDigest.getInstance("md5").digest(plainText.getBytes());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
return plainText;
|
||||
}
|
||||
String md5code = new BigInteger(1, secretBytes).toString(16);
|
||||
for (int i = 0; i < 32 - md5code.length(); i++) {
|
||||
md5code = String.format("0%s", md5code);
|
||||
}
|
||||
|
||||
return md5code.substring(8, 16);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* 游戏回调数据缓存
|
||||
*/
|
||||
public class SudFSMMGCache {
|
||||
|
||||
private String captainUserId; // 记录当前队长的用户id
|
||||
private SudMGPMGState.MGCommonGameState mgCommonGameStateModel; // 全局游戏状态
|
||||
private boolean isHitBomb = false; // 是否数字炸弹
|
||||
private final HashSet<String> playerInSet = new HashSet<>(); // 记录已经加入了游戏的玩家
|
||||
private final HashSet<String> playerReadySet = new HashSet<>(); // 记录已经准备好的游戏玩家
|
||||
private final HashMap<String, SudMGPMGState.MGCommonPlayerPlaying> playerPlayingMap = new HashMap<>(); // 记录玩家的游戏状态
|
||||
|
||||
// 队长状态 处理
|
||||
public void onPlayerMGCommonPlayerCaptain(String userId, SudMGPMGState.MGCommonPlayerCaptain model) {
|
||||
if (model != null) {
|
||||
if (model.isCaptain) {
|
||||
captainUserId = userId;
|
||||
} else {
|
||||
if (Objects.equals(captainUserId, userId)) {
|
||||
captainUserId = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 游戏状态 处理
|
||||
public void onGameMGCommonGameState(SudMGPMGState.MGCommonGameState model) {
|
||||
mgCommonGameStateModel = model;
|
||||
}
|
||||
|
||||
// 玩家加入状态处理
|
||||
public void onPlayerMGCommonPlayerIn(String userId, SudMGPMGState.MGCommonPlayerIn model) {
|
||||
if (model != null) {
|
||||
if (model.isIn) {
|
||||
playerInSet.add(userId);
|
||||
} else {
|
||||
playerInSet.remove(userId);
|
||||
playerReadySet.remove(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 玩家准备状态
|
||||
public void onPlayerMGCommonPlayerReady(String userId, SudMGPMGState.MGCommonPlayerReady model) {
|
||||
if (model != null) {
|
||||
if (model.isReady) {
|
||||
playerReadySet.add(userId);
|
||||
} else {
|
||||
playerReadySet.remove(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 玩家游戏状态
|
||||
public void onPlayerMGCommonPlayerPlaying(String userId, SudMGPMGState.MGCommonPlayerPlaying model) {
|
||||
if (model != null) {
|
||||
playerPlayingMap.put(userId, model);
|
||||
}
|
||||
}
|
||||
|
||||
// 关键词状态
|
||||
public void onGameMGCommonKeyWordToHit(SudMGPMGState.MGCommonKeyWordToHit model) {
|
||||
if (model != null) {
|
||||
isHitBomb = model.wordType.equals("number");
|
||||
}
|
||||
}
|
||||
|
||||
// 返回该玩家是否正在游戏中
|
||||
public boolean playerIsPlaying(String userId) {
|
||||
SudMGPMGState.MGCommonPlayerPlaying mgCommonPlayerPlaying = playerPlayingMap.get(userId);
|
||||
if (mgCommonPlayerPlaying != null) {
|
||||
return mgCommonPlayerPlaying.isPlaying;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 返回该玩家是否已准备
|
||||
public boolean playerIsReady(String userId) {
|
||||
return playerReadySet.contains(userId);
|
||||
}
|
||||
|
||||
// 返回该玩家是否已加入了游戏
|
||||
public boolean playerIsIn(String userId) {
|
||||
return playerInSet.contains(userId);
|
||||
}
|
||||
|
||||
// 获取当前游戏中的人数
|
||||
public int getPlayerInNumber() {
|
||||
return playerInSet.size();
|
||||
}
|
||||
|
||||
// 是否数字炸弹
|
||||
public boolean isHitBomb() {
|
||||
return isHitBomb;
|
||||
}
|
||||
|
||||
// 销毁游戏
|
||||
public void destroyMG() {
|
||||
captainUserId = null;
|
||||
mgCommonGameStateModel = null;
|
||||
isHitBomb = false;
|
||||
playerInSet.clear();
|
||||
playerReadySet.clear();
|
||||
playerPlayingMap.clear();
|
||||
}
|
||||
|
||||
/** 获取队长userId */
|
||||
public String getCaptainUserId() {
|
||||
return captainUserId;
|
||||
}
|
||||
|
||||
/** 获取当前已加入游戏的玩家集合 */
|
||||
public HashSet<String> getPlayerInSet() {
|
||||
return new HashSet<>(playerInSet);
|
||||
}
|
||||
|
||||
/** 获取当前已准备的玩家集合 */
|
||||
public HashSet<String> getPlayerReadySet() {
|
||||
return new HashSet<>(playerReadySet);
|
||||
}
|
||||
|
||||
/** 获取玩家游戏状态集合 */
|
||||
public HashMap<String, SudMGPMGState.MGCommonPlayerPlaying> getPlayerPlayingMap() {
|
||||
return new HashMap<>(playerPlayingMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前游戏的状态,数值参数{@link SudMGPMGState.MGCommonGameState}
|
||||
*/
|
||||
public int getGameState() {
|
||||
if (mgCommonGameStateModel != null) {
|
||||
return mgCommonGameStateModel.gameState;
|
||||
}
|
||||
return SudMGPMGState.MGCommonGameState.UNKNOW;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,901 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
import com.yunbao.common.sud.state.SudMGPMGState;
|
||||
import com.yunbao.common.utils.ISudFSMStateHandleUtils;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
|
||||
/**
|
||||
* {@link SudFSMMGDecorator} 回调定义
|
||||
*/
|
||||
public interface SudFSMMGListener {
|
||||
|
||||
/**
|
||||
* 游戏日志
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
default void onGameLog(String str) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏加载进度
|
||||
*
|
||||
* @param stage 阶段:start=1,loading=2,end=3
|
||||
* @param retCode 错误码:0成功
|
||||
* @param progress 进度:[0, 100]
|
||||
*/
|
||||
default void onGameLoadingProgress(int stage, int retCode, int progress) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏开始,需要实现
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
void onGameStarted();
|
||||
|
||||
/**
|
||||
* 游戏销毁,需要实现
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
void onGameDestroyed();
|
||||
|
||||
/**
|
||||
* Code过期,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param dataJson {"code":"value"}
|
||||
*/
|
||||
void onExpireCode(ISudFSMStateHandle handle, String dataJson);
|
||||
|
||||
/**
|
||||
* 获取游戏View信息,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param handle
|
||||
* @param dataJson {}
|
||||
*/
|
||||
void onGetGameViewInfo(ISudFSMStateHandle handle, String dataJson);
|
||||
|
||||
/**
|
||||
* 获取游戏Config,需要实现
|
||||
* APP接入方需要调用handle.success或handle.fail
|
||||
*
|
||||
* @param handle
|
||||
* @param dataJson {}
|
||||
* 最低版本:v1.1.30.xx
|
||||
*/
|
||||
void onGetGameCfg(ISudFSMStateHandle handle, String dataJson);
|
||||
|
||||
// region 游戏回调APP 通用状态
|
||||
// 参考文档:https://github.com/SudTechnology/sud-mgp-doc/blob/main/Client/MG%20FSM/%E9%80%9A%E7%94%A8%E7%8A%B6%E6%80%81-%E7%8E%A9%E5%AE%B6.md
|
||||
|
||||
/**
|
||||
* 1.游戏公屏消息
|
||||
* mg_common_public_message
|
||||
*/
|
||||
default void onGameMGCommonPublicMessage(ISudFSMStateHandle handle, SudMGPMGState.MGCommonPublicMessage model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 关键词状态
|
||||
* mg_common_key_word_to_hit
|
||||
*/
|
||||
default void onGameMGCommonKeyWordToHit(ISudFSMStateHandle handle, SudMGPMGState.MGCommonKeyWordToHit model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 游戏结算状态
|
||||
* mg_common_game_settle
|
||||
*/
|
||||
default void onGameMGCommonGameSettle(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSettle model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 加入游戏按钮点击状态
|
||||
* mg_common_self_click_join_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickJoinBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickJoinBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 取消加入(退出)游戏按钮点击状态
|
||||
* mg_common_self_click_cancel_join_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickCancelJoinBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickCancelJoinBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 准备按钮点击状态
|
||||
* mg_common_self_click_ready_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickReadyBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickReadyBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 取消准备按钮点击状态
|
||||
* mg_common_self_click_cancel_ready_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickCancelReadyBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickCancelReadyBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 开始游戏按钮点击状态
|
||||
* mg_common_self_click_start_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickStartBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickStartBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 9. 分享按钮点击状态
|
||||
* mg_common_self_click_share_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickShareBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickShareBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 10. 游戏状态
|
||||
* mg_common_game_state
|
||||
*/
|
||||
default void onGameMGCommonGameState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameState model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 11. 结算界面关闭按钮点击状态(2021-12-27新增)
|
||||
* mg_common_self_click_game_settle_close_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickGameSettleCloseBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 12. 结算界面再来一局按钮点击状态(2021-12-27新增)
|
||||
* mg_common_self_click_game_settle_again_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickGameSettleAgainBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强)
|
||||
* mg_common_game_sound_list
|
||||
*/
|
||||
default void onGameMGCommonGameSoundList(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSoundList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强)
|
||||
* mg_common_game_sound
|
||||
*/
|
||||
default void onGameMGCommonGameSound(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSound model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||
* mg_common_game_bg_music_state
|
||||
*/
|
||||
default void onGameMGCommonGameBgMusicState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameBgMusicState model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||
* mg_common_game_sound_state
|
||||
*/
|
||||
default void onGameMGCommonGameSoundState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSoundState model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增)
|
||||
* mg_common_game_asr
|
||||
*/
|
||||
default void onGameMGCommonGameASR(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameASR model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 18. 麦克风状态(2022-02-08新增)
|
||||
* mg_common_self_microphone
|
||||
*/
|
||||
default void onGameMGCommonSelfMicrophone(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfMicrophone model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 19. 耳机(听筒,扬声器)状态(2022-02-08新增)
|
||||
* mg_common_self_headphone
|
||||
*/
|
||||
default void onGameMGCommonSelfHeadphone(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfHeadphone model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 20. App通用状态操作结果错误码(2022-05-10新增)
|
||||
* mg_common_app_common_self_x_resp
|
||||
*/
|
||||
default void onGameMGCommonAPPCommonSelfXResp(ISudFSMStateHandle handle, SudMGPMGState.MGCommonAPPCommonSelfXResp model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增)
|
||||
* mg_common_game_add_ai_players
|
||||
*/
|
||||
default void onGameMGCommonGameAddAIPlayers(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameAddAIPlayers model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 22. 游戏通知app层添当前网络连接状态(2022-06-21新增)
|
||||
* mg_common_game_network_state
|
||||
*/
|
||||
default void onGameMGCommonGameNetworkState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameNetworkState model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 23. 游戏通知app获取积分
|
||||
* mg_common_game_score
|
||||
*/
|
||||
default void onGameMGCommonGameGetScore(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameGetScore model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 24. 游戏通知app带入积分
|
||||
* mg_common_game_set_score
|
||||
*/
|
||||
default void onGameMGCommonGameSetScore(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSetScore model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 25. 创建订单
|
||||
* mg_common_game_create_order
|
||||
*/
|
||||
default void onGameMGCommonGameCreateOrder(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameCreateOrder model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 26. 游戏通知app玩家角色(仅对狼人杀有效)
|
||||
* mg_common_player_role_id
|
||||
*/
|
||||
default void onGameMGCommonPlayerRoleId(ISudFSMStateHandle handle, SudMGPMGState.MGCommonPlayerRoleId model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 27. 游戏通知app玩家被扔便便(你画我猜,你说我猜,友尽闯关有效)
|
||||
* mg_common_self_click_poop
|
||||
*/
|
||||
default void onGameMGCommonSelfClickPoop(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickPoop model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 28. 游戏通知app玩家被点赞(你画我猜,你说我猜,友尽闯关有效)
|
||||
* mg_common_self_click_good
|
||||
*/
|
||||
default void onGameMGCommonSelfClickGood(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickGood model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 29. 游戏通知app游戏FPS(仅对碰碰,多米诺骨牌,飞镖达人生效)
|
||||
* mg_common_game_fps
|
||||
*/
|
||||
default void onGameMGCommonGameFps(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameFps model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 30. 游戏通知app游戏弹框
|
||||
* mg_common_alert
|
||||
*/
|
||||
default void onGameMGCommonAlert(ISudFSMStateHandle handle, SudMGPMGState.MGCommonAlert model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 31. 游戏通知app最坑队友(只支持友尽闯关)
|
||||
* mg_common_worst_teammate
|
||||
*/
|
||||
default void onGameMGCommonWorstTeammate(ISudFSMStateHandle handle, SudMGPMGState.MGCommonWorstTeammate model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 32. 游戏通知app因玩家逃跑导致游戏结束(只支持友尽闯关)
|
||||
* mg_common_game_over_tip
|
||||
*/
|
||||
default void onGameMGCommonGameOverTip(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameOverTip model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 33. 游戏通知app玩家颜色(只支持友尽闯关)
|
||||
* mg_common_game_player_color
|
||||
*/
|
||||
default void onGameMGCommonGamePlayerColor(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGamePlayerColor model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 34. 游戏通知app玩家头像的坐标(只支持ludo)
|
||||
* mg_common_game_player_icon_position
|
||||
*/
|
||||
default void onGameMGCommonGamePlayerIconPosition(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGamePlayerIconPosition model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 35. 游戏通知app退出游戏(只支持teenpattipro 与 德州pro)
|
||||
* mg_common_self_click_exit_game_btn
|
||||
*/
|
||||
default void onGameMGCommonSelfClickExitGameBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickExitGameBtn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 36. 游戏通知app是否要开启带入积分(只支持teenpattipro 与 德州pro)
|
||||
* mg_common_game_is_app_chip
|
||||
*/
|
||||
default void onGameMGCommonGameIsAppChip(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameIsAppChip model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 37. 游戏通知app当前游戏的设置信息(只支持德州pro,teenpatti pro)
|
||||
* mg_common_game_rule
|
||||
*/
|
||||
default void onGameMGCommonGameRule(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameRule model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 38. 游戏通知app进行玩法设置(只支持德州pro,teenpatti pro)
|
||||
* mg_common_game_settings
|
||||
*/
|
||||
default void onGameMGCommonGameSettings(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSettings model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 39. 游戏通知app钱币不足(只支持德州pro,teenpatti pro)
|
||||
* mg_common_game_money_not_enough
|
||||
*/
|
||||
default void onGameMGCommonGameMoneyNotEnough(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameMoneyNotEnough model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 40. 游戏通知app下发定制ui配置表(只支持ludo)
|
||||
* mg_common_game_ui_custom_config
|
||||
*/
|
||||
default void onGameMGCommonGameUiCustomConfig(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameUiCustomConfig model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 41. 设置app提供给游戏可点击区域(赛车)
|
||||
* mg_common_set_click_rect
|
||||
*/
|
||||
default void onGameMGCommonSetClickRect(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSetClickRect model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 42. 通知app提供对应uids列表玩家的数据(赛车)
|
||||
* mg_common_users_info
|
||||
*/
|
||||
default void onGameMGCommonUsersInfo(ISudFSMStateHandle handle, SudMGPMGState.MGCommonUsersInfo model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 43. 通知app游戏前期准备完成(赛车)
|
||||
* mg_common_game_prepare_finish
|
||||
*/
|
||||
default void onGameMGCommonGamePrepareFinish(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGamePrepareFinish model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 44. 通知app游戏主界面已显示(赛车)
|
||||
* mg_common_show_game_scene
|
||||
*/
|
||||
default void onGameMGCommonShowGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCommonShowGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 45. 通知app游戏主界面已隐藏(赛车)
|
||||
* mg_common_hide_game_scene
|
||||
*/
|
||||
default void onGameMGCommonHideGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCommonHideGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
// endregion 游戏回调APP 通用状态
|
||||
|
||||
// region 游戏回调APP 玩家状态
|
||||
|
||||
/**
|
||||
* 1.加入状态(已修改)
|
||||
* mg_common_player_in
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerIn(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerIn model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2.准备状态(已修改)
|
||||
* mg_common_player_ready
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerReady(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerReady model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.队长状态(已修改)
|
||||
* mg_common_player_captain
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerCaptain(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerCaptain model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.游戏状态(已修改)
|
||||
* mg_common_player_playing
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerPlaying(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerPlaying model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5.玩家在线状态
|
||||
* mg_common_player_online
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerOnline(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerOnline model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6.玩家换游戏位状态
|
||||
* mg_common_player_change_seat
|
||||
*/
|
||||
default void onPlayerMGCommonPlayerChangeSeat(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerChangeSeat model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 游戏通知app点击玩家头像
|
||||
* mg_common_self_click_game_player_icon
|
||||
*/
|
||||
default void onPlayerMGCommonSelfClickGamePlayerIcon(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfClickGamePlayerIcon model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 游戏通知app玩家死亡状态(2022-04-24新增)
|
||||
* mg_common_self_die_status
|
||||
*/
|
||||
default void onPlayerMGCommonSelfDieStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfDieStatus model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 9. 游戏通知app轮到玩家出手状态(2022-04-24新增)
|
||||
* mg_common_self_turn_status
|
||||
*/
|
||||
default void onPlayerMGCommonSelfTurnStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfTurnStatus model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 10. 游戏通知app玩家选择状态(2022-04-24新增)
|
||||
* mg_common_self_select_status
|
||||
*/
|
||||
default void onPlayerMGCommonSelfSelectStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfSelectStatus model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效)
|
||||
* mg_common_game_countdown_time
|
||||
*/
|
||||
default void onPlayerMGCommonGameCountdownTime(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonGameCountdownTime model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效)
|
||||
* mg_common_self_ob_status
|
||||
*/
|
||||
default void onPlayerMGCommonSelfObStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfObStatus model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
// endregion 游戏回调APP 玩家状态
|
||||
|
||||
// region 游戏回调APP 玩家状态 你画我猜
|
||||
// 参考文档:https://github.com/SudTechnology/sud-mgp-doc/blob/main/Client/MG%20FSM/%E4%BD%A0%E7%94%BB%E6%88%91%E7%8C%9C.md
|
||||
|
||||
/**
|
||||
* 1. 选词中状态(已修改)
|
||||
* mg_dg_selecting
|
||||
*/
|
||||
default void onPlayerMGDGSelecting(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGSelecting model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 作画中状态(已修改)
|
||||
* mg_dg_painting
|
||||
*/
|
||||
default void onPlayerMGDGPainting(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGPainting model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 显示错误答案状态(已修改)
|
||||
* mg_dg_erroranswer
|
||||
*/
|
||||
default void onPlayerMGDGErroranswer(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGErroranswer model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 显示总积分状态(已修改)
|
||||
* mg_dg_totalscore
|
||||
*/
|
||||
default void onPlayerMGDGTotalscore(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGTotalscore model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 本次获得积分状态(已修改)
|
||||
* mg_dg_score
|
||||
*/
|
||||
default void onPlayerMGDGScore(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGScore model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
// endregion 游戏回调APP 玩家状态 你画我猜
|
||||
|
||||
// region 游戏回调APP 通用状态 元宇宙砂砂舞
|
||||
|
||||
/**
|
||||
* 1. 元宇宙砂砂舞指令回调
|
||||
* mg_common_game_disco_action
|
||||
*/
|
||||
default void onGameMGCommonGameDiscoAction(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameDiscoAction model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 元宇宙砂砂舞指令动作结束通知
|
||||
* mg_common_game_disco_action_end
|
||||
*/
|
||||
default void onGameMGCommonGameDiscoActionEnd(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameDiscoActionEnd model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
// endregion 游戏回调APP 通用状态 元宇宙砂砂舞
|
||||
|
||||
// region 游戏回调APP 通用状态 定制火箭
|
||||
|
||||
/**
|
||||
* 1. 礼物配置文件(火箭)
|
||||
* mg_custom_rocket_config
|
||||
*/
|
||||
default void onGameMGCustomRocketConfig(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketConfig model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 拥有模型列表(火箭)
|
||||
* mg_custom_rocket_model_list
|
||||
*/
|
||||
default void onGameMGCustomRocketModelList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketModelList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 拥有组件列表(火箭)
|
||||
* mg_custom_rocket_component_list
|
||||
*/
|
||||
default void onGameMGCustomRocketComponentList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketComponentList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 获取用户信息(火箭)
|
||||
* mg_custom_rocket_user_info
|
||||
*/
|
||||
default void onGameMGCustomRocketUserInfo(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUserInfo model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 订单记录列表(火箭)
|
||||
* mg_custom_rocket_order_record_list
|
||||
*/
|
||||
default void onGameMGCustomRocketOrderRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketOrderRecordList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 展馆内列表(火箭)
|
||||
* mg_custom_rocket_room_record_list
|
||||
*/
|
||||
default void onGameMGCustomRocketRoomRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketRoomRecordList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 展馆内玩家送出记录(火箭)
|
||||
* mg_custom_rocket_user_record_list
|
||||
*/
|
||||
default void onGameMGCustomRocketUserRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUserRecordList model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 设置默认模型(火箭)
|
||||
* mg_custom_rocket_set_default_model
|
||||
*/
|
||||
default void onGameMGCustomRocketSetDefaultModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketSetDefaultModel model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 9. 动态计算一键发送价格(火箭)
|
||||
* mg_custom_rocket_dynamic_fire_price
|
||||
*/
|
||||
default void onGameMGCustomRocketDynamicFirePrice(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketDynamicFirePrice model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 10. 一键发送(火箭)
|
||||
* mg_custom_rocket_fire_model
|
||||
*/
|
||||
default void onGameMGCustomRocketFireModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFireModel model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 11. 新组装模型(火箭)
|
||||
* mg_custom_rocket_create_model
|
||||
*/
|
||||
default void onGameMGCustomRocketCreateModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketCreateModel model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 12. 模型更换组件(火箭)
|
||||
* mg_custom_rocket_replace_component
|
||||
*/
|
||||
default void onGameMGCustomRocketReplaceComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketReplaceComponent model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 13. 购买组件(火箭)
|
||||
* mg_custom_rocket_buy_component
|
||||
*/
|
||||
default void onGameMGCustomRocketBuyComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketBuyComponent model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 14. 播放效果开始(火箭)
|
||||
* mg_custom_rocket_play_effect_start
|
||||
*/
|
||||
default void onGameMGCustomRocketPlayEffectStart(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPlayEffectStart model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 15. 播放效果完成(火箭)
|
||||
* mg_custom_rocket_play_effect_finish
|
||||
*/
|
||||
default void onGameMGCustomRocketPlayEffectFinish(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPlayEffectFinish model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 16. 验证签名合规(火箭)
|
||||
* mg_custom_rocket_verify_sign
|
||||
*/
|
||||
default void onGameMGCustomRocketVerifySign(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketVerifySign model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 17. 上传icon(火箭)
|
||||
* mg_custom_rocket_upload_model_icon
|
||||
*/
|
||||
default void onGameMGCustomRocketUploadModelIcon(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUploadModelIcon model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 18. 前期准备完成(火箭)
|
||||
* mg_custom_rocket_prepare_finish
|
||||
*/
|
||||
default void onGameMGCustomRocketPrepareFinish(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPrepareFinish model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 19. 火箭主界面已显示(火箭)
|
||||
* mg_custom_rocket_show_game_scene
|
||||
*/
|
||||
default void onGameMGCustomRocketShowGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketShowGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 20. 火箭主界面已隐藏(火箭)
|
||||
* mg_custom_rocket_hide_game_scene
|
||||
*/
|
||||
default void onGameMGCustomRocketHideGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketHideGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 21. 点击锁住组件(火箭)
|
||||
* mg_custom_rocket_click_lock_component
|
||||
*/
|
||||
default void onGameMGCustomRocketClickLockComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketClickLockComponent model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 22. 火箭效果飞行点击(火箭)
|
||||
* mg_custom_rocket_fly_click
|
||||
*/
|
||||
default void onGameMGCustomRocketFlyClick(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFlyClick model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 23. 火箭效果飞行结束(火箭)
|
||||
* mg_custom_rocket_fly_end
|
||||
*/
|
||||
default void onGameMGCustomRocketFlyEnd(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFlyEnd model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 24. 设置点击区域(火箭)
|
||||
* mg_custom_rocket_set_click_rect
|
||||
*/
|
||||
default void onGameMGCustomRocketSetClickRect(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketSetClickRect model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 25. 颜色和签名自定义改到装配间的模式,保存颜色或签名
|
||||
* mg_custom_rocket_save_sign_color
|
||||
*/
|
||||
default void onGameMGCustomRocketSaveSignColor(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketSaveSignColor model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
// endregion 游戏回调APP 通用状态 定制火箭
|
||||
|
||||
// region 游戏回调APP 通用状态 棒球
|
||||
|
||||
/**
|
||||
* 1. 查询排行榜数据(棒球)
|
||||
* mg_baseball_ranking
|
||||
*/
|
||||
default void onGameMGBaseballRanking(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballRanking model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 查询我的排名(棒球)
|
||||
* mg_baseball_my_ranking
|
||||
*/
|
||||
default void onGameMGBaseballMyRanking(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballMyRanking model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 查询当前距离我的前后玩家数据(棒球)
|
||||
* mg_baseball_range_info
|
||||
*/
|
||||
default void onGameMGBaseballRangeInfo(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballRangeInfo model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 设置app提供给游戏可点击区域(棒球)
|
||||
* mg_baseball_set_click_rect
|
||||
*/
|
||||
default void onGameMGBaseballSetClickRect(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballSetClickRect model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 前期准备完成(棒球)
|
||||
* mg_baseball_prepare_finish
|
||||
*/
|
||||
default void onGameMGBaseballPrepareFinish(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballPrepareFinish model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 主界面已显示(棒球)
|
||||
* mg_baseball_show_game_scene
|
||||
*/
|
||||
default void onGameMGBaseballShowGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballShowGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 主界面已隐藏(棒球)
|
||||
* mg_baseball_hide_game_scene
|
||||
*/
|
||||
default void onGameMGBaseballHideGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballHideGameScene model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 获取文本配置数据(棒球)
|
||||
* mg_baseball_text_config
|
||||
*/
|
||||
default void onGameMGBaseballTextConfig(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballTextConfig model) {
|
||||
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
}
|
||||
// endregion 游戏回调APP 通用状态 棒球
|
||||
|
||||
/**
|
||||
* 游戏状态变化
|
||||
* 透传游戏向App发送的游戏通用状态消息
|
||||
* **********使用此方法可先看下此方法的使用逻辑*************
|
||||
*
|
||||
* @param handle 回调操作
|
||||
* @param state 状态命令
|
||||
* @param dataJson 状态值
|
||||
* @return 返回true,表示由此方法接管该状态处理,此时需注意调用:ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
*/
|
||||
default boolean onGameStateChange(ISudFSMStateHandle handle, String state, String dataJson) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏玩家状态变化
|
||||
* 透传游戏向App发送的玩家状态变化
|
||||
* **********使用此方法可先看下此方法的使用逻辑*************
|
||||
*
|
||||
* @param handle 回调操作
|
||||
* @param userId 用户Id
|
||||
* @param state 状态命令
|
||||
* @param dataJson 状态值
|
||||
* @return 返回true,表示由此方法接管该状态处理,此时需注意调用:ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||
*/
|
||||
default boolean onPlayerStateChange(ISudFSMStateHandle handle, String userId, String state, String dataJson) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,446 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.decorator;
|
||||
|
||||
import com.yunbao.common.sud.state.SudMGPAPPState;
|
||||
import com.yunbao.common.utils.SudJsonUtils;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSTAPP;
|
||||
import tech.sud.mgp.core.ISudListenerNotifyStateChange;
|
||||
|
||||
/**
|
||||
* ISudFSTAPP的装饰类,接近于业务
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSTAPP.html
|
||||
* 注意:
|
||||
* 1,向游戏侧发送状态之后,不能立即调用destroyMG()方法,也不能立即finish Activity。例如:{@link SudFSTAPPDecorator#notifyAPPCommonSelfEnd()}
|
||||
*/
|
||||
public class SudFSTAPPDecorator {
|
||||
|
||||
/**
|
||||
* APP调用游戏的接口
|
||||
*/
|
||||
private ISudFSTAPP iSudFSTAPP;
|
||||
|
||||
/**
|
||||
* 设置app调用sdk的对象
|
||||
*
|
||||
* @param iSudFSTAPP
|
||||
*/
|
||||
public void setISudFSTAPP(ISudFSTAPP iSudFSTAPP) {
|
||||
this.iSudFSTAPP = iSudFSTAPP;
|
||||
}
|
||||
|
||||
// region 状态通知,ISudFSTAPP.notifyStateChange
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 1. 加入状态
|
||||
*
|
||||
* @param isIn true 加入游戏,false 退出游戏
|
||||
* @param seatIndex 加入的游戏位(座位号) 默认传seatIndex = -1 随机加入,seatIndex 从0开始,不可大于座位数
|
||||
* @param isSeatRandom 默认为ture, 带有游戏位(座位号)的时候,如果游戏位(座位号)已经被占用,是否随机分配一个空位坐下 isSeatRandom=true 随机分配空位坐下,isSeatRandom=false 不随机分配
|
||||
* @param teamId 不支持分队的游戏:数值填1;支持分队的游戏:数值填1或2(两支队伍);
|
||||
*/
|
||||
public void notifyAPPCommonSelfIn(boolean isIn, int seatIndex, boolean isSeatRandom, int teamId) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfIn state = new SudMGPAPPState.APPCommonSelfIn();
|
||||
state.isIn = isIn;
|
||||
state.seatIndex = seatIndex;
|
||||
state.isSeatRandom = isSeatRandom;
|
||||
state.teamId = teamId;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_IN, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 2. 准备状态
|
||||
* 用户(本人)准备/取消准备
|
||||
*
|
||||
* @param isReady true 准备,false 取消准备
|
||||
*/
|
||||
public void notifyAPPCommonSelfReady(boolean isReady) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfReady state = new SudMGPAPPState.APPCommonSelfReady();
|
||||
state.isReady = isReady;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_READY, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 3. 游戏状态 模型
|
||||
* 用户游戏状态,如果用户在游戏中,建议:
|
||||
* a.空出屏幕中心区:
|
||||
* 关闭全屏礼物特效;
|
||||
* b.部分强操作类小游戏(spaceMax为true),尽量收缩原生UI,给游戏留出尽量大的操作空间:
|
||||
* 收缩公屏;
|
||||
* 收缩麦位;
|
||||
* 如果不在游戏中,则恢复。
|
||||
*
|
||||
* @param isPlaying true 开始游戏,false 结束游戏
|
||||
* @param reportGameInfoExtras string类型,Https服务回调report_game_info参数,最大长度1024字节,超过则截断(2022-01-21)
|
||||
*/
|
||||
public void notifyAPPCommonSelfPlaying(boolean isPlaying, String reportGameInfoExtras, String reportGameInfoKey) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfPlaying state = new SudMGPAPPState.APPCommonSelfPlaying();
|
||||
state.isPlaying = isPlaying;
|
||||
state.reportGameInfoExtras = reportGameInfoExtras;
|
||||
state.reportGameInfoKey = reportGameInfoKey;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_PLAYING, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 4. 队长状态
|
||||
* 用户是否为队长,队长在游戏中会有开始游戏的权利。
|
||||
* 发送此状态后,会把队长身份转移到另一名用户身上。
|
||||
* 注意:必须是队长发送才有效果。可通过{@link SudFSMMGDecorator#getCaptainUserId()}拿到当前队长id
|
||||
*
|
||||
* @param curCaptainUID 必填,指定队长uid
|
||||
*/
|
||||
public void notifyAPPCommonSelfCaptain(String curCaptainUID) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfCaptain state = new SudMGPAPPState.APPCommonSelfCaptain();
|
||||
state.curCaptainUID = curCaptainUID;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_CAPTAIN, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 5. 踢人
|
||||
* 用户(本人,队长)踢其他玩家;
|
||||
* 队长才能踢人;
|
||||
*
|
||||
* @param kickedUID 被踢用户uid
|
||||
*/
|
||||
public void notifyAPPCommonSelfKick(String kickedUID) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfKick state = new SudMGPAPPState.APPCommonSelfKick();
|
||||
state.kickedUID = kickedUID;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_KICK, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 6. 结束游戏
|
||||
* 用户(本人,队长)结束(本局)游戏
|
||||
* 注意:必须是队长发送才有效果。可通过{@link SudFSMMGDecorator#getCaptainUserId()}拿到当前队长id
|
||||
*/
|
||||
public void notifyAPPCommonSelfEnd() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfEnd state = new SudMGPAPPState.APPCommonSelfEnd();
|
||||
// 使用iSudFSTAPP.notifyStateChange方法向游戏侧发送状态时,因为大部分状态都需要通过网络向后端发送状态指令
|
||||
// 所以如果发送状态后,马上就销毁游戏或者Activity,那么状态指令大概率会不生效
|
||||
// *** 如果要确保指令能到达后端,那么发送指令后不要立即destroyMG()或finish Activity,可在发送后delay一定时间(如300 or 500 ms)再销毁
|
||||
// *** 如果不在乎指令是否能成功到达,可忽略delay
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_END, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 9. 麦克风状态
|
||||
* 用户(本人)麦克风状态,建议:
|
||||
* 进入房间后初始通知一次;
|
||||
* 每次变更(开麦/闭麦/禁麦/解麦)通知一次;
|
||||
*
|
||||
* @param isOn true 开麦,false 闭麦
|
||||
* @param isDisabled true 被禁麦,false 未被禁麦
|
||||
*/
|
||||
public void notifyAPPCommonSelfMicrophone(boolean isOn, boolean isDisabled) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfMicrophone state = new SudMGPAPPState.APPCommonSelfMicrophone();
|
||||
state.isOn = isOn;
|
||||
state.isDisabled = isDisabled;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_MICROPHONE, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 10. 文字命中状态
|
||||
* 用户(本人)聊天信息命中关键词状态,建议:
|
||||
* 精确匹配;
|
||||
* 首次聊天内容命中关键词之后,后续聊天内容不翻转成未命中;
|
||||
* 直至小游戏侧关键词更新,再将状态翻转为未命中;
|
||||
*
|
||||
* @param isHit true 命中,false 未命中
|
||||
* @param keyWord 单个关键词, 兼容老版本
|
||||
* @param text 返回转写文本
|
||||
* @param wordType text:文本包含匹配; number:数字等于匹配
|
||||
* @param keyWordList 命中关键词,可以包含多个关键词
|
||||
* @param numberList 在number模式下才有,返回转写的多个数字
|
||||
*/
|
||||
public void notifyAPPCommonSelfTextHitState(boolean isHit, String keyWord, String text,
|
||||
String wordType, List<String> keyWordList, List<Integer> numberList) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonSelfTextHitState state = new SudMGPAPPState.APPCommonSelfTextHitState();
|
||||
state.isHit = isHit;
|
||||
state.keyWord = keyWord;
|
||||
state.text = text;
|
||||
state.wordType = wordType;
|
||||
state.keyWordList = keyWordList;
|
||||
state.numberList = numberList;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_TEXT_HIT, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 11. 打开或关闭背景音乐(2021-12-27新增)
|
||||
*
|
||||
* @param isOpen true 打开背景音乐,false 关闭背景音乐
|
||||
*/
|
||||
public void notifyAPPCommonOpenBgMusic(boolean isOpen) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonOpenBgMusic state = new SudMGPAPPState.APPCommonOpenBgMusic();
|
||||
state.isOpen = isOpen;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_BG_MUSIC, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 12. 打开或关闭音效(2021-12-27新增)
|
||||
*
|
||||
* @param isOpen true 打开音效,false 关闭音效
|
||||
*/
|
||||
public void notifyAPPCommonOpenSound(boolean isOpen) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonOpenSound state = new SudMGPAPPState.APPCommonOpenSound();
|
||||
state.isOpen = isOpen;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_SOUND, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 13. 打开或关闭游戏中的振动效果(2021-12-27新增)
|
||||
*
|
||||
* @param isOpen 打开振动效果,false 关闭振动效果
|
||||
*/
|
||||
public void notifyAPPCommonOpenVibrate(boolean isOpen) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonOpenVibrate state = new SudMGPAPPState.APPCommonOpenVibrate();
|
||||
state.isOpen = isOpen;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_VIBRATE, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 14. 设置游戏的音量大小(2021-12-31新增)
|
||||
*
|
||||
* @param volume 音量大小 0 到 100
|
||||
*/
|
||||
public void notifyAPPCommonGameSoundVolume(int volume) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonGameSoundVolume state = new SudMGPAPPState.APPCommonGameSoundVolume();
|
||||
state.volume = volume;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SOUND_VOLUME, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 15. 设置游戏玩法选项(2022-05-10新增)
|
||||
*
|
||||
* @param ludo ludo游戏
|
||||
*/
|
||||
public void notifyAPPCommonGameSettingSelectInfo(SudMGPAPPState.Ludo ludo) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonGameSettingSelectInfo state = new SudMGPAPPState.APPCommonGameSettingSelectInfo();
|
||||
state.ludo = ludo;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SETTING_SELECT_INFO, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 16. 设置游戏中的AI玩家(2022-05-11新增)
|
||||
*
|
||||
* @param aiPlayers AI玩家
|
||||
* @param isReady 机器人加入后是否自动准备 1:自动准备,0:不自动准备 默认为1
|
||||
*/
|
||||
public void notifyAPPCommonGameAddAIPlayers(List<SudMGPAPPState.AIPlayers> aiPlayers, int isReady) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonGameAddAIPlayers state = new SudMGPAPPState.APPCommonGameAddAIPlayers();
|
||||
state.aiPlayers = aiPlayers;
|
||||
state.isReady = isReady;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_ADD_AI_PLAYERS, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo)
|
||||
*/
|
||||
public void notifyAPPCommonGameReconnect() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonGameReconnect state = new SudMGPAPPState.APPCommonGameReconnect();
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_RECONNECT, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 18. app返回玩家当前积分
|
||||
*/
|
||||
public void notifyAPPCommonGameScore(long score) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.APPCommonGameScore state = new SudMGPAPPState.APPCommonGameScore();
|
||||
state.score = score;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SCORE, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
// endregion 状态通知,ISudFSTAPP.notifyStateChange
|
||||
|
||||
// region 生命周期
|
||||
public void startMG() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.startMG();
|
||||
}
|
||||
}
|
||||
|
||||
public void pauseMG() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.pauseMG();
|
||||
}
|
||||
}
|
||||
|
||||
public void playMG() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.playMG();
|
||||
}
|
||||
}
|
||||
|
||||
public void stopMG() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.stopMG();
|
||||
}
|
||||
}
|
||||
|
||||
public void destroyMG() {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.destroyMG();
|
||||
}
|
||||
}
|
||||
|
||||
// endregion 生命周期
|
||||
|
||||
/**
|
||||
* 更新code
|
||||
*
|
||||
* @param code
|
||||
* @param listener
|
||||
*/
|
||||
public void updateCode(String code, ISudListenerNotifyStateChange listener) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.updateCode(code, listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 音频流数据
|
||||
*/
|
||||
public void pushAudio(ByteBuffer buffer, int bufferLength) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.pushAudio(buffer, bufferLength);
|
||||
}
|
||||
}
|
||||
|
||||
// region 元宇宙砂砂舞
|
||||
|
||||
/**
|
||||
* 发送
|
||||
* 1. 元宇宙砂砂舞相关设置
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/CommonStateForDisco.html
|
||||
*
|
||||
* @param actionId 必传的参数,用于指定类型的序号,不同序号用于区分游戏内的不同功能,不传则会判断为无效指令,具体序号代表的功能见下表
|
||||
* @param cooldown 持续时间,单位秒,部分功能有持续时间就需要传对应的数值,不传或传错则会按各自功能的默认值处理(见下表)
|
||||
* @param isTop 是否置顶,针对部分功能可排队置顶(false:不置顶;true:置顶;默认为false)
|
||||
* @param field1 额外参数1,针对部分功能有具体的意义
|
||||
* @param field2 额外参数2,针对部分功能有具体的意义
|
||||
*/
|
||||
public void notifyAppCommonGameDiscoAction(int actionId, Integer cooldown, Boolean isTop, String field1, String field2) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
SudMGPAPPState.AppCommonGameDiscoAction state = new SudMGPAPPState.AppCommonGameDiscoAction();
|
||||
state.actionId = actionId;
|
||||
state.cooldown = cooldown;
|
||||
state.isTop = isTop;
|
||||
state.field1 = field1;
|
||||
state.field2 = field2;
|
||||
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_DISCO_ACTION, SudJsonUtils.toJson(state), null);
|
||||
}
|
||||
}
|
||||
// endregion 元宇宙砂砂舞
|
||||
|
||||
/**
|
||||
* APP状态通知给小游戏
|
||||
*
|
||||
* @param state 状态标识
|
||||
* @param dataJson 数据
|
||||
* @param listener 回调监听
|
||||
*/
|
||||
public void notifyStateChange(String state, String dataJson, ISudListenerNotifyStateChange listener) {
|
||||
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||
if (iSudFSTAPP != null) {
|
||||
iSudFSTAPP.notifyStateChange(state, dataJson, listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* APP状态通知给小游戏
|
||||
*
|
||||
* @param state 状态标识
|
||||
* @param dataJson 数据
|
||||
*/
|
||||
public void notifyStateChange(String state, String dataJson) {
|
||||
notifyStateChange(state, dataJson, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP状态通知给小游戏
|
||||
*
|
||||
* @param state 状态标识
|
||||
* @param obj 数据
|
||||
*/
|
||||
public void notifyStateChange(String state, Object obj) {
|
||||
notifyStateChange(state, SudJsonUtils.toJson(obj), null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 游戏配置模型
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameCfg.html
|
||||
*/
|
||||
public class GameConfigModel implements Serializable {
|
||||
|
||||
public int gameMode = 1; // 游戏模式(每个游戏默认模式是1,不填是1)
|
||||
public int gameCPU = 0; // 游戏CPU(值为0和1;0:CPU正常功耗,1:CPU低功耗;默认是0,CPU正常功耗)
|
||||
public int gameSoundControl = 0; // 游戏中声音的播放是否被app层接管(值为0和1;0:游戏播放声音,1:app层播放声音,游戏中不播放任何声音;默认是0)
|
||||
public int gameSoundVolume = 100; // 游戏中音量的大小(值为0到100;默认是100)
|
||||
public GameUi ui = new GameUi(); // 对游戏ui界面的配置,可定制ui界面的显示与不显示
|
||||
|
||||
// 游戏配置中,ui部分
|
||||
public static class GameUi implements Serializable {
|
||||
public GameSettle gameSettle = new GameSettle(); // 结算界面
|
||||
public GamePing ping = new GamePing(); // 界面中的ping值
|
||||
public GameVersion version = new GameVersion(); // 界面中的版本信息值
|
||||
public GameLevel level = new GameLevel(); // 大厅中的段位信息
|
||||
public GameLobbySettingBtn lobby_setting_btn = new GameLobbySettingBtn(); // 大厅的设置按钮
|
||||
public GameLobbyHelpBtn lobby_help_btn = new GameLobbyHelpBtn(); // 大厅的帮助按钮
|
||||
public GameLobbyPlayers lobby_players = new GameLobbyPlayers(); // 大厅玩家展示位
|
||||
public GameLobbyPlayerCaptainIcon lobby_player_captain_icon = new GameLobbyPlayerCaptainIcon(); // 大厅玩家展示位上队长标识
|
||||
public GameLobbyPlayerKickoutIcon lobby_player_kickout_icon = new GameLobbyPlayerKickoutIcon(); // 大厅玩家展示位上踢人标识
|
||||
public GameLobbyRule lobby_rule = new GameLobbyRule(); // 大厅的玩法规则描述文字
|
||||
public GameLobbyGameSetting lobby_game_setting = new GameLobbyGameSetting(); // 玩法设置
|
||||
public GameJoinBtn join_btn = new GameJoinBtn(); // 加入按钮
|
||||
public GameCancelJoinBtn cancel_join_btn = new GameCancelJoinBtn(); // 取消加入按钮
|
||||
public GameReadyBtn ready_btn = new GameReadyBtn(); // 准备按钮
|
||||
public GameCancelReadyBtn cancel_ready_btn = new GameCancelReadyBtn(); // 取消准备按钮
|
||||
public GameStartBtn start_btn = new GameStartBtn(); // 开始按钮
|
||||
public GameShareBtn share_btn = new GameShareBtn(); // 分享
|
||||
public GameSttingBtn game_setting_btn = new GameSttingBtn(); // 游戏场景中的设置按钮
|
||||
public GameHelpBtn game_help_btn = new GameHelpBtn(); // 游戏场景中的帮助按钮
|
||||
public GameSettleCloseBtn game_settle_close_btn = new GameSettleCloseBtn(); // 游戏结算界面中的关闭按钮
|
||||
public GameSettleAgainBtn game_settle_again_btn = new GameSettleAgainBtn(); // 游戏结算界面中的再来一局按钮
|
||||
public GameBg game_bg = new GameBg();// 是否隐藏背景图,包括大厅和战斗
|
||||
public BlockChangeSeat block_change_seat = new BlockChangeSeat(); // 自定义阻止换座位
|
||||
public GameSettingSelectPnl game_setting_select_pnl = new GameSettingSelectPnl(); // 大厅中的玩法选择设置面板
|
||||
public GameManagedImage game_managed_image = new GameManagedImage(); // 游戏中的托管图标
|
||||
public GameTableImage game_table_image = new GameTableImage(); // 游戏中牌桌背景图 (注:只对某些带牌桌类游戏有作用)
|
||||
public GameCountdownTime game_countdown_time = new GameCountdownTime(); // 游戏中游戏倒计时显示 (注:现在只针对umo生效)
|
||||
public GameSelectedTips game_selected_tips = new GameSelectedTips(); // 游戏中所选择的玩法提示文字 (注:现在只针对ludo生效)
|
||||
public NFTAvatar nft_avatar = new NFTAvatar(); // 控制NFT头像的开关
|
||||
public GameOpening game_opening = new GameOpening(); // 控制开场动画的开关
|
||||
public GameMvp game_mvp = new GameMvp(); // 游戏结算前的mvp动画
|
||||
public UmoIcon umo_icon = new UmoIcon(); // 游戏中动画和头像右上角的UMO图标
|
||||
public Logo logo = new Logo(); // 大厅中的logo
|
||||
public GamePlayers game_players = new GamePlayers(); // 游戏中的游戏位
|
||||
}
|
||||
|
||||
// 结算界面
|
||||
public static class GameSettle implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏结算界面(false: 显示; true: 隐藏,默认为 false)
|
||||
}
|
||||
|
||||
// 界面中的ping值
|
||||
public static class GamePing implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏ping值(false: 显示;true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 界面中的版本信息值
|
||||
public static class GameVersion implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏版本信息(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅中的段位信息
|
||||
public static class GameLevel implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏段位信息(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅的设置按钮
|
||||
public static class GameLobbySettingBtn implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏大厅的设置按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅的帮助按钮
|
||||
public static class GameLobbyHelpBtn implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏大厅的帮助按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅玩家展示位
|
||||
public static class GameLobbyPlayers implements Serializable {
|
||||
public boolean custom = false; // 大厅玩家展示位头像点击加入(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏大厅玩家展示位(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅玩家展示位上队长标识
|
||||
public static class GameLobbyPlayerCaptainIcon implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏大厅玩家展示位上队长标识(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅玩家展示位上踢人标识
|
||||
public static class GameLobbyPlayerKickoutIcon implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏大厅玩家展示位上踢人标识(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 大厅的玩法规则描述文字
|
||||
public static class GameLobbyRule implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏大厅的玩法规则描述文字(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 玩法设置
|
||||
public static class GameLobbyGameSetting implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏玩法设置(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 加入按钮
|
||||
public static class GameJoinBtn implements Serializable {
|
||||
public boolean custom = false; // 加入按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏加入按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 取消加入按钮
|
||||
public static class GameCancelJoinBtn implements Serializable {
|
||||
public boolean custom = false; // 取消加入按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏取消加入按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 准备按钮
|
||||
public static class GameReadyBtn implements Serializable {
|
||||
public boolean custom = false; // 准备按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏准备按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 取消准备按钮
|
||||
public static class GameCancelReadyBtn implements Serializable {
|
||||
public boolean custom = false; // 取消准备按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏取消准备按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 开始游戏按钮
|
||||
public static class GameStartBtn implements Serializable {
|
||||
public boolean custom = false; // 开始游戏按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = false; // 是否隐藏开始游戏按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 分享按钮
|
||||
public static class GameShareBtn implements Serializable {
|
||||
public boolean custom = false; // 分享按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||
public boolean hide = true; // 是否隐藏分享按钮(false: 显示; true: 隐藏,默认为true)
|
||||
}
|
||||
|
||||
// 游戏场景中的设置按钮
|
||||
public static class GameSttingBtn implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏游戏场景中的设置按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 游戏场景中的帮助按钮
|
||||
public static class GameHelpBtn implements Serializable {
|
||||
public boolean hide = false; // 是否隐藏游戏场景中的帮助按钮(false: 显示; true: 隐藏,默认为false)
|
||||
}
|
||||
|
||||
// 游戏结算界面中的关闭按钮
|
||||
public static class GameSettleCloseBtn implements Serializable {
|
||||
public boolean custom = false; // 游戏结算界面中的关闭按钮(false: 关闭结算界面返回大厅; true: 游戏通知按钮点击事件,并关闭结算界面返回大厅;默认为false)
|
||||
}
|
||||
|
||||
// 游戏结算界面中的再来一局按钮
|
||||
public static class GameSettleAgainBtn implements Serializable {
|
||||
// 游戏结算界面中的再来一局按钮
|
||||
// (false: 关闭结算界面返回大厅并将玩家设置为准备状态; true: 游戏通知按钮点击事件,并关闭结算界面返回大厅(不将玩家设置为准备状态);默认为false)
|
||||
public boolean custom = false;
|
||||
|
||||
// 是否隐藏结算界面中的『再来一局』按钮(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 是否隐藏背景图,包括大厅和战斗
|
||||
// !!!这里只隐藏加载完成后的背景图,加载中背景图如需隐藏则调用:{SudMGP.getCfg().setShowLoadingGameBg(false); }
|
||||
public static class GameBg implements Serializable {
|
||||
//(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 自定义阻止换座位
|
||||
public static class BlockChangeSeat implements Serializable {
|
||||
//(false: 可以换座位; true: 不可以换座位;默认为false)
|
||||
public boolean custom = false;
|
||||
}
|
||||
|
||||
// 大厅中的玩法选择设置面板
|
||||
public static class GameSettingSelectPnl implements Serializable {
|
||||
// 是否隐藏大厅中的玩法选择设置面板(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 游戏中的托管图标
|
||||
public static class GameManagedImage implements Serializable {
|
||||
// 是否隐藏游戏中的托管图标(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 游戏中牌桌背景图 (注:只对某些带牌桌类游戏有作用)
|
||||
public static class GameTableImage implements Serializable {
|
||||
// 是否隐藏游戏牌桌背景图(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 游戏中游戏倒计时显示 (注:现在只针对umo生效)
|
||||
public static class GameCountdownTime implements Serializable {
|
||||
// 是否隐藏游戏中游戏倒计时显示(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 游戏中所选择的玩法提示文字 (注:现在只针对ludo生效)
|
||||
public static class GameSelectedTips implements Serializable {
|
||||
// 是否隐藏游戏中所选择的玩法提示文字显示(false: 显示; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 控制NFT头像的开关
|
||||
public static class NFTAvatar implements Serializable {
|
||||
// true隐藏 false显示
|
||||
public boolean hide = true;
|
||||
}
|
||||
|
||||
// 控制开场动画的开关
|
||||
public static class GameOpening implements Serializable {
|
||||
// true隐藏 false显示
|
||||
public boolean hide = true;
|
||||
}
|
||||
|
||||
// 游戏结算前的mvp动画
|
||||
public static class GameMvp implements Serializable {
|
||||
// true隐藏 false显示
|
||||
public boolean hide = true;
|
||||
}
|
||||
|
||||
// 游戏中动画和头像右上角的UMO图标
|
||||
public static class UmoIcon implements Serializable {
|
||||
// 是否隐藏游戏中动画和头像右上角的UMO图标并改为UNO(false: 不隐藏,依然显示UMO; true: 隐藏,改为显示UNO,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 大厅中的logo
|
||||
public static class Logo implements Serializable {
|
||||
// 是否隐藏大厅中的logo(false: 不隐藏; true: 隐藏,默认为false)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
// 游戏中的游戏位
|
||||
public static class GamePlayers implements Serializable {
|
||||
// 是否隐藏游戏中的游戏位(false: 不隐藏; true: 隐藏,默认为false,暂时只支持你画我猜)
|
||||
public boolean hide = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.model;
|
||||
|
||||
/**
|
||||
* 游戏视图
|
||||
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameViewInfo.html
|
||||
*/
|
||||
public class GameViewInfoModel {
|
||||
// 返回码
|
||||
public int ret_code;
|
||||
|
||||
// 返回消息
|
||||
public String ret_msg;
|
||||
|
||||
// 游戏View的大小
|
||||
public GameViewSizeModel view_size = new GameViewSizeModel();
|
||||
|
||||
// 游戏安全操作区域
|
||||
public GameViewRectModel view_game_rect = new GameViewRectModel();
|
||||
|
||||
public static class GameViewSizeModel {
|
||||
// 游戏View的宽 (单位像素)
|
||||
public int width;
|
||||
|
||||
// 游戏View的高 (单位像素)
|
||||
public int height;
|
||||
}
|
||||
|
||||
public static class GameViewRectModel {
|
||||
// 相对于view_size左边框偏移(单位像素)
|
||||
public int left;
|
||||
// 相对于view_size上边框偏移(单位像素)
|
||||
public int top;
|
||||
// 相对于view_size右边框偏移(单位像素)
|
||||
public int right;
|
||||
// 相对于view_size下边框偏移(单位像素)
|
||||
public int bottom;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.sud.state;
|
||||
|
||||
/**
|
||||
* mg2app,状态响应
|
||||
*/
|
||||
public class MGStateResponse {
|
||||
|
||||
// 返回码,成功
|
||||
public static final int SUCCESS = 0;
|
||||
|
||||
public int ret_code; // 返回码
|
||||
public String ret_msg; // 返回消息
|
||||
}
|
||||
1001
common/src/main/java/com/yunbao/common/sud/state/SudMGPAPPState.java
Normal file
1001
common/src/main/java/com/yunbao/common/sud/state/SudMGPAPPState.java
Normal file
File diff suppressed because it is too large
Load Diff
1509
common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java
Normal file
1509
common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ package com.yunbao.common.utils;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
@@ -151,16 +152,19 @@ public class GiftCacheUtil {
|
||||
return;
|
||||
}
|
||||
clickId.add(bean.getId()+"");
|
||||
getFile(context,getDownloadSaveName(bean.getId()), bean.getSwf(), "0", new CommonCallback<File>() {
|
||||
@Override
|
||||
public void callback(File bean) {
|
||||
if(bean!=null) {
|
||||
clickId.remove(getIdForFileName(bean.getName())+"");
|
||||
downloadCache.remove(getIdForFileName(bean.getName()));
|
||||
if (!TextUtils.isEmpty( bean.getSwf())){
|
||||
getFile(context,getDownloadSaveName(bean.getId()), bean.getSwf(), "0", new CommonCallback<File>() {
|
||||
@Override
|
||||
public void callback(File bean) {
|
||||
if(bean!=null) {
|
||||
clickId.remove(getIdForFileName(bean.getName())+"");
|
||||
downloadCache.remove(getIdForFileName(bean.getName()));
|
||||
}
|
||||
mDownloadGifCallback.callback(bean);
|
||||
}
|
||||
mDownloadGifCallback.callback(bean);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +245,7 @@ public class GiftCacheUtil {
|
||||
if (clickId.contains(id+"")) {
|
||||
continue;
|
||||
}
|
||||
if (bean.getSwf().isEmpty()) {
|
||||
if (TextUtils.isEmpty(bean.getSwf())) {
|
||||
handler.post(() -> commonCallback.callback(null));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright © Sud.Tech
|
||||
* https://sud.tech
|
||||
*/
|
||||
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import com.yunbao.common.sud.state.MGStateResponse;
|
||||
|
||||
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||
|
||||
public class ISudFSMStateHandleUtils {
|
||||
|
||||
/**
|
||||
* 回调游戏,成功
|
||||
*
|
||||
* @param handle
|
||||
*/
|
||||
public static void handleSuccess(ISudFSMStateHandle handle) {
|
||||
MGStateResponse response = new MGStateResponse();
|
||||
response.ret_code = MGStateResponse.SUCCESS;
|
||||
response.ret_msg = "success";
|
||||
handle.success(SudJsonUtils.toJson(response));
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user