Commit d1257e0f authored by xw's avatar xw

[提交人]:王雪伟

[提交简述] :多多菜园1.0.9
[实现方案] :除虫加入随机概率
parent 38df28cb
......@@ -20,6 +20,7 @@
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/icon_launch"
android:hardwareAccelerated="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:icon, android:label,android:theme">
......
......@@ -86,10 +86,10 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
})
//小满上报
// if (Constant.isReportXiaoman) {
// AdSdk.exposure("2773", com.ym.modulecommon.utils.SettingPreference.getToken())
// Constant.isReportXiaoman = false
// }
if (Constant.isReportXiaoman) {
AdSdk.exposure("2773", com.ym.modulecommon.utils.SettingPreference.getToken())
Constant.isReportXiaoman = false
}
openNotif()
AdUtils.loadNextCacheRewardVideoAd(this)
......@@ -165,6 +165,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
//头像跳转
fun onclickHead() {
JumpUtils.jumpSettingActivity()
// gotoXiaoManActivity()
}
/**
......@@ -361,13 +362,16 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
/**
* 获取地块列表
* 获取地块列表 土地列表
* */
fun getListLandNew(from: Int) {
Log.d("Wxw", "初始化地块列表成功$from")
GameApiClient.gameApi.getListLand().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<NewLandListEntity>() {
override fun onSuccess(result: NewLandListEntity?) {
if (result?.videoRate!=null){
Constant.isShowCleanWormVideo=result.videoRate
}
var json = Utils.obj2Str(result)
if (from == 1) {
callUnity("Canvas", "loadLandListSuccess", json)
......@@ -582,6 +586,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
this.runOnUiThread(object : Runnable {
override fun run() {
MainDialog.showDialogWorm(this@GameActivity, View.OnClickListener {
//需要看视频除虫
AdUtils.playRewardAd(
this@GameActivity,
"CleanWorm",
......@@ -594,6 +599,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
})
}, View.OnClickListener {
//不用看视频 直接除虫
getUnlockLandNew(id, 4, 0)
})
}
......
......@@ -53,15 +53,15 @@ class BaseApplication : BaseApplication() {
private var backToFrontTime: Long = 0
override fun onCreate() {
super.onCreate()
NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
// NetConfig.BASE_FEED_URL="https://fsapi.ihuomao.com/"
// NetConfig.BASE_AD_URL="https://bs.ihuomao.com/"
// NetConfig.URL_REPORT_BASE="http://report.ihuomao.com/"
//TODO 上线去掉测试地址
// NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
NetConfig.BASE_FEED_URL = "http://feedapitest2.zhangxinhulian.com/"
// Constant.appLs = "afcbef40e31631d3"//appls
AdManager.init(this,"afcbef40e31631d3")
LogUtils.getConfig().logSwitch = true
......
......@@ -645,7 +645,8 @@ object MainDialog {
//生虫弹窗
fun showDialogWorm(
activity: Activity?,
onClickListener: View.OnClickListener
onClickListener: View.OnClickListener,
onClickNoVideoListener: View.OnClickListener
) {
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
......@@ -662,12 +663,28 @@ object MainDialog {
mDialogView.findViewById<ImageView>(R.id.id_img_close_clean_worm).setOnClickListener {
mDialog.dismiss()
}
mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm).setOnClickListener {
var cleanWormBtn = mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm)
cleanWormBtn.setOnClickListener {
EventUtils.onEvent("click_clean_worm_video_btn", "除虫看视频点击")
onClickListener.onClick(it)
mDialog.dismiss()
}
var cleanWormBtnNoVideo = mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm_no_video)
cleanWormBtnNoVideo.setOnClickListener {
EventUtils.onEvent("click_clean_worm_btn", "除虫点击")
onClickNoVideoListener.onClick(it)
mDialog.dismiss()
}
//需要看视频
if (ReportUtils.isCreat(Constant.isShowCleanWormVideo)){
cleanWormBtn.visibility=View.VISIBLE
cleanWormBtnNoVideo.visibility=View.GONE
}else{
cleanWormBtn.visibility=View.GONE
cleanWormBtnNoVideo.visibility=View.VISIBLE
}
mDialog.setOnDismissListener(object : DialogInterface.OnDismissListener {
override fun onDismiss(p0: DialogInterface?) {
onDestroy()
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/worm_btn_press_no_video" android:state_pressed="false"/>
<item android:drawable="@drawable/worm_btn_no_video" android:state_pressed="true"/>
</selector>
\ No newline at end of file
......@@ -71,8 +71,18 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="visible"
android:layout_marginBottom="@dimen/dp_20"
android:src="@drawable/select_clean_worm" />
<ImageView
android:id="@+id/id_img_clean_worm_no_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_20"
android:src="@drawable/select_clean_worm_no_video" />
</RelativeLayout>
</RelativeLayout>
......
......@@ -47,7 +47,7 @@ public class Constant {
public static final String a = "2Lve43ngWzArs7Ql";
public static String b;
public static String appLs= "afcbef40e31631d3";
public static String appLs = "afcbef40e31631d3";
public static final String gender = "gender";
public static int showSearch;
......@@ -596,4 +596,5 @@ public class Constant {
public static String ReportSessionId = "";
public static boolean isReportXiaoman = true;
public static int isShowCleanWormVideo = 100;
}
......@@ -19,8 +19,17 @@ public class NewLandListEntity {
private int rate;
private int configNum;
private float timeRate;
private int videoRate;
private List<LandListEntity> landList;
public int getVideoRate() {
return videoRate;
}
public void setVideoRate(int videoRate) {
this.videoRate = videoRate;
}
public float getTimeRate() {
return timeRate;
}
......
package com.ym.library.utils;
import android.os.Build;
import androidx.annotation.RequiresApi;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
public class ReportUtils {
/**
* 获取随机数
*
* @param len
* @return
*/
......@@ -18,4 +24,17 @@ public class ReportUtils {
return String.valueOf(rs);
}
/**
*0%-100%(间隔5)
*/
public static boolean isCreat(int probabilityNum) {
int num = probabilityNum / 5;
Boolean[] randomArr = { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };// 0&
for (int i = 0; i < num; i++)
{
randomArr[i] = true;
}
return randomArr[new Random().nextInt(randomArr.length)];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment