40 lines
916 B
Kotlin
40 lines
916 B
Kotlin
package com.gh.common.chain
|
|
|
|
import android.content.Context
|
|
import com.gh.gamecenter.feature.entity.GameEntity
|
|
|
|
abstract class DownloadChainHandler {
|
|
private var next: DownloadChainHandler? = null
|
|
|
|
// asVGame: 当前下载是否以畅玩游戏来进行
|
|
var processEndCallback: ((asVGame: Boolean, Any?) -> Unit)? = null
|
|
|
|
/**
|
|
* 设置下一个处理者
|
|
*/
|
|
fun setNext(next: DownloadChainHandler?) {
|
|
this.next = next
|
|
}
|
|
|
|
/**
|
|
* 获取下一个处理者
|
|
*/
|
|
fun getNext(): DownloadChainHandler? {
|
|
return next
|
|
}
|
|
|
|
/**
|
|
* 是否存在下一个处理者
|
|
*/
|
|
fun hasNext(): Boolean {
|
|
return next != null
|
|
}
|
|
|
|
/**
|
|
* 处理请求
|
|
* @param gameEntity 游戏实体
|
|
* @param asVGame 是否作为畅玩游戏进行
|
|
*/
|
|
abstract fun handleRequest(context: Context, gameEntity: GameEntity, asVGame: Boolean)
|
|
|
|
} |