LiveDetailChatRoomController.ets 937 Bytes
import { ContentDetailDTO } from 'wdBean/Index'
import { LiveRoom } from './LiveRoom'
import { LiveRoomBaseInfo } from './LiveRoomBaseInfo'
import { LiveRoomManager } from './LiveRoomManager'

export class LiveDetailChatRoomController {

  detail?: ContentDetailDTO

  public configDetail(detail: ContentDetailDTO) {
    this.detail = detail

    let roomInfo = new LiveRoomBaseInfo()
    roomInfo.roomID = detail.liveInfo.mlive.roomId
    roomInfo.mliveID = detail.liveInfo.mlive.mliveId
    roomInfo.liveID = detail.newsId + ""

    this.listenConnect()

    LiveRoomManager.sharedManager().connectLiveRoomWith(roomInfo)
  }

  listenConnect() {
    LiveRoomManager.sharedManager().onConnectedRoom = (room: LiveRoom) => {

      room.onJoined = (room: LiveRoom) => {

      }
      room.onJoinFailed = (room: LiveRoom, code: number) => {

      }
      room.onExited = (room: LiveRoom) => {

      }

      room.enterRoom()
    }
  }
}