package com.swago.baseswago.baseroom.ui

import androidx.viewbinding.ViewBinding
import com.swago.baseswago.activity.BaseXActivity
import com.swago.baseswago.baseroom.IRoomActiveListener
import com.swago.baseswago.baseroom.IRoomInfo
import com.swago.baseswago.baseroom.RoleType
import com.swago.baseswago.baseroom.SwagoRoomManager

/**
 *@date 2021/10/4 10:43
 *description:
 */
abstract class AbsAnchorActivity <VB: ViewBinding,T: IRoomInfo> : BaseXActivity<VB>(),IRoomActiveListener{

    var roleType = RoleType.anchor

    override fun initOther() {
        SwagoRoomManager.addListener(this)
        SwagoRoomManager.roleType = roleType

    }

    override fun onDestroy() {
        super.onDestroy()
        if (SwagoRoomManager.iRoomInfo != null){
            SwagoRoomManager.closeRoom()
        }
        SwagoRoomManager.removeListener(this)
        SwagoRoomManager.clearListener()
    }

}