import Phaser from 'phaser'
import LoopEntity from '../entity/loop'
import Dialog from '../entity/dialog'
import DialogManager from '../manager/dialogmanager'
import GamblingManager from '../manager/gamblingmanager'
import BetGroup from '../entity/bet'
import IntroEye from '../entity/eye'
import DiceGroup from '../entity/dice'

class GameScene extends Phaser.Scene {
  constructor () {
    super('game')
  }

  create () {
    this.loop = this.add.existing(new LoopEntity(
      this,
      this.game.canvas.width - 350,
      335
    ))
    this.dialog = this.add.existing(new Dialog(
      this,
      50,
      this.game.canvas.height - 10
    ))
    this.dialog.init(this)

    this.bet = this.add.existing(new BetGroup(this))
    this.dice = this.add.existing(new DiceGroup(this))
    this.dice.hide()

    this.eye = this.add.existing(new IntroEye(this))

    GamblingManager.init(this)
    DialogManager.init(this)

    this.cameras.main.setBackgroundColor(0x22243d)

    this.eye.startAnim(true)
  }

  update () {
    this.dice.update()
  }
}

export default GameScene
