|
@@ -31,11 +31,13 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
|
|
|
private var nextCoins: Int = 0
|
|
|
private var nextTime: Int = 0
|
|
|
private var showChangeRoom = false
|
|
|
+ private var countdownOver = false //倒计时是否结束
|
|
|
private var rewardsModel: OnlineRewardsModel? = null
|
|
|
private var scaleXAnimator: ObjectAnimator? = null
|
|
|
private var scaleYAnimator: ObjectAnimator? = null
|
|
|
var openGetCoins: ((duration: String, coins: Int, nextCoins: Int, nextTime: Int) -> Unit)? =
|
|
|
null
|
|
|
+ var countdownOverFun: (() -> Unit)?= null
|
|
|
|
|
|
private
|
|
|
constructor(context: Context) : this(context, null)
|
|
@@ -63,7 +65,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
|
|
|
).show()
|
|
|
return
|
|
|
}
|
|
|
- if (scaleXAnimator?.isRunning == true){
|
|
|
+ if (scaleXAnimator?.isRunning == true && countdownOver){
|
|
|
openGetCoins?.invoke(duration, coins, nextCoins, nextTime)
|
|
|
}
|
|
|
}
|
|
@@ -117,6 +119,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
|
|
|
if (timeL == 0L){
|
|
|
if (scaleXAnimator?.isRunning == false && rewardsModel != null){
|
|
|
startGetAnimation()
|
|
|
+ countdownOverFun?.invoke()
|
|
|
}
|
|
|
} else {
|
|
|
totalTime ++
|
|
@@ -151,6 +154,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
|
|
|
}
|
|
|
|
|
|
fun setRewardsSuccess(success:Boolean){
|
|
|
+ countdownOver = false
|
|
|
if (success){
|
|
|
scaleXAnimator?.cancel()
|
|
|
scaleYAnimator?.cancel()
|
|
@@ -248,4 +252,11 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 倒计时结束成功
|
|
|
+ * */
|
|
|
+ fun countdownOverSuccess(){
|
|
|
+ countdownOver = true
|
|
|
+ }
|
|
|
}
|