6.8.0:小游戏结算界面,观众视角修改

This commit is contained in:
余前卫 2024-07-18 17:31:44 +08:00
parent a0f3f246a6
commit 0ea92c00a2

View File

@ -43,6 +43,7 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow{
private AppCompatTextView sub_win_name,sub_win_score,sub_loss_name,sub_loss_score,sub_time; private AppCompatTextView sub_win_name,sub_win_score,sub_loss_name,sub_loss_score,sub_time;
private CountDownTimer countDownTimer; private CountDownTimer countDownTimer;
private List<SudSettleBean> settleBeans = new ArrayList<>(); private List<SudSettleBean> settleBeans = new ArrayList<>();
private boolean containMe;
@Override @Override
public void buildDialog(XPopup.Builder builder) { public void buildDialog(XPopup.Builder builder) {
@ -89,48 +90,62 @@ public class SudGameDoubleDialog extends AbsDialogCenterPopupWindow{
sortByWinNum(settleBeans); sortByWinNum(settleBeans);
SudSettleBean sudSettleBean1 = settleBeans.get(0); // 第一名 SudSettleBean sudSettleBean1 = settleBeans.get(0); // 第一名
SudSettleBean sudSettleBean2 = settleBeans.get(1); // 第二名 SudSettleBean sudSettleBean2 = settleBeans.get(1); // 第二名
checkMe(sudSettleBean1.getUid(),sudSettleBean2.getUid());//判断这场对局是不是包含自己
ImgLoader.display(mContext,sudSettleBean1.getAvatar_url(),sub_win_head); // 检查是否是当前用户
ImgLoader.display(mContext,sudSettleBean2.getAvatar_url(),sub_loss_head); boolean isFirstMe = CommonAppConfig.getInstance().getUid().equals(sudSettleBean1.getUid());
sub_win_name.setText(sudSettleBean1.getNick_name()); boolean isDraw = sudSettleBean1.getWin_num() == sudSettleBean2.getWin_num();
sub_loss_name.setText(sudSettleBean2.getNick_name()); boolean isZh = WordUtil.isNewZh();
if (sudSettleBean1.getWin_num()>0){
sub_win_score.setText("+"+sudSettleBean1.getWin_num());
}else {
sub_win_score.setText(String.valueOf(sudSettleBean1.getWin_num()));
}
sub_loss_score.setText(String.valueOf(sudSettleBean2.getWin_num()));
if (sudSettleBean1.getWin_num() == sudSettleBean2.getWin_num()){ if (containMe) {
//平局 // 当前用户在游戏中
if (WordUtil.isNewZh()){ SudSettleBean winBean = isFirstMe ? sudSettleBean1 : sudSettleBean2;
sub_title.setImageResource(R.mipmap.sub_draw_zh); SudSettleBean lossBean = isFirstMe ? sudSettleBean2 : sudSettleBean1;
}else {
sub_title.setImageResource(R.mipmap.sub_draw_en); ImgLoader.display(mContext, winBean.getAvatar_url(), sub_win_head);
ImgLoader.display(mContext, lossBean.getAvatar_url(), sub_loss_head);
sub_win_name.setText(winBean.getNick_name());
sub_loss_name.setText(lossBean.getNick_name());
sub_win_score.setText(winBean.getWin_num() > 0 ? "+" + winBean.getWin_num() : String.valueOf(winBean.getWin_num()));
sub_loss_score.setText(String.valueOf(lossBean.getWin_num()));
if (isDraw) {
// 平局
sub_title.setImageResource(isZh ? R.mipmap.sub_draw_zh : R.mipmap.sub_draw_en);
sub_win_hat.setVisibility(View.GONE);
} else {
// 胜利或失败
sub_title.setImageResource(isZh ? (isFirstMe ? R.mipmap.sub_win_zh : R.mipmap.sub_loss_zh) : (isFirstMe ? R.mipmap.sub_win_en : R.mipmap.sub_loss_en));
sub_win_hat.setVisibility(View.VISIBLE);
} }
sub_win_hat.setVisibility(View.GONE); } else {
}else { // 当前用户不在游戏中
//有胜负 ImgLoader.display(mContext, sudSettleBean1.getAvatar_url(), sub_win_head);
sub_win_hat.setVisibility(View.VISIBLE); ImgLoader.display(mContext, sudSettleBean2.getAvatar_url(), sub_loss_head);
if (CommonAppConfig.getInstance().getUid().equals(sudSettleBean1.getUid())){ sub_win_name.setText(sudSettleBean1.getNick_name());
//本人胜利 sub_loss_name.setText(sudSettleBean2.getNick_name());
if (WordUtil.isNewZh()){
sub_title.setImageResource(R.mipmap.sub_win_zh); sub_win_score.setText(sudSettleBean1.getWin_num() > 0 ? "+" + sudSettleBean1.getWin_num() : String.valueOf(sudSettleBean1.getWin_num()));
}else { sub_loss_score.setText(String.valueOf(sudSettleBean2.getWin_num()));
sub_title.setImageResource(R.mipmap.sub_win_en);
} if (isDraw) {
}else { // 平局
//本人失败 sub_title.setImageResource(isZh ? R.mipmap.sub_draw_zh : R.mipmap.sub_draw_en);
if (WordUtil.isNewZh()){ sub_win_hat.setVisibility(View.GONE);
sub_title.setImageResource(R.mipmap.sub_loss_zh); } else {
}else { // 非当前用户的胜利
sub_title.setImageResource(R.mipmap.sub_loss_en); sub_title.setImageResource(isZh ? R.mipmap.sub_win_zh : R.mipmap.sub_win_en);
} sub_win_hat.setVisibility(View.VISIBLE);
} }
} }
} }
} }
private void checkMe(String id1,String id2){
containMe = CommonAppConfig.getInstance().getUid().equals(id1) || CommonAppConfig.getInstance().getUid().equals(id2);
}
@Override @Override
protected void onShow() { protected void onShow() {
super.onShow(); super.onShow();