Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckyFarm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
LuckyFarm
Commits
d1257e0f
Commit
d1257e0f
authored
Dec 11, 2020
by
xw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :多多菜园1.0.9 [实现方案] :除虫加入随机概率
parent
38df28cb
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
84 additions
and
14 deletions
+84
-14
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-0
GameActivity.kt
app/src/main/java/com/ym/game/GameActivity.kt
+13
-5
BaseApplication.kt
app/src/main/java/com/ym/game/application/BaseApplication.kt
+5
-5
MainDialog.kt
app/src/main/java/com/ym/game/view/MainDialog.kt
+20
-3
worm_btn_no_video.png
app/src/main/res/drawable-xhdpi/worm_btn_no_video.png
+0
-0
worm_btn_press_no_video.png
app/src/main/res/drawable-xhdpi/worm_btn_press_no_video.png
+0
-0
select_clean_worm_no_video.xml
app/src/main/res/drawable/select_clean_worm_no_video.xml
+5
-0
dialog_worm.xml
app/src/main/res/layout/dialog_worm.xml
+10
-0
Constant.java
library/src/main/java/com/ym/library/Constant.java
+2
-1
NewLandListEntity.java
...rc/main/java/com/ym/library/module/NewLandListEntity.java
+9
-0
ReportUtils.java
library/src/main/java/com/ym/library/utils/ReportUtils.java
+19
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
d1257e0f
...
...
@@ -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"
>
...
...
app/src/main/java/com/ym/game/GameActivity.kt
View file @
d1257e0f
...
...
@@ -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
)
})
}
...
...
app/src/main/java/com/ym/game/application/BaseApplication.kt
View file @
d1257e0f
...
...
@@ -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
...
...
app/src/main/java/com/ym/game/view/MainDialog.kt
View file @
d1257e0f
...
...
@@ -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
()
...
...
app/src/main/res/drawable-xhdpi/worm_btn_no_video.png
0 → 100644
View file @
d1257e0f
24 KB
app/src/main/res/drawable-xhdpi/worm_btn_press_no_video.png
0 → 100644
View file @
d1257e0f
29 KB
app/src/main/res/drawable/select_clean_worm_no_video.xml
0 → 100644
View file @
d1257e0f
<?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
app/src/main/res/layout/dialog_worm.xml
View file @
d1257e0f
...
...
@@ -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>
...
...
library/src/main/java/com/ym/library/Constant.java
View file @
d1257e0f
...
...
@@ -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
;
}
library/src/main/java/com/ym/library/module/NewLandListEntity.java
View file @
d1257e0f
...
...
@@ -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
;
}
...
...
library/src/main/java/com/ym/library/utils/ReportUtils.java
View file @
d1257e0f
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
)];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment