57 lines
1.6 KiB
CoffeeScript
57 lines
1.6 KiB
CoffeeScript
$ = jQuery
|
|
context = window
|
|
context.JK ||= {}
|
|
|
|
context.JK.SinglePlayerProfileGuardDialog = class SinglePlayerProfileGuardDialog
|
|
constructor: (@app) ->
|
|
@rest = context.JK.Rest()
|
|
@client = context.jamClient
|
|
@logger = context.JK.logger
|
|
@gearUtils = context.JK.GearUtilsInstance
|
|
@screen = null
|
|
@dialogId = 'single-player-profile-dialog';
|
|
@dialog = null;
|
|
|
|
initialize:() =>
|
|
dialogBindings = {
|
|
'beforeShow' : @beforeShow,
|
|
'afterShow' : @afterShow
|
|
}
|
|
|
|
@dialog = $('[layout-id="' + @dialogId + '"]');
|
|
@app.bindDialog(@dialogId, dialogBindings);
|
|
@content = @dialog.find(".dialog-inner")
|
|
@audioLatency = @dialog.find('.audio-latency')
|
|
@btnPrivateSession = @dialog.find('.btn-private-session')
|
|
@btnGearSetup = @dialog.find('.btn-gear-setup')
|
|
|
|
@btnPrivateSession.on('click', @onPrivateSessionChoice)
|
|
@btnGearSetup.on('click', @onGearSetupChoice)
|
|
|
|
beforeShow:() =>
|
|
@dialog.data('result', { choice: null})
|
|
|
|
|
|
afterShow:() =>
|
|
canPlayWithOthers = @gearUtils.canPlayWithOthers()
|
|
|
|
if canPlayWithOthers.isNoInputProfile
|
|
@content.removeClass('high-latency').addClass('has-no-inputs')
|
|
else
|
|
@content.removeClass('has-no-input').addClass('high-latency')
|
|
|
|
latency = '?'
|
|
if canPlayWithOthers.audioLatency?
|
|
latency = canPlayWithOthers.audioLatency
|
|
|
|
@audioLatency.text("#{latency} milliseconds.")
|
|
|
|
onPrivateSessionChoice: () =>
|
|
@dialog.data('result', { choice: 'private_session'})
|
|
@app.layout.closeDialog(@dialogId)
|
|
return false
|
|
|
|
onGearSetupChoice: () =>
|
|
@dialog.data('result', { choice: 'gear_setup'})
|
|
@app.layout.closeDialog(@dialogId)
|
|
return false |