diff --git a/FaceUnity/src/main/res/values-zh-rCN/strings.xml b/FaceUnity/src/main/res/values-zh-rCN/strings.xml index 5f124dfcc..a8243f912 100644 --- a/FaceUnity/src/main/res/values-zh-rCN/strings.xml +++ b/FaceUnity/src/main/res/values-zh-rCN/strings.xml @@ -1,96 +1,96 @@ 警告 - 抱歉,你所使用的证书权限或SDK不包括该功能。 - 相机权限被禁用或者相机被别的应用占用! - 重试 + 抱歉,你所使用的證書權限或SDK不包括該功能。 + 相機權限被禁用或者相機被別的應用佔用! + 重試 退出 Resolution:\n\t%dX%d\nFPS: %d\nRender time:\n\t%dms 保存照片成功! - 保存视频成功! - 保存视频失败! - 视频太短啦! - 视频处理中请稍等 - 未检测到人脸 - 人脸不全 - 单输入 - 双输入 + 保存視頻成功! + 保存視頻失敗! + 視頻太短啦! + 視頻處理中請稍等 + 未檢測到人臉 + 人臉不全 + 單輸入 + 雙輸入 磨皮 美白 - 红润 - 锐化 + 紅潤 + 銳化 亮眼 美牙 大眼 - 圆眼 + 圓眼 自然 女神 - 长脸 - 圆脸 - 瘦脸 - V脸 - 窄脸 - 短脸 - 小脸 + 長臉 + 圓臉 + 瘦臉 + V臉 + 窄臉 + 短臉 + 小臉 下巴 - 额头 + 額頭 瘦鼻 嘴型 - 瘦颧骨 - 瘦下颌骨 - 美肤 + 瘦顴骨 + 瘦下頜骨 + 美膚 美型 - 滤镜 - 风格推荐 + 濾鏡 + 風格推薦 去黑眼圈 - 去法令纹 + 去法令紋 微笑嘴角 眉毛上下 - 眉间距 - 开眼角 - 缩人中 - 长鼻 + 眉間距 + 開眼角 + 縮人中 + 長鼻 眼距 眼睛角度 - 口红 - 腮红 + 口紅 + 腮紅 眉毛 眼影 - 眼线 + 眼線 睫毛 美瞳 粉底 高光 - 阴影 - 卸妆 - 自定义 + 陰影 + 卸妝 + 自定義 桃花 男友 清透 西柚 - 选择图片 - 选择视频 - 请从相册中选择图片或视频 - 所选图片文件不存在。 - 所选视频文件不存在。 + 選擇圖片 + 選擇視頻 + 請從相冊中選擇圖片或視頻 + 所選圖片文件不存在。 + 所選視頻文件不存在。 - 张嘴试试 - 鼓腮帮子 - 皱眉试试 + 張嘴試試 + 鼓腮幫子 + 皺眉試試 眨一眨眼 - 嘟嘴试试 - 微笑触发 - 吹气触发 - 张嘴试试 + 嘟嘴試試 + 微笑觸發 + 吹氣觸發 + 張嘴試試 推出手掌 - 单手手指比心 - 比个六 - 双拳靠近脸颊卖萌 + 單手手指比心 + 比個六 + 雙拳靠近臉頰賣萌 - 原图 + 原圖 白亮 1 白亮 2 白亮 3 @@ -109,23 +109,23 @@ 小清新 3 小清新 4 小清新 6 - 冷色调 1 - 冷色调 2 - 冷色调 3 - 冷色调 4 - 冷色调 7 - 冷色调 8 - 冷色调 11 - 暖色调 1 - 暖色调 2 - 个性 1 - 个性 2 - 个性 3 - 个性 4 - 个性 5 - 个性 7 - 个性 10 - 个性 11 + 冷色調 1 + 冷色調 2 + 冷色調 3 + 冷色調 4 + 冷色調 7 + 冷色調 8 + 冷色調 11 + 暖色調 1 + 暖色調 2 + 個性 1 + 個性 2 + 個性 3 + 個性 4 + 個性 5 + 個性 7 + 個性 10 + 個性 11 黑白 1 黑白 2 黑白 3 @@ -138,14 +138,14 @@ 自然 6 自然 7 自然 8 - 质感灰 1 - 质感灰 2 - 质感灰 3 - 质感灰 4 - 质感灰 5 - 质感灰 6 - 质感灰 7 - 质感灰 8 + 質感灰 1 + 質感灰 2 + 質感灰 3 + 質感灰 4 + 質感灰 5 + 質感灰 6 + 質感灰 7 + 質感灰 8 蜜桃 1 蜜桃 2 蜜桃 3 @@ -155,85 +155,85 @@ 蜜桃 7 蜜桃 8 - - 风格 1 - 风格 2 - 风格 3 - 风格 4 - 风格 5 - 风格 6 - 风格 7 - 使用%s先取消“风格推荐” + + 風格 1 + 風格 2 + 風格 3 + 風格 4 + 風格 5 + 風格 6 + 風格 7 + 使用%s先取消“風格推薦” - 对准线框 正脸拍摄 - 替换失败 - 未识别模板的人脸,请重新选择模板 - 未检测到人脸,请重新拍摄 - 人脸不全,请重新拍摄 - 人脸偏转角度过大,请正脸拍摄。 + 對準線框 正臉拍攝 + 替換失敗 + 未識別模板的人臉,請重新選擇模板 + 未檢測到人臉,請重新拍攝 + 人臉不全,請重新拍攝 + 人臉偏轉角度過大,請正臉拍攝。 知道啦 - 检测到多人,请选择一人进行换脸 + 檢測到多人,請選擇一人進行換臉 Animoji - 动漫滤镜 + 動漫濾鏡 - 删除模型 + 刪除模型 新建模型 - 编辑模型 + 編輯模型 - 发型 - 脸型 + 髮型 + 臉型 眼睛 嘴唇 鼻子 - 脸型长度 - 脸颊宽度 - 下颚宽度 + 臉型長度 + 臉頰寬度 + 下顎寬度 下巴高低 眼睛位置 眼角高度 眼睛高低 - 眼睛宽窄 + 眼睛寬窄 鼻子位置 - 鼻翼宽窄 - 鼻头高低 + 鼻翼寬窄 + 鼻頭高低 嘴部位置 上唇厚度 下唇厚度 - 嘴唇宽度 - 你还没有创建过模型哦 - 是否将所有参数恢复到默认值? - 自定义 + 嘴唇寬度 + 你還沒有創建過模型哦 + 是否將所有參數恢復到默認值? + 自定義 保存成功 - 返回后当前操作将不会被保存哦 - 删除 + 返回后當前操作將不會被保存哦 + 刪除 取消 - 删除(%d) - 删除道具 - 全选 - 你还没有创建过道具哦 - 确定 + 刪除(%d) + 刪除道具 + 全選 + 你還沒有創建過道具哦 + 確定 取消 - 确定删除所选中的道具? - 删除成功 - 删除失败 + 確定刪除所選中的道具? + 刪除成功 + 刪除失敗 道具保存成功 - 恢复 + 恢復 - 雾面 - 润泽Ⅰ - 润泽Ⅱ + 霧面 + 潤澤Ⅰ + 潤澤Ⅱ 珠光 咬唇 - 苹果肌 + 蘋果肌 扇形 眼角 微醺 高光 I 高光 II - 阴影 I + 陰影 I 蜜糖 奶茶 水波 @@ -241,106 +241,106 @@ 孔雀 星河 落目 - 极光 - 柳叶眉 + 極光 + 柳恭弘=叶 恭弘眉 野生眉 古典眉 - 标准眉 - 单色眼影 - 双色眼影 I - 双色眼影 II - 双色眼影 III + 標準眉 + 單色眼影 + 雙色眼影 I + 雙色眼影 II + 雙色眼影 III 三色眼影 I 三色眼影 II 自然型 I 自然型 II - 浓密型 I - 浓密型 II - 夸张型 I - 夸张型 II - 猫眼 + 濃密型 I + 濃密型 II + 誇張型 I + 誇張型 II + 貓眼 下垂眼 - 拉开眼距 + 拉開眼距 拉近眼距 - 长眼 - 圆眼 + 長眼 + 圓眼 嗲嗲兔 - 冻龄 - 国风 + 凍齡 + 國風 混血 性感 甜美 - 邻家 - 欧美 - 妩媚 - 减龄 + 鄰家 + 歐美 + 嫵媚 + 減齡 暖冬 - 红枫 + 紅楓 少女 - 紫韵 - 厌世猫 - 人鱼 + 紫韻 + 厭世貓 + 人魚 初秋 - 千纸鹤 + 千紙鶴 超模 - 雏菊 - 港风 + 雛菊 + 港風 Rose 瘦身 - 长腿 - 细腰 + 長腿 + 細腰 美肩 美臀 - 小头 + 小頭 瘦腿 - 未检测到人体 - 全身驱动 - 半身驱动 + 未檢測到人體 + 全身驅動 + 半身驅動 - 载入图片或视频 - 未检测到手势 + 載入圖片或視頻 + 未檢測到手勢 - 抠像 + 摳像 背景 - 关键颜色 + 關鍵顏色 相似度 平滑 祛色度 - 安全区域 + 安全區域 科技 - 沙滩 + 沙灘 教室 森林 - 水墨画 - 请使用纯色背景拍摄,推荐绿色幕布效果最佳 + 水墨畫 + 請使用純色背景拍攝,推薦綠色幕布效果最佳 我知道了 - 下载失败 + 下載失敗 返回 - 白色区域为安全区域,不参与绿幕抠像 + 白色區域為安全區域,不參与綠幕摳像 - 眉毛上下功能仅支持在高端机上使用 - 眉间距功能仅支持在高端机上使用 + 眉毛上下功能僅支持在高端機上使用 + 眉間距功能僅支持在高端機上使用 - 美颜 - 美妆 - 贴纸 - 美体 + 美顏 + 美妝 + 貼紙 + 美體 - 未检测到人脸 - 未检测到人脸或人体 + 未檢測到人臉 + 未檢測到人臉或人體 奶茶 豆沙 超A - 搞笑大头 + 搞笑大頭 Animoji - 精品贴纸 + 精品貼紙 重置 自定義 diff --git a/FaceUnity/src/main/res/values/strings.xml b/FaceUnity/src/main/res/values/strings.xml index e0f66a9b3..050818a37 100644 --- a/FaceUnity/src/main/res/values/strings.xml +++ b/FaceUnity/src/main/res/values/strings.xml @@ -16,33 +16,33 @@ SingleInput DualInput - Fine smooth - Whiten - Ruddy + Buffing + Skin Tone + Rosy Sharpen - Eye brighten - Tooth whiten - Eye enlarge - Eye round - Natural + Brighen + Whiten + Enlarge + Round + Origin Goddess Long face Round face - Cheekbone - Jawbone - Cheek thin - V face - CheekNarrow - Cheek short - Cheek small - Chin - Forehead - Nose - Mouth - Skin - Reshape + Cheek + Jaw + Lower Width + V Shape + Upper Width + Short Face + Size Face + Chin Length + Hairline + Nose Size + Mouth Size + Skincare + Beauty type Filter - Presets + Style recommend Lipstick Blush Eyebrow @@ -59,16 +59,16 @@ Boyfriend Clear Grapefruit - Circle - Wrinkles + Dark Circles + Laugh Line Smile - Brow height - Brow space - Canthus - Philtrum - Length - Eye distance - Slant + Brow Position + Brow Distance + Inner Corner + Mouth Position + Nose Lift + Eye Distance + Eye Upturn None Style 1 Style 2 @@ -77,7 +77,7 @@ Style 5 Style 6 Style 7 - To use %s, cancel \'Presets\' first. + To use %s, cancel \'Style recommend\' first. Photo Video diff --git a/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java b/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java index 41efb787c..820e6c3f6 100644 --- a/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/InvitePopDialog.java @@ -102,7 +102,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow { initData(); link.setText(url.substring(0, 40)); if(StringUtil.isEmpty(titleStr)) { - info.setText(R.string.dialog_invite_info); + info.setText(mContext.getString(R.string.dialog_invite_info)); }else{ info.setText(titleStr); } @@ -129,7 +129,7 @@ public class InvitePopDialog extends AbsDialogPopupWindow { private void initData() { data = new ArrayList<>(); - //data.add(builder(ShareBuilder.APP_FACEBOOK)); + data.add(builder(ShareBuilder.APP_FACEBOOK)); data.add(builder(ShareBuilder.APP_LINE)); data.add(builder(ShareBuilder.APP_TWITTER)); data.add(builder(ShareBuilder.APP_WHATSAPP)); diff --git a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java index 36161ddd2..077cef5a4 100644 --- a/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/SharePopDialog.java @@ -18,6 +18,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.share.R; +import com.yunbao.common.utils.WordUtil; import com.yunbao.share.adapters.ShareAppAdapter; import com.yunbao.share.bean.ShareBuilder; @@ -63,7 +64,7 @@ public class SharePopDialog extends AbsDialogPopupWindow { } public SharePopDialog setShareLink(String link) { - this.shareLink = link; + this.shareLink = link + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); return this; } @@ -112,6 +113,7 @@ public class SharePopDialog extends AbsDialogPopupWindow { url = shareLink; } } + url = url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); link.setText(url); info.setText(String.format(getContext().getString(R.string.dialog_share_info), StringUtil.isEmpty(anchorName) ? "" : anchorName)); ImgLoader.display(getContext(), anchorAvatar, avatar); @@ -138,7 +140,7 @@ public class SharePopDialog extends AbsDialogPopupWindow { url = ShareBuilder.createLiveShareLink(uid, anchorId, anchorName, anchorAvatar); } ClipboardManager cm = (ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE); - ClipData clipData = ClipData.newPlainText("text",info.getText().toString()+"\n"+url); + ClipData clipData = ClipData.newPlainText("text", info.getText().toString() + "\n" + url + "&isZh=" + (WordUtil.isNewZh() ? "1" : 0)); cm.setPrimaryClip(clipData); ToastUtil.show(getContext().getString(com.yunbao.common.R.string.copy_success)); } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 6e4669fb5..732505853 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -236,6 +236,48 @@ rx.internal.util.atomic.LinkedQueueNode* consumerNode; -keep class com.faceunity.wrapper.faceunity$LoadConfig*{ private static boolean sLoadedLibrary; } +-keep class com.umeng.** {*;} + +-keep class org.repackage.** {*;} + +-keep class com.uyumao.** { *; } + +-keepclassmembers class * { + public (org.json.JSONObject); +} + +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} +#----svga +-keep class com.opensource.svgaplayer.**{ + public ; + public static ; +} +# json序列化的混淆 +-keep class tech.sud.mgp.hello.ui.scenes.ticket.model.** {*;} +-keep class tech.sud.mgp.hello.service.game.req.** {*;} +-keep class tech.sud.mgp.hello.service.game.resp.** {*;} +-keep class tech.sud.mgp.hello.service.login.req.** {*;} +-keep class tech.sud.mgp.hello.service.login.resp.** {*;} +-keep class tech.sud.mgp.hello.service.main.req.** {*;} +-keep class tech.sud.mgp.hello.service.main.resp.** {*;} +-keep class tech.sud.mgp.hello.service.main.config.** {*;} +-keep class tech.sud.mgp.hello.service.room.req.** {*;} +-keep class tech.sud.mgp.hello.service.room.resp.** {*;} +-keep class tech.sud.mgp.hello.service.room.model.** {*;} +-keep class tech.sud.mgp.hello.ui.main.home.model.** {*;} +-keep class tech.sud.mgp.hello.ui.scenes.base.model.** {*;} +-keep class tech.sud.mgp.hello.ui.scenes.common.cmd.** {*;} +-keep class tech.sud.mgp.hello.ui.scenes.custom.model.** {*;} +-keep class tech.sud.mgp.hello.ui.scenes.orderentertainment.model.** {*;} +-keep class tech.sud.mgp.hello.ui.main.settings.model.** {*;} +-keep class tech.sud.mgp.hello.ui.main.nft.model.** {*;} +-keep class tech.sud.mgp.hello.common.event.model.** {*;} + +-keep class com.yunbao.common.sud.** {*;} + #--融云语聊-- -keep public class cn.rongcloud.** {*;} -ignorewarnings \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b52c66ce2..3addface6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -62,6 +62,9 @@ + + + - - + + - - + + - - - - - - + + + + + + - + - + + @@ -162,13 +166,16 @@ - + + diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index b2674d02c..d26bdc5a8 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -32,6 +32,8 @@ import com.tencent.imsdk.v2.V2TIMGroupMemberInfo; import com.tencent.imsdk.v2.V2TIMManager; import com.tencent.imsdk.v2.V2TIMSimpleMsgListener; import com.tencent.imsdk.v2.V2TIMUserInfo; +import com.umeng.analytics.MobclickAgent; +import com.umeng.commonsdk.UMConfigure; import com.yunbao.common.BuildConfig; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppContext; @@ -163,8 +165,23 @@ public class AppContext extends CommonAppContext { if (isMainProcess()) { OpenInstall.init(this); } + //设置LOG开关,默认为false + UMConfigure.setLogEnabled(true); + //友盟正式初始化 + UMConfigure.init(getApplicationContext(), "64e40ee55488fe7b3afa2c96", "PDLive", UMConfigure.DEVICE_TYPE_PHONE, + "64e40ee55488fe7b3afa2c96"); + + //集成umeng-crash-vx.x.x.aar,则需要关闭原有统计SDK异常捕获功能 + MobclickAgent.setCatchUncaughtExceptions(false); + //PushSDK初始化(如使用推送SDK,必须调用此方法) + + //统计SDK是否支持采集在子进程中打点的自定义事件,默认不支持 + UMConfigure.setProcessEvent(true);//支持多进程打点 + MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); + UMConfigure.submitPolicyGrantResult(getApplicationContext(), true); + registerActivityLifecycleCallbacks(new AdjustLifecycleCallbacks()); //初始化 AndroidUtilCode Utils.init(this); diff --git a/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java b/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java index 5251deee9..f0619923c 100644 --- a/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java +++ b/app/src/main/java/com/shayu/phonelive/activity/LauncherActivity.java @@ -229,8 +229,11 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL } else { checkUidAndToken(); } + }else{ + ToastUtil.show(getString(R.string.net_error)); } } + }); } @@ -389,6 +392,15 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL mPlayer = null; } + @Override + public void onBackPressed() { + if (mLauncherAdViewHolder != null) { + mLauncherAdViewHolder.release(); + checkUidAndToken(); + return; + } + super.onBackPressed(); + } /** * 播放广告 diff --git a/build.gradle b/build.gradle index e5625c196..732386157 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,7 @@ buildscript { maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.faceunity.com/repository/maven-public/' }//美颜库 + maven { url 'https://repo1.maven.org/maven2/' }//埋点 google() mavenCentral() } @@ -41,6 +42,7 @@ allprojects { maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.faceunity.com/repository/maven-public/' }//美颜库 maven { url "https://jitpack.io" } + maven { url 'https://repo1.maven.org/maven2/' }//埋点 google() // Google's Maven repository } } diff --git a/common/build.gradle b/common/build.gradle index ca3fd6dc6..c8b416b3d 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -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' diff --git a/common/src/main/AndroidManifest.xml b/common/src/main/AndroidManifest.xml index 8ddcbe240..a4240da8d 100644 --- a/common/src/main/AndroidManifest.xml +++ b/common/src/main/AndroidManifest.xml @@ -1,16 +1,15 @@ - - - + + + - - - + + + - - 支付宝 end ---> + 支付宝 + + + 支付宝 end + --> + () { + @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() { + @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 "); + } + } + }); + } + + } + +} diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index efa509052..702e94fe1 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -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(); + } + + } diff --git a/common/src/main/java/com/yunbao/common/adapter/AvatarListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/AvatarListAdapter.java new file mode 100644 index 000000000..5b1f5fdff --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/AvatarListAdapter.java @@ -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 playerObjects = new ArrayList<>(); + + public AvatarListAdapter(List 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(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java index 3f0c434c1..2ab378200 100644 --- a/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/CustomDrawerPopupAdapter.java @@ -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 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() { + .anchorRecommend(map, new com.yunbao.common.http.base.HttpCallback() { @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)); } }); } diff --git a/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java new file mode 100644 index 000000000..9bd25c0d3 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/InteractionGamesAdapter.java @@ -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 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 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 mChild) { + child.clear(); + child.addAll(mChild); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java new file mode 100644 index 000000000..54c1f1c45 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleFunGamesAdapter.java @@ -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 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 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 mChild) { + child.clear(); + child.addAll(mChild); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java new file mode 100644 index 000000000..38a531bce --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRoleInteractionGamesAdapter.java @@ -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 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 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 mChild) { + child.clear(); + child.addAll(mChild); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java new file mode 100644 index 000000000..ef0105714 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewRolerPopupAdapter.java @@ -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 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 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); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java index 4363e6dd2..69c38cfed 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java @@ -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; } } diff --git a/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java b/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java index 335f8a6f5..3f6c5acae 100644 --- a/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/MsgFollowAdapter.java @@ -110,7 +110,7 @@ public class MsgFollowAdapter extends RecyclerView.Adapter @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show( mContext.getString(R.string.net_error)); } }); } diff --git a/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java b/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java new file mode 100644 index 000000000..d473abe0b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/NewRoleFunGamesAdapter.java @@ -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 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 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 mChild) { + child.clear(); + child.addAll(mChild); + notifyDataSetChanged(); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java new file mode 100644 index 000000000..027340dd4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameListAdapter.java @@ -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 { + 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); + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java new file mode 100644 index 000000000..076778b2a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchHistoryListAdapter.java @@ -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 { + private List mList; + private Context mContext; + private OnItemClickListener onItemClickListener; + private boolean isHome = false; + + public SudGameSearchHistoryListAdapter(Context mContext, boolean isHome) { + this.isHome = isHome; + this.mContext = mContext; + mList = new ArrayList<>(); + } + + public void setList(List list) { + this.mList = list; + notifyDataSetChanged(); + } + + public void setOnItemClickListener(OnItemClickListener 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 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); + } + }); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudGameSearchRoomListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchRoomListAdapter.java new file mode 100644 index 000000000..eb595f474 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudGameSearchRoomListAdapter.java @@ -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 { + + + @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); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java new file mode 100644 index 000000000..b4e52cbb5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudHomeGameListAdapter.java @@ -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 { + private Context mContext; + private List mList; + private boolean isHome = false; + + public SudHomeGameListAdapter(Context mContext, boolean isHome) { + this.mContext = mContext; + this.isHome = isHome; + mList = new ArrayList<>(); + } + + public void setList(List 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(); + } + +} diff --git a/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java new file mode 100644 index 000000000..82bf6df02 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/adapter/SudTitleSelectAdapter.java @@ -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 selectString = new ArrayList<>(); + + private int mIndex; + private int mType; + + public SudTitleSelectAdapter(List 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); + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/ActiveModel.java b/common/src/main/java/com/yunbao/common/bean/ActiveModel.java index 88a8c3559..bdd51d47f 100644 --- a/common/src/main/java/com/yunbao/common/bean/ActiveModel.java +++ b/common/src/main/java/com/yunbao/common/bean/ActiveModel.java @@ -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; } } diff --git a/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java b/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java new file mode 100644 index 000000000..399eb1dfa --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CheckRemainingBalance.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java b/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java new file mode 100644 index 000000000..3afcad115 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/CreateSudRoomModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java index 481f17600..ca6cab442 100644 --- a/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java +++ b/common/src/main/java/com/yunbao/common/bean/CustomSidebarChildModel.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/bean/CustomSidebarInfoModel.java b/common/src/main/java/com/yunbao/common/bean/CustomSidebarInfoModel.java index 5e3ab5547..e3eb057a9 100644 --- a/common/src/main/java/com/yunbao/common/bean/CustomSidebarInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/CustomSidebarInfoModel.java @@ -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 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; } diff --git a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java index 9e9b84a10..35d6b7295 100644 --- a/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java +++ b/common/src/main/java/com/yunbao/common/bean/EnterRoomNewModel.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java index 820dc6062..cf00fc1f9 100644 --- a/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LinkMicUserBean.java @@ -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; } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveBean.java b/common/src/main/java/com/yunbao/common/bean/LiveBean.java index f4cec2ec4..11de89a26 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveBean.java @@ -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 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 CREATOR = new Creator() { diff --git a/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java b/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java index cc05b3bff..3ff79aa6f 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveClassBean.java @@ -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; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index 2dac9e946..31c65e757 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java b/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java index b68478a05..2ee074cad 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveUserMailBoxModel.java @@ -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; } diff --git a/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java new file mode 100644 index 000000000..0189513be --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java @@ -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 + '\'' + + '}'; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java index dcff7de27..bd70bb03c 100644 --- a/common/src/main/java/com/yunbao/common/bean/PkRankBean.java +++ b/common/src/main/java/com/yunbao/common/bean/PkRankBean.java @@ -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 + '\'' + '}'; } } diff --git a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java index 49c05a3de..a28783b02 100644 --- a/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java +++ b/common/src/main/java/com/yunbao/common/bean/RedPacketInfoModel.java @@ -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; + } } diff --git a/common/src/main/java/com/yunbao/common/bean/SudGameDateModel.java b/common/src/main/java/com/yunbao/common/bean/SudGameDateModel.java new file mode 100644 index 000000000..75f8bc9bf --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudGameDateModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java b/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java new file mode 100644 index 000000000..9d1f676d1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudRoomListModel.java @@ -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 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 getPlayerObjects() { + return playerObjects; + } + + public SudRoomListModel setPlayerObjects(List 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); + } + + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/SudgameCodeModel.java b/common/src/main/java/com/yunbao/common/bean/SudgameCodeModel.java new file mode 100644 index 000000000..fe6802070 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/SudgameCodeModel.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index ca4c91489..aa44fc257 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -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() { diff --git a/common/src/main/java/com/yunbao/common/bean/playerObject.java b/common/src/main/java/com/yunbao/common/bean/playerObject.java new file mode 100644 index 000000000..9bd08532a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/playerObject.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/custom/CommonRefreshView.java b/common/src/main/java/com/yunbao/common/custom/CommonRefreshView.java index e7e28cc31..4da3fbca8 100644 --- a/common/src/main/java/com/yunbao/common/custom/CommonRefreshView.java +++ b/common/src/main/java/com/yunbao/common/custom/CommonRefreshView.java @@ -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) { diff --git a/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java new file mode 100644 index 000000000..76a7e48cb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/AbsDialogFullScreenPopupWindow.java @@ -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; + } + + /** + * 参考配置 + */ + 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(); + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java new file mode 100644 index 000000000..c8ff09ae8 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/CreateSudGamePopup.java @@ -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 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 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() { + @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(); + + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java b/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java new file mode 100644 index 000000000..442bc2577 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/LiveNewRolePopup.java @@ -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>() { + @Override + public void onSuccess(List 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(); + } + +} diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java new file mode 100644 index 000000000..b4f0dc002 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdBottomDialogPopup.java @@ -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 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 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()); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java new file mode 100644 index 000000000..5e92f5f10 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/OpenAdCenterDialogPopup.java @@ -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 mListener; + + public OpenAdCenterDialogPopup(@NonNull Context context, OpenAdModel model) { + super(context); + this.model = model; + } + + public OpenAdCenterDialogPopup setListener(OnItemClickListener 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()); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java new file mode 100644 index 000000000..7ce57a4bd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListPopup.java @@ -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 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 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() { + @Override + public RefreshAdapter 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 processData(String[] info) { + if (info.length > 0) { + List 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 list, int listCount) { + Log.i("onRefreshSuccess", listCount + ""); + } + + @Override + public void onRefreshFailure() { + + } + + @Override + public void onLoadMoreSuccess(List 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() { + @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(); + } + + +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java new file mode 100644 index 000000000..7f0571bcb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameListSelectPopup.java @@ -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 customSidebarChildModels = new ArrayList<>(); + private List selectString = new ArrayList<>(); + private Map 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 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); + } + } +} diff --git a/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java new file mode 100644 index 000000000..20b7010c0 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/SudGameSearchDialogPopup.java @@ -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 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>() { + @Override + public void onSuccess(List 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)); + + } +} diff --git a/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java b/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java index c4580cd8b..af2d07894 100644 --- a/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java +++ b/common/src/main/java/com/yunbao/common/event/AllServerNotifyEvent.java @@ -13,6 +13,7 @@ public class AllServerNotifyEvent extends BaseModel { //礼物名称 @SerializedName("giftname") private String giftName; + //盲盒名称 @SerializedName("box_type_name") private String boxTypeName; diff --git a/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java b/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java new file mode 100644 index 000000000..94667df04 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CheckRemainingBalanceEvent.java @@ -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 results = new ArrayList<>(); + + public List getResults() { + return results; + } + + public CheckRemainingBalanceEvent setResults(List results) { + this.results = results; + return this; + } + + public int getSeatIndex() { + return seatIndex; + } + + public CheckRemainingBalanceEvent setSeatIndex(int seatIndex) { + this.seatIndex = seatIndex; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/CreateSudGameEvent.java b/common/src/main/java/com/yunbao/common/event/CreateSudGameEvent.java new file mode 100644 index 000000000..84e42962b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/CreateSudGameEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java index 436161b05..c05d507b5 100644 --- a/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java +++ b/common/src/main/java/com/yunbao/common/event/CustomDrawerPopupEvent.java @@ -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 child = new ArrayList<>(); + + public List getChild() { + return child; + } + + public CustomDrawerPopupEvent setChild(List 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; diff --git a/common/src/main/java/com/yunbao/common/event/HideShowEvent.java b/common/src/main/java/com/yunbao/common/event/HideShowEvent.java new file mode 100644 index 000000000..85b0dabb2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/HideShowEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/LiveNewRoleEvent.java b/common/src/main/java/com/yunbao/common/event/LiveNewRoleEvent.java new file mode 100644 index 000000000..a5e7acf36 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/LiveNewRoleEvent.java @@ -0,0 +1,4 @@ +package com.yunbao.common.event; + +public class LiveNewRoleEvent { +} diff --git a/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java b/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java new file mode 100644 index 000000000..936c57317 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/LiveOpenSudRoomEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java b/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java new file mode 100644 index 000000000..2479fc6de --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/LiveSudGamePopupShowOrHideEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/NewRoleCustomDrawerPopupEvent.java b/common/src/main/java/com/yunbao/common/event/NewRoleCustomDrawerPopupEvent.java new file mode 100644 index 000000000..c81744145 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/NewRoleCustomDrawerPopupEvent.java @@ -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 child = new ArrayList<>(); + + public List getChild() { + return child; + } + + public NewRoleCustomDrawerPopupEvent setChild(List 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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java b/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java new file mode 100644 index 000000000..1b42752cd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/RoomHolderTypeEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java index 6b0fd0b22..9c99fab9b 100644 --- a/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java +++ b/common/src/main/java/com/yunbao/common/event/SendBlindGiftEvent.java @@ -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; + } } diff --git a/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java b/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java new file mode 100644 index 000000000..ce281c008 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/ShowHideEvent.java @@ -0,0 +1,7 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class ShowHideEvent extends BaseModel { + +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListDissMissEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListDissMissEvent.java new file mode 100644 index 000000000..e79d1c4be --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameListDissMissEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class SudGameListDissMissEvent extends BaseModel { +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java new file mode 100644 index 000000000..35d05b6df --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameListEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListRefreshEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListRefreshEvent.java new file mode 100644 index 000000000..b7a4ed188 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameListRefreshEvent.java @@ -0,0 +1,6 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +public class SudGameListRefreshEvent extends BaseModel { +} diff --git a/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java b/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java new file mode 100644 index 000000000..00be65be7 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudGameListSillEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/event/SudRoomListModelEvent.java b/common/src/main/java/com/yunbao/common/event/SudRoomListModelEvent.java new file mode 100644 index 000000000..c2448e5ec --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/SudRoomListModelEvent.java @@ -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; + } +} diff --git a/common/src/main/java/com/yunbao/common/fragment/GoogleFragment.java b/common/src/main/java/com/yunbao/common/fragment/GoogleFragment.java index e01c43fb9..e7ff09e0f 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GoogleFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/GoogleFragment.java @@ -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; diff --git a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java index bb7a963c1..88801f6bd 100644 --- a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java @@ -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() { @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() { @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() { @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"); } }); diff --git a/common/src/main/java/com/yunbao/common/fragment/ProcessFragment.java b/common/src/main/java/com/yunbao/common/fragment/ProcessFragment.java index 2519b3016..49793cd89 100644 --- a/common/src/main/java/com/yunbao/common/fragment/ProcessFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/ProcessFragment.java @@ -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; } } diff --git a/common/src/main/java/com/yunbao/common/fragment/WalletFragment.java b/common/src/main/java/com/yunbao/common/fragment/WalletFragment.java index c60a06cd8..0b517bc48 100644 --- a/common/src/main/java/com/yunbao/common/fragment/WalletFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/WalletFragment.java @@ -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); diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index 7431a5d51..c90987dff 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -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); } } diff --git a/common/src/main/java/com/yunbao/common/http/HttpCallback.java b/common/src/main/java/com/yunbao/common/http/HttpCallback.java index 31cc2e101..404aab7e5 100644 --- a/common/src/main/java/com/yunbao/common/http/HttpCallback.java +++ b/common/src/main/java/com/yunbao/common/http/HttpCallback.java @@ -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 { public void onSuccess(Response 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 { 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(); diff --git a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java index 77deacb8a..6db78ebd0 100644 --- a/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/LiveHttpUtil.java @@ -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); + } } diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 47049923e..731a43d1d 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -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> anchorRecommend( @Query("num") String num ); + @GET("/api/public/?service=Home.anchorRecommend") + Observable> anchorRecommend( + @QueryMap Map map + ); + /** * 直播间上下滚动列表 * * @param num 请求数量 * @return */ - @GET("/api/public/?service=Home.anchorRecommend ") + @GET("/api/public/?service=Home.anchorRecommend") Observable> anchorRecommend( @Query("num") String num, @Query("type") String type ); @@ -182,7 +192,7 @@ public interface PDLiveApi { */ @GET("/api/public/?service=Live.getLiveInfo") Observable>> getLiveInfo( - @Query("liveuid") String liveuid + @Query("liveuid") String liveui ); /** @@ -296,7 +306,7 @@ public interface PDLiveApi { * 新侧边栏请求 */ @GET("/api/public/?service=Live.getCustomSidebarInfo") - Observable>> getCustomSidebarInfo(); + Observable>> getCustomSidebarInfo(@Query("type") String type); /** * 任务领取接口 @@ -766,18 +776,19 @@ public interface PDLiveApi { /** - * 获取盲盒礼物当前数据 + * 创建红包 */ @GET("/api/public/?service=Live.createRedPacket") Observable> 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> redPacketInfo( @@ -968,5 +979,74 @@ public interface PDLiveApi { @GET("/api/public/?service=gift.getGiftNamingInfo") Observable> getGiftNamingInfo(@Query("gift_id") String giftId); + /** + * 获取游戏code + * + * @return + */ + @GET("/api/public/?service=Sudgame.getCode") + Observable>> getCode(); + + /** + * 创建游戏房 + * + * @return + */ + @GET("/api/public/?service=Sudgameserver.createSudRoom") + Observable> 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>> 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>> 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> checkRemainingBalance( + @Query("room_id") String roomId + ); + + @GET("/api/public/?service=Sudgameserver.randomRoom") + Observable> randomRoom( + @Query("sud_game_id") String sudGameId, + @Query("threshold") String threshold, + @Query("room_holder_type") String roomHolderType + ); + + @GET("/api/public/?service=Sudgameserver.checkRoomStatus") + Observable> checkRoomStatus( + @Query("room_id") String roomId + ); + + /** + * 活动弹窗 + */ + @GET("/api/public/?service=Home.activityPopup") + Observable>> activityPopup(); + } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index b385a72fb..37c58fd8e 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -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> callback) { + public void getCustomSidebarInfo(String type, HttpCallback> 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 callback) { + public void createRedPacket(String liveUid, String redPacketMoney, String redPacketQuantity, String conditions, boolean needFansGroup, HttpCallback 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>() { @@ -1931,7 +1936,7 @@ public class LiveNetManager { public void giftDetail(String liveUid, String giftId, String toUid, HttpCallback callback) { API.get().pdLiveApi(mContext) - .giftDetail(liveUid, giftId,toUid) + .giftDetail(liveUid, giftId, toUid) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>() { @@ -2171,7 +2176,7 @@ public class LiveNetManager { }).isDisposed(); } - public void getGiftNamingInfo(String giftId,HttpCallback callback) { + public void getGiftNamingInfo(String giftId, HttpCallback callback) { API.get().pdLiveApi(mContext) .getGiftNamingInfo(giftId) .subscribeOn(Schedulers.io()) @@ -2179,7 +2184,7 @@ public class LiveNetManager { .subscribe(new Consumer>() { @Override public void accept(ResponseModel 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> callback) { + API.get().pdLiveApi(mContext) + .activityPopup() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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> callback) { + API.get().pdLiveApi(mContext) + .getCode() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .createSudRoom(roomName, goldenBeanNumber, gameId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel createSudRoomModelResponseModel) throws Exception { + if (callback != null) { + if (createSudRoomModelResponseModel.getData().getCode() == 0) { + callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + } else { + callback.onError(createSudRoomModelResponseModel.getData().getMsg()); + } + + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .randomRoom(sudGameId, threshold, roomHolderType) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel createSudRoomModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .checkRoomStatus(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel createSudRoomModelResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(createSudRoomModelResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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> callback) { + API.get().pdLiveApi(mContext) + .getRoomList(sudGameId, threshold, roomHolderType, liveUid, page) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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> callback) { + API.get().pdLiveApi(mContext) + .searchRoomList(sudGameId, threshold, roomHolderType, "0", search, page) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> listResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(listResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @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 callback) { + API.get().pdLiveApi(mContext) + .checkRemainingBalance(roomId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>() { + @Override + public void accept(ResponseModel checkRemainingBalanceResponseModel) throws Exception { + if (callback != null) { + callback.onSuccess(checkRemainingBalanceResponseModel.getData().getInfo()); + } + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } + /** * 直播间取消网络请求 */ diff --git a/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java index 793a3ae88..cea6a102a 100644 --- a/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/main/MainNetManager.java @@ -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 map, HttpCallback 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 httpCallback) { - API.get().pdLiveApi(mContext).anchorRecommend(num, "1") + Map 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(); } + /** * 获取直播间上下滑动红包集合 */ diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 452eff158..260ec4cac 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -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")) { diff --git a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java index 4c3fc88ef..c1b85d3ab 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMRTCManager.java @@ -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); diff --git a/common/src/main/java/com/yunbao/common/manager/MicUserManager.java b/common/src/main/java/com/yunbao/common/manager/MicUserManager.java new file mode 100644 index 000000000..df7209ca5 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/MicUserManager.java @@ -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 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 getMicUserList() { + if (micUsers.size() < 1) { + micUsers = getList(micKey, new TypeToken>() { + }.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(); + } +} diff --git a/common/src/main/java/com/yunbao/common/manager/MicedUserManager.java b/common/src/main/java/com/yunbao/common/manager/MicedUserManager.java new file mode 100644 index 000000000..989e179ee --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/MicedUserManager.java @@ -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 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 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 getMicUserList() { + if (micUsers.size() < 1) { + micUsers = getList(micKey, new TypeToken>() { + }.getType()); + } + + return micUsers; + } + + public void removeAllMicUserList() { + deleteByKey(micKey); + micUsers.clear(); + } +} diff --git a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java new file mode 100644 index 000000000..7d64a092c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java @@ -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 showMap; + private List list = null; + private Handler handler = new Handler(Looper.getMainLooper()); + private Map 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>() { + @Override + public void onSuccess(List 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(); + } + } + } +} diff --git a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java index a5a85961a..ebb586b0a 100644 --- a/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java +++ b/common/src/main/java/com/yunbao/common/manager/RandomPkManager.java @@ -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"); } }); } diff --git a/common/src/main/java/com/yunbao/common/pay/PayPresenter.java b/common/src/main/java/com/yunbao/common/pay/PayPresenter.java index b8bd3f2a2..cae17cc09 100644 --- a/common/src/main/java/com/yunbao/common/pay/PayPresenter.java +++ b/common/src/main/java/com/yunbao/common/pay/PayPresenter.java @@ -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(); diff --git a/common/src/main/java/com/yunbao/common/pay/wx/WxPayBuilder.java b/common/src/main/java/com/yunbao/common/pay/wx/WxPayBuilder.java index a34349bc7..181b78bcc 100644 --- a/common/src/main/java/com/yunbao/common/pay/wx/WxPayBuilder.java +++ b/common/src/main/java/com/yunbao/common/pay/wx/WxPayBuilder.java @@ -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); // } } } diff --git a/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java new file mode 100644 index 000000000..81200c004 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java @@ -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(); + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java new file mode 100644 index 000000000..d0dd12dc1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/QuickStartGameViewModel.java @@ -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 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>() { + @Override + public void onSuccess(List 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()); + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/QuickStartUtils.java b/common/src/main/java/com/yunbao/common/sud/QuickStartUtils.java new file mode 100644 index 000000000..c378a182a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/QuickStartUtils.java @@ -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); + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGCache.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGCache.java new file mode 100644 index 000000000..0415ebed4 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGCache.java @@ -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 playerInSet = new HashSet<>(); // 记录已经加入了游戏的玩家 + private final HashSet playerReadySet = new HashSet<>(); // 记录已经准备好的游戏玩家 + private final HashMap 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 getPlayerInSet() { + return new HashSet<>(playerInSet); + } + + /** 获取当前已准备的玩家集合 */ + public HashSet getPlayerReadySet() { + return new HashSet<>(playerReadySet); + } + + /** 获取玩家游戏状态集合 */ + public HashMap getPlayerPlayingMap() { + return new HashMap<>(playerPlayingMap); + } + + /** + * 返回当前游戏的状态,数值参数{@link SudMGPMGState.MGCommonGameState} + */ + public int getGameState() { + if (mgCommonGameStateModel != null) { + return mgCommonGameStateModel.gameState; + } + return SudMGPMGState.MGCommonGameState.UNKNOW; + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java new file mode 100644 index 000000000..c6b7d4883 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java @@ -0,0 +1,1018 @@ +/* + * Copyright © Sud.Tech + * https://sud.tech + */ + +package com.yunbao.common.sud.decorator; + + +import android.util.Log; + +import com.yunbao.common.event.CheckRemainingBalanceEvent; +import com.yunbao.common.sud.state.SudMGPMGState; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ISudFSMStateHandleUtils; +import com.yunbao.common.utils.SudJsonUtils; + +import tech.sud.mgp.core.ISudFSMMG; +import tech.sud.mgp.core.ISudFSMStateHandle; + +/** + * ISudFSMMG 游戏调APP回调装饰类 + * 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG.html + */ +public class SudFSMMGDecorator implements ISudFSMMG { + + // 回调 + private SudFSMMGListener sudFSMMGListener; + + // 数据状态封装 + private final SudFSMMGCache sudFSMMGCache = new SudFSMMGCache(); + + /** + * 设置回调 + * + * @param listener 监听器 + */ + public void setSudFSMMGListener(SudFSMMGListener listener) { + sudFSMMGListener = listener; + } + + /** + * 游戏日志 + * 最低版本:v1.1.30.xx + */ + @Override + public void onGameLog(String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGameLog(dataJson); + } + } + + /** + * 游戏加载进度 + * + * @param stage 阶段:start=1,loading=2,end=3 + * @param retCode 错误码:0成功 + * @param progress 进度:[0, 100] + */ + @Override + public void onGameLoadingProgress(int stage, int retCode, int progress) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGameLoadingProgress(stage, retCode, progress); + } + } + + /** + * 游戏开始 + * 最低版本:v1.1.30.xx + */ + @Override + public void onGameStarted() { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGameStarted(); + } + } + + /** + * 游戏销毁 + * 最低版本:v1.1.30.xx + */ + @Override + public void onGameDestroyed() { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGameDestroyed(); + } + } + + /** + * Code过期,需要实现 + * APP接入方需要调用handle.success或handle.fail + * + * @param dataJson {"code":"value"} + */ + @Override + public void onExpireCode(ISudFSMStateHandle handle, String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onExpireCode(handle, dataJson); + } + } + + /** + * 获取游戏View信息,需要实现 + * APP接入方需要调用handle.success或handle.fail + * + * @param handle 操作 + * @param dataJson {} + */ + @Override + public void onGetGameViewInfo(ISudFSMStateHandle handle, String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGetGameViewInfo(handle, dataJson); + } + } + + /** + * 获取游戏Config,需要实现 + * APP接入方需要调用handle.success或handle.fail + * + * @param handle 操作 + * @param dataJson {} + * 最低版本:v1.1.30.xx + */ + @Override + public void onGetGameCfg(ISudFSMStateHandle handle, String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null) { + listener.onGetGameCfg(handle, dataJson); + } + } + + /** + * 游戏状态变化 + * APP接入方需要调用handle.success或handle.fail + * + * @param handle 操作 + * @param state 状态命令 + * @param dataJson 状态值 + */ + @Override + public void onGameStateChange(ISudFSMStateHandle handle, String state, String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null && listener.onGameStateChange(handle, state, dataJson)) { + return; + } + switch (state) { + case SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE: // 1. 公屏消息 + SudMGPMGState.MGCommonPublicMessage mgCommonPublicMessage = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPublicMessage.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonPublicMessage(handle, mgCommonPublicMessage); + } + break; + case SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT: // 2. 关键词状态 + SudMGPMGState.MGCommonKeyWordToHit mgCommonKeyWordToHit = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonKeyWordToHit.class); + sudFSMMGCache.onGameMGCommonKeyWordToHit(mgCommonKeyWordToHit); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonKeyWordToHit(handle, mgCommonKeyWordToHit); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SETTLE: // 3. 游戏结算状态 + SudMGPMGState.MGCommonGameSettle mgCommonGameSettle = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSettle.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle); + } + Bus.get().post(new CheckRemainingBalanceEvent().setResults(mgCommonGameSettle.results)); + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态 + SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class); + Bus.get().post(new CheckRemainingBalanceEvent().setSeatIndex(mgCommonSelfClickJoinBtn.seatIndex)); +// if (listener == null) { +// ISudFSMStateHandleUtils.handleSuccess(handle); +// } else { +// listener.onGameMGCommonSelfClickJoinBtn(handle, mgCommonSelfClickJoinBtn); +// } + + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_CANCEL_JOIN_BTN: // 5. 取消加入(退出)游戏按钮点击状态 + SudMGPMGState.MGCommonSelfClickCancelJoinBtn selfClickCancelJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickCancelJoinBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickCancelJoinBtn(handle, selfClickCancelJoinBtn); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_READY_BTN: // 6. 准备按钮点击状态 + SudMGPMGState.MGCommonSelfClickReadyBtn mgCommonSelfClickReadyBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickReadyBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickReadyBtn(handle, mgCommonSelfClickReadyBtn); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_CANCEL_READY_BTN: // 7. 取消准备按钮点击状态 + SudMGPMGState.MGCommonSelfClickCancelReadyBtn mgCommonSelfClickCancelReadyBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickCancelReadyBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickCancelReadyBtn(handle, mgCommonSelfClickCancelReadyBtn); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN: // 8. 开始游戏按钮点击状态 + SudMGPMGState.MGCommonSelfClickStartBtn mgCommonSelfClickStartBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickStartBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickStartBtn(handle, mgCommonSelfClickStartBtn); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_SHARE_BTN: // 9. 分享按钮点击状态 + SudMGPMGState.MGCommonSelfClickShareBtn mgCommonSelfClickShareBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickShareBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickShareBtn(handle, mgCommonSelfClickShareBtn); + } + break; + case SudMGPMGState.MG_COMMON_GAME_STATE: // 10. 游戏状态 + SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class); + sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameState(handle, mgCommonGameState); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_CLOSE_BTN: // 11. 结算界面关闭按钮点击状态(2021-12-27新增) + SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn mgCommonSelfClickGameSettleCloseBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickGameSettleCloseBtn(handle, mgCommonSelfClickGameSettleCloseBtn); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN: // 12. 结算界面再来一局按钮点击状态(2021-12-27新增) + SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn mgCommonSelfClickGameSettleAgainBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强) + SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSoundList(handle, mgCommonGameSoundList); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SOUND: // 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强) + SudMGPMGState.MGCommonGameSound mgCommonGameSound = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSound.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSound(handle, mgCommonGameSound); + } + break; + case SudMGPMGState.MG_COMMON_GAME_BG_MUSIC_STATE: // 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强) + SudMGPMGState.MGCommonGameBgMusicState mgCommonGameBgMusicState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameBgMusicState.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameBgMusicState(handle, mgCommonGameBgMusicState); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SOUND_STATE: // 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强) + SudMGPMGState.MGCommonGameSoundState mgCommonGameSoundState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundState.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSoundState(handle, mgCommonGameSoundState); + } + break; + case SudMGPMGState.MG_COMMON_GAME_ASR: // 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增) + SudMGPMGState.MGCommonGameASR mgCommonGameASR = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameASR.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameASR(handle, mgCommonGameASR); + } + break; + case SudMGPMGState.MG_COMMON_SELF_MICROPHONE: // 18. 麦克风状态(2022-02-08新增) + SudMGPMGState.MGCommonSelfMicrophone mgCommonSelfMicrophone = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfMicrophone.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfMicrophone(handle, mgCommonSelfMicrophone); + } + break; + case SudMGPMGState.MG_COMMON_SELF_HEADPHONE: // 19. 耳机(听筒,扬声器)状态(2022-02-08新增) + SudMGPMGState.MGCommonSelfHeadphone mgCommonSelfHeadphone = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfHeadphone.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfHeadphone(handle, mgCommonSelfHeadphone); + } + break; + case SudMGPMGState.MG_COMMON_APP_COMMON_SELF_X_RESP: // 20. App通用状态操作结果错误码(2022-05-10新增) + SudMGPMGState.MGCommonAPPCommonSelfXResp mgCommonAPPCommonSelfXResp = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonAPPCommonSelfXResp.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonAPPCommonSelfXResp(handle, mgCommonAPPCommonSelfXResp); + } + break; + case SudMGPMGState.MG_COMMON_GAME_ADD_AI_PLAYERS: // 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增) + SudMGPMGState.MGCommonGameAddAIPlayers mgCommonGameAddAIPlayers = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameAddAIPlayers.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameAddAIPlayers(handle, mgCommonGameAddAIPlayers); + } + break; + case SudMGPMGState.MG_COMMON_GAME_NETWORK_STATE: // 22. 游戏通知app层添当前网络连接状态(2022-06-21新增) + SudMGPMGState.MGCommonGameNetworkState mgCommonGameNetworkState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameNetworkState.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameNetworkState(handle, mgCommonGameNetworkState); + } + break; + case SudMGPMGState.MG_COMMON_GAME_GET_SCORE: // 23. 游戏通知app获取积分 + SudMGPMGState.MGCommonGameGetScore mgCommonGameScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameGetScore.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameGetScore(handle, mgCommonGameScore); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SET_SCORE: // 24. 游戏通知app带入积分 + SudMGPMGState.MGCommonGameSetScore mgCommonGameSetScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSetScore.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSetScore(handle, mgCommonGameSetScore); + } + break; + case SudMGPMGState.MG_COMMON_GAME_CREATE_ORDER: // 25. 创建订单 + SudMGPMGState.MGCommonGameCreateOrder mgCommonGameCreateOrder = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCreateOrder.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameCreateOrder(handle, mgCommonGameCreateOrder); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_ROLE_ID: // 26. 游戏通知app玩家角色(仅对狼人杀有效) + SudMGPMGState.MGCommonPlayerRoleId mgCommonPlayerRoleId = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerRoleId.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonPlayerRoleId(handle, mgCommonPlayerRoleId); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_POOP: // 27. 游戏通知app玩家被扔便便(你画我猜,你说我猜,友尽闯关有效) + SudMGPMGState.MGCommonSelfClickPoop mgCommonSelfClickPoop = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickPoop.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickPoop(handle, mgCommonSelfClickPoop); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_GOOD: // 28. 游戏通知app玩家被点赞(你画我猜,你说我猜,友尽闯关有效) + SudMGPMGState.MGCommonSelfClickGood mgCommonSelfClickGood = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGood.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickGood(handle, mgCommonSelfClickGood); + } + break; + case SudMGPMGState.MG_COMMON_GAME_FPS: // 29. 游戏通知app游戏FPS(仅对碰碰,多米诺骨牌,飞镖达人生效) + SudMGPMGState.MGCommonGameFps mgCommonGameFps = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameFps.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameFps(handle, mgCommonGameFps); + } + break; + case SudMGPMGState.MG_COMMON_ALERT: // 30. 游戏通知app游戏弹框 + SudMGPMGState.MGCommonAlert mgCommonAlert = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonAlert.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonAlert(handle, mgCommonAlert); + } + break; + case SudMGPMGState.MG_COMMON_WORST_TEAMMATE: // 31. 游戏通知app最坑队友(只支持友尽闯关) + SudMGPMGState.MGCommonWorstTeammate mgCommonWorstTeammate = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonWorstTeammate.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonWorstTeammate(handle, mgCommonWorstTeammate); + } + break; + case SudMGPMGState.MG_COMMON_GAME_OVER_TIP: // 32. 游戏通知app因玩家逃跑导致游戏结束(只支持友尽闯关) + SudMGPMGState.MGCommonGameOverTip mgCommonGameOverTip = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameOverTip.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameOverTip(handle, mgCommonGameOverTip); + } + break; + case SudMGPMGState.MG_COMMON_GAME_PLAYER_COLOR: // 33. 游戏通知app玩家颜色(只支持友尽闯关) + SudMGPMGState.MGCommonGamePlayerColor mgCommonGamePlayerColor = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGamePlayerColor.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGamePlayerColor(handle, mgCommonGamePlayerColor); + } + break; + case SudMGPMGState.MG_COMMON_GAME_PLAYER_ICON_POSITION: // 34. 游戏通知app玩家头像的坐标(只支持ludo) + SudMGPMGState.MGCommonGamePlayerIconPosition mgCommonGamePlayerIconPosition = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGamePlayerIconPosition.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGamePlayerIconPosition(handle, mgCommonGamePlayerIconPosition); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_EXIT_GAME_BTN: // 35. 游戏通知app退出游戏(只支持teenpattipro 与 德州pro) + SudMGPMGState.MGCommonSelfClickExitGameBtn mgCommonSelfClickExitGameBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickExitGameBtn.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSelfClickExitGameBtn(handle, mgCommonSelfClickExitGameBtn); + } + break; + case SudMGPMGState.MG_COMMON_GAME_IS_APP_CHIP: // 36. 游戏通知app是否要开启带入积分(只支持teenpattipro 与 德州pro) + SudMGPMGState.MGCommonGameIsAppChip mgCommonGameIsAppChip = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameIsAppChip.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameIsAppChip(handle, mgCommonGameIsAppChip); + } + break; + case SudMGPMGState.MG_COMMON_GAME_RULE: // 37. 游戏通知app当前游戏的设置信息(只支持德州pro,teenpatti pro) + SudMGPMGState.MGCommonGameRule mgCommonGameRule = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameRule.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameRule(handle, mgCommonGameRule); + } + break; + case SudMGPMGState.MG_COMMON_GAME_SETTINGS: // 38. 游戏通知app进行玩法设置(只支持德州pro,teenpatti pro) + SudMGPMGState.MGCommonGameSettings mgCommonGameSettings = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSettings.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameSettings(handle, mgCommonGameSettings); + } + break; + case SudMGPMGState.MG_COMMON_GAME_MONEY_NOT_ENOUGH: // 39. 游戏通知app钱币不足(只支持德州pro,teenpatti pro) + SudMGPMGState.MGCommonGameMoneyNotEnough mgCommonGameMoneyNotEnough = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameMoneyNotEnough.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameMoneyNotEnough(handle, mgCommonGameMoneyNotEnough); + } + break; + case SudMGPMGState.MG_COMMON_GAME_UI_CUSTOM_CONFIG: // 40. 游戏通知app下发定制ui配置表(只支持ludo) + SudMGPMGState.MGCommonGameUiCustomConfig mgCommonGameUiCustomConfig = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameUiCustomConfig.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameUiCustomConfig(handle, mgCommonGameUiCustomConfig); + } + break; + case SudMGPMGState.MG_COMMON_SET_CLICK_RECT: // 41. 设置app提供给游戏可点击区域(赛车) + SudMGPMGState.MGCommonSetClickRect mgCommonSetClickRect = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSetClickRect.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonSetClickRect(handle, mgCommonSetClickRect); + } + break; + case SudMGPMGState.MG_COMMON_USERS_INFO: // 42. 通知app提供对应uids列表玩家的数据(赛车) + SudMGPMGState.MGCommonUsersInfo mgCommonUsersInfo = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonUsersInfo.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonUsersInfo(handle, mgCommonUsersInfo); + } + break; + case SudMGPMGState.MG_COMMON_GAME_PREPARE_FINISH: // 43. 通知app游戏前期准备完成(赛车) + SudMGPMGState.MGCommonGamePrepareFinish mgCommonGamePrepareFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGamePrepareFinish.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGamePrepareFinish(handle, mgCommonGamePrepareFinish); + } + break; + case SudMGPMGState.MG_COMMON_SHOW_GAME_SCENE: // 44. 通知app游戏主界面已显示(赛车) + SudMGPMGState.MGCommonShowGameScene mgCommonShowGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonShowGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonShowGameScene(handle, mgCommonShowGameScene); + } + break; + case SudMGPMGState.MG_COMMON_HIDE_GAME_SCENE: // 45. 通知app游戏主界面已隐藏(赛车) + SudMGPMGState.MGCommonHideGameScene mgCommonHideGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonHideGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonHideGameScene(handle, mgCommonHideGameScene); + } + break; + case SudMGPMGState.MG_COMMON_GAME_DISCO_ACTION: // 1. 元宇宙砂砂舞指令回调 + SudMGPMGState.MGCommonGameDiscoAction mgCommonGameDiscoAction = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameDiscoAction.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameDiscoAction(handle, mgCommonGameDiscoAction); + } + break; + case SudMGPMGState.MG_COMMON_GAME_DISCO_ACTION_END: // 2. 元宇宙砂砂舞指令动作结束通知 + SudMGPMGState.MGCommonGameDiscoActionEnd mgCommonGameDiscoActionEnd = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameDiscoActionEnd.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCommonGameDiscoActionEnd(handle, mgCommonGameDiscoActionEnd); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_CONFIG: // 1. 礼物配置文件(火箭) + SudMGPMGState.MGCustomRocketConfig mgCustomRocketConfig = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketConfig.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketConfig(handle, mgCustomRocketConfig); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_MODEL_LIST: // 2. 拥有模型列表(火箭) + SudMGPMGState.MGCustomRocketModelList mgCustomRocketModelList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketModelList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketModelList(handle, mgCustomRocketModelList); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_COMPONENT_LIST: // 3. 拥有组件列表(火箭) + SudMGPMGState.MGCustomRocketComponentList mgCustomRocketComponentList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketComponentList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketComponentList(handle, mgCustomRocketComponentList); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_USER_INFO: // 4. 获取用户信息(火箭) + SudMGPMGState.MGCustomRocketUserInfo mgCustomRocketUserInfo = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUserInfo.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketUserInfo(handle, mgCustomRocketUserInfo); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_ORDER_RECORD_LIST: // 5. 订单记录列表(火箭) + SudMGPMGState.MGCustomRocketOrderRecordList mgCustomRocketOrderRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketOrderRecordList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketOrderRecordList(handle, mgCustomRocketOrderRecordList); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_ROOM_RECORD_LIST: // 6. 展馆内列表(火箭) + SudMGPMGState.MGCustomRocketRoomRecordList mgCustomRocketRoomRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketRoomRecordList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketRoomRecordList(handle, mgCustomRocketRoomRecordList); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_USER_RECORD_LIST: // 7. 展馆内玩家送出记录(火箭) + SudMGPMGState.MGCustomRocketUserRecordList mgCustomRocketUserRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUserRecordList.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketUserRecordList(handle, mgCustomRocketUserRecordList); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_SET_DEFAULT_MODEL: // 8. 设置默认模型(火箭) + SudMGPMGState.MGCustomRocketSetDefaultModel mgCustomRocketSetDefaultSeat = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketSetDefaultModel.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketSetDefaultModel(handle, mgCustomRocketSetDefaultSeat); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_DYNAMIC_FIRE_PRICE: // 9. 动态计算一键发送价格(火箭) + SudMGPMGState.MGCustomRocketDynamicFirePrice mgCustomRocketDynamicFirePrice = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketDynamicFirePrice.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketDynamicFirePrice(handle, mgCustomRocketDynamicFirePrice); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_FIRE_MODEL: // 10. 一键发送(火箭) + SudMGPMGState.MGCustomRocketFireModel mGCustomRocketFireModel = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFireModel.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketFireModel(handle, mGCustomRocketFireModel); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_CREATE_MODEL: // 11. 新组装模型(火箭) + SudMGPMGState.MGCustomRocketCreateModel mgCustomRocketCreateModel = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketCreateModel.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketCreateModel(handle, mgCustomRocketCreateModel); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_REPLACE_COMPONENT: // 12. 模型更换组件(火箭) + SudMGPMGState.MGCustomRocketReplaceComponent mgCustomRocketReplaceComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketReplaceComponent.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketReplaceComponent(handle, mgCustomRocketReplaceComponent); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_BUY_COMPONENT: // 13. 购买组件(火箭) + SudMGPMGState.MGCustomRocketBuyComponent mgCustomRocketBuyComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketBuyComponent.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketBuyComponent(handle, mgCustomRocketBuyComponent); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_PLAY_EFFECT_START: // 14. 播放效果开始(火箭) + SudMGPMGState.MGCustomRocketPlayEffectStart mgCustomRocketPlayEffectStart = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPlayEffectStart.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketPlayEffectStart(handle, mgCustomRocketPlayEffectStart); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_PLAY_EFFECT_FINISH: // 15. 播放效果完成(火箭) + SudMGPMGState.MGCustomRocketPlayEffectFinish mgCustomRocketPlayEffectFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPlayEffectFinish.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketPlayEffectFinish(handle, mgCustomRocketPlayEffectFinish); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_VERIFY_SIGN: // 16. 验证签名合规(火箭) + SudMGPMGState.MGCustomRocketVerifySign mgCustomRocketVerifySign = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketVerifySign.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketVerifySign(handle, mgCustomRocketVerifySign); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_UPLOAD_MODEL_ICON: // 17. 上传icon(火箭) + SudMGPMGState.MGCustomRocketUploadModelIcon mgCustomRocketUploadModelIcon = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUploadModelIcon.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketUploadModelIcon(handle, mgCustomRocketUploadModelIcon); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_PREPARE_FINISH: // 18. 前期准备完成(火箭) + SudMGPMGState.MGCustomRocketPrepareFinish mgCustomRocketPrepareFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPrepareFinish.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketPrepareFinish(handle, mgCustomRocketPrepareFinish); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_SHOW_GAME_SCENE: // 19. 火箭主界面已显示(火箭) + SudMGPMGState.MGCustomRocketShowGameScene mgCustomRocketShowGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketShowGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketShowGameScene(handle, mgCustomRocketShowGameScene); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_HIDE_GAME_SCENE: // 20. 火箭主界面已隐藏(火箭) + SudMGPMGState.MGCustomRocketHideGameScene mgCustomRocketHideGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketHideGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketHideGameScene(handle, mgCustomRocketHideGameScene); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_CLICK_LOCK_COMPONENT: // 21. 点击锁住组件(火箭) + SudMGPMGState.MGCustomRocketClickLockComponent mgCustomRocketClickLockComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketClickLockComponent.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketClickLockComponent(handle, mgCustomRocketClickLockComponent); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_FLY_CLICK: // 22. 火箭效果飞行点击(火箭) + SudMGPMGState.MGCustomRocketFlyClick mgCustomRocketFlyClick = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFlyClick.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketFlyClick(handle, mgCustomRocketFlyClick); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_FLY_END: // 23. 火箭效果飞行结束(火箭) + SudMGPMGState.MGCustomRocketFlyEnd mgCustomRocketFlyEnd = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFlyEnd.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketFlyEnd(handle, mgCustomRocketFlyEnd); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_SET_CLICK_RECT: // 24. 设置点击区域(火箭) + SudMGPMGState.MGCustomRocketSetClickRect mgCustomRocketSetClickRect = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketSetClickRect.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketSetClickRect(handle, mgCustomRocketSetClickRect); + } + break; + case SudMGPMGState.MG_CUSTOM_ROCKET_SAVE_SIGN_COLOR: // 25. 颜色和签名自定义改到装配间的模式,保存颜色或签名 模型 + SudMGPMGState.MGCustomRocketSaveSignColor mgCustomRocketSaveSignColor = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketSaveSignColor.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGCustomRocketSaveSignColor(handle, mgCustomRocketSaveSignColor); + } + break; + case SudMGPMGState.MG_BASEBALL_RANKING: // 1. 查询排行榜数据(棒球) + SudMGPMGState.MGBaseballRanking mgBaseballRanking = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballRanking.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballRanking(handle, mgBaseballRanking); + } + break; + case SudMGPMGState.MG_BASEBALL_MY_RANKING: // 2. 查询我的排名(棒球) + SudMGPMGState.MGBaseballMyRanking mgBaseballMyRanking = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballMyRanking.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballMyRanking(handle, mgBaseballMyRanking); + } + break; + case SudMGPMGState.MG_BASEBALL_RANGE_INFO: // 3. 查询当前距离我的前后玩家数据(棒球) + SudMGPMGState.MGBaseballRangeInfo mgBaseballRangeInfo = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballRangeInfo.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballRangeInfo(handle, mgBaseballRangeInfo); + } + break; + case SudMGPMGState.MG_BASEBALL_SET_CLICK_RECT: // 4. 设置app提供给游戏可点击区域(棒球) + SudMGPMGState.MGBaseballSetClickRect mgBaseballSetClickRect = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballSetClickRect.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballSetClickRect(handle, mgBaseballSetClickRect); + } + break; + case SudMGPMGState.MG_BASEBALL_PREPARE_FINISH: // 5. 前期准备完成(棒球) + SudMGPMGState.MGBaseballPrepareFinish mgBaseballPrepareFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballPrepareFinish.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballPrepareFinish(handle, mgBaseballPrepareFinish); + } + break; + case SudMGPMGState.MG_BASEBALL_SHOW_GAME_SCENE: // 6. 主界面已显示(棒球) + SudMGPMGState.MGBaseballShowGameScene mgBaseballShowGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballShowGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballShowGameScene(handle, mgBaseballShowGameScene); + } + break; + case SudMGPMGState.MG_BASEBALL_HIDE_GAME_SCENE: // 7. 主界面已隐藏(棒球) + SudMGPMGState.MGBaseballHideGameScene mgBaseballHideGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballHideGameScene.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballHideGameScene(handle, mgBaseballHideGameScene); + } + break; + case SudMGPMGState.MG_BASEBALL_TEXT_CONFIG: // 8. 获取文本配置数据(棒球) + SudMGPMGState.MGBaseballTextConfig mgBaseballTextConfig = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballTextConfig.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onGameMGBaseballTextConfig(handle, mgBaseballTextConfig); + } + break; + default: + ISudFSMStateHandleUtils.handleSuccess(handle); + break; + } + } + + /** + * 游戏玩家状态变化 + * APP接入方需要调用handle.success或handle.fail + * + * @param handle 操作 + * @param userId 用户id + * @param state 状态命令 + * @param dataJson 状态值 + */ + @Override + public void onPlayerStateChange(ISudFSMStateHandle handle, String userId, String state, String dataJson) { + SudFSMMGListener listener = sudFSMMGListener; + if (listener != null && listener.onPlayerStateChange(handle, userId, state, dataJson)) { + return; + } + Log.e("SudFSMMGDecorator", "userId:" + userId + " state:" + state + " dataJson:" + dataJson); + switch (state) { + case SudMGPMGState.MG_COMMON_PLAYER_IN: // 1.加入状态(已修改) + SudMGPMGState.MGCommonPlayerIn mgCommonPlayerIn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerIn.class); + sudFSMMGCache.onPlayerMGCommonPlayerIn(userId, mgCommonPlayerIn); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerIn(handle, userId, mgCommonPlayerIn); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_READY: // 2.准备状态(已修改) + + SudMGPMGState.MGCommonPlayerReady mgCommonPlayerReady = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerReady.class); + sudFSMMGCache.onPlayerMGCommonPlayerReady(userId, mgCommonPlayerReady); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerReady(handle, userId, mgCommonPlayerReady); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_CAPTAIN: // 3.队长状态(已修改) + SudMGPMGState.MGCommonPlayerCaptain mgCommonPlayerCaptain = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerCaptain.class); + sudFSMMGCache.onPlayerMGCommonPlayerCaptain(userId, mgCommonPlayerCaptain); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerCaptain(handle, userId, mgCommonPlayerCaptain); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_PLAYING: // 4.游戏状态(已修改) + SudMGPMGState.MGCommonPlayerPlaying mgCommonPlayerPlaying = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerPlaying.class); + sudFSMMGCache.onPlayerMGCommonPlayerPlaying(userId, mgCommonPlayerPlaying); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerPlaying(handle, userId, mgCommonPlayerPlaying); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_ONLINE: // 5.玩家在线状态 + SudMGPMGState.MGCommonPlayerOnline mgCommonPlayerOnline = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerOnline.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerOnline(handle, userId, mgCommonPlayerOnline); + } + break; + case SudMGPMGState.MG_COMMON_PLAYER_CHANGE_SEAT: // 6.玩家换游戏位状态 + SudMGPMGState.MGCommonPlayerChangeSeat mgCommonPlayerChangeSeat = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerChangeSeat.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonPlayerChangeSeat(handle, userId, mgCommonPlayerChangeSeat); + } + break; + case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_PLAYER_ICON: // 7. 游戏通知app点击玩家头像 + SudMGPMGState.MGCommonSelfClickGamePlayerIcon mgCommonSelfClickGamePlayerIcon = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGamePlayerIcon.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonSelfClickGamePlayerIcon(handle, userId, mgCommonSelfClickGamePlayerIcon); + } + break; + case SudMGPMGState.MG_COMMON_SELF_DIE_STATUS: // 8. 游戏通知app玩家死亡状态(2022-04-24新增) + SudMGPMGState.MGCommonSelfDieStatus mgCommonSelfDieStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfDieStatus.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonSelfDieStatus(handle, userId, mgCommonSelfDieStatus); + } + break; + case SudMGPMGState.MG_COMMON_SELF_TURN_STATUS: // 9. 游戏通知app轮到玩家出手状态(2022-04-24新增) + SudMGPMGState.MGCommonSelfTurnStatus mgCommonSelfTurnStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfTurnStatus.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonSelfTurnStatus(handle, userId, mgCommonSelfTurnStatus); + } + break; + case SudMGPMGState.MG_COMMON_SELF_SELECT_STATUS: // 10. 游戏通知app玩家选择状态(2022-04-24新增) + SudMGPMGState.MGCommonSelfSelectStatus mgCommonSelfSelectStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfSelectStatus.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonSelfSelectStatus(handle, userId, mgCommonSelfSelectStatus); + } + break; + case SudMGPMGState.MG_COMMON_GAME_COUNTDOWN_TIME: // 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效) + SudMGPMGState.MGCommonGameCountdownTime mgCommonGameCountdownTime = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCountdownTime.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonGameCountdownTime(handle, userId, mgCommonGameCountdownTime); + } + break; + case SudMGPMGState.MG_COMMON_SELF_OB_STATUS: // 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效) + SudMGPMGState.MGCommonSelfObStatus mgCommonSelfObStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfObStatus.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGCommonSelfObStatus(handle, userId, mgCommonSelfObStatus); + } + break; + case SudMGPMGState.MG_DG_SELECTING: // 1. 选词中状态(已修改) + SudMGPMGState.MGDGSelecting mgdgSelecting = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGSelecting.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGDGSelecting(handle, userId, mgdgSelecting); + } + break; + case SudMGPMGState.MG_DG_PAINTING: // 2. 作画中状态(已修改) + SudMGPMGState.MGDGPainting mgdgPainting = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGPainting.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGDGPainting(handle, userId, mgdgPainting); + } + break; + case SudMGPMGState.MG_DG_ERRORANSWER: // 3. 显示错误答案状态(已修改) + SudMGPMGState.MGDGErroranswer mgdgErroranswer = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGErroranswer.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGDGErroranswer(handle, userId, mgdgErroranswer); + } + break; + case SudMGPMGState.MG_DG_TOTALSCORE: // 4. 显示总积分状态(已修改) + SudMGPMGState.MGDGTotalscore mgdgTotalscore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGTotalscore.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGDGTotalscore(handle, userId, mgdgTotalscore); + } + break; + case SudMGPMGState.MG_DG_SCORE: // 5. 本次获得积分状态(已修改) + SudMGPMGState.MGDGScore mgdgScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGScore.class); + if (listener == null) { + ISudFSMStateHandleUtils.handleSuccess(handle); + } else { + listener.onPlayerMGDGScore(handle, userId, mgdgScore); + } + break; + default: + ISudFSMStateHandleUtils.handleSuccess(handle); + break; + } + } + + /** + * 获取队长userId + */ + public String getCaptainUserId() { + return sudFSMMGCache.getCaptainUserId(); + } + + // 返回该玩家是否正在游戏中 + public boolean playerIsPlaying(String userId) { + return sudFSMMGCache.playerIsPlaying(userId); + } + + // 返回该玩家是否已准备 + public boolean playerIsReady(String userId) { + return sudFSMMGCache.playerIsReady(userId); + } + + // 返回该玩家是否已加入了游戏 + public boolean playerIsIn(String userId) { + return sudFSMMGCache.playerIsIn(userId); + } + + // 获取当前游戏中的人数 + public int getPlayerInNumber() { + return sudFSMMGCache.getPlayerInNumber(); + } + + // 是否数字炸弹 + public boolean isHitBomb() { + return sudFSMMGCache.isHitBomb(); + } + + // 销毁游戏 + public void destroyMG() { + sudFSMMGCache.destroyMG(); + } + + /** + * 返回当前游戏的状态,数值参数{@link SudMGPMGState.MGCommonGameState} + */ + public int getGameState() { + return sudFSMMGCache.getGameState(); + } + + /** + * 获取缓存的状态 + */ + public SudFSMMGCache getSudFSMMGCache() { + return sudFSMMGCache; + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java new file mode 100644 index 000000000..8b6da8ba1 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java @@ -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; + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSTAPPDecorator.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSTAPPDecorator.java new file mode 100644 index 000000000..b9111098c --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSTAPPDecorator.java @@ -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 keyWordList, List 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 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); + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/model/GameConfigModel.java b/common/src/main/java/com/yunbao/common/sud/model/GameConfigModel.java new file mode 100644 index 000000000..72bcf1312 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/model/GameConfigModel.java @@ -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; + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/model/GameViewInfoModel.java b/common/src/main/java/com/yunbao/common/sud/model/GameViewInfoModel.java new file mode 100644 index 000000000..6436a8b1a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/model/GameViewInfoModel.java @@ -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; + } + +} diff --git a/common/src/main/java/com/yunbao/common/sud/state/MGStateResponse.java b/common/src/main/java/com/yunbao/common/sud/state/MGStateResponse.java new file mode 100644 index 000000000..9027ba16d --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/state/MGStateResponse.java @@ -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; // 返回消息 +} diff --git a/common/src/main/java/com/yunbao/common/sud/state/SudMGPAPPState.java b/common/src/main/java/com/yunbao/common/sud/state/SudMGPAPPState.java new file mode 100644 index 000000000..68938c586 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/state/SudMGPAPPState.java @@ -0,0 +1,1001 @@ +/* + * Copyright © Sud.Tech + * https://sud.tech + */ + +package com.yunbao.common.sud.state; + +import java.io.Serializable; +import java.util.List; + +/** + * APP to MG 的通用状态定义 + * 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/ + */ +public class SudMGPAPPState implements Serializable { + + // region 通用状态 + /** + * 1. 加入状态 + * 最低版本: v1.1.30.xx + */ + public static final String APP_COMMON_SELF_IN = "app_common_self_in"; + + /** + * 1. 加入状态 模型 + * 用户(本人)加入游戏/退出游戏 + * 正确流程: + * 1.isIn=true: 加入游戏=>准备游戏=>开始游戏; + * 2.isIn=false: 结束=>取消准备=>退出游戏; + */ + public static class APPCommonSelfIn implements Serializable { + // rue 加入游戏,false 退出游戏 + public boolean isIn; + + // 加入的游戏位(座位号) 默认传seatIndex = -1 随机加入,seatIndex 从0开始,不可大于座位数 + public int seatIndex; + + // 默认为ture, 带有游戏位(座位号)的时候,如果游戏位(座位号)已经被占用,是否随机分配一个空位坐下 isSeatRandom=true 随机分配空位坐下,isSeatRandom=false 不随机分配 + public boolean isSeatRandom; + + // 不支持分队的游戏:数值填1;支持分队的游戏:数值填1或2(两支队伍); + public int teamId; + } + + /** + * 2. 准备状态 + * 最低版本: v1.1.30.xx + */ + public static final String APP_COMMON_SELF_READY = "app_common_self_ready"; + + /** + * 2. 准备状态 模型 + * 用户(本人)准备/取消准备 + */ + public static class APPCommonSelfReady implements Serializable { + // true 准备,false 取消准备 + public boolean isReady; + } + + /** + * 3. 游戏状态 + * 最低版本: v1.1.30.xx + */ + public static final String APP_COMMON_SELF_PLAYING = "app_common_self_playing"; + + /** + * 3. 游戏状态 模型 + * 用户游戏状态,如果用户在游戏中,建议: + * a.空出屏幕中心区: + * 关闭全屏礼物特效; + * b.部分强操作类小游戏(spaceMax为true),尽量收缩原生UI,给游戏留出尽量大的操作空间: + * 收缩公屏; + * 收缩麦位; + * 如果不在游戏中,则恢复。 + */ + public static class APPCommonSelfPlaying implements Serializable { + // true 开始游戏,false 结束游戏 + public boolean isPlaying; + + // string类型,Https服务回调report_game_info参数,最大长度1024字节,超过则截断(2022-01-21) + public String reportGameInfoExtras; + + // string类型,最大长度64字节,接入方服务端,可以根据这个字段来查询一局游戏的数据 + public String reportGameInfoKey; + } + + /** + * 4. 队长状态 + * 最低版本: v1.1.30.xx + */ + public static final String APP_COMMON_SELF_CAPTAIN = "app_common_self_captain"; + + /** + * 4. 队长状态 模型 + * 用户是否为队长,队长在游戏中会有开始游戏的权利。 + */ + public static class APPCommonSelfCaptain implements Serializable { + // 必填,指定队长uid + public String curCaptainUID; + } + + /** + * 5. 踢人 + * v1.1.30.xx + */ + public static final String APP_COMMON_SELF_KICK = "app_common_self_kick"; + + /** + * 5. 踢人 模型 + * 用户(本人,队长)踢其他玩家; + * 队长才能踢人; + */ + public static class APPCommonSelfKick implements Serializable { + // 被踢用户uid + public String kickedUID; + } + + /** + * 6. 结束游戏 + * v1.1.30.xx + */ + public static final String APP_COMMON_SELF_END = "app_common_self_end"; + + /** + * 6. 结束游戏 模型 + * 用户(本人,队长)结束(本局)游戏 + */ + public static class APPCommonSelfEnd implements Serializable { + // 当前不需要传参 + } + + /** + * 7. 房间状态(depreated 已废弃v1.1.30.xx) + */ + public static final String APP_COMMON_SELF_ROOM = "app_common_self_room"; + + /** + * 8. 麦位状态(depreated 已废弃v1.1.30.xx) + */ + public static final String APP_COMMON_SELF_SEAT = "app_common_self_seat"; + + /** + * 9. 麦克风状态 + */ + public static final String APP_COMMON_SELF_MICROPHONE = "app_common_self_microphone"; + + /** + * 9. 麦克风状态 模型 + * 用户(本人)麦克风状态,建议: + * 进入房间后初始通知一次; + * 每次变更(开麦/闭麦/禁麦/解麦)通知一次; + */ + public static class APPCommonSelfMicrophone implements Serializable { + // true 开麦,false 闭麦 + public boolean isOn; + + // true 被禁麦,false 未被禁麦 + public boolean isDisabled; + } + + /** + * 10. 文字命中状态 + */ + public static final String APP_COMMON_SELF_TEXT_HIT = "app_common_self_text_hit"; + + /** + * 10. 文字命中状态 模型 + * 用户(本人)聊天信息命中关键词状态,建议: + * 精确匹配; + * 首次聊天内容命中关键词之后,后续聊天内容不翻转成未命中; + * 直至小游戏侧关键词更新,再将状态翻转为未命中; + */ + public static class APPCommonSelfTextHitState implements Serializable { + // true 命中,false 未命中 + public boolean isHit; + + // 单个关键词, 兼容老版本 + public String keyWord; + + // 返回转写文本 + public String text; + + // text:文本包含匹配; number:数字等于匹配 + public String wordType; + + // 命中关键词,可以包含多个关键词 + public List keyWordList; + + // 在number模式下才有,返回转写的多个数字 + public List numberList; + } + + /** + * 11. 打开或关闭背景音乐(2021-12-27新增) + */ + public static final String APP_COMMON_OPEN_BG_MUSIC = "app_common_open_bg_music"; + + /** + * 11. 打开或关闭背景音乐(2021-12-27新增) 模型 + */ + public static class APPCommonOpenBgMusic implements Serializable { + // true 打开背景音乐,false 关闭背景音乐 + public boolean isOpen; + } + + /** + * 12. 打开或关闭音效(2021-12-27新增) + */ + public static final String APP_COMMON_OPEN_SOUND = "app_common_open_sound"; + + /** + * 12. 打开或关闭音效(2021-12-27新增) 模型 + */ + public static class APPCommonOpenSound implements Serializable { + // true 打开音效,false 关闭音效 + public boolean isOpen; + } + + /** + * 13. 打开或关闭游戏中的振动效果(2021-12-27新增) + */ + public static final String APP_COMMON_OPEN_VIBRATE = "app_common_open_vibrate"; + + /** + * 13. 打开或关闭游戏中的振动效果(2021-12-27新增)模型 + */ + public static class APPCommonOpenVibrate implements Serializable { + // true 打开振动效果,false 关闭振动效果 + public boolean isOpen; + } + + /** + * 14. 设置游戏的音量大小(2021-12-31新增) + */ + public static final String APP_COMMON_GAME_SOUND_VOLUME = "app_common_game_sound_volume"; + + /** + * 14. 设置游戏的音量大小(2021-12-31新增)模型 + */ + public static class APPCommonGameSoundVolume implements Serializable { + // 音量大小 0 到 100 + public int volume; + } + + /** + * 15. 设置游戏玩法选项(2022-05-10新增) + */ + public static final String APP_COMMON_GAME_SETTING_SELECT_INFO = "app_common_game_setting_select_info"; + + /** + * 15. 设置游戏玩法选项(2022-05-10新增) 模型 + */ + public static class APPCommonGameSettingSelectInfo implements Serializable { + public Ludo ludo; // 游戏名称 + } + + public static class Ludo implements Serializable { + public int mode; // mode: 默认赛制,0: 快速, 1: 经典; + public int chessNum; // chessNum: 默认棋子数量, 2: 对应2颗棋子; 4: 对应4颗棋子; + public int item; // item: 默认道具, 1: 有道具, 0: 没有道具 + } + + /** + * 16. 设置游戏中的AI玩家(2022-05-11新增) + */ + public static final String APP_COMMON_GAME_ADD_AI_PLAYERS = "app_common_game_add_ai_players"; + + /** + * 16. 设置游戏中的AI玩家(2022-05-11新增) 模型 + */ + public static class APPCommonGameAddAIPlayers implements Serializable { + public List aiPlayers; // AI玩家 + public int isReady = 1; // 机器人加入后是否自动准备 1:自动准备,0:不自动准备 默认为1 + } + + public static class AIPlayers implements Serializable { + public String userId; // 玩家id + public String avatar; // 头像url + public String name; // 名字 + public String gender; // 性别 male:男,female:女 + } + + /** + * 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo) + */ + public static final String APP_COMMON_GAME_RECONNECT = "app_common_game_reconnect"; + + /** + * 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo) 模型 + */ + public static class APPCommonGameReconnect implements Serializable { + } + + /** + * 18. app返回玩家当前积分 + */ + public static final String APP_COMMON_GAME_SCORE = "app_common_game_score"; + + /** + * 18. app返回玩家当前积分 模型 + */ + public static class APPCommonGameScore implements Serializable { + public long score; // 玩家当前积分 + } + + /** + * 23. app通知游戏创建订单的结果 + */ + public static final String APP_COMMON_GAME_CREATE_ORDER_RESULT = "app_common_game_create_order_result"; + + /** + * 23. app通知游戏创建订单的结果 模型 + */ + public static class APPCommonGameCreateOrderResult implements Serializable { + public int result; // app通知游戏创建订单的结果0:失败 1:成功 + } + + /** + * 24. app通知游戏设置玩法(只支持 德州pro和teenpattipro) + */ + public static final String APP_COMMON_GAME_SETTINGS = "app_common_game_settings"; + + /** + * 24. app通知游戏设置玩法(只支持 德州pro和teenpattipro) 模型 + */ + public static class APPCommonGameSettings implements Serializable { + public int smallBlind; // 1 配置小盲,大盲为小盲的2倍[1,2,5,10,20,50,100,200,500,1000] + public int ante; // 0 前注 + public int sBuyIn; // 100 带入值/最小带入配置[100,200,100,200,500,1000,2000,5000,100000] + public int bBuyIn; // 200 最大带入,无限(0) + public int isAutoStart; // 2 0表示关闭自动开始 [0,2,6,7,8,9] + public int isStraddle; // 0 0:关闭,1自由,2强制 + public double tableDuration; // 0.05 牌桌时长配置(小时)[0.5,1,2,4,6,8] + public int thinkTime; // 20 思考时间(秒)[10,15,20] + } + + /** + * 25. app通知返回大厅 + */ + public static final String APP_COMMON_GAME_BACK_LOBBY = "app_common_game_back_lobby"; + + /** + * 25. app通知返回大厅 模型 + */ + public static class APPCommonGameBackLobby implements Serializable { + } + + /** + * 26. app通知游戏定制UI配置表 (仅支持ludo) + */ + public static final String APP_COMMON_GAME_UI_CUSTOM_CONFIG = "app_common_game_ui_custom_config"; + + /** + * 26. app通知游戏定制UI配置表 (仅支持ludo) 模型 + */ + public static class APPCommonGameUiCustomConfig implements Serializable { + public String gameBoard01; // 棋盘底 + public String gameBoard02; // 棋盘 + public String diceBg; // 骰子白底 + public String diceBgGold; // 黄金骰子底 + public String dice01; // 骰子1 + public String dice02; // 骰子2 + public String dice03; // 骰子3 + public String dice04; // 骰子4 + public String dice05; // 骰子5 + public String dice06; // 骰子6 + public String diceCrown; // 骰子皇冠 + public String chessYellow; // 黄色棋子 + public String chessBlue; // 蓝色棋子 + public String chessGreen; // 绿色棋子 + public String chessRed; // 红色棋子 + } + + /** + * 27. app通知游戏玩家信息列表 (赛车) + */ + public static final String APP_COMMON_USERS_INFO = "app_common_users_info"; + + /** + * 27. app通知游戏玩家信息列表 (赛车) 模型 + */ + public static class APPCommonUsersInfo implements Serializable { + public List infos; + + public static class UserInfoModel { + public String uid; // 玩家id + public String avatar; // 玩家头像url + public String name; // 玩家名字 + } + } + + /** + * 28. app通知游戏自定义帮助内容 (赛车) + */ + public static final String APP_COMMON_CUSTOM_HELP_INFO = "app_common_custom_help_info"; + + /** + * 28. app通知游戏自定义帮助内容 (赛车) 模型 + */ + public static class APPCommonCustomHelpInfo implements Serializable { + public List content; + } + + /** + * 29. app主动调起主界面(赛车) + */ + public static final String APP_COMMON_SHOW_GAME_SCENE = "app_common_show_game_scene"; + + /** + * 29. app主动调起主界面(赛车) 模型 + */ + public static class APPCommonShowGameScene implements Serializable { + } + + /** + * 30. app主动隐藏主界面(赛车) + */ + public static final String APP_COMMON_HIDE_GAME_SCENE = "app_common_hide_game_scene"; + + /** + * 30. app主动隐藏主界面(赛车) 模型 + */ + public static class APPCommonHideGameScene implements Serializable { + } + // endregion 通用状态 + + // region 元宇宙砂砂舞 + /** + * 1. 元宇宙砂砂舞相关设置 + * 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/CommonStateForDisco.html + */ + public static final String APP_COMMON_GAME_DISCO_ACTION = "app_common_game_disco_action"; + + /** + * 1. 元宇宙砂砂舞相关设置 模型 + */ + public static class AppCommonGameDiscoAction implements Serializable { + public int actionId; // 必传的参数,用于指定类型的序号,不同序号用于区分游戏内的不同功能,不传则会判断为无效指令,具体序号代表的功能见下表 + public Integer cooldown; // 持续时间,单位秒,部分功能有持续时间就需要传对应的数值,不传或传错则会按各自功能的默认值处理(见下表) + public Boolean isTop; // 是否置顶,针对部分功能可排队置顶(false:不置顶;true:置顶;默认为false) + public String field1; // 额外参数1,针对部分功能有具体的意义 + public String field2; // 额外参数2,针对部分功能有具体的意义 + } + // endregion 元宇宙砂砂舞 + + // region 定制火箭 + /** + * 1. 礼物配置文件回调 + */ + public static final String APP_CUSTOM_ROCKET_CONFIG = "app_custom_rocket_config"; + + /** + * 1. 礼物配置文件回调 模型 + */ + public static class AppCustomRocketConfig implements Serializable { + public int maxSeat; // 最大机位 + public double firePrice; // 发射的静态价格 + public int isDynamicPrice; // 发射价格是否动态开关 0:静态 1动态 + public String gameIntroduce; // 玩法介绍 + public String monetaryUnit; // 货币的单位 + public long serverTime; // 服务器时间戳,单位秒 + public List filterModel; // 过滤不显示的模块(默认是为空) + public List filterLayer; // 过滤不显示的页面(默认是为空) + public List componentList; // 组件列表 1套装,2主仓,3尾翼,4头像,5签名,6颜色 + public List headList; // 组件列表 + public List extraList; // 专属配置 + + public static class ComponentModel { + public String componentId; // 组件的ID + public int type; // 1套装,2主仓,3尾翼 + public String name; // 显示名称(商城+装配间+购买记录+...) + public double price; // 价格 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期:单位是秒 + public String imageId; // 图片ID + public int isLock; // 锁:0不锁 1锁 + public int isShow; // 展示:0不展示 1展示 + } + + public static class HeadModel { + public String componentId; // 组件的ID + public int type; // 4头像(商城+装配间+购买记录+...) + public String name; // 显示名称 + public double price; // 价格 暂时不考虑小数 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期:单位是秒 + public String userId; // 用户的userId + public String nickname; // 昵称 + public int sex; // 性别 0:男 1:女 + public String url; // 头像URL + } + + public static class ExtraModel { + public String componentId; // 组件的ID + public int type; // 5签名,6颜色 + public String name; // 显示名称(商城+装配间+购买记录+...) + public double price; // 价格 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期:单位是秒 + public String desc; // 描述 + } + } + + /** + * 2. 拥有模型列表回调(火箭) + */ + public static final String APP_CUSTOM_ROCKET_MODEL_LIST = "app_custom_rocket_model_list"; + + /** + * 2. 拥有模型列表回调(火箭) 模型 + */ + public static class AppCustomRocketModelList implements Serializable { + public String defaultModelId; // 默认模型 + public int isScreenshot; // 截图:0不截图 1截图(app上传失败或者过期时,被动截图) + public List list; + + public static class Model { + public String modelId; // 模型Id + public int isAvatar; // 可以换装:0不可以 1可以 + public String serviceFlag; // 服务标识 + public List componentList; // 列表 + + public static class ComponentModel { + public String itemId; // 唯一标识 + public int type; // 类型 + public String value; // 值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + } + } + } + + /** + * 3. 拥有组件列表回调(火箭) + */ + public static final String APP_CUSTOM_ROCKET_COMPONENT_LIST = "app_custom_rocket_component_list"; + + /** + * 3. 拥有组件列表回调(火箭) 模型 + */ + public static class AppCustomRocketComponentList implements Serializable { + public List defaultList; // 默认组件列表 + public List list; // 组件列表 + + public static class ComponentModel { + public String itemId; // 唯一标识 + public int type; // 类型 + public String value; // 值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + public long date; // 购买时间:1970年1月1日开始。时间戳:单位是秒 + public String extra; // (可选择) 字段存在显示内容,字段不存在显示时间或者永久 + } + } + + /** + * 4. 获取用户信息回调(火箭) + */ + public static final String APP_CUSTOM_ROCKET_USER_INFO = "app_custom_rocket_user_info"; + + /** + * 4. 获取用户信息回调(火箭) 模型 + */ + public static class AppCustomRocketUserInfo implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public List userList; // 用户信息列表 + } + + /** + * 5. 订单记录列表回调 + */ + public static final String APP_CUSTOM_ROCKET_ORDER_RECORD_LIST = "app_custom_rocket_order_record_list"; + + /** + * 5. 订单记录列表回调 模型 + */ + public static class AppCustomRocketOrderRecordList implements Serializable { + public int pageIndex; // 第几页 + public int pageCount; // 总页数 + public List list; // 列表 + + /** + * 定制火箭,订单组件 模型 + */ + public static class ComponentModel { + public int type; // 类型 + public String value; // 值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + public long date; // 有效期时间戳:单位是秒 + } + } + + /** + * 6. 展馆内列表回调 + */ + public static final String APP_CUSTOM_ROCKET_ROOM_RECORD_LIST = "app_custom_rocket_room_record_list"; + + /** + * 6. 展馆内列表回调 模型 + */ + public static class AppCustomRocketRoomRecordList implements Serializable { + public int pageIndex; // 第几页 + public int pageCount; // 总页数 + public List list; // 列表 + + public static class RoomRecordModel { + public CustomRocketUserInfoModel fromUser; // 送礼人 + public int number; // 火箭数量 + } + } + + /** + * 7. 展馆内玩家送出记录回调 + */ + public static final String APP_CUSTOM_ROCKET_USER_RECORD_LIST = "app_custom_rocket_user_record_list"; + + /** + * 7. 展馆内玩家送出记录回调 模型 + */ + public static class AppCustomRocketUserRecordList implements Serializable { + public int pageIndex; // 第几页 + public int pageCount; // 总页数 + public CustomRocketUserInfoModel fromUser; // 送礼人 + public List list; // 列表 + + public static class UserRecordModel { + public long date; // 订单时间戳: 单位是秒 + public int number; // 个数 + public CustomRocketUserInfoModel toUser; // 收礼人 + public List componentList; // 列表 + + public static class ComponentModel { + public int type; // 类型 + public String value; // 值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + } + } + } + + /** + * 8. 设置默认模型(火箭) + */ + public static final String APP_CUSTOM_ROCKET_SET_DEFAULT_MODEL = "app_custom_rocket_set_default_model"; + + /** + * 8. 设置默认模型(火箭) 模型 + */ + public static class AppCustomRocketSetDefaultModel implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; // 数据 + + public static class Data { + public String modelId; // 默认模型 + } + } + + /** + * 9. 动态计算一键发送价格回调 + */ + public static final String APP_CUSTOM_ROCKET_DYNAMIC_FIRE_PRICE = "app_custom_rocket_dynamic_fire_price"; + + /** + * 9. 动态计算一键发送价格回调 模型 + */ + public static class AppCustomRocketDynamicFirePrice implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; // 数据 + + public static class Data { + public double price; // 发送的价格 + } + } + + /** + * 10. 一键发送回调 + */ + public static final String APP_CUSTOM_ROCKET_FIRE_MODEL = "app_custom_rocket_fire_model"; + + /** + * 10. 一键发送回调 模型 + */ + public static class AppCustomRocketFireModel implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + } + + /** + * 11. 新组装模型 回调 + */ + public static final String APP_CUSTOM_ROCKET_CREATE_MODEL = "app_custom_rocket_create_model"; + + /** + * 11. 新组装模型 回调 模型 + */ + public static class AppCustomRocketCreateModel implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; + + public static class Data { + public String modelId; // 模型Id + public int isAvatar; // 可以换装:0不可以 1可以 + public String serviceFlag; // 服务标识 + public List componentList; + + public static class ComponentModel { + public String itemId; // 模型Id + } + } + } + + /** + * 12. 更换组件 回调 + */ + public static final String APP_CUSTOM_ROCKET_REPLACE_COMPONENT = "app_custom_rocket_replace_component"; + + /** + * 12. 更换组件 回调 模型 + */ + public static class AppCustomRocketReplaceComponent implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; + + public static class Data { + public String modelId; // 模型Id + public List componentList; + + public static class ComponentModel { + public String itemId; + } + } + } + + /** + * 13. 购买组件 回调 + */ + public static final String APP_CUSTOM_ROCKET_BUY_COMPONENT = "app_custom_rocket_buy_component"; + + /** + * 13. 购买组件 回调 模型 + */ + public static class AppCustomRocketBuyComponent implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; + + public static class Data { + public List componentList; + + public static class ComponentModel { + public String itemId; // 唯一标识 + public int type; // 类型 + public String value; // 值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + public long date; // 有效期时间戳:单位是秒 + } + } + } + + /** + * 14. app播放火箭发射动效(火箭) + */ + public static final String APP_CUSTOM_ROCKET_PLAY_MODEL_LIST = "app_custom_rocket_play_model_list"; + + /** + * 14. app播放火箭发射动效(火箭) 模型 + */ + public static class AppCustomRocketPlayModelList implements Serializable { + public String orderId; // 订单号 + public InteractConfigModel interactConfig; // 可选配置 + public List componentList; // 组件列表 + + public static class ComponentModel { + public int type; // 类型 + public String value; // 值 + } + + public static class InteractConfigModel { + public int interactivePlay; // 互动玩法默认状态,1是关闭,0是打开,默认打开; + public List gear; // 每个档位需要点击的次数; + public int nicknameTips; // 昵称飘字是否显示,1是隐藏,0是显示,默认0; + public int uiSwitche; // 左上角UI信息是否显示,1是隐藏,0是显示,默认0; + public int guide; // 新手引导是否显示,1是隐藏,0是显示,默认0; + } + } + + /** + * 15. app推送主播信息(火箭) + */ + public static final String APP_CUSTOM_ROCKET_NEW_USER_INFO = "app_custom_rocket_new_user_info"; + + /** + * 15. app推送主播信息(火箭) 模型 + */ + public static class AppCustomRocketNewUserInfo implements Serializable { + public List userList; // 用户信息列表 + } + + /** + * 16. 验证签名合规(火箭) + */ + public static final String APP_CUSTOM_ROCKET_VERIFY_SIGN = "app_custom_rocket_verify_sign"; + + /** + * 16. 验证签名合规(火箭) 回调 模型 + */ + public static class AppCustomRocketVerifySign implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; + + public static class Data { + public String sign; // 验证的签名 + } + } + + /** + * 17. app主动调起火箭主界面(火箭) + */ + public static final String APP_CUSTOM_ROCKET_SHOW_GAME_SCENE = "app_custom_rocket_show_game_scene"; + + /** + * 17. app主动调起火箭主界面(火箭) 模型 + */ + public static class AppCustomRocketShowGameScene implements Serializable { + } + + /** + * 18. app主动隐藏火箭主界面(火箭) + */ + public static final String APP_CUSTOM_ROCKET_HIDE_GAME_SCENE = "app_custom_rocket_hide_game_scene"; + + /** + * 18. app主动隐藏火箭主界面(火箭) 模型 + */ + public static class AppCustomRocketHideGameScene implements Serializable { + } + + /** + * 19. app推送解锁组件(火箭) + */ + public static final String APP_CUSTOM_ROCKET_UNLOCK_COMPONENT = "app_custom_rocket_unlock_component"; + + /** + * 19. app推送解锁组件(火箭) 模型 + */ + public static class AppCustomRocketUnlockComponent implements Serializable { + public int type; // 组件类型 + public String componentId; // 组件ID + } + + /** + * 20. app推送火箭效果飞行点击(火箭) + */ + public static final String APP_CUSTOM_ROCKET_FLY_CLICK = "app_custom_rocket_fly_click"; + + /** + * 20. app推送火箭效果飞行点击(火箭) 模型 + */ + public static class AppCustomRocketFlyClick implements Serializable { + } + + /** + * 21. app推送关闭火箭播放效果(火箭) + */ + public static final String APP_CUSTOM_ROCKET_CLOSE_PLAY_EFFECT = "app_custom_rocket_close_play_effect"; + + /** + * 21. app推送关闭火箭播放效果(火箭) 模型 + */ + public static class AppCustomRocketClosePlayEffect implements Serializable { + } + + /** + * 22. 颜色和签名自定义改到装配间的模式,保存颜色或签名回调 + */ + public static final String APP_CUSTOM_ROCKET_SAVE_SIGN_COLOR = "app_custom_rocket_save_sign_color"; + + /** + * 22. 颜色和签名自定义改到装配间的模式,保存颜色或签名回调 模型 + */ + public static final class AppCustomRocketSaveSignColor implements Serializable { + public int resultCode; // 0: 请求成功,1:请求失败 + public String error; // 错误描述 + public Data data; // 数据 + + public static class Data { + public List componentList; + } + + public static class ComponentModel { + public String itemId; // 唯一标识 + public int type; // 签名 + public String value; // 签名的值 + public int isForever; // 永久:0非永久 1永久 + public long validTime; // 有效期时间戳:单位是秒 + } + } + + /** + * 定制火箭,用户信息 模型 + */ + public static class CustomRocketUserInfoModel { + public String userId; // 用户的userId + public String nickname; // 昵称 + public int sex; // 性别 0:男 1:女 + public String url; // 头像URL + } + // endregion 定制火箭 + + // region 棒球 + /** + * 1. 下发游戏客户端查询排行榜数据(棒球) + */ + public static final String APP_BASEBALL_RANKING = "app_baseball_ranking"; + + /** + * 1. 下发游戏客户端查询排行榜数据(棒球) 模型 + */ + public static class AppBaseballRanking implements Serializable { + public List data; + } + + /** + * 2. 下发游戏客户端查询我的排名数据(棒球) + */ + public static final String APP_BASEBALL_MY_RANKING = "app_baseball_my_ranking"; + + /** + * 2. 下发游戏客户端查询我的排名数据(棒球) 模型 + */ + public static class AppBaseballMyRanking implements Serializable { + public AppBaseballPlayerInfo data; + } + + /** + * 3. 下发游戏客户端查询排在自己前后的玩家数据(棒球) + */ + public static final String APP_BASEBALL_RANGE_INFO = "app_baseball_range_info"; + + /** + * 3. 下发游戏客户端查询排在自己前后的玩家数据(棒球) 模型 + */ + public static class AppBaseballRangeInfo implements Serializable { + public AppBaseballPlayerInfo before; // 前一名 + public AppBaseballPlayerInfo after; // 后一名 + } + + /** + * 4. app主动调起主界面(棒球) + */ + public static final String APP_BASEBALL_SHOW_GAME_SCENE = "app_baseball_show_game_scene"; + + /** + * 4. app主动调起主界面(棒球) 模型 + */ + public static class AppBaseballShowGameScene implements Serializable { + } + + /** + * 5. app主动隐藏主界面(棒球) + */ + public static final String APP_BASEBALL_HIDE_GAME_SCENE = "app_baseball_hide_game_scene"; + + /** + * 5. app主动隐藏主界面(棒球) 模型 + */ + public static class AppBaseballHideGameScene implements Serializable { + } + + /** + * 6. app推送需要的文本数据(棒球) + */ + public static final String APP_BASEBALL_TEXT_CONFIG = "app_baseball_text_config"; + + /** + * 6. app推送需要的文本数据(棒球) 模型 + */ + public static class AppBaseballTextConfig implements Serializable { + public String mode1; + public String mode2; + public String mode3; + } + + public static class AppBaseballPlayerInfo implements Serializable { + public String playerId; // 玩家Id + public String name; // 玩家昵称 + public String avatar; // 头像 + public long distance; // 距离 + public int rank; // 排名 + } + // endregion 棒球 + +} diff --git a/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java new file mode 100644 index 000000000..1523a5a16 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java @@ -0,0 +1,1509 @@ +/* + * Copyright © Sud.Tech + * https://sud.tech + */ + +package com.yunbao.common.sud.state; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.List; + +/** + * MG to APP 的状态定义 + * 参考文档:https://docs.sud.tech/zh-CN/app/Client/MGFSM/ + */ +public class SudMGPMGState implements Serializable { + + // region MG状态机-通用状态-游戏 + // 参考文档:https://docs.sud.tech/zh-CN/app/Client/MGFSM/CommonStateGame.html + /** + * 1. 公屏消息(已修改) + * 最低版本: v1.1.30.xx + */ + public static final String MG_COMMON_PUBLIC_MESSAGE = "mg_common_public_message"; + + /** + * 1. 公屏消息(已修改) + * 向公屏发送消息,字段含义如下 + * type + * 0 通知 + * 1 提醒 + * 2 结算 + * 3 其他 + * msg + * 内为转义字段: + * + * 其中name/uid/color均为可选字段,字段为空的情况如下: + * + * SDK仅会缓存最新一条。 + */ + public static class MGCommonPublicMessage implements Serializable { + // 0 通知 + // 1 提醒 + // 2 结算 + // 3 其他 + public int type; + + // 消息内容 + public List msg; + + public static class MGCommonPublicMessageMsg implements Serializable { + // 词组类型 当phrase=1时,会返回text; 当phrase=2时,会返回user + public int phrase; + public MGCommonPublicMessageMsgText text; + public MGCommonPublicMessageMsgUser user; + } + + public static class MGCommonPublicMessageMsgText implements Serializable { + @SerializedName(value = "default") + public String defaultStr; // 默认文本 + + @SerializedName(value = "zh-CN") + public String zh_CN; // 中文(简体) + + @SerializedName(value = "zh-HK") + public String zh_HK; // 中文(香港) + + @SerializedName(value = "zh-MO") + public String zh_MO; // 中文(澳门) + + @SerializedName(value = "zh-SG") + public String zh_SG; // 中文(新加坡) + + @SerializedName(value = "zh-TW") + public String zh_TW; // 中文(繁体) + + @SerializedName(value = "en-US") + public String en_US; // 英语(美国) + + @SerializedName(value = "en-GB") + public String en_GB; // 英语(英国) + + @SerializedName(value = "ms-BN") + public String ms_BN; // 马来语(文莱达鲁萨兰) + + @SerializedName(value = "ms-MY") + public String ms_MY; // 马来语(马来西亚) + + @SerializedName(value = "vi-VN") + public String vi_VN; // 越南语 + + @SerializedName(value = "id-ID") + public String id_ID; // 印度尼西亚语 + + @SerializedName(value = "es-ES") + public String es_ES; // 西班牙语(传统) + + @SerializedName(value = "ja-JP") + public String ja_JP; // 日语 + + @SerializedName(value = "ko-KR") + public String ko_KR; // 朝鲜语 + + @SerializedName(value = "th-TH") + public String th_TH; // 泰语 + + @SerializedName(value = "ar-SA") + public String ar_SA; // 阿拉伯语(沙特阿拉伯) + + @SerializedName(value = "ur-PK") + public String ur_PK; // 乌都语 + + @SerializedName(value = "tr-TR") + public String tr_TR; // 土耳其语 + } + + public static class MGCommonPublicMessageMsgUser implements Serializable { + // 默认内容 + public String defaultStr; + // 用户名称 + public String name; + // 用户id + public String uid; + // 颜色值 + public String color; + } + } + + /** + * 2. 关键词状态 + */ + public static final String MG_COMMON_KEY_WORD_TO_HIT = "mg_common_key_word_to_hit"; + + /** + * 2. 关键词状态 + */ + public static class MGCommonKeyWordToHit implements Serializable { + // 必填字段;text:文本包含匹配; number:数字等于匹配(必填字段);默认:text(你画我猜、你说我猜);数字炸弹填number; + public String wordType; + + // 单个关键词,兼容老版本。轮到自己猜词时才有值,否则为null + public String word; + + // 关键词,每一轮都会下发,不区分角色 + public String realWord; + + // 必填字段;关键词列表,可以传送多个关键词。轮到自己猜词时才有值,否则为null + public List wordList; + + // 必填字段;关键词语言,默认:zh-CN; + public String wordLanguage; + } + + /** + * 3. 游戏结算状态 + */ + public static final String MG_COMMON_GAME_SETTLE = "mg_common_game_settle"; + + /** + * 3. 游戏结算状态 + */ + public static class MGCommonGameSettle implements Serializable { + // 游戏模式默认为1 + public int gameMode; + + // 本局游戏的id + public String gameRoundId; + + // 游戏结果玩家列表 + public List results; + + /** + * 游戏结果玩家定义 + */ + public static class PlayerResult implements Serializable { + public String uid; // 用户id + public int rank; // 排名 从 1 开始 + public int award; // 奖励 + public int score; // 积分 + public int isEscaped; // 是否逃跑 1:逃跑 0:非逃跑 + public String killerId; // 杀自己的玩家的id + public int isAI; // 是否是AI玩家,1为AI + } + } + + /** + * 4. 加入游戏按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_JOIN_BTN = "mg_common_self_click_join_btn"; + + /** + * 4. 加入游戏按钮点击状态 模型 + * 用户(本人)点击加入按钮,或者点击头像加入 + */ + public static class MGCommonSelfClickJoinBtn implements Serializable { + // 点击头像加入游戏对应的座位号,int 类型,从0开始, 如果seatIndex=-1,则是随机加入一个空位,如果seatIndex 大于座位数,则加入不成功 + public int seatIndex; + } + + /** + * 5. 取消加入(退出)游戏按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_CANCEL_JOIN_BTN = "mg_common_self_click_cancel_join_btn"; + + /** + * 5. 取消加入(退出)游戏按钮点击状态 模型 + * 用户(本人)点击取消加入按钮 + */ + public static class MGCommonSelfClickCancelJoinBtn implements Serializable { + } + + /** + * 6. 准备按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_READY_BTN = "mg_common_self_click_ready_btn"; + + /** + * 6. 准备按钮点击状态 模型 + */ + public static class MGCommonSelfClickReadyBtn implements Serializable { + } + + /** + * 7. 取消准备按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_CANCEL_READY_BTN = "mg_common_self_click_cancel_ready_btn"; + + /** + * 7. 取消准备按钮点击状态 模型 + */ + public static class MGCommonSelfClickCancelReadyBtn implements Serializable { + } + + /** + * 8. 开始游戏按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_START_BTN = "mg_common_self_click_start_btn"; + + /** + * 8. 开始游戏按钮点击状态 模型 + */ + public static class MGCommonSelfClickStartBtn implements Serializable { + } + + /** + * 9. 分享按钮点击状态 + */ + public static final String MG_COMMON_SELF_CLICK_SHARE_BTN = "mg_common_self_click_share_btn"; + + /** + * 9. 分享按钮点击状态 模型 + * 用户(本人)点击分享按钮 + */ + public static class MGCommonSelfClickShareBtn implements Serializable { + } + + /** + * 10. 游戏状态 + */ + public static final String MG_COMMON_GAME_STATE = "mg_common_game_state"; + + /** + * 10. 游戏状态 模型 + */ + public static class MGCommonGameState implements Serializable { + public static final int UNKNOW = -1; // 未知 + public static final int IDLE = 0; + public static final int LOADING = 1; + public static final int PLAYING = 2; + + // gameState=0 (idle 状态,游戏未开始,空闲状态); + // gameState=1(loading 状态,所有玩家都准备好,队长点击了开始游戏按钮,等待加载游戏场景开始游戏,游戏即将开始提示阶段); + // gameState=2(playing状态,游戏进行中状态) + public int gameState; + } + + /** + * 11. 结算界面关闭按钮点击状态(2021-12-27新增) + */ + public static final String MG_COMMON_SELF_CLICK_GAME_SETTLE_CLOSE_BTN = "mg_common_self_click_game_settle_close_btn"; + + /** + * 11. 结算界面关闭按钮点击状态(2021-12-27新增) 模型 + * 用户(本人)点击结算界面关闭按钮 + */ + public static class MGCommonSelfClickGameSettleCloseBtn implements Serializable { + } + + /** + * 12. 结算界面再来一局按钮点击状态(2021-12-27新增) + */ + public static final String MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN = "mg_common_self_click_game_settle_again_btn"; + + /** + * 12. 结算界面再来一局按钮点击状态(2021-12-27新增)模型 + * 用户(本人)点击结算界面再来一局按钮 + */ + public static class MGCommonSelfClickGameSettleAgainBtn implements Serializable { + } + + /** + * 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强) + */ + public static final String MG_COMMON_GAME_SOUND_LIST = "mg_common_game_sound_list"; + + /** + * 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强) 模型 + * 游戏上报本游戏中所有的声音资源列表 + */ + public static class MGCommonGameSoundList implements Serializable { + // 声音资源列表 + public List list; + + public static class MGCommonGameSound implements Serializable { + // 声音资源的名字 + public String name; + // 声音资源的URL链接 + public String url; + // 声音资源类型 + public String type; + } + } + + /** + * 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强) + */ + public static final String MG_COMMON_GAME_SOUND = "mg_common_game_sound"; + + /** + * 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强) 模型 + * 游戏通知app层播放背景音乐的开关状态 + */ + public static class MGCommonGameSound implements Serializable { + // 是否播放 isPlay==true(播放),isPlay==false(停止) + public boolean isPlay; + // 要播放的声音文件名,不带后缀 + public String name; + // 声音资源类型 + public String type; + // 播放次数;注:times == 0 为循环播放 + public String times; + // https://www.xxxx.xx/xxx.mp3" 声音资源的url链接 + public String url; + } + + /** + * 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强) + */ + public static final String MG_COMMON_GAME_BG_MUSIC_STATE = "mg_common_game_bg_music_state"; + + /** + * 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强) 模型 + * 游戏通知app层播放背景音乐的开关状态 + */ + public static class MGCommonGameBgMusicState implements Serializable { + // 背景音乐的开关状态 true: 开,false: 关 + public boolean state; + } + + /** + * 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强) + */ + public static final String MG_COMMON_GAME_SOUND_STATE = "mg_common_game_sound_state"; + + /** + * 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强) 模型 + * 游戏通知app层播放音效的状态 + */ + public static class MGCommonGameSoundState implements Serializable { + // 背景音乐的开关状态 true: 开,false: 关 + public boolean state; + } + + /** + * 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增) + */ + public static final String MG_COMMON_GAME_ASR = "mg_common_game_asr"; + + /** + * 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增) 模型 + */ + public static class MGCommonGameASR implements Serializable { + // true:打开语音识别 false:关闭语音识别 + public boolean isOpen; + } + + /** + * 18. 麦克风状态(2022-02-08新增) + */ + public static final String MG_COMMON_SELF_MICROPHONE = "mg_common_self_microphone"; + + /** + * 18. 麦克风状态(2022-02-08新增) 模型 + * 游戏通知app麦克风状态 + */ + public static class MGCommonSelfMicrophone implements Serializable { + // 麦克风开关状态 true: 开,false: 关 + public boolean isOn; + } + + /** + * 19. 耳机(听筒,扬声器)状态(2022-02-08新增) + */ + public static final String MG_COMMON_SELF_HEADPHONE = "mg_common_self_headphone"; + + /** + * 19. 耳机(听筒,扬声器)状态(2022-02-08新增) 模型 + */ + public static class MGCommonSelfHeadphone implements Serializable { + // 耳机(听筒,喇叭)开关状态 true: 开,false: 关 + public boolean isOn; + } + + /** + * 20. App通用状态操作结果错误码(2022-05-10新增) + */ + public static final String MG_COMMON_APP_COMMON_SELF_X_RESP = "mg_common_app_common_self_x_resp"; + + /** + * 20. App通用状态操作结果错误码(2022-05-10新增) 模型 + */ + public static class MGCommonAPPCommonSelfXResp implements Serializable { + public String state; // 字段必填, 参考:游戏业务错误 https://docs.sud.tech/zh-CN/app/Client/APPFST/CommonState.html + public int resultCode; // 字段必填,参考:游戏业务错误 https://docs.sud.tech/zh-CN/app/Server/ErrorCode.html + public boolean isIn; // 当state=app_common_self_in时,字段必填 + public boolean isReady; // 当state=app_common_self_ready时,字段必填 + public boolean isPlaying; // 当state=app_common_self_playing时,字段必填 + public String reportGameInfoExtras; // 当state=app_common_self_playing时,字段必填 + public String curCaptainUID; // 当state=app_common_self_captain时,字段必填 + public String kickedUID; // 当state=app_common_self_kick时,字段必填 + } + + /** + * 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增) + */ + public static final String MG_COMMON_GAME_ADD_AI_PLAYERS = "mg_common_game_add_ai_players"; + + /** + * 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增) 模型 + */ + public static class MGCommonGameAddAIPlayers implements Serializable { + public int resultCode; // 返回码 0:成功,非0:不成功 + public List userIds; // 加入成功的playerId列表 + } + + /** + * 22. 游戏通知app层添当前网络连接状态(2022-06-21新增) + */ + public static final String MG_COMMON_GAME_NETWORK_STATE = "mg_common_game_network_state"; + + /** + * 22. 游戏通知app层添当前网络连接状态(2022-06-21新增) 模型 + */ + public static class MGCommonGameNetworkState implements Serializable { + public int state; // 0:closed, 1: connected + } + + /** + * 23. 游戏通知app获取积分 + */ + public static final String MG_COMMON_GAME_GET_SCORE = "mg_common_game_get_score"; + + /** + * 23. 游戏通知app获取积分 模型 + */ + public static class MGCommonGameGetScore implements Serializable { + } + + /** + * 24. 游戏通知app带入积分 + */ + public static final String MG_COMMON_GAME_SET_SCORE = "mg_common_game_set_score"; + + /** + * 24. 游戏通知app带入积分 模型 + */ + public static class MGCommonGameSetScore implements Serializable { + public String roundId; // 局id + public long lastRoundScore; // 本人当前积分 + public long incrementalScore; // 充值积分 + public long totalScore; // 充值后总积分 + } + + /** + * 25. 创建订单 + */ + public static final String MG_COMMON_GAME_CREATE_ORDER = "mg_common_game_create_order"; + + /** + * 25. 创建订单 模型 + */ + public static class MGCommonGameCreateOrder implements Serializable { + public String cmd; // 触发的行为动作,比如打赏,购买等 + public String fromUid; // 付费用户uid + public String toUid; // 目标用户uid + public long value; // 所属的游戏价值 + public String payload; // 扩展数据 json 字符串, 特殊可选 + } + + /** + * 26. 游戏通知app玩家角色(仅对狼人杀有效) + */ + public static final String MG_COMMON_PLAYER_ROLE_ID = "mg_common_player_role_id"; + + /** + * 26. 游戏通知app玩家角色(仅对狼人杀有效) 模型 + */ + public static class MGCommonPlayerRoleId implements Serializable { + public List playersRoleId; // 列表 + + public static class MGCommonPlayerModel implements Serializable { + public String uid; // 玩家id + public int roleId; // 角色id + } + } + + /** + * 27. 游戏通知app玩家被扔便便(你画我猜,你说我猜,友尽闯关有效) + */ + public static final String MG_COMMON_SELF_CLICK_POOP = "mg_common_self_click_poop"; + + /** + * 27. 游戏通知app玩家被扔便便(你画我猜,你说我猜,友尽闯关有效) 模型 + */ + public static class MGCommonSelfClickPoop implements Serializable { + } + + /** + * 28. 游戏通知app玩家被点赞(你画我猜,你说我猜,友尽闯关有效) + */ + public static final String MG_COMMON_SELF_CLICK_GOOD = "mg_common_self_click_good"; + + /** + * 28. 游戏通知app玩家被点赞(你画我猜,你说我猜,友尽闯关有效) 模型 + */ + public static class MGCommonSelfClickGood implements Serializable { + } + + /** + * 29. 游戏通知app游戏FPS(仅对碰碰,多米诺骨牌,飞镖达人生效) + */ + public static final String MG_COMMON_GAME_FPS = "mg_common_game_fps"; + + /** + * 29. 游戏通知app游戏FPS(仅对碰碰,多米诺骨牌,飞镖达人生效) 模型 + */ + public static class MGCommonGameFps implements Serializable { + public int fps; + } + + /** + * 30. 游戏通知app游戏弹框 + */ + public static final String MG_COMMON_ALERT = "mg_common_alert"; + + /** + * 30. 游戏通知app游戏弹框 模型 + */ + public static class MGCommonAlert implements Serializable { + public String state; // show:显示,close:关闭 + } + + /** + * 31. 游戏通知app最坑队友(只支持友尽闯关) + */ + public static final String MG_COMMON_WORST_TEAMMATE = "mg_common_worst_teammate"; + + /** + * 31. 游戏通知app最坑队友(只支持友尽闯关) 模型 + */ + public static class MGCommonWorstTeammate implements Serializable { + public String uid; // 最坑队友的uid + } + + /** + * 32. 游戏通知app因玩家逃跑导致游戏结束(只支持友尽闯关) + */ + public static final String MG_COMMON_GAME_OVER_TIP = "mg_common_game_over_tip"; + + /** + * 32. 游戏通知app因玩家逃跑导致游戏结束(只支持友尽闯关) 模型 + */ + public static class MGCommonGameOverTip implements Serializable { + public List uids; // 逃跑玩家的uid数组 + } + + /** + * 33. 游戏通知app玩家颜色(只支持友尽闯关) + */ + public static final String MG_COMMON_GAME_PLAYER_COLOR = "mg_common_game_player_color"; + + /** + * 33. 游戏通知app玩家颜色(只支持友尽闯关) 模型 + */ + public static class MGCommonGamePlayerColor implements Serializable { + public List players; + + public static class PlayerColorModel { + public String uid; // 用户id + public int color; // color:1是粉色,2是紫色,3是绿色,4是蓝色,5是黄色,6是橙色 + } + } + + /** + * 34. 游戏通知app玩家头像的坐标(只支持ludo) + */ + public static final String MG_COMMON_GAME_PLAYER_ICON_POSITION = "mg_common_game_player_icon_position"; + + /** + * 34. 游戏通知app玩家头像的坐标(只支持ludo) 模型 + */ + public static class MGCommonGamePlayerIconPosition implements Serializable { + public String uid; + public PlayerIconPositionModel position; + + public static class PlayerIconPositionModel { + // 头像坐标和宽高,坐标为头像中心 + public double x; + public double y; + public double width; + public double height; + } + } + + /** + * 35. 游戏通知app退出游戏(只支持teenpattipro 与 德州pro) + */ + public static final String MG_COMMON_SELF_CLICK_EXIT_GAME_BTN = "mg_common_self_click_exit_game_btn"; + + /** + * 35. 游戏通知app退出游戏(只支持teenpattipro 与 德州pro) 模型 + */ + public static class MGCommonSelfClickExitGameBtn implements Serializable { + } + + /** + * 36. 游戏通知app是否要开启带入积分(只支持teenpattipro 与 德州pro) + */ + public static final String MG_COMMON_GAME_IS_APP_CHIP = "mg_common_game_is_app_chip"; + + /** + * 36. 游戏通知app是否要开启带入积分(只支持teenpattipro 与 德州pro) 模型 + */ + public static class MGCommonGameIsAppChip implements Serializable { + public int isAppChip; // 0:不开启,1:开启 + } + + /** + * 37. 游戏通知app当前游戏的设置信息(只支持德州pro,teenpatti pro) + */ + public static final String MG_COMMON_GAME_RULE = "mg_common_game_rule"; + + /** + * 37. 游戏通知app当前游戏的设置信息(只支持德州pro,teenpatti pro) 模型 + */ + public static class MGCommonGameRule implements Serializable { + public GameRuleModel gameMode; + + // 德州与teenpatti的结构融合在一起 + public static class GameRuleModel { + public Integer smallBlind; // 小盲 + public Integer ante; // 前注 + public Integer isStraddle; // 0:关闭,1自由,2强制 + public Integer sBuyIn; // 带入值/最小带入配置 + public Integer bBuyIn; // 最大带入,无限(0) + public Integer isAutoStart; // 是否自动开始 + public Double tableDuration; // 牌桌时长配置(小时) + public Integer thinkTime; // 思考时间(秒) + public Integer darkCard; // 暗牌回合 + public Integer potLimit; // 最大带入 + public Integer round; // 最大回合 + public Integer singleLimit; // 单注限 + } + } + + /** + * 38. 游戏通知app进行玩法设置(只支持德州pro,teenpatti pro) + */ + public static final String MG_COMMON_GAME_SETTINGS = "mg_common_game_settings"; + + /** + * 38. 游戏通知app进行玩法设置(只支持德州pro,teenpatti pro) 模型 + */ + public static class MGCommonGameSettings implements Serializable { + } + + /** + * 39. 游戏通知app钱币不足(只支持德州pro,teenpatti pro) + */ + public static final String MG_COMMON_GAME_MONEY_NOT_ENOUGH = "mg_common_game_money_not_enough"; + + /** + * 39. 游戏通知app钱币不足(只支持德州pro,teenpatti pro) 模型 + */ + public static class MGCommonGameMoneyNotEnough implements Serializable { + } + + /** + * 40. 游戏通知app下发定制ui配置表(只支持ludo) + */ + public static final String MG_COMMON_GAME_UI_CUSTOM_CONFIG = "mg_common_game_ui_custom_config"; + + /** + * 40. 游戏通知app下发定制ui配置表(只支持ludo) 模型 + */ + public static class MGCommonGameUiCustomConfig implements Serializable { + } + + /** + * 41. 设置app提供给游戏可点击区域(赛车) + */ + public static final String MG_COMMON_SET_CLICK_RECT = "mg_common_set_click_rect"; + + /** + * 41. 设置app提供给游戏可点击区域(赛车) 模型 + */ + public static class MGCommonSetClickRect implements Serializable { + public List list; // 游戏的点击区域 + } + + /** + * 42. 通知app提供对应uids列表玩家的数据(赛车) + */ + public static final String MG_COMMON_USERS_INFO = "mg_common_users_info"; + + /** + * 42. 通知app提供对应uids列表玩家的数据(赛车) 模型 + */ + public static class MGCommonUsersInfo implements Serializable { + public List uids; + } + + /** + * 43. 通知app游戏前期准备完成(赛车) + */ + public static final String MG_COMMON_GAME_PREPARE_FINISH = "mg_common_game_prepare_finish"; + + /** + * 43. 通知app游戏前期准备完成(赛车) 模型 + */ + public static class MGCommonGamePrepareFinish implements Serializable { + } + + /** + * 44. 通知app游戏主界面已显示(赛车) + */ + public static final String MG_COMMON_SHOW_GAME_SCENE = "mg_common_show_game_scene"; + + /** + * 44. 通知app游戏主界面已显示(赛车) 模型 + */ + public static class MGCommonShowGameScene implements Serializable { + } + + /** + * 45. 通知app游戏主界面已隐藏(赛车) + */ + public static final String MG_COMMON_HIDE_GAME_SCENE = "mg_common_hide_game_scene"; + + /** + * 45. 通知app游戏主界面已隐藏(赛车) 模型 + */ + public static class MGCommonHideGameScene implements Serializable { + } + // endregion 通用状态-游戏 + + // region MG状态机-通用状态-玩家 + // 参考:https://docs.sud.tech/zh-CN/app/Client/MGFSM/CommonStatePlayer.html + + /** + * 1.加入状态(已修改) + * 最低版本: v1.1.30.xx + */ + public static final String MG_COMMON_PLAYER_IN = "mg_common_player_in"; + + /** + * 1.加入状态(已修改) 模型 + * 用户是否加入游戏; + * 游戏开始后,未加入的用户为OB视角。 + */ + public static class MGCommonPlayerIn implements Serializable { + // true 已加入,false 未加入 + public boolean isIn; + + // 加入哪支队伍 + public int teamId; + + // 当isIn==false时有效;0 主动退出,1 被踢;(reason默认-1,无意义便于处理) + public int reason; + + // 当reason==1时有效;kickUID为踢人的用户uid;判断被踢的人是本人条件(onPlayerStateChange(userId==kickedUID == selfUID);(kickUID默认"",无意义便于处理) + public String kickUID; + } + + /** + * 2.准备状态(已修改) + * 最低版本: v1.1.30.xx + */ + public static final String MG_COMMON_PLAYER_READY = "mg_common_player_ready"; + + /** + * 2.准备状态(已修改) 模型 + * 用户是否为队长,队长在游戏中会有开始游戏的权利。 + */ + public static class MGCommonPlayerReady implements Serializable { + // 当retCode==0时有效;true 已准备,false 未准备 + public boolean isReady; + } + + /** + * 3.队长状态(已修改) + * 最低版本: v1.1.30.xx + */ + public static final String MG_COMMON_PLAYER_CAPTAIN = "mg_common_player_captain"; + + /** + * 3.队长状态(已修改) 模型 + * 用户是否为队长,队长在游戏中会有开始游戏的权利。 + */ + public static class MGCommonPlayerCaptain implements Serializable { + // true 是队长,false 不是队长; + public boolean isCaptain; + } + + /** + * 4.游戏状态(已修改) + * 最低版本: v1.1.30.xx + */ + public static final String MG_COMMON_PLAYER_PLAYING = "mg_common_player_playing"; + + /** + * 4.游戏状态(已修改)模型 + * 用户游戏状态,如果用户在游戏中,建议: + * a.空出屏幕中心区: + * 关闭全屏礼物特效; + * b.部分强操作类小游戏(spaceMax为true),尽量收缩原生UI,给游戏留出尽量大的操作空间: + * 收缩公屏; + * 收缩麦位; + * 如果不在游戏中,则恢复。 + */ + public static class MGCommonPlayerPlaying implements Serializable { + // true 游戏中,false 未在游戏中; + public boolean isPlaying; + // 本轮游戏id,当isPlaying==true时有效 + public String gameRoundId; + // 当isPlaying==false时有效;isPlaying=false, 0:正常结束 1:提前结束(自己不玩了)2:无真人可以提前结束(无真人,只有机器人) 3:所有人都提前结束;(reason默认-1,无意义便于处理) + public int reason; + // true 建议尽量收缩原生UI,给游戏留出尽量大的操作空间 false 初始状态; + public Boolean spaceMax; + } + + /** + * 5.玩家在线状态 + */ + public static final String MG_COMMON_PLAYER_ONLINE = "mg_common_player_online"; + + /** + * 5.玩家在线状态 模型 + */ + public static class MGCommonPlayerOnline implements Serializable { + // true:在线,false: 离线 + public boolean isOnline; + } + + /** + * 6.玩家换游戏位状态 + */ + public static final String MG_COMMON_PLAYER_CHANGE_SEAT = "mg_common_player_change_seat"; + + /** + * 6.玩家换游戏位状态 模型 + */ + public static class MGCommonPlayerChangeSeat implements Serializable { + // 换位前的游戏位(座位号) + public int preSeatIndex; + // 换位成功后的游戏位(座位号) + public int currentSeatIndex; + } + + /** + * 7. 游戏通知app点击玩家头像 + */ + public static final String MG_COMMON_SELF_CLICK_GAME_PLAYER_ICON = "mg_common_self_click_game_player_icon"; + + /** + * 7. 游戏通知app点击玩家头像 模型 + */ + public static class MGCommonSelfClickGamePlayerIcon implements Serializable { + // 被点击头像的用户id + public String uid; + } + + /** + * 8. 游戏通知app玩家死亡状态(2022-04-24新增) + */ + public static final String MG_COMMON_SELF_DIE_STATUS = "mg_common_self_die_status"; + + /** + * 8. 游戏通知app玩家死亡状态(2022-04-24新增)模型 + */ + public static class MGCommonSelfDieStatus implements Serializable { + public String uid; // 用户id + public boolean isDeath; // 玩家是否死亡 true:死亡, false: 未死亡;默认 false + } + + /** + * 9. 游戏通知app轮到玩家出手状态(2022-04-24新增) + */ + public static final String MG_COMMON_SELF_TURN_STATUS = "mg_common_self_turn_status"; + + /** + * 9. 游戏通知app轮到玩家出手状态(2022-04-24新增)模型 + */ + public static class MGCommonSelfTurnStatus implements Serializable { + public String uid; // 用户id + public boolean isTurn; // 是否轮到玩家出手 true:是上面uid玩家的出手回合, false: 不是上面uid玩家的出手回合;默认false + } + + /** + * 10. 游戏通知app玩家选择状态(2022-04-24新增) + */ + public static final String MG_COMMON_SELF_SELECT_STATUS = "mg_common_self_select_status"; + + /** + * 10. 游戏通知app玩家选择状态(2022-04-24新增)模型 + */ + public static class MGCommonSelfSelectStatus implements Serializable { + public String uid; // 用户id + public boolean isSelected; // 玩家是否选择 true:选择, false: 未选择; 默认false + } + + /** + * 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效) + */ + public static final String MG_COMMON_GAME_COUNTDOWN_TIME = "mg_common_game_countdown_time"; + + /** + * 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效)模型 + */ + public static class MGCommonGameCountdownTime implements Serializable { + public int countdown;// 剩余时间,单位为秒 + } + + /** + * 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效) + */ + public static final String MG_COMMON_SELF_OB_STATUS = "mg_common_self_ob_status"; + + /** + * 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效)模型 + */ + public static class MGCommonSelfObStatus implements Serializable { + public boolean isOb;// 是否成为ob视角 + } + + // endregion 通用状态-玩家 + + + // region 碰碰我最强 + // endregion 碰碰我最强 + + // region 飞刀达人 + // endregion 飞刀达人 + + // region 你画我猜 + // 参考文档:https://docs.sud.tech/zh-CN/app/Client/MGFSM/DrawGuess.html + + /** + * 1. 选词中状态(已修改) + */ + public static final String MG_DG_SELECTING = "mg_dg_selecting"; + + /** + * 1. 选词中状态(已修改) 模型 + * 选词中,头像正下方 + */ + public static class MGDGSelecting implements Serializable { + // bool 类型 true:正在选词中,false: 不在选词中 + public boolean isSelecting; + } + + /** + * 2. 作画中状态(已修改) + */ + public static final String MG_DG_PAINTING = "mg_dg_painting"; + + /** + * 2. 作画中状态(已修改) 模型 + * 作画中,头像正下方 + */ + public static class MGDGPainting implements Serializable { + // true: 绘画中,false: 取消绘画 + public boolean isPainting; + } + + /** + * 3. 显示错误答案状态(已修改) + */ + public static final String MG_DG_ERRORANSWER = "mg_dg_erroranswer"; + + /** + * 3. 显示错误答案状态(已修改) 模型 + * 错误的答案,最多6中文,头像正下方 + */ + public static class MGDGErroranswer implements Serializable { + // 字符串类型,展示错误答案 + public String msg; + } + + /** + * 4. 显示总积分状态(已修改) + */ + public static final String MG_DG_TOTALSCORE = "mg_dg_totalscore"; + + /** + * 4. 显示总积分状态(已修改) 模型 + * 总积分,位于头像右上角 + */ + public static class MGDGTotalscore implements Serializable { + // 字符串类型 总积分 + public String msg; + } + + /** + * 5. 本次获得积分状态(已修改) + */ + public static final String MG_DG_SCORE = "mg_dg_score"; + + /** + * 5. 本次获得积分状态(已修改) 模型 + * 本次积分,头像正下方 + */ + public static final class MGDGScore implements Serializable { + // string类型,展示本次获得积分 + public String msg; + } + + // endregion 你画我猜 + + // region 元宇宙砂砂舞 + /** + * 1. 元宇宙砂砂舞指令回调 + */ + public static final String MG_COMMON_GAME_DISCO_ACTION = "mg_common_game_disco_action"; + + /** + * 1. 元宇宙砂砂舞指令回调 模型 + * app指令请求游戏客户端成功与否的回调 + */ + public static final class MGCommonGameDiscoAction implements Serializable { + public int actionId; // 指令序号类型 + public boolean isSuccess; // true 指令成功,false 指令失败 + } + + /** + * 2. 元宇宙砂砂舞指令动作结束通知 + */ + public static final String MG_COMMON_GAME_DISCO_ACTION_END = "mg_common_game_disco_action_end"; + + /** + * 2. 元宇宙砂砂舞指令动作结束通知 模型 + * 游戏客户端通知APP指令动作结束 + */ + public static final class MGCommonGameDiscoActionEnd implements Serializable { + public int actionId; // 指令序号类型 + public String playerId; // // 玩家ID string 类型 + } + // endregion 元宇宙砂砂舞 + + // region 定制火箭 + /** + * 1. 礼物配置文件(火箭) + */ + public static final String MG_CUSTOM_ROCKET_CONFIG = "mg_custom_rocket_config"; + + /** + * 1. 礼物配置文件(火箭) 模型 + */ + public static final class MGCustomRocketConfig implements Serializable { + } + + /** + * 2. 拥有模型列表(火箭) + */ + public static final String MG_CUSTOM_ROCKET_MODEL_LIST = "mg_custom_rocket_model_list"; + + /** + * 2. 拥有模型列表(火箭) 模型 + */ + public static final class MGCustomRocketModelList implements Serializable { + } + + /** + * 3. 拥有组件列表(火箭) + */ + public static final String MG_CUSTOM_ROCKET_COMPONENT_LIST = "mg_custom_rocket_component_list"; + + /** + * 3. 拥有组件列表(火箭) 模型 + */ + public static final class MGCustomRocketComponentList implements Serializable { + } + + /** + * 4. 获取用户信息(火箭) + */ + public static final String MG_CUSTOM_ROCKET_USER_INFO = "mg_custom_rocket_user_info"; + + /** + * 4. 获取用户信息 模型 + */ + public static final class MGCustomRocketUserInfo implements Serializable { + public List userIdList; + } + + /** + * 5. 订单记录列表(火箭) + */ + public static final String MG_CUSTOM_ROCKET_ORDER_RECORD_LIST = "mg_custom_rocket_order_record_list"; + + /** + * 5. 订单记录列表(火箭) 模型 + */ + public static final class MGCustomRocketOrderRecordList implements Serializable { + public int pageIndex; // 第几页 + public int pageSize; // 每页多少条数据 + } + + /** + * 6. 展馆内列表(火箭) + */ + public static final String MG_CUSTOM_ROCKET_ROOM_RECORD_LIST = "mg_custom_rocket_room_record_list"; + + /** + * 6. 展馆内列表(火箭) 模型 + */ + public static final class MGCustomRocketRoomRecordList implements Serializable { + public int pageIndex; // 第几页 + public int pageSize; // 每页多少条数据 + } + + /** + * 7. 展馆内玩家送出记录(火箭) + */ + public static final String MG_CUSTOM_ROCKET_USER_RECORD_LIST = "mg_custom_rocket_user_record_list"; + + /** + * 7. 展馆内玩家送出记录(火箭) 模型 + */ + public static final class MGCustomRocketUserRecordList implements Serializable { + public String userId; // 用户id + public int pageIndex; // 第几页 + public int pageSize; // 每页多少条数据 + } + + /** + * 8. 设置默认模型(火箭) + */ + public static final String MG_CUSTOM_ROCKET_SET_DEFAULT_MODEL = "mg_custom_rocket_set_default_model"; + + /** + * 8. 设置默认模型(火箭) 模型 + */ + public static final class MGCustomRocketSetDefaultModel implements Serializable { + public String modelId; // 默认模型 + } + + /** + * 9. 动态计算一键发送价格(火箭) + */ + public static final String MG_CUSTOM_ROCKET_DYNAMIC_FIRE_PRICE = "mg_custom_rocket_dynamic_fire_price"; + + /** + * 9. 动态计算一键发送价格(火箭) 模型 + */ + public static final class MGCustomRocketDynamicFirePrice implements Serializable { + public List componentList; // 组件列表 + + public static class ComponentModel { + public String itemId; // 已购买的唯一标识 + } + } + + /** + * 10. 一键发送(火箭) + */ + public static final String MG_CUSTOM_ROCKET_FIRE_MODEL = "mg_custom_rocket_fire_model"; + + /** + * 10. 一键发送(火箭) 模型 + */ + public static final class MGCustomRocketFireModel implements Serializable { + public List componentList; // 组件列表 + + public static class ComponentModel { + public int type; // 类型 + public String itemId; // 已购买的唯一标识 + } + } + + /** + * 11. 新组装模型(火箭) + */ + public static final String MG_CUSTOM_ROCKET_CREATE_MODEL = "mg_custom_rocket_create_model"; + + /** + * 11. 新组装模型(火箭) 模型 + */ + public static final class MGCustomRocketCreateModel implements Serializable { + public List componentList; // 组件列表 + + public static class ComponentModel { + public String itemId; // 模型Id + } + } + + /** + * 12. 模型更换组件(火箭) + */ + public static final String MG_CUSTOM_ROCKET_REPLACE_COMPONENT = "mg_custom_rocket_replace_component"; + + /** + * 12. 模型更换组件(火箭) 模型 + */ + public static final class MGCustomRocketReplaceComponent implements Serializable { + public String modelId; // 模型ID + public List componentList; // 组件列表 + + public static class ComponentModel { + public String itemId; // 已购买的唯一标识 + } + } + + /** + * 13. 购买组件(火箭) + */ + public static final String MG_CUSTOM_ROCKET_BUY_COMPONENT = "mg_custom_rocket_buy_component"; + + /** + * 13. 购买组件(火箭) 模型 + */ + public static final class MGCustomRocketBuyComponent implements Serializable { + public List componentList; // 组件列表 + + public static class ComponentModel { + public String componentId; // 已购买的唯一标识 + public String value; // 值 + } + } + + /** + * 14. 播放效果开始(火箭) + */ + public static final String MG_CUSTOM_ROCKET_PLAY_EFFECT_START = "mg_custom_rocket_play_effect_start"; + + /** + * 14. 播放效果开始(火箭) 模型 + */ + public static final class MGCustomRocketPlayEffectStart implements Serializable { + } + + /** + * 15. 播放效果完成(火箭) + */ + public static final String MG_CUSTOM_ROCKET_PLAY_EFFECT_FINISH = "mg_custom_rocket_play_effect_finish"; + + /** + * 15. 播放效果完成(火箭) 模型 + */ + public static final class MGCustomRocketPlayEffectFinish implements Serializable { + } + + /** + * 16. 验证签名合规(火箭) + */ + public static final String MG_CUSTOM_ROCKET_VERIFY_SIGN = "mg_custom_rocket_verify_sign"; + + /** + * 16. 验证签名合规(火箭) 模型 + */ + public static final class MGCustomRocketVerifySign implements Serializable { + public String sign; // 验证的内容 + } + + /** + * 17. 上传icon(火箭) + */ + public static final String MG_CUSTOM_ROCKET_UPLOAD_MODEL_ICON = "mg_custom_rocket_upload_model_icon"; + + /** + * 17. 上传icon(火箭) 模型 + */ + public static final class MGCustomRocketUploadModelIcon implements Serializable { + public String data; // 图片base64数据 + } + + /** + * 18. 前期准备完成(火箭) + * 表示app此时可以向火箭发出指令了 + */ + public static final String MG_CUSTOM_ROCKET_PREPARE_FINISH = "mg_custom_rocket_prepare_finish"; + + /** + * 18. 前期准备完成(火箭) 模型 + */ + public static final class MGCustomRocketPrepareFinish implements Serializable { + } + + /** + * 19. 火箭主界面已显示(火箭) + */ + public static final String MG_CUSTOM_ROCKET_SHOW_GAME_SCENE = "mg_custom_rocket_show_game_scene"; + + /** + * 19. 火箭主界面已显示(火箭) 模型 + */ + public static final class MGCustomRocketShowGameScene implements Serializable { + } + + /** + * 20. 火箭主界面已隐藏(火箭) + */ + public static final String MG_CUSTOM_ROCKET_HIDE_GAME_SCENE = "mg_custom_rocket_hide_game_scene"; + + /** + * 20. 火箭主界面已隐藏(火箭) 模型 + */ + public static final class MGCustomRocketHideGameScene implements Serializable { + } + + /** + * 21. 点击锁住组件(火箭) + */ + public static final String MG_CUSTOM_ROCKET_CLICK_LOCK_COMPONENT = "mg_custom_rocket_click_lock_component"; + + /** + * 21. 点击锁住组件(火箭) 模型 + */ + public static final class MGCustomRocketClickLockComponent implements Serializable { + public int type; // 组件类型 + public String componentId; // 组件ID + } + + /** + * 22. 火箭效果飞行点击(火箭) + */ + public static final String MG_CUSTOM_ROCKET_FLY_CLICK = "mg_custom_rocket_fly_click"; + + /** + * 22. 火箭效果飞行点击(火箭) 模型 + */ + public static final class MGCustomRocketFlyClick implements Serializable { + } + + /** + * 23. 火箭效果飞行结束(火箭) + */ + public static final String MG_CUSTOM_ROCKET_FLY_END = "mg_custom_rocket_fly_end"; + + /** + * 23. 火箭效果飞行结束(火箭) 模型 + */ + public static final class MGCustomRocketFlyEnd implements Serializable { + public long clickNumber; // 点击多少次 + public long flyNumber; // 飞行多远 + } + + /** + * 24. 设置点击区域(火箭) + */ + public static final String MG_CUSTOM_ROCKET_SET_CLICK_RECT = "mg_custom_rocket_set_click_rect"; + + /** + * 24. 设置点击区域(火箭) 模型 + */ + public static final class MGCustomRocketSetClickRect implements Serializable { + public List list; // 游戏的点击区域 + } + + /** + * 25. 颜色和签名自定义改到装配间的模式,保存颜色或签名 + */ + public static final String MG_CUSTOM_ROCKET_SAVE_SIGN_COLOR = "mg_custom_rocket_save_sign_color"; + + /** + * 25. 颜色和签名自定义改到装配间的模式,保存颜色或签名 模型 + */ + public static final class MGCustomRocketSaveSignColor implements Serializable { + public List componentList; + + public static class ComponentModel { + public String componentId; // 组件的ID + public String value; // 颜色值,采用十六进制 + public String modelId; // 模型id (更新模型时使用) + } + } + // endregion 定制火箭 + + // region 棒球 + /** + * 1. 查询排行榜数据(棒球) + * 游戏客户端通知APP查询排行榜数据 + */ + public static final String MG_BASEBALL_RANKING = "mg_baseball_ranking"; + + /** + * 1. 查询排行榜数据(棒球) 模型 + */ + public static final class MGBaseballRanking implements Serializable { + public int page; // 页数 + public int size; // 每页显示的数量 + } + + /** + * 2. 查询我的排名(棒球) + * 游戏客户端通知APP查询我的排名 + */ + public static final String MG_BASEBALL_MY_RANKING = "mg_baseball_my_ranking"; + + /** + * 2. 查询我的排名(棒球) 模型 + */ + public static final class MGBaseballMyRanking implements Serializable { + } + + /** + * 3. 查询当前距离我的前后玩家数据(棒球) + * 游戏客户端通知APP查询当前距离我的前后玩家数据(需要排除自己) + */ + public static final String MG_BASEBALL_RANGE_INFO = "mg_baseball_range_info"; + + /** + * 3. 查询当前距离我的前后玩家数据(棒球) 模型 + */ + public static final class MGBaseballRangeInfo implements Serializable { + public long distance; // 自己当前的距离 + } + + /** + * 4. 设置app提供给游戏可点击区域(棒球) + * 游戏客户端通知APP指令动作设置点击区域 + */ + public static final String MG_BASEBALL_SET_CLICK_RECT = "mg_baseball_set_click_rect"; + + /** + * 4. 设置app提供给游戏可点击区域(棒球) 模型 + */ + public static final class MGBaseballSetClickRect implements Serializable { + public List list; + } + + /** + * 5. 前期准备完成(棒球) + * 游戏客户端通知APP指令动作前期准备完成 + */ + public static final String MG_BASEBALL_PREPARE_FINISH = "mg_baseball_prepare_finish"; + + /** + * 5. 前期准备完成(棒球) 模型 + */ + public static final class MGBaseballPrepareFinish implements Serializable { + } + + /** + * 6. 主界面已显示(棒球) + * 游戏客户端通知APP指令动作主界面已显示 + */ + public static final String MG_BASEBALL_SHOW_GAME_SCENE = "mg_baseball_show_game_scene"; + + /** + * 6. 主界面已显示(棒球) 模型 + */ + public static final class MGBaseballShowGameScene implements Serializable { + } + + /** + * 7. 主界面已隐藏(棒球) + * 游戏客户端通知APP指令动作主界面已隐藏 + */ + public static final String MG_BASEBALL_HIDE_GAME_SCENE = "mg_baseball_hide_game_scene"; + + /** + * 7. 主界面已隐藏(棒球) 模型 + */ + public static final class MGBaseballHideGameScene implements Serializable { + } + + /** + * 8. 获取文本配置数据(棒球) + */ + public static final String MG_BASEBALL_TEXT_CONFIG = "mg_baseball_text_config"; + + /** + * 8. 获取文本配置数据(棒球) 模型 + */ + public static final class MGBaseballTextConfig implements Serializable { + } + // endregion 棒球 + + /** 点击区域定义 */ + public static class InteractionClickRect { + public float x; // 区域的x + public float y; // 区域的y + public float width; // 区域的width + public float height; // 区域的height + } + +} diff --git a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java index 1a42452e7..01ec230f9 100644 --- a/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/GiftCacheUtil.java @@ -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() { - @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() { + @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; } diff --git a/common/src/main/java/com/yunbao/common/utils/ISudFSMStateHandleUtils.java b/common/src/main/java/com/yunbao/common/utils/ISudFSMStateHandleUtils.java new file mode 100644 index 000000000..581607d77 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/ISudFSMStateHandleUtils.java @@ -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)); + } + +} diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index 7597fec8b..689914400 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -4,6 +4,7 @@ import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; import android.app.Activity; +import android.app.Dialog; import android.os.Handler; import android.os.Looper; import android.view.View; @@ -17,13 +18,16 @@ import com.alibaba.fastjson.JSONObject; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.ReportCommunityBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.bean.VideoBean; import com.yunbao.common.bean.VideoListBean; import com.yunbao.common.event.JavascriptInterfaceEvent; +import com.yunbao.common.event.LiveRoomChangeEvent; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.IMLoginManager; @@ -129,10 +133,10 @@ public class JavascriptInterfaceUtils { url = CommonAppConfig.HOST + url; if (url.contains("?")) { url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } else { url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } if (LiveZhuangBana) { RouteUtil.forwardLiveZhuangBanActivity(url, false); @@ -152,10 +156,10 @@ public class JavascriptInterfaceUtils { url = CommonAppConfig.HOST + url; if (url.contains("?")) { url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } else { url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" - + CommonAppConfig.getInstance().getToken(); + + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); } if (LiveZhuangBana) { RouteUtil.forwardLiveZhuangBanActivity(url, title); @@ -262,6 +266,49 @@ public class JavascriptInterfaceUtils { } + /** + * 跳转直播并打开礼物栏选中礼物 + * @param liveId 直播间id + * @param giftId 礼物id + */ + @JavascriptInterface + public void androidMethodLookToLiveGift(String liveId,String giftId){ + LiveHttpUtil.getLiveInfo(liveId, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + + if (liveBean == null) { + return; + } + liveBean.setGiftId(giftId); + new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + + if (!"".endsWith(Constants.mStream)) { + + if (MicStatusManager.getInstance().isMic(liveUid)) { + MicStatusManager.getInstance().showDownMicDialog(mContext); + return; + } + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, Integer.parseInt(liveTypeVal)).setLiveEnd(true)); + } else { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveTypeVal), Integer.parseInt(liveSdk)); + } + androidGoBack(); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } + } + }); + } @JavascriptInterface public void androidMethodLookToLive(String liveId) { Bus.get().post(new JavascriptInterfaceEvent() @@ -562,32 +609,28 @@ public class JavascriptInterfaceUtils { Bus.get().post(new JavascriptInterfaceEvent() .setMethod("clickLogOffAccount")); } - @JavascriptInterface - public void androidFansGroupBuy(String id) { + public void androidFansGroupBuy(String id){ Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidFansGroupBuy").setUserId(id)); } - @JavascriptInterface - public void androidFansGroupPack() { + public void androidFansGroupPack(){ Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidFansGroupPack")); } - @JavascriptInterface - public void androidFansGroupInfo() { + public void androidFansGroupInfo(){ Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidFansGroupInfo")); } @JavascriptInterface - public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl, int isAnchor) { - RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0, isAnchor == 1); + public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl,int isAnchor ) { + RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0,isAnchor==1); } - @JavascriptInterface - public void wearOrCancelFanMedal() { + public void wearOrCancelFanMedal(){ HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo") .params("uid", IMLoginManager.get(mContext).getUserInfo().getId()) .params("token", IMLoginManager.get(mContext).getUserInfo().getToken()) @@ -603,12 +646,26 @@ public class JavascriptInterfaceUtils { } }); } - @JavascriptInterface - public void androidCancelAnchorAttention() { + public void androidCancelAnchorAttention(){ Bus.get().post(new JavascriptInterfaceEvent() .setMethod("androidCancelAnchorAttention")); } + @JavascriptInterface + public void androidLnsufficientBalanceClick(String msg){ + DialogUitl.showSimpleDialog(mContext, msg, new DialogUitl.SimpleCallback2() { + @Override + public void onCancelClick() { + + } + + @Override + public void onConfirmClick(Dialog dialog, String content) { + dialog.dismiss(); + ARouter.getInstance().build(PATH_COIN).withInt("p", 0).navigation(); + } + }); + } @JavascriptInterface public void androidCallChat(String targetId) { diff --git a/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java b/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java index 78ee85a88..66c3043ed 100644 --- a/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java +++ b/common/src/main/java/com/yunbao/common/utils/MicStatusManager.java @@ -134,7 +134,11 @@ public class MicStatusManager { new Handler(Looper.getMainLooper()).post(new Runnable() { public void run() { MicStatusManager.getInstance().clear(); - ToastUtil.show("已成功退出語音連麥"); + if(WordUtil.isNewZh()) { + ToastUtil.show("已成功退出語音連麥"); + }else{ + ToastUtil.show("You have successfully exited the voice connection"); + } } }); } @@ -193,7 +197,11 @@ public class MicStatusManager { * 显示退出连麦状态对话框 */ public void showDownMicDialog(Context context) { - DialogUitl.showSimpleDialog(context, "當前正在連麥中", new DialogUitl.SimpleCallback() { + String content="當前正在連麥中"; + if(!WordUtil.isNewZh()){ + content="Currently connecting the wheat"; + } + DialogUitl.showSimpleDialog(context, content, new DialogUitl.SimpleCallback() { @Override public void onConfirmClick(Dialog dialog, String content) { // downMic(); //不做下麦跳转 diff --git a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java index afe0208c3..a1ec0f2c7 100644 --- a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -30,7 +30,7 @@ public class NobleUtil { case 1:return "男爵"; case 2:return "子爵"; case 3:return "侯爵"; - case 4:return "公爵"; + case 4:return "公爵"; case 5:return "国王"; case 6:return "皇帝"; case 7:return "超皇"; @@ -39,15 +39,15 @@ public class NobleUtil { } public static String nobleIdToStringNameForEn(int id){ switch (id){ - case 1:return "baron"; - case 2:return "viscount"; - case 3:return "marquis"; - case 4:return "duke"; - case 5:return "king"; - case 6:return "emperor"; - case 7:return "SuperEmperor"; + case 1:return "Baron"; + case 2:return "Viscount"; + case 3:return "Marquis"; + case 4:return "Duke"; + case 5:return "King"; + case 6:return "Emperor"; + case 7:return "SuperKing"; } - return "Not Opened"; + return "Not opened"; } public static int getNobleBackgroundId(int id){ switch (id){ diff --git a/common/src/main/java/com/yunbao/common/utils/PluginManager.java b/common/src/main/java/com/yunbao/common/utils/PluginManager.java index 395dbee7c..17e723687 100644 --- a/common/src/main/java/com/yunbao/common/utils/PluginManager.java +++ b/common/src/main/java/com/yunbao/common/utils/PluginManager.java @@ -49,17 +49,17 @@ public class PluginManager { } public boolean isDownloadApk() { - if(!CommonAppConfig.IS_PLUGIN_MODEL){ + if (!CommonAppConfig.IS_PLUGIN_MODEL) { return true; } - return new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk").exists(); + return new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").exists(); } /** * 加载主播插件 */ public void loadAnchorPlugin(DialogInterface.OnDismissListener dismissListener) { - if(!CommonAppConfig.IS_PLUGIN_MODEL){ + if (!CommonAppConfig.IS_PLUGIN_MODEL) { dismissListener.onDismiss(null); return; } @@ -73,7 +73,8 @@ public class PluginManager { e.printStackTrace(); } File sdk = new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk"); - if (!sdk.exists()) { + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").exists() || !sdk.exists()) { + Log.i(TAG, "loadAnchorPlugin: 插件未下载"); if (StringUtil.isEmpty(anchorPluginDownloadUrl)) { Log.e(TAG, "主播下载地址为空"); return; @@ -97,8 +98,12 @@ public class PluginManager { * @param outDir 解压路径 */ private void loadFaceSo(File plugin, String outDir) { - if(!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin"+File.separator+"lib").exists()) { - unzip(plugin.getAbsolutePath(), outDir, ".so"); + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").exists()) { + Log.i(TAG, "loadFaceSo: lib插件未解压"); + if (unzip(plugin.getAbsolutePath(), outDir, ".so")) { + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").mkdirs(); + Log.i(TAG, "loadFaceSo: lib插件解压"); + } } String[] abis = Build.SUPPORTED_ABIS; String abi = Arrays.asList(abis).contains("arm64-v8a") ? "arm64-v8a" : "armeabi-v7a"; @@ -108,8 +113,8 @@ public class PluginManager { try { Field field = Class.forName("com.faceunity.wrapper.faceunity$LoadConfig").getDeclaredField("sLoadedLibrary"); field.setAccessible(true); - field.set(null,true); - }catch (Exception e){ + field.set(null, true); + } catch (Exception e) { e.printStackTrace(); } } @@ -121,8 +126,12 @@ public class PluginManager { * @param outDir 解压路径 */ private void loadFaceBundle(File plugin, String outDir) { - if(!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin"+File.separator+"assets").exists()) { - unzip(plugin.getAbsolutePath(), outDir, ".bundle"); + if (!new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").exists()) { + Log.i(TAG, "loadFaceBundle: bundle未解压"); + if (unzip(plugin.getAbsolutePath(), outDir, ".bundle")) { + Log.i(TAG, "loadFaceBundle: bundle解压"); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").mkdirs(); + } } try { Object BUNDLE_AI_FACE = Class.forName("com.yunbao.faceunity.utils.FURenderer").getField("BUNDLE_AI_FACE").get(null); @@ -131,6 +140,7 @@ public class PluginManager { Class.forName("com.yunbao.faceunity.utils.FaceUnityConfig").getField("BUNDLE_FACE_BEAUTIFICATION").set(null, outDir + File.separator + "assets" + File.separator + BUNDLE_FACE_BEAUTIFICATION); } catch (Exception e) { e.printStackTrace(); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "assets.lock").delete(); } } @@ -143,10 +153,12 @@ public class PluginManager { private void loadSo(File dir, String file) { file += ".so"; if (new File(dir.getAbsolutePath() + File.separator + file).exists()) { + Log.d(TAG, "加载 " + dir.getAbsolutePath() + File.separator + file); System.load(dir + File.separator + file); Log.d(TAG, "加载成功 " + dir + File.separator + file); } else { Log.e(TAG, "不存在 " + dir + File.separator + file); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin" + File.separator + "lib.lock").delete(); } } @@ -159,6 +171,7 @@ public class PluginManager { @Override public void onSuccess(File file) { Log.d(TAG, "下载成功 " + file); + new File(CommonAppContext.sInstance.getFilesDir().getAbsolutePath() + File.separator + "plugin_download" + File.separator + "anchorPlugin.apk.lock").mkdirs(); loadAnchorPlugin(dismissListener); } @@ -169,7 +182,7 @@ public class PluginManager { @Override public void onError(Throwable e) { - + downloadAnchorSdk(dismissListener); } }); } @@ -186,13 +199,14 @@ public class PluginManager { FileOutputStream out; byte buffer[] = new byte[1024]; try { + Log.i(TAG, "unzip: " + outDir); ZipInputStream zis = new ZipInputStream(new FileInputStream(zip)); ZipEntry entry = zis.getNextEntry(); while (entry != null) { String name = entry.getName(); if (entry.isDirectory()) { File newDir = new File(outDir + entry.getName()); - newDir.mkdir(); + newDir.mkdirs(); } else if (name.endsWith(suffix)) { File outputFile = new File(outDir + File.separator + name); String outputPath = outputFile.getCanonicalPath(); @@ -205,7 +219,7 @@ public class PluginManager { outputFile = new File(outputPath, name); outputFile.createNewFile(); out = new FileOutputStream(outputFile); - + Log.i(TAG, "unzip: >>" + outputFile.getAbsolutePath()); int tmp = 0; while ((tmp = zis.read(buffer)) > 0) { out.write(buffer, 0, tmp); diff --git a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java index 686941ef4..b90d3c457 100644 --- a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java @@ -107,7 +107,7 @@ public class ProcessImageUtil extends ProcessResultUtil { @Override public void onFailure() { - ToastUtil.show(R.string.img_camera_cancel); + ToastUtil.show(mContext.getString(R.string.img_camera_cancel)); } }; mAlumbResultCallback = new ActivityResultCallback() { @@ -122,7 +122,7 @@ public class ProcessImageUtil extends ProcessResultUtil { @Override public void onFailure() { - ToastUtil.show(R.string.img_alumb_cancel); + ToastUtil.show(mContext.getString(R.string.img_alumb_cancel)); } }; mCropResultCallback = new ActivityResultCallback() { @@ -135,7 +135,7 @@ public class ProcessImageUtil extends ProcessResultUtil { @Override public void onFailure() { - ToastUtil.show(R.string.img_crop_cancel); + ToastUtil.show(mContext.getString(R.string.img_crop_cancel)); } }; } diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index 79eb53702..203f2448a 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -183,7 +183,7 @@ public class RouteUtil { * 跳转到充值页面 */ public static void forwardMyCoin(Context context) { - String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken(); + String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=Mall&a=zhifu&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : 0); ARouter.getInstance().build(PATH_COIN).withString("url", url).navigation(); } diff --git a/common/src/main/java/com/yunbao/common/utils/SudJsonUtils.java b/common/src/main/java/com/yunbao/common/utils/SudJsonUtils.java new file mode 100644 index 000000000..5cc790238 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/utils/SudJsonUtils.java @@ -0,0 +1,43 @@ +package com.yunbao.common.utils; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * json解析工具 + */ +public class SudJsonUtils { + + /** + * 解析json + * + * @return 如果解析出错,则返回空对象 + */ + public static T fromJson(final String json, final Class type) { + try { + return getGson().fromJson(json, type); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 对象解析成json + * + * @param object + * @return + */ + public static String toJson(final Object object) { + return getGson().toJson(object); + } + + public static Gson getGson() { + return InnerClass.gson; + } + + public static class InnerClass { + public static Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + } + +} diff --git a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java index d2240037d..e0808c4af 100644 --- a/common/src/main/java/com/yunbao/common/utils/ToastUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ToastUtil.java @@ -1,5 +1,6 @@ package com.yunbao.common.utils; +import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.graphics.Color; @@ -59,11 +60,19 @@ public class ToastUtil { /** * 显示黑底白字的提示 * - * @param content 内容 + * @param content 内容 * @param delayMillis 显示时间 毫秒 */ public static void showStyle(String content, long delayMillis) { - Dialog dialog = new Dialog(CommonAppContext.getTopActivity(), R.style.dialog); + Context context = CommonAppContext.getTopActivity(); + if (context == null) { + context = CommonAppContext.sInstance; + } + if (context == null) { + return; + } + + Dialog dialog = new Dialog(context, R.style.dialog); dialog.setContentView(R.layout.dialog_toast); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); @@ -78,23 +87,27 @@ public class ToastUtil { dialog.show(); new Handler(Looper.getMainLooper()).postDelayed(dialog::dismiss, delayMillis); } - public static void showDebug(String s){ - if(BuildConfig.DEBUG){ - show("开发模式:"+s); + + public static void showDebug(String s) { + if (BuildConfig.DEBUG) { + show("开发模式:" + s); } } - public static void showDebug(int s){ - if(BuildConfig.DEBUG){ - show(s); + + public static void showDebug(int s) { + if (BuildConfig.DEBUG) { + show("开发模式:" + s); } } + public static void show(String s) { if (TextUtils.isEmpty(s)) { return; } - Log.i("ts","ll"); - Toast.makeText(CommonAppContext.sInstance,s,Toast.LENGTH_SHORT).show(); - Log.i("ts","22"); + Log.i("Toast", "Toast show: " + s); + Log.i("ts", "ll"); + Toast.makeText(CommonAppContext.sInstance, s, Toast.LENGTH_SHORT).show(); + Log.i("ts", "22"); // long curTime = System.currentTimeMillis(); // if (curTime - sLastTime > 2000) { diff --git a/common/src/main/java/com/yunbao/common/utils/WordUtil.java b/common/src/main/java/com/yunbao/common/utils/WordUtil.java index bbdea7e62..2c48546a4 100644 --- a/common/src/main/java/com/yunbao/common/utils/WordUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/WordUtil.java @@ -27,6 +27,16 @@ public class WordUtil { return sResources.getString(res); } + public static boolean isZh() { + Locale locale = sResources.getConfiguration().locale; + String language = locale.getLanguage(); + return language.endsWith("zh"); + } + + public static boolean isNewZh() { + return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE; + } + public static String getNewString(int res) { Configuration config = new Configuration(); Configuration tmp = sResources.getConfiguration(); @@ -37,14 +47,6 @@ public class WordUtil { sResources.updateConfiguration(tmp, sResources.getDisplayMetrics()); return str; } - public static boolean isZh() { - Locale locale = sResources.getConfiguration().locale; - String language = locale.getLanguage(); - return language.endsWith("zh"); - } - public static boolean isNewZh(){ - return IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE || IMLoginManager.get(CommonAppContext.sInstance).getLocaleLanguage() == Locale.TRADITIONAL_CHINESE; - } /** * 是否包含特殊字符 diff --git a/common/src/main/java/com/yunbao/common/utils/WordsTypeUtil.java b/common/src/main/java/com/yunbao/common/utils/WordsTypeUtil.java index 0598af1c0..3ba779675 100644 --- a/common/src/main/java/com/yunbao/common/utils/WordsTypeUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/WordsTypeUtil.java @@ -36,23 +36,22 @@ public class WordsTypeUtil { /** * @param {*} num - * @returns ---汉字 - */ + * @returns ---汉字 */ // 转换数字为大写 public static String numberConvertToUppercase(int number) { String[] upperCaseNumber = {"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"}; int length = String.valueOf(number).length(); if (length == 1) { - return upperCaseNumber[number]; + return WordUtil.isNewZh() ? upperCaseNumber[number] : String.valueOf(number); } else if (length == 2) { if (number == 10) { - return upperCaseNumber[number]; + return WordUtil.isNewZh() ? upperCaseNumber[number] : String.valueOf(number); } else if (number > 10 && number < 20) { - return upperCaseNumber[10] + upperCaseNumber[number - 10]; + return WordUtil.isNewZh() ? upperCaseNumber[10] : "1" + (WordUtil.isNewZh() ? upperCaseNumber[number - 10] : String.valueOf(number - 10)); } else { int num1 = number / 10; int num2 = number - (num1 * 10); - return upperCaseNumber[num1] + upperCaseNumber[10] + upperCaseNumber[num2]; + return (WordUtil.isNewZh() ? upperCaseNumber[num1] : String.valueOf(num1)) + (WordUtil.isNewZh() ? upperCaseNumber[10] : "") + (WordUtil.isNewZh() ? upperCaseNumber[num2] : String.valueOf(num2)); } } else { return String.valueOf(number); diff --git a/common/src/main/java/com/yunbao/common/views/AvatarListViewHolder.java b/common/src/main/java/com/yunbao/common/views/AvatarListViewHolder.java new file mode 100644 index 000000000..0ee10c6c6 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/AvatarListViewHolder.java @@ -0,0 +1,24 @@ +package com.yunbao.common.views; + +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.R; +import com.yunbao.common.bean.playerObject; +import com.yunbao.common.glide.ImgLoader; + +public class AvatarListViewHolder extends RecyclerView.ViewHolder { + private RoundedImageView mAvatar; + + public AvatarListViewHolder(@NonNull View itemView) { + super(itemView); + mAvatar = itemView.findViewById(R.id.avatar); + } + + public void setData(playerObject model) { + ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java index 232ea3a6c..9ad0e8686 100644 --- a/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java +++ b/common/src/main/java/com/yunbao/common/views/CustomDrawerPopupView.java @@ -13,6 +13,7 @@ import com.lxj.xpopup.enums.PopupPosition; import com.yunbao.common.R; import com.yunbao.common.adapter.CustomDrawerPopupAdapter; import com.yunbao.common.bean.AnchorRecommendItemModel; +import com.yunbao.common.bean.CustomSidebarChildModel; import com.yunbao.common.bean.CustomSidebarInfoModel; import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.http.live.LiveNetManager; @@ -170,7 +171,7 @@ public class CustomDrawerPopupView extends DrawerPopupView { adapter.updateData(data); } else { LiveNetManager.get(mContext) - .getCustomSidebarInfo(new com.yunbao.common.http.base.HttpCallback>() { + .getCustomSidebarInfo("0", new com.yunbao.common.http.base.HttpCallback>() { @Override public void onSuccess(List data) { adapter.updateData(data); @@ -178,7 +179,7 @@ public class CustomDrawerPopupView extends DrawerPopupView { @Override public void onError(String error) { - ToastUtil.show(R.string.net_error); + ToastUtil.show(mContext.getString(R.string.net_error)); } }); } @@ -221,6 +222,8 @@ public class CustomDrawerPopupView extends DrawerPopupView { void share(); void changeFontSize(); + + void interaction(long interactionID, List child); } @Subscribe(threadMode = ThreadMode.MAIN) @@ -263,10 +266,13 @@ public class CustomDrawerPopupView extends DrawerPopupView { dismiss(); callBack.changeVideo(); } - if(event.isFontSize()){ + if (event.isFontSize()) { dismiss(); callBack.changeFontSize(); } + if (event.isInteraction()) { + callBack.interaction(event.getInteractionID(), event.getChild()); + } } if (event.isRefresh()) { diff --git a/common/src/main/java/com/yunbao/common/views/DrawerRecommendChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerRecommendChildViewHolder.java index 147ec1713..ae47a973d 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerRecommendChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerRecommendChildViewHolder.java @@ -17,6 +17,7 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; @@ -48,7 +49,8 @@ public class DrawerRecommendChildViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) .append("/") @@ -56,7 +58,8 @@ public class DrawerRecommendChildViewHolder extends RecyclerView.ViewHolder { .append("?uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } Bus.get().post(new CustomDrawerPopupEvent() .setDisMiss(true) diff --git a/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java index 38d2389e4..fdaa31287 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerRecommendViewHolder.java @@ -17,6 +17,7 @@ import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; /** @@ -56,7 +57,8 @@ public class DrawerRecommendViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) .append("/") @@ -64,7 +66,8 @@ public class DrawerRecommendViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } Bus.get().post(new CustomDrawerPopupEvent() diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java index af7e22b5f..da952ddfe 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskChildViewHolder.java @@ -19,6 +19,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.weight.ViewClicksAntiShake; public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { @@ -110,7 +111,7 @@ public class DrawerTaskChildViewHolder extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show(R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } else { diff --git a/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java b/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java index b0f69758b..17715b42c 100644 --- a/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/DrawerTaskViewHolder.java @@ -17,6 +17,7 @@ import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; /** @@ -61,7 +62,8 @@ public class DrawerTaskViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) .append("/") @@ -69,7 +71,8 @@ public class DrawerTaskViewHolder extends RecyclerView.ViewHolder { .append("?uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); }//资料 Bus.get().post(new CustomDrawerPopupEvent() .setDisMiss(true) diff --git a/main/src/main/java/com/yunbao/main/views/FlowLayout.java b/common/src/main/java/com/yunbao/common/views/FlowLayout.java similarity index 99% rename from main/src/main/java/com/yunbao/main/views/FlowLayout.java rename to common/src/main/java/com/yunbao/common/views/FlowLayout.java index c6e348b20..faa58fa62 100644 --- a/main/src/main/java/com/yunbao/main/views/FlowLayout.java +++ b/common/src/main/java/com/yunbao/common/views/FlowLayout.java @@ -1,4 +1,4 @@ -package com.yunbao.main.views; +package com.yunbao.common.views; import android.content.Context; import android.graphics.Rect; diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java index e7bef052d..13023f15c 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesChildViewHolder.java @@ -16,6 +16,7 @@ import com.yunbao.common.event.CustomDrawerPopupEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { @@ -58,7 +59,8 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) .append("/") @@ -66,7 +68,8 @@ public class FunGamesChildViewHolder extends RecyclerView.ViewHolder { .append("?uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } Bus.get().post(new CustomDrawerPopupEvent() .setHtmlUrl(htmlUrl.toString()) diff --git a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java index 9534274c4..e24ddd2db 100644 --- a/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/FunGamesViewHolder.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.umeng.analytics.MobclickAgent; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.adapter.FunGamesAdapter; @@ -20,9 +21,12 @@ import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class FunGamesViewHolder extends RecyclerView.ViewHolder { private FunGamesAdapter funGamesAdapter; @@ -66,7 +70,8 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder { .append("&uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } else { htmlUrl.append(CommonAppConfig.HOST) .append("/") @@ -74,8 +79,10 @@ public class FunGamesViewHolder extends RecyclerView.ViewHolder { .append("?uid=") .append(userInfo.getId()) .append("&token=") - .append(userInfo.getToken()); + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); } + Bus.get().post(new CustomDrawerPopupEvent() .setDisMiss(true) .setHtmlUrl(htmlUrl.toString()) diff --git a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java index 80b31e916..4aa99edb4 100644 --- a/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/InputCustomPopup.java @@ -14,6 +14,7 @@ import com.lxj.xpopup.animator.PopupAnimator; import com.lxj.xpopup.core.CenterPopupView; import com.yunbao.common.R; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; /** @@ -85,7 +86,7 @@ public class InputCustomPopup extends CenterPopupView { public void onViewClicks() { String textContent = content.getText().toString(); if (TextUtils.isEmpty(textContent)) { - ToastUtil.show("输入内容不可为空"); + ToastUtil.show(WordUtil.isNewZh()?"输入内容不可为空":"The input cannot be empty"); return; } if (listener != null) { diff --git a/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java new file mode 100644 index 000000000..8d1dde931 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/InteractionGamesChildViewHolder.java @@ -0,0 +1,63 @@ +package com.yunbao.common.views; + +import android.text.TextUtils; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +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.glide.ImgLoader; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class InteractionGamesChildViewHolder extends RecyclerView.ViewHolder { + private ImageView funGamePic; + private TextView funGameName; + + public InteractionGamesChildViewHolder(@NonNull View itemView) { + super(itemView); + funGamePic = itemView.findViewById(R.id.fun_game_pic); + funGameName = itemView.findViewById(R.id.fun_game_name); + } + + public void setData(CustomSidebarChildModel model, boolean rigts) { + if (rigts) { + ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); + } else { + ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); + } + + + funGameName.setText(model.getTitle()); + if (!TextUtils.isEmpty(model.getSudGameIsNew())||TextUtils.equals(model.getSudGameIsNew(),"1")){ + itemView.findViewById(R.id.icon_new_game).setVisibility(View.VISIBLE); + }else { + itemView.findViewById(R.id.icon_new_game).setVisibility(View.GONE); + } + ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (interactionGamesCallBack != null) { + interactionGamesCallBack.onItemViewClicks(model, rigts); + } + + + } + }); + } + + private InteractionGamesCallBack interactionGamesCallBack; + + public void setItemViewClicks(InteractionGamesCallBack callBack) { + interactionGamesCallBack = callBack; + } + + public interface InteractionGamesCallBack { + void onItemViewClicks(CustomSidebarChildModel model, boolean rigts); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/InteractionGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/InteractionGamesViewHolder.java new file mode 100644 index 000000000..b8f4ca34e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/InteractionGamesViewHolder.java @@ -0,0 +1,63 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.adapter.InteractionGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.util.List; + +public class InteractionGamesViewHolder extends RecyclerView.ViewHolder { + private InteractionGamesAdapter funGamesAdapter; + private TextView sendGoodGift, selectMore; + private RecyclerView childList; + private ImageView selectMoreIcon; + boolean isShowMore = true; + + public InteractionGamesViewHolder(@NonNull View itemView) { + super(itemView); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + selectMoreIcon = itemView.findViewById(R.id.select_more_icon); + selectMore = itemView.findViewById(R.id.select_more); + funGamesAdapter = new InteractionGamesAdapter(itemView.getContext(), true); + childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); + childList.setAdapter(funGamesAdapter); + + } + + public void setData(CustomSidebarInfoModel model) { + List sidebarChildModels = model.getChild(); + itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE); + sendGoodGift.setText(model.getTitle()); + funGamesAdapter.updateData(sidebarChildModels); + + ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.select_more_layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (isShowMore) { + funGamesAdapter.selectAll(sidebarChildModels); + + selectMore.setText(R.string.video_comment_collapsed); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_up, selectMoreIcon); + } else { + funGamesAdapter.updateData(sidebarChildModels); + selectMore.setText(R.string.moer); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_down, selectMoreIcon); + } + isShowMore = !isShowMore; + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java index 15e9c34c4..8e35daaf9 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveAnchorMessageCustomPopup.java @@ -13,6 +13,7 @@ import com.yunbao.common.bean.ListInfoMessageModel; 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 com.yunbao.common.views.weight.OnRecyclerViewScrollListener; import java.util.List; @@ -68,7 +69,7 @@ public class LiveAnchorMessageCustomPopup extends BottomPopupView { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveClarityCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveClarityCustomPopup.java index f4ed86164..d4df1c650 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveClarityCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveClarityCustomPopup.java @@ -116,9 +116,9 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl ViewClicksAntiShake.clicksAntiShake(lineHd, () -> { if (lineHd.getTag() != null) { if (isUser) {//用户端 - ToastUtil.show(R.string.live_user_ban_hd); + ToastUtil.show(getContext().getString(R.string.live_user_ban_hd)); } else {//主播端 - ToastUtil.show(R.string.function_is_suspended); + ToastUtil.show(getContext().getString(R.string.function_is_suspended)); } return; } @@ -151,9 +151,9 @@ public class LiveClarityCustomPopup extends BottomPopupView implements View.OnCl ViewClicksAntiShake.clicksAntiShake(lineFhd, () -> { if (lineFhd.getTag() != null) { if (isUser) {//用户端 - ToastUtil.show(R.string.live_user_ban_fhd); + ToastUtil.show(getContext().getString(R.string.live_user_ban_fhd)); } else {//主播端 - ToastUtil.show(R.string.function_is_suspended); + ToastUtil.show(getContext().getString(R.string.function_is_suspended)); } return; } diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewRoleFunGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveNewRoleFunGamesViewHolder.java new file mode 100644 index 000000000..731ff761e --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveNewRoleFunGamesViewHolder.java @@ -0,0 +1,65 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.adapter.NewRoleFunGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.util.List; + +public class LiveNewRoleFunGamesViewHolder extends RecyclerView.ViewHolder { + private NewRoleFunGamesAdapter funGamesAdapter; + private TextView sendGoodGift, selectMore; + private RecyclerView childList; + private ImageView selectMoreIcon; + boolean isShowMore = true; + + public LiveNewRoleFunGamesViewHolder(@NonNull View itemView) { + super(itemView); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + selectMoreIcon = itemView.findViewById(R.id.select_more_icon); + selectMore = itemView.findViewById(R.id.select_more); + funGamesAdapter = new NewRoleFunGamesAdapter(itemView.getContext(),true); + childList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.HORIZONTAL, false)); + childList.setAdapter(funGamesAdapter); + + } + + public void setData(CustomSidebarInfoModel model) { + + List sidebarChildModels = model.getChild(); + itemView.findViewById(R.id.select_more_layout).setVisibility(sidebarChildModels.size() >= 8 ? View.VISIBLE : View.GONE); + sendGoodGift.setText(model.getTitle()); + funGamesAdapter.updateData(sidebarChildModels); + + ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.select_more_layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (isShowMore) { + funGamesAdapter.selectAll(sidebarChildModels); + + selectMore.setText(R.string.video_comment_collapsed); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_up, selectMoreIcon); + } else { + funGamesAdapter.updateData(sidebarChildModels); + selectMore.setText(R.string.moer); + ImgLoader.display(itemView.getContext(), R.mipmap.icon_more_down, selectMoreIcon); + } + isShowMore = !isShowMore; + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java new file mode 100644 index 000000000..98380e2f6 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveNewRoleInteractionGamesViewHolder.java @@ -0,0 +1,44 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.InteractionGamesAdapter; +import com.yunbao.common.adapter.LiveNewRoleInteractionGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; + +import java.util.List; + +public class LiveNewRoleInteractionGamesViewHolder extends RecyclerView.ViewHolder { + private LiveNewRoleInteractionGamesAdapter funGamesAdapter; + private TextView sendGoodGift; + private RecyclerView childList; + private ImageView selectMoreIcon; + boolean isShowMore = true; + + public LiveNewRoleInteractionGamesViewHolder(@NonNull View itemView) { + super(itemView); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + selectMoreIcon = itemView.findViewById(R.id.select_more_icon); + funGamesAdapter = new LiveNewRoleInteractionGamesAdapter(itemView.getContext(), true); + childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); + childList.setAdapter(funGamesAdapter); + + } + + public void setData(CustomSidebarInfoModel model) { + List sidebarChildModels = model.getChild(); + sendGoodGift.setText(model.getTitle()); + funGamesAdapter.updateData(sidebarChildModels); + + + } +} diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java b/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java new file mode 100644 index 000000000..43d54460a --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveNewRoleRigtsInterestsViewHolder.java @@ -0,0 +1,56 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.adapter.FunGamesAdapter; +import com.yunbao.common.adapter.LiveNewRoleFunGamesAdapter; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.CustomSidebarInfoModel; + +import java.util.ArrayList; +import java.util.List; + +public class LiveNewRoleRigtsInterestsViewHolder extends RecyclerView.ViewHolder { + private LiveNewRoleFunGamesAdapter funGamesAdapter; + private TextView sendGoodGift; + private RecyclerView childList; + private boolean showRed = false; + public LiveNewRoleRigtsInterestsViewHolder(@NonNull View itemView,boolean showRed) { + super(itemView); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + sendGoodGift = itemView.findViewById(R.id.send_good_gift); + childList = itemView.findViewById(R.id.child_list); + funGamesAdapter = new LiveNewRoleFunGamesAdapter(itemView.getContext(), false,showRed); + childList.setLayoutManager(new GridLayoutManager(itemView.getContext(), 4)); + childList.setAdapter(funGamesAdapter); + } + + public void setData(CustomSidebarInfoModel model) { + + sendGoodGift.setText(model.getTitle()); + funGamesAdapter.updateData(generateData()); + } + + private List generateData() { + List child = new ArrayList<>(); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.noble)) + .setResIcon(R.mipmap.live_more_icon_aristocrat)); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.guard_guard)) + .setResIcon(R.mipmap.live_more_icon_guard)); + child.add(new CustomSidebarChildModel() + .setTitle(itemView.getContext().getString(R.string.fan_club)) + .setResIcon(R.mipmap.live_more_icon_fans)); + return child; + + } +} + diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewWishGiftPopup.java b/common/src/main/java/com/yunbao/common/views/LiveNewWishGiftPopup.java index 56d53dc8f..f8cc6bb8c 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewWishGiftPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewWishGiftPopup.java @@ -2,6 +2,7 @@ package com.yunbao.common.views; import android.graphics.Color; import android.util.Log; +import android.util.TypedValue; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -28,6 +29,7 @@ import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; @@ -88,7 +90,7 @@ public class LiveNewWishGiftPopup extends BottomPopupView { for (int i = 0; i < 3; i++) { TextView wishItem = (TextView) LayoutInflater.from(getContext()) .inflate(R.layout.view_tablaout_wish_item, null, false); - + wishItem.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); switch (i) { case 0: wishItem.setText(R.string.live_gift); @@ -112,7 +114,7 @@ public class LiveNewWishGiftPopup extends BottomPopupView { View tab = tabs.getChildAt(i); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) tab.getLayoutParams(); layoutParams.setMarginEnd(DpUtil.dp2px(4)); - layoutParams.width = DpUtil.dp2px(58); + layoutParams.width = DpUtil.dp2px(90); tab.setLayoutParams(layoutParams); wishTab.requestLayout(); } @@ -165,7 +167,7 @@ public class LiveNewWishGiftPopup extends BottomPopupView { @Override public void onError(String error) { - ToastUtil.show(R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java index 4ca74750f..b0f409204 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java @@ -32,6 +32,7 @@ import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import org.greenrobot.eventbus.Subscribe; @@ -201,7 +202,7 @@ public class LiveNewWishListPopup extends BottomPopupView { ViewList.add(zhouXinFragment); ViewList.add(lunarWishFragment); ViewList.add(seasonalWishFragment); - if (TextUtils.equals(ct, "zh")) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { wishListTop.setBackgroundResource(R.drawable.wish_list_day_zh); } else { wishListTop.setBackgroundResource(R.drawable.wish_list_day_en); @@ -253,7 +254,7 @@ public class LiveNewWishListPopup extends BottomPopupView { type = tab.getId() + 1; switch (type) { case 1: - if (TextUtils.equals(ct, "zh")) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { wishListTop.setBackgroundResource(R.drawable.wish_list_day_zh); } else { wishListTop.setBackgroundResource(R.drawable.wish_list_day_en); @@ -261,7 +262,7 @@ public class LiveNewWishListPopup extends BottomPopupView { replacementWish.setText(R.string.replacement_wish_day); break; case 2: - if (TextUtils.equals(ct, "zh")) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { wishListTop.setBackgroundResource(R.drawable.wish_list_week_zh); } else { wishListTop.setBackgroundResource(R.drawable.wish_list_week_en); @@ -269,7 +270,7 @@ public class LiveNewWishListPopup extends BottomPopupView { replacementWish.setText(R.string.replacement_wish_zhou); break; case 3: - if (TextUtils.equals(ct, "zh")) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { wishListTop.setBackgroundResource(R.drawable.wish_list_lunar_zh); } else { wishListTop.setBackgroundResource(R.drawable.wish_list_lunar_en); @@ -277,7 +278,7 @@ public class LiveNewWishListPopup extends BottomPopupView { replacementWish.setText(R.string.replacement_wish_lunar); break; case 4: - if (TextUtils.equals(ct, "zh")) { + if (IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { wishListTop.setBackgroundResource(R.drawable.wish_list_seasonal_zh); } else { wishListTop.setBackgroundResource(R.drawable.wish_list_seasonal_en); @@ -325,19 +326,19 @@ public class LiveNewWishListPopup extends BottomPopupView { List wishList2 = new ArrayList<>(); Gson gson = new Gson(); if (wishList2.size()>10){ - ToastUtil.show(R.string.must_hint); + ToastUtil.show(mContext.getString(R.string.must_hint)); return; } LiveNetManager.get(getContext()). setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @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"); } }); })) diff --git a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java index 02ea18b27..bc86b844d 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveOpenCustomPopup.java @@ -6,6 +6,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import com.lxj.xpopup.core.CenterPopupView; +import com.yunbao.common.Constants; import com.yunbao.common.R; import com.yunbao.common.bean.LiveClassBean; import com.yunbao.common.bean.LiveRoomTypeBean; @@ -14,6 +15,7 @@ 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.ToastUtil; +import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; public class LiveOpenCustomPopup extends CenterPopupView { @@ -36,7 +38,12 @@ public class LiveOpenCustomPopup extends CenterPopupView { public LiveOpenCustomPopup setLiveRoomTypeBean(LiveRoomTypeBean liveRoomTypeBean) { this.liveRoomTypeBean = liveRoomTypeBean; - textLiveRoomType.setText(liveRoomTypeBean.getName()); + if (liveRoomTypeBean.getId()== Constants.LIVE_TYPE_PWD){ + textLiveRoomType.setText(WordUtil.isNewZh() ? "密碼房" : "password room"); + }else { + textLiveRoomType.setText(liveRoomTypeBean.getName()); + } + return this; } @@ -73,7 +80,11 @@ public class LiveOpenCustomPopup extends CenterPopupView { textLiveClass.setText(classBean.getName()); } if (liveRoomTypeBean != null) { - textLiveRoomType.setText(liveRoomTypeBean.getName()); + if (liveRoomTypeBean.getId()== Constants.LIVE_TYPE_PWD){ + textLiveRoomType.setText(WordUtil.isNewZh() ? "密碼房" : "password room"); + }else { + textLiveRoomType.setText(liveRoomTypeBean.getName()); + } } setSelectClarity(selectClarity); //關閉彈窗 @@ -184,7 +195,7 @@ public class LiveOpenCustomPopup extends CenterPopupView { @Override public void onError(String error) { - ToastUtil.show(R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java index ea727fba8..d82157fd1 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotMessageCustomPopup.java @@ -24,6 +24,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 org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -130,7 +131,7 @@ public class LiveRobotMessageCustomPopup extends BottomPopupView { } }); } else { - ToastUtil.show(R.string.robot_minimum_interval); + ToastUtil.show(getContext().getString(R.string.robot_minimum_interval)); } @@ -181,7 +182,7 @@ public class LiveRobotMessageCustomPopup extends BottomPopupView { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java index eeef5348b..4356f38b2 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSayHelloCustomPopup.java @@ -19,6 +19,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 org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -125,7 +126,7 @@ public class LiveRobotSayHelloCustomPopup extends BottomPopupView { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java index be5d489f2..d777f6ca0 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveRobotSettingCustomPopup.java @@ -22,6 +22,7 @@ import com.yunbao.common.bean.LiveAiRobotBean; 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; public class LiveRobotSettingCustomPopup extends BottomPopupView implements View.OnClickListener { private static String TAG = "AI机器人"; @@ -251,7 +252,7 @@ public class LiveRobotSettingCustomPopup extends BottomPopupView implements View @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); diff --git a/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java new file mode 100644 index 000000000..237fb0490 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/LiveSudGamePopup.java @@ -0,0 +1,211 @@ +package com.yunbao.common.views; + +import android.app.Activity; +import android.content.Context; +import android.view.View; +import android.widget.FrameLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.lifecycle.Observer; + +import com.lxj.xpopup.XPopup; +import com.lxj.xpopup.core.BottomPopupView; +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.event.HideShowEvent; +import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; +import com.yunbao.common.event.ShowHideEvent; +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.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.Locale; + +/** + * sub半屏游戏弹窗 + */ +public class LiveSudGamePopup extends BottomPopupView { + 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; + + public LiveSudGamePopup(@NonNull Context context, long interactionID, String liveUid) { + super(context); + mInteractionID = interactionID; + mLiveUid = liveUid; + } + + public LiveSudGamePopup(@NonNull Context context, CreateSudRoomModel createSudRoomModel) { + super(context); + mCreateSudRoomModel = createSudRoomModel; + mInteractionID = mCreateSudRoomModel.getLongSudGameId(); + mLiveUid = mCreateSudRoomModel.getSudGameRoomId(); + IMLoginManager.get(context).setSudGame(""); + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dialog_live_sud_game; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + Bus.getOn(this); + initView(); + initDate(); + + } + + private void initView() { + 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(getContext(), mCreateSudRoomModel.getAvatar(), mAvatar); + } + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.exit), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + gameViewModel.onDestroy(); + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2)); + } + }); + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (IMLoginManager.get(getContext()).getSudGameMin()) { + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(1)); + Bus.get().post(new ShowHideEvent()); + } else { + IMLoginManager.get(getContext()).setSudGameMin(); + new XPopup.Builder(getContext()) + .asCustom(new HintCustomPopup(getContext(), + getContext().getString(R.string.dialog_tip), + getContext().getString(R.string.currently_in_the_game)) + .setLiveOpenOk(getContext().getString(R.string.sud_in_game_minimize)) + .setLiveOpenCancel(getContext().getString(R.string.cancel)) + .setCallBack(new HintCustomPopup.HintCustomCallBack() { + @Override + public void onSure() { + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(1)); + Bus.get().post(new ShowHideEvent()); + } + + @Override + public void onCancel() { + + + } + })).show(); + } + + + } + }); + gameViewModel.gameViewLiveData.observe(this, new Observer() { + @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_game_setting.hide = true; // 配置不隐藏ping值 + + gameConfigModel.ui.lobby_players.custom = true; + gameConfigModel.ui.join_btn.custom = true; + // SudMGP平台64bit游戏ID + gameViewModel.switchGame((Activity) getContext(), mLiveUid, mInteractionID); + } + + private void initDate() { + + } + public void BusGetOff(){ + Bus.getOff(this); + } + @Override + public void dismiss() { + + super.dismiss(); + } + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onHideShow(HideShowEvent event) { + if (event.isClose()) { + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(2)); + } else { + if (event.isHide()) { + findViewById(R.id.min_game).setVisibility(GONE); + } + + } + + } + + @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(getContext()).checkRemainingBalance(mCreateSudRoomModel.getSudGameRoomId(), new HttpCallback() { + @Override + public void onSuccess(CheckRemainingBalance data) { + if (data.getGoldenBeanRemainingBalance() == 1) { + gameViewModel.sudFSTAPPDecorator.notifyAPPCommonSelfIn(true, event.getSeatIndex(), true, 1); + } else { + if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("金豆不够 "); + } else { + ToastUtil.show("Insufficient money "); + } + + } + } + + @Override + public void onError(String error) { + if (IMLoginManager.get(getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("金豆不够 "); + } else { + ToastUtil.show("Insufficient money "); + } + } + }); + } + + } +} diff --git a/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java new file mode 100644 index 000000000..3a6b460ad --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/NewRoleFunGamesChildViewHolder.java @@ -0,0 +1,98 @@ +package com.yunbao.common.views; + +import android.text.TextUtils; +import android.util.Log; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.R; +import com.yunbao.common.bean.CustomSidebarChildModel; +import com.yunbao.common.bean.IMLoginModel; +import com.yunbao.common.event.LiveNewRoleEvent; +import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class NewRoleFunGamesChildViewHolder extends RecyclerView.ViewHolder { + private ImageView funGamePic; + private TextView funGameName; + private View red_point; + private boolean showRed = false; + + public NewRoleFunGamesChildViewHolder(@NonNull View itemView, boolean showRed) { + super(itemView); + this.showRed = showRed; + funGamePic = itemView.findViewById(R.id.fun_game_pic); + funGameName = itemView.findViewById(R.id.fun_game_name); + red_point = itemView.findViewById(R.id.red_point); + } + + public void setData(CustomSidebarChildModel model, boolean rigts) { + if (rigts) { + ImgLoader.display(itemView.getContext(), model.getIcon(), funGamePic); + } else { + ImgLoader.display(itemView.getContext(), model.getResIcon(), funGamePic); + } + Log.e("GamesChildViewHolder", "model.getTitle::::::::::" + model.getTitle()); + Log.e("GamesChildViewHolder", "itemView.getContext().getString::::::::::" + model.getTitle()); + Log.e("GamesChildViewHolder", "showRed::::::::::" + showRed); + if (TextUtils.equals(model.getTitle(), itemView.getContext().getString(R.string.fan_club))) { + red_point.setVisibility(showRed ? View.VISIBLE : View.GONE); + } + + funGameName.setText(model.getTitle()); + + ViewClicksAntiShake.clicksAntiShake(itemView, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (!rigts) { + Bus.get().post(new NewRoleCustomDrawerPopupEvent() + .setDisMiss(true).setRightsInterests(model.getTitle())); + } else { + int activityID = TextUtils.isEmpty(model.getActivityId()) ? 0 : Integer.parseInt(model.getActivityId()); + if (activityID != 0) { + Bus.get().post(new NewRoleCustomDrawerPopupEvent() + .setDisMiss(true).setActivityId(activityID)); + } else { + IMLoginModel userInfo = IMLoginManager.get(itemView.getContext()).getUserInfo(); + StringBuffer htmlUrl = new StringBuffer(); + if (model.getSrc().contains("?")) { + htmlUrl.append(CommonAppConfig.HOST).append("/").append(model.getSrc()) + .append("&uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); + } else { + htmlUrl.append(CommonAppConfig.HOST) + .append("/") + .append(model.getSrc()) + .append("?uid=") + .append(userInfo.getId()) + .append("&token=") + .append(userInfo.getToken()) .append("&isZh=") + .append(WordUtil.isNewZh() ? "1" : 0); + } + Bus.get().post(new NewRoleCustomDrawerPopupEvent() + .setHtmlUrl(htmlUrl.toString()) + .setDisMiss(true) + .setScreen(TextUtils.equals(model.getShowType(), "2"))); + + + } + } + + + Bus.get().post(new LiveNewRoleEvent()); + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java b/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java index 34eb112d9..36ce1e7f0 100644 --- a/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/RobotMessageViewHolder.java @@ -16,6 +16,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; public class RobotMessageViewHolder extends RecyclerView.ViewHolder { @@ -44,7 +45,7 @@ public class RobotMessageViewHolder extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java b/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java index 2b2951c06..199118d50 100644 --- a/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java +++ b/common/src/main/java/com/yunbao/common/views/RobotSayHelloViewHoler.java @@ -16,6 +16,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; public class RobotSayHelloViewHoler extends RecyclerView.ViewHolder { private TextView serialNumber, messageText; @@ -44,7 +45,7 @@ public class RobotSayHelloViewHoler extends RecyclerView.ViewHolder { @Override public void onError(String error) { - ToastUtil.show( R.string.net_error); + ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred"); } }); } diff --git a/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java new file mode 100644 index 000000000..11252d5eb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/SudGameListViewHolder.java @@ -0,0 +1,181 @@ +package com.yunbao.common.views; + +import android.content.Intent; +import android.os.Handler; +import android.text.TextUtils; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.alibaba.fastjson.JSON; +import com.google.gson.Gson; +import com.lxj.xpopup.XPopup; +import com.makeramen.roundedimageview.RoundedImageView; +import com.yunbao.common.R; +import com.yunbao.common.activity.SudGameActivity; +import com.yunbao.common.bean.CreateSudRoomModel; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.SudRoomListModel; +import com.yunbao.common.event.LiveOpenSudRoomEvent; +import com.yunbao.common.event.LiveSudGamePopupShowOrHideEvent; +import com.yunbao.common.event.SudGameListDissMissEvent; +import com.yunbao.common.event.SudGameListRefreshEvent; +import com.yunbao.common.glide.ImgLoader; +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.LiveRoomCheckLivePresenter; +import com.yunbao.common.utils.RouteUtil; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +import java.util.Locale; + +public class SudGameListViewHolder extends RecyclerView.ViewHolder { + private RoundedImageView mAvatar; + private TextView roomName, playerWeAre, playerWeAre2, goldenBeanNumber; + private RoundedImageView avatarList1, avatarList2, avatarList3, avatarList4, avatarList5; + private ImageView gifImageView; + private ImageView sex, game_icon; + + + public SudGameListViewHolder(@NonNull View itemView) { + super(itemView); + mAvatar = itemView.findViewById(R.id.avatar); + roomName = itemView.findViewById(R.id.room_name); + playerWeAre = itemView.findViewById(R.id.player_we_are); + playerWeAre2 = itemView.findViewById(R.id.player_we_are_2); + game_icon = itemView.findViewById(R.id.game_icon); + goldenBeanNumber = itemView.findViewById(R.id.golden_bean_number); + gifImageView = itemView.findViewById(R.id.btn_live); + avatarList1 = itemView.findViewById(R.id.avatar_list1); + avatarList2 = itemView.findViewById(R.id.avatar_list2); + avatarList3 = itemView.findViewById(R.id.avatar_list3); + avatarList4 = itemView.findViewById(R.id.avatar_list4); + avatarList5 = itemView.findViewById(R.id.avatar_list5); + sex = itemView.findViewById(R.id.sex); + avatarList1.setVisibility(View.GONE); + avatarList2.setVisibility(View.GONE); + avatarList3.setVisibility(View.GONE); + avatarList4.setVisibility(View.GONE); + avatarList5.setVisibility(View.GONE); + } + + public void setData(SudRoomListModel model, boolean isHome) { + ImgLoader.display(itemView.getContext(), model.getAvatar(), mAvatar); + roomName.setText(model.getRoomName()); + playerWeAre.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are), model.getPlayerTotal())); + playerWeAre2.setText(String.format(itemView.getContext().getString(R.string.interactive_game_player_we_are_2), model.getTotal())); + goldenBeanNumber.setText(model.getGoldenBeanNumber()); + gifImageView.setVisibility(TextUtils.equals(model.getLiveUid(), "0") ? View.GONE : View.VISIBLE); + if (TextUtils.equals(model.getSex(), "1")) { + ImgLoader.display(itemView.getContext(), R.mipmap.icon_sex_man, sex); + } else if (TextUtils.equals(model.getSex(), "2")) { + ImgLoader.display(itemView.getContext(), R.mipmap.icon_sex_woman, sex); + } + ImgLoader.display(itemView.getContext(), model.getSudgameicon(), game_icon); + ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.layout), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + LiveNetManager.get(itemView.getContext()).checkRoomStatus(model.getId(), new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(CreateSudRoomModel data) { + if (TextUtils.equals(data.getRoomStatus(), "0")) { + if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + ToastUtil.show("房间不存在"); + } else { + ToastUtil.show("The room does not exist"); + } + Bus.get().post(new SudGameListRefreshEvent()); + } else { + CreateSudRoomModel createSudRoomModel = new CreateSudRoomModel(); + createSudRoomModel.setSudGameId(model.getSudGameId()); + createSudRoomModel.setSudGameRoomId(model.getSudGameRoomId()); + createSudRoomModel.setAvatar(model.getAvatar()); + createSudRoomModel.setRoomName(model.getRoomName()); + createSudRoomModel.setSudGameName(model.getSudGameName()); + if (isHome) { + if (TextUtils.equals(model.getLiveUid(), "0")) { + Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); + intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); + itemView.getContext().startActivity(intent); + } else { + String yes = "是"; + if (IMLoginManager.get(itemView.getContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) { + yes = "是"; + } else { + yes = "Yes"; + } + new XPopup.Builder(itemView.getContext()) + .asCustom(new HintCustomPopup(itemView.getContext(), + itemView.getContext().getString(R.string.interactive_game_search_room_currently_live), + itemView.getContext().getString(R.string.interactive_game_search_room_broadcast_room)) + .setLiveOpenOk(yes) + .setLiveOpenCancel(itemView.getContext().getString(R.string.interactive_game_search_room_bhe_game)) + .setCallBack(new HintCustomPopup.HintCustomCallBack() { + @Override + public void onSure() { + LiveHttpUtil.getLiveInfo(model.getLiveUid() + "", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + new LiveRoomCheckLivePresenter(itemView.getContext(), liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() { + @Override + public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) { + RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal)); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + Bus.get().post(new LiveOpenSudRoomEvent().setCreateSudRoomModel(createSudRoomModel)); + } + },1500); + } + + @Override + public void onCheckError(String contextError) { + + } + }); + } else { + RouteUtil.forwardUserHome(itemView.getContext(), model.getLiveUid(), 0); + } + } + }); + } + + @Override + public void onCancel() { + + Intent intent = new Intent(itemView.getContext(), SudGameActivity.class); + intent.putExtra("CreateSudRoom", new Gson().toJson(createSudRoomModel)); + itemView.getContext().startActivity(intent); + } + })).show(); + + } + + } else { + + Bus.get().post(new LiveSudGamePopupShowOrHideEvent().setType(0).setCreateSudRoomModel(createSudRoomModel)); + Bus.get().post(new SudGameListDissMissEvent()); + } + } + } + + @Override + public void onError(String error) { + ToastUtil.show(error); + } + }); + + + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/SudHint.java b/common/src/main/java/com/yunbao/common/views/SudHint.java new file mode 100644 index 000000000..4e471849b --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/SudHint.java @@ -0,0 +1,36 @@ +package com.yunbao.common.views; + +import android.content.Context; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import com.lxj.xpopup.core.BottomPopupView; +import com.yunbao.common.R; +import com.yunbao.common.utils.WordUtil; + +public class SudHint extends BottomPopupView { + private String sudGameRoomName; + private TextView sud_text_name; + + public SudHint(@NonNull Context context, String sudGameRoomName) { + super(context); + this.sudGameRoomName = sudGameRoomName; + } + + // 返回自定义弹窗的布局 + @Override + protected int getImplLayoutId() { + return R.layout.dialog_sud_hint; + } + + // 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑 + @Override + protected void onCreate() { + super.onCreate(); + sud_text_name = findViewById(R.id.sud_text_name); + sud_text_name.setText(WordUtil.isNewZh()? + String.format("主播创建了【%s】房间,快来与主播同玩~",sudGameRoomName): + String.format("The anchor has created a 【%s】 room. Come and play with the anchor~",sudGameRoomName)); + } +} diff --git a/common/src/main/java/com/yunbao/common/views/SudTitleSelectViewHolder.java b/common/src/main/java/com/yunbao/common/views/SudTitleSelectViewHolder.java new file mode 100644 index 000000000..e5a02af94 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/views/SudTitleSelectViewHolder.java @@ -0,0 +1,35 @@ +package com.yunbao.common.views; + +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import com.yunbao.common.R; +import com.yunbao.common.views.weight.ViewClicksAntiShake; + +public class SudTitleSelectViewHolder extends RecyclerView.ViewHolder { + private TextView title; + + public SudTitleSelectViewHolder(@NonNull View itemView) { + super(itemView); + title = itemView.findViewById(R.id.select_title); + } + + public void setData(String titleStr, boolean select, int position,SudTitleSelectListener listener) { + title.setText(titleStr); + title.setSelected(select); + ViewClicksAntiShake.clicksAntiShake(title, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (listener!=null){ + listener.onSudTitleSelectCallBack(position); + } + } + }); + } + public interface SudTitleSelectListener { + void onSudTitleSelectCallBack(int index); + } +} diff --git a/common/src/main/res/drawable/background_live_sud_hint.png b/common/src/main/res/drawable/background_live_sud_hint.png new file mode 100644 index 000000000..9b11c5af2 Binary files /dev/null and b/common/src/main/res/drawable/background_live_sud_hint.png differ diff --git a/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml b/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml index ee73ee2f4..f3698b385 100644 --- a/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml +++ b/common/src/main/res/drawable/bg_anchor_mic_info_btn_invite.xml @@ -1,9 +1,15 @@ - + - + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_home_search_input.xml b/common/src/main/res/drawable/bg_home_search_input.xml new file mode 100644 index 000000000..b4b9326fb --- /dev/null +++ b/common/src/main/res/drawable/bg_home_search_input.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_home_search_not.xml b/common/src/main/res/drawable/bg_home_search_not.xml new file mode 100644 index 000000000..cfea71ab5 --- /dev/null +++ b/common/src/main/res/drawable/bg_home_search_not.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_home_sud_list_btn.xml b/common/src/main/res/drawable/bg_home_sud_list_btn.xml new file mode 100644 index 000000000..1a215bf24 --- /dev/null +++ b/common/src/main/res/drawable/bg_home_sud_list_btn.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_home_sud_list_sill.xml b/common/src/main/res/drawable/bg_home_sud_list_sill.xml new file mode 100644 index 000000000..89348f16a --- /dev/null +++ b/common/src/main/res/drawable/bg_home_sud_list_sill.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_item_home_search_history.xml b/common/src/main/res/drawable/bg_item_home_search_history.xml new file mode 100644 index 000000000..491c6fce0 --- /dev/null +++ b/common/src/main/res/drawable/bg_item_home_search_history.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_item_search_history.xml b/common/src/main/res/drawable/bg_item_search_history.xml new file mode 100644 index 000000000..a38fb93ab --- /dev/null +++ b/common/src/main/res/drawable/bg_item_search_history.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_game_back.xml b/common/src/main/res/drawable/bg_live_sud_game_back.xml new file mode 100644 index 000000000..c6d1aa167 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_game_back.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_game_top.xml b/common/src/main/res/drawable/bg_live_sud_game_top.xml new file mode 100644 index 000000000..4c5e37c35 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_game_top.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_hint.xml b/common/src/main/res/drawable/bg_live_sud_hint.xml new file mode 100644 index 000000000..29964763f --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_hint.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list.xml b/common/src/main/res/drawable/bg_live_sud_list.xml new file mode 100644 index 000000000..4216aa85c --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_btn.xml b/common/src/main/res/drawable/bg_live_sud_list_btn.xml new file mode 100644 index 000000000..716846250 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_btn.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_input.xml b/common/src/main/res/drawable/bg_live_sud_list_input.xml new file mode 100644 index 000000000..5a7b6214a --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_input.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_input_home.xml b/common/src/main/res/drawable/bg_live_sud_list_input_home.xml new file mode 100644 index 000000000..e5080b3ae --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_input_home.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_select.xml b/common/src/main/res/drawable/bg_live_sud_list_select.xml new file mode 100644 index 000000000..1b4692bf2 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_select.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_select_item.xml b/common/src/main/res/drawable/bg_live_sud_list_select_item.xml new file mode 100644 index 000000000..f81e534a3 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_select_item.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/bg_live_sud_list_sill.xml b/common/src/main/res/drawable/bg_live_sud_list_sill.xml new file mode 100644 index 000000000..23aedc744 --- /dev/null +++ b/common/src/main/res/drawable/bg_live_sud_list_sill.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/activity_sud_game.xml b/common/src/main/res/layout/activity_sud_game.xml new file mode 100644 index 000000000..bc192ae65 --- /dev/null +++ b/common/src/main/res/layout/activity_sud_game.xml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_create_sud_game.xml b/common/src/main/res/layout/dialog_create_sud_game.xml new file mode 100644 index 000000000..fa9eccf57 --- /dev/null +++ b/common/src/main/res/layout/dialog_create_sud_game.xml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_home_create_sud_game.xml b/common/src/main/res/layout/dialog_home_create_sud_game.xml new file mode 100644 index 000000000..32344e052 --- /dev/null +++ b/common/src/main/res/layout/dialog_home_create_sud_game.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_home_search_sud_game.xml b/common/src/main/res/layout/dialog_home_search_sud_game.xml new file mode 100644 index 000000000..50a8d0fe9 --- /dev/null +++ b/common/src/main/res/layout/dialog_home_search_sud_game.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_gift_popup.xml b/common/src/main/res/layout/dialog_live_gift_popup.xml index 05b18ba17..6f8b320be 100644 --- a/common/src/main/res/layout/dialog_live_gift_popup.xml +++ b/common/src/main/res/layout/dialog_live_gift_popup.xml @@ -6,77 +6,194 @@ android:layout_gravity="bottom" android:orientation="vertical"> - - - - - - - - - - - + android:layout_height="0dp" + android:layout_weight="1"> + + + + + + + + + + + + + + + + + + + + + + + + + + + android:src="@drawable/backgroud_custom_gift2" + app:riv_corner_radius_bottom_left="0dp" + app:riv_corner_radius_bottom_right="0dp" + app:riv_corner_radius_top_left="10dp" + app:riv_corner_radius_top_right="10dp" /> + + android:layout_height="wrap_content" + android:layout_marginTop="5dp" + android:animateLayoutChanges="true"> - + - + + + + + + + + + + + + + + + - - - - - - - - - - - - + android:id="@+id/btn_luck_gift_tip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="5dp"> + + - + + + + android:id="@+id/diamond_linear" + android:layout_width="wrap_content" + android:layout_height="32dp" + android:background="@drawable/background_gift_money" + android:gravity="center_vertical" + android:paddingStart="4dp" + android:paddingTop="7dp" + android:paddingBottom="7dp"> - + - + + + + + + + + + + + + + + + + + + + + + + android:text="@string/live_gift_send" + android:textColor="@color/white" + android:textSize="14sp" /> + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_height="196dp" + android:layout_marginTop="12dp" /> - + + - + - - - - - - - + diff --git a/common/src/main/res/layout/dialog_live_mic_invite.xml b/common/src/main/res/layout/dialog_live_mic_invite.xml index 8da222dd4..6c94c267d 100644 --- a/common/src/main/res/layout/dialog_live_mic_invite.xml +++ b/common/src/main/res/layout/dialog_live_mic_invite.xml @@ -15,7 +15,7 @@ + + + + + + + + + + + + + diff --git a/common/src/main/res/layout/dialog_live_new_role.xml b/common/src/main/res/layout/dialog_live_new_role.xml new file mode 100644 index 000000000..64c5edb97 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_new_role.xml @@ -0,0 +1,14 @@ + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_new_wish_list.xml b/common/src/main/res/layout/dialog_live_new_wish_list.xml index f044c166a..5d6372c9a 100644 --- a/common/src/main/res/layout/dialog_live_new_wish_list.xml +++ b/common/src/main/res/layout/dialog_live_new_wish_list.xml @@ -10,7 +10,7 @@ android:id="@+id/wish_list_top" android:layout_width="match_parent" android:layout_height="160dp" - android:background="@drawable/wish_list_day_zh" + android:background="@drawable/wish_list_lunar_en" android:scaleType="fitCenter" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_open_bottom_ad.xml b/common/src/main/res/layout/dialog_open_bottom_ad.xml new file mode 100644 index 000000000..192f2d295 --- /dev/null +++ b/common/src/main/res/layout/dialog_open_bottom_ad.xml @@ -0,0 +1,29 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_open_center_ad.xml b/common/src/main/res/layout/dialog_open_center_ad.xml new file mode 100644 index 000000000..d32b5e485 --- /dev/null +++ b/common/src/main/res/layout/dialog_open_center_ad.xml @@ -0,0 +1,31 @@ + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_search_sud_game.xml b/common/src/main/res/layout/dialog_search_sud_game.xml new file mode 100644 index 000000000..3f0c6e5a3 --- /dev/null +++ b/common/src/main/res/layout/dialog_search_sud_game.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_sud_game_list.xml b/common/src/main/res/layout/dialog_sud_game_list.xml new file mode 100644 index 000000000..27b1b61cb --- /dev/null +++ b/common/src/main/res/layout/dialog_sud_game_list.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +