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