小遊戲修改

This commit is contained in:
18401019693 2023-10-24 15:46:47 +08:00
parent 993b09b853
commit 926de0463c
18 changed files with 279 additions and 46 deletions

View File

@ -0,0 +1,16 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class HideShowEvent extends BaseModel {
private boolean isClose = false;
public boolean isClose() {
return isClose;
}
public HideShowEvent setClose(boolean close) {
isClose = close;
return this;
}
}

View File

@ -0,0 +1,7 @@
package com.yunbao.common.event;
import com.yunbao.common.bean.BaseModel;
public class ShowHideEvent extends BaseModel {
}

View File

@ -61,6 +61,14 @@ public class IMLoginManager extends BaseCacheManager {
return !TextUtils.isEmpty(getString("RedPoint")) && !TextUtils.equals(getString("RedPoint"), "1");
}
public void setSudGameMin() {
put("SudGameMin", "1");
}
public boolean getSudGameMin() {
return !TextUtils.isEmpty(getString("SudGameMin")) && !TextUtils.equals(getString("SudGameMin"), "1");
}
public void setSudGame(String sudGameJson) {
put(KEY_GAME, sudGameJson);
}

View File

@ -9,12 +9,15 @@ 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.ShowHideEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
@ -92,6 +95,38 @@ public class LiveSudGamePopup extends BottomPopupView {
dialog.dismiss();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.min_game), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
if (IMLoginManager.get(getContext()).getSudGameMin()) {
dialog.hide();
Bus.get().post(new ShowHideEvent());
} else {
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() {
IMLoginManager.get(getContext()).setSudGameMin();
dialog.hide();
Bus.get().post(new ShowHideEvent());
}
@Override
public void onCancel() {
}
})).show();
}
}
});
gameViewModel.gameViewLiveData.observe(this, new Observer<View>() {
@Override
public void onChanged(View view) {
@ -126,6 +161,16 @@ public class LiveSudGamePopup extends BottomPopupView {
super.onDismiss();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onHideShow(HideShowEvent event) {
if (event.isClose()){
dialog.dismiss();
}else {
dialog.show();
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCheckRemainingBalanceEvent(CheckRemainingBalanceEvent event) {
if (event.getResults().size() > 0) {

View File

@ -28,11 +28,12 @@
android:layout_weight="1" />
<ImageView
android:visibility="gone"
android:id="@+id/min_game"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="16dp"
android:src="@mipmap/icon_interactive_game_create_room_seats" />
android:src="@mipmap/icon_min_game"
android:visibility="visible" />
<TextView
android:id="@+id/exit"
@ -66,9 +67,9 @@
android:id="@+id/avatar"
android:layout_width="35dp"
android:layout_height="35dp"
android:visibility="gone"
android:layout_marginStart="6dp"
android:scaleType="centerCrop"
android:visibility="gone"
app:riv_oval="true" />
<LinearLayout

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -1363,5 +1363,9 @@ Limited ride And limited avatar frame</string>
<string name="choose_a_prank_gift">Choose a prank gift</string>
<string name="choose_a_prank_gift_hint">Enter the prank content...</string>
<string name="choose_a_prank_gift_hint2">Input quantity</string>
<string name="sud_in_game">IN GAME</string>
<string name="currently_in_the_game">You are currently in the game, please return in a timely manner.\\nFailure to return for a long time will be considered a surrender.</string>
<string name="the_live_room">Exiting the live room will synchronize with exiting the game room.\\nDo you want to continue</string>
<string name="sud_in_game_minimize">minimize</string>
</resources>

View File

@ -1360,4 +1360,8 @@
<string name="choose_a_prank_gift">選擇整蠱禮物</string>
<string name="choose_a_prank_gift_hint">輸入整蠱內容...</string>
<string name="choose_a_prank_gift_hint2">输入数量</string>
<string name="sud_in_game">遊戲中</string>
<string name="currently_in_the_game">您正在遊戲中,請及時返回 長時間未返回將會視爲認輸哦</string>
<string name="the_live_room">退出直播間將會同步退出遊戲房間 是否继续</string>
<string name="sud_in_game_minimize">最小化</string>
</resources>

View File

@ -1359,4 +1359,8 @@
<string name="choose_a_prank_gift">選擇整蠱禮物</string>
<string name="choose_a_prank_gift_hint">輸入整蠱內容...</string>
<string name="choose_a_prank_gift_hint2">输入数量</string>
<string name="sud_in_game">遊戲中</string>
<string name="currently_in_the_game">您正在遊戲中,請及時返回 長時間未返回將會視爲認輸哦</string>
<string name="the_live_room">退出直播間將會同步退出遊戲房間 是否继续</string>
<string name="sud_in_game_minimize">最小化</string>
</resources>

View File

@ -1359,5 +1359,9 @@
<string name="choose_a_prank_gift">選擇整蠱禮物</string>
<string name="choose_a_prank_gift_hint">輸入整蠱內容...</string>
<string name="choose_a_prank_gift_hint2">输入数量</string>
<string name="sud_in_game">遊戲中</string>
<string name="currently_in_the_game">您正在遊戲中,請及時返回\n長時間未返回將會視爲認輸哦</string>
<string name="the_live_room">退出直播間將會同步退出遊戲房間\n是否继续</string>
<string name="sud_in_game_minimize">最小化</string>
</resources>

View File

@ -1366,4 +1366,8 @@ Limited ride And limited avatar frame</string>
<string name="choose_a_prank_gift">Choose a prank gift</string>
<string name="choose_a_prank_gift_hint">Enter the prank content...</string>
<string name="choose_a_prank_gift_hint2">Input quantity</string>
<string name="currently_in_the_game">You are currently in the game, please return in a timely manner.\\nFailure to return for a long time will be considered a surrender.</string>
<string name="the_live_room">Exiting the live room will synchronize with exiting the game room.\\nDo you want to continue</string>
<string name="sud_in_game">IN GAME</string>
<string name="sud_in_game_minimize">minimize</string>
</resources>

View File

@ -5,7 +5,7 @@ ext {
minSdkVersion : 21,
targetSdkVersion : 33,
versionCode : 453,
versionName : "6.6.0"
versionName : "6.6.6"
]
manifestPlaceholders = [
//

View File

@ -64,11 +64,13 @@ import com.yunbao.common.dialog.YoursystemisolderDialog;
import com.yunbao.common.event.CustomDrawerPopupEvent;
import com.yunbao.common.event.FollowEvent;
import com.yunbao.common.event.GiftWallIlluminateEvent;
import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.event.LiveErrorEvent;
import com.yunbao.common.event.LiveOpenSudRoomEvent;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.event.NewRoleCustomDrawerPopupEvent;
import com.yunbao.common.event.ShowHideEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil;
@ -95,6 +97,7 @@ import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.common.views.CustomDrawerPopupView;
import com.yunbao.common.views.HintCustomPopup;
import com.yunbao.common.views.floatingview.APPEasyFloat;
import com.yunbao.common.views.weight.VerticalViewPager;
import com.yunbao.live.R;
@ -562,22 +565,59 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void onBackPressed() {
MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间");
OpenAdManager.getInstance().dismiss();
try {
manager.onBackPressed();
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else {
manager.onRemove(true);
if (manager != null && manager.getsudGameMin()) {
new XPopup.Builder(mContext)
.asCustom(new HintCustomPopup(mContext,
mContext.getString(com.yunbao.common.R.string.dialog_tip),
mContext.getString(com.yunbao.common.R.string.the_live_room))
.setLiveOpenOk(mContext.getString(com.yunbao.common.R.string.confirm))
.setLiveOpenCancel(mContext.getString(com.yunbao.common.R.string.cancel))
.setCallBack(new HintCustomPopup.HintCustomCallBack() {
@Override
public void onSure() {
MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间");
OpenAdManager.getInstance().dismiss();
try {
manager.onBackPressed();
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else {
manager.onRemove(true);
}
Bus.get().post(new HideShowEvent().setClose(true));
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onCancel() {
}
})).show();
} else {
MobclickAgent.onEvent(mContext, "live_room_close", "退出直播间");
OpenAdManager.getInstance().dismiss();
try {
manager.onBackPressed();
if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_REQUEST) {
manager.micIngTypeOne(mLiveBean, mLiveType, mLiveTypeVal);
} else if (MicStatusManager.getInstance().getMicStatus() == MicStatusManager.MIC_TYPE_OPEN) {
manager.micIngTypeTwo(mLiveBean, mLiveType, mLiveTypeVal);
} else {
manager.onRemove(true);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void end() {
@ -737,33 +777,38 @@ public class LiveAudienceActivity extends LiveActivity {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveRoomChangeEvent(LiveRoomChangeEvent e) {
LiveBean liveBean = e.getLiveBean();
if (TextUtils.equals(mLiveUid, liveBean.getUid())) {
ToastUtil.show(mContext.getString(R.string.current_live_room));
} else {
if (e.isLiveEnd()) {
manager.removeLiveEnd();
}
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
}
if (liveBean != null) {
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
manager.onRemove(false);
mLiveType = e.getLiveType();
mLiveTypeVal = e.getLiveTypeVal();
mLiveBean = liveBean;
mLiveUid = liveBean.getUid();
mStream = liveBean.getStream();
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
if (manager!=null&&manager.getsudGameMin()){
ToastUtil.show(WordUtil.isNewZh()?"小遊戲進行中,無法切換直播間":"Game in progress, unable to switch to live room");
}else {
LiveBean liveBean = e.getLiveBean();
if (TextUtils.equals(mLiveUid, liveBean.getUid())) {
ToastUtil.show(mContext.getString(R.string.current_live_room));
} else {
if (e.isLiveEnd()) {
manager.removeLiveEnd();
}
if (LiveRoomViewHolder.mHandler != null) {
LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null);
}
if (liveBean != null) {
LiveHttpUtil.cancel(LiveHttpConsts.CHECK_LIVE);
LiveHttpUtil.cancel(LiveHttpConsts.ENTER_ROOM);
LiveHttpUtil.cancel(LiveHttpConsts.ROOM_CHARGE);
manager.onRemove(false);
mLiveType = e.getLiveType();
mLiveTypeVal = e.getLiveTypeVal();
mLiveBean = liveBean;
mLiveUid = liveBean.getUid();
mStream = liveBean.getStream();
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
}
}
}
}
@Override
@ -1124,7 +1169,8 @@ public class LiveAudienceActivity extends LiveActivity {
break;
case GUARD:
if (event.getObject() == null) {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); } else {
openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity);
} else {
openNewBuyGuardWindow(true);
}
break;
@ -1593,7 +1639,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void onError(String error) {
ToastUtil.show(WordUtil.isNewZh()?"抱歉!出錯了!":"i \\'m sorry! An error occurred");
ToastUtil.show(WordUtil.isNewZh() ? "抱歉!出錯了!" : "i \\'m sorry! An error occurred");
}
});
@ -1647,6 +1693,19 @@ public class LiveAudienceActivity extends LiveActivity {
});
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onShowHideEvent(ShowHideEvent event) {
if (manager != null) {
manager.onShowHideEvent();
verticalViewPager.setEnableScroll(false);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onHideShow(HideShowEvent event) {
verticalViewPager.setEnableScroll(true);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onLiveOpenSudRoomEvent(LiveOpenSudRoomEvent liveOpenSudRoomEvent) {
if (manager != null) {
@ -1734,7 +1793,7 @@ public class LiveAudienceActivity extends LiveActivity {
} else {
if (IMLoginManager.get(mContext).getRedPoint()) {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.VISIBLE);
}else {
} else {
manager.mLiveAudienceViewHolder.mRedPointPrivilege.setVisibility(View.GONE);
}

View File

@ -97,6 +97,7 @@ import com.yunbao.common.bean.XydCompleteModel;
import com.yunbao.common.event.AllServerNotifyEvent;
import com.yunbao.common.event.AnchorInfoEvent;
import com.yunbao.common.event.CustomFullServiceNotifyEvent;
import com.yunbao.common.event.HideShowEvent;
import com.yunbao.common.event.LiveRoomChangeEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.API;
@ -666,6 +667,19 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
return R.layout.view_live_room;
}
private View sudGameMin;
public void onShowHideEvent() {
sudGameMin = findViewById(R.id.sud_game_min);
sudGameMin.setVisibility(View.VISIBLE);
ViewClicksAntiShake.clicksAntiShake(sudGameMin, new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
Bus.get().post(new HideShowEvent().setClose(false));
sudGameMin.setVisibility(View.GONE);
}
});
}
/**
* 获取下一秒钟的时间
@ -3050,7 +3064,29 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
MobclickAgent.onEvent(mContext, "live_room_noble", "贵族按钮");
((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveRyAnchorActivity);
} else if (i == R.id.btn_close) {
// if (sudGameMin!=null&&sudGameMin.getVisibility()==View.VISIBLE) {
// new XPopup.Builder(mContext)
// .asCustom(new HintCustomPopup(mContext,
// mContext.getString(com.yunbao.common.R.string.dialog_tip),
// mContext.getString(com.yunbao.common.R.string.the_live_room))
// .setLiveOpenOk( mContext.getString(com.yunbao.common.R.string.confirm))
// .setLiveOpenCancel( mContext.getString(com.yunbao.common.R.string.cancel))
// .setCallBack(new HintCustomPopup.HintCustomCallBack() {
// @Override
// public void onSure() {
// close();
// }
//
// @Override
// public void onCancel() {
//
//
// }
// })).show();
// } else {
close();
// }
//小屏
} else if (i == R.id.btn_noble) {
((LiveActivity) mContext).openLuckGiftTip();
@ -3067,6 +3103,10 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
public boolean getsudGameMin() {
return sudGameMin != null && sudGameMin.getVisibility() == View.VISIBLE;
}
/**
* 私信的切换动画
*

View File

@ -216,6 +216,12 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
this.createSudRoomModel = createSudRoomModel;
}
public void onShowHideEvent() {
if (mLiveRoomViewHolder != null) {
mLiveRoomViewHolder.onShowHideEvent();
}
}
public PortraitLiveManager(Activity context, Intent intent) {
this.mContext = context;
this.mIntent = intent;
@ -1630,6 +1636,10 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
}
}
public boolean getsudGameMin() {
return mLiveRoomViewHolder != null && mLiveRoomViewHolder.getsudGameMin();
}
@Override
public void onHourRank(LiveChatBean bean, JSONObject ranks) {
if (mLiveRoomViewHolder != null && !TextUtils.isEmpty(liveID) && ranks != null) {

View File

@ -1059,11 +1059,11 @@
android:id="@+id/iv_look"
android:layout_width="52dp"
android:layout_height="24dp"
android:singleLine="true"
android:ellipsize="end"
android:layout_marginRight="12dp"
android:background="@drawable/bg_all_server_icon"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:text="@string/live_onlookers"
android:textColor="@color/white"
android:textSize="12sp" />
@ -2239,6 +2239,33 @@
android:gravity="bottom"
android:orientation="vertical">
<LinearLayout
android:id="@+id/sud_game_min"
android:layout_width="75dp"
android:layout_height="28dp"
android:layout_marginBottom="20dp"
android:background="@mipmap/background_sud_game_float"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:layout_width="20dp"
android:layout_height="16dp"
android:layout_marginStart="8dp"
android:src="@mipmap/icon_sud_game_min" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/sud_in_game"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
<com.ms.banner.Banner
android:id="@+id/top_banner2"
android:layout_width="52dp"
@ -2455,7 +2482,6 @@
android:id="@+id/sud_text_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_alignParentBottom="true"
android:layout_marginStart="21dp"
android:layout_marginEnd="21dp"
@ -2467,5 +2493,6 @@
android:paddingBottom="8dp"
android:text="主播創建了【游戲名】房間,快來與主播同玩~"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>