mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
A few tweaks for the iPad app.
This commit is contained in:
parent
d50a90171a
commit
2491861d76
9 changed files with 34 additions and 25 deletions
|
@ -10,5 +10,6 @@ module.exports = class ThangNamesCollection extends CocoCollection
|
|||
|
||||
fetch: (options) ->
|
||||
options ?= {}
|
||||
_.extend options, {type:'POST', data:{ids:@ids}}
|
||||
method = if application.isIPadApp then 'GET' else 'POST' # Not sure why this was required that one time.
|
||||
_.extend options, {type: method, data: {ids: @ids}}
|
||||
super(options)
|
||||
|
|
|
@ -105,6 +105,7 @@ watchForErrors = ->
|
|||
#msg += "\nColumn: #{col}" if col?
|
||||
#msg += "\nError: #{error}" if error?
|
||||
#msg += "\nStack: #{stack}" if stack = error?.stack
|
||||
unless webkit?.messageHandlers # Don't show these notys on iPad
|
||||
noty text: message, layout: 'topCenter', type: 'error', killer: false, timeout: 5000, dismissQueue: true, maxVisible: 3, callback: {onClose: -> --currentErrors}
|
||||
Backbone.Mediator.publish 'application:error', message: msg # For iOS app
|
||||
|
||||
|
|
|
@ -521,12 +521,8 @@ module.exports = Surface = class Surface extends CocoClass
|
|||
newHeight = newWidth / aspectRatio
|
||||
return unless newWidth > 0 and newHeight > 0
|
||||
return if newWidth is oldWidth and newHeight is oldHeight
|
||||
##if InstallTrigger? # Firefox rendering performance goes down as canvas size goes up
|
||||
## newWidth = Math.min 924, newWidth
|
||||
## newHeight = Math.min 589, newHeight
|
||||
#@normalCanvas.width newWidth
|
||||
#@normalCanvas.height newHeight
|
||||
scaleFactor = if application.isIPadApp then 2 else 1 # Retina
|
||||
#scaleFactor = if application.isIPadApp then 2 else 1 # Retina
|
||||
scaleFactor = 1
|
||||
@normalCanvas.add(@webGLCanvas).attr width: newWidth * scaleFactor, height: newHeight * scaleFactor
|
||||
|
||||
# Cannot do this to the webGLStage because it does not use scaleX/Y.
|
||||
|
|
|
@ -129,6 +129,7 @@ class CocoModel extends Backbone.Model
|
|||
errorMessage = "Error saving #{@get('name') ? @type()}"
|
||||
console.log 'going to log an error message'
|
||||
console.warn errorMessage, res.responseJSON
|
||||
unless webkit?.messageHandlers # Don't show these notys on iPad
|
||||
try
|
||||
noty text: "#{errorMessage}: #{res.status} #{res.statusText}", layout: 'topCenter', type: 'error', killer: false, timeout: 10000
|
||||
catch notyError
|
||||
|
|
|
@ -136,16 +136,6 @@ $stashWidth: $totalWidth - $equippedWidth - $stashMargin
|
|||
&[data-slot="right-hand"] .placeholder
|
||||
background-position-x: -17 * $itemSlotInnerWidth
|
||||
|
||||
&[data-slot="whatever"]
|
||||
// My spooging of the other placeholders had them dimmed; these didn't.
|
||||
.placeholder
|
||||
@include opacity(0.35)
|
||||
border-color: black
|
||||
&.selected
|
||||
&[data-slot="whatever"]
|
||||
.placeholder
|
||||
border-color: #28f
|
||||
|
||||
.item-container
|
||||
position: absolute
|
||||
left: 0
|
||||
|
|
|
@ -48,3 +48,11 @@
|
|||
|
||||
.modal-header
|
||||
text-align: center
|
||||
|
||||
body.ipad #level-victory-modal
|
||||
.share-buttons
|
||||
display: none
|
||||
|
||||
.modal-body
|
||||
font-size: 30px
|
||||
font-family: Bangers
|
||||
|
|
|
@ -47,6 +47,7 @@ $gameControlMargin: 30px
|
|||
.level, .level-shadow
|
||||
position: absolute
|
||||
border-radius: 100%
|
||||
-webkit-transform: scaleY(0.75)
|
||||
transform: scaleY(0.75)
|
||||
|
||||
.level
|
||||
|
|
|
@ -4,6 +4,7 @@ LevelSession = require 'models/LevelSession'
|
|||
CocoCollection = require 'collections/CocoCollection'
|
||||
AudioPlayer = require 'lib/AudioPlayer'
|
||||
PlayLevelModal = require 'views/play/modal/PlayLevelModal'
|
||||
ThangType = require 'models/ThangType'
|
||||
|
||||
class LevelSessionsCollection extends CocoCollection
|
||||
url: ''
|
||||
|
@ -34,6 +35,7 @@ module.exports = class WorldMapView extends RootView
|
|||
@getLevelPlayCounts()
|
||||
$(window).on 'resize', @onWindowResize
|
||||
@playAmbientSound()
|
||||
@preloadTopHeroes()
|
||||
|
||||
destroy: ->
|
||||
$(window).off 'resize', @onWindowResize
|
||||
|
@ -165,8 +167,9 @@ module.exports = class WorldMapView extends RootView
|
|||
|
||||
playAmbientSound: ->
|
||||
return if @ambientSound
|
||||
terrain = 'Grass'
|
||||
return unless file = {Dungeon: 'ambient-map-dungeon', Grass: 'ambient-map-grass'}[terrain]
|
||||
#terrain = 'Grass'
|
||||
terrain = 'Dungeon'
|
||||
return unless file = {Dungeon: 'ambient-dungeon', Grass: 'ambient-map-grass'}[terrain]
|
||||
src = "/file/interface/#{file}#{AudioPlayer.ext}"
|
||||
unless AudioPlayer.getStatus(src)?.loaded
|
||||
AudioPlayer.preloadSound src
|
||||
|
@ -175,6 +178,14 @@ module.exports = class WorldMapView extends RootView
|
|||
@ambientSound = createjs.Sound.play src, loop: -1, volume: 0.1
|
||||
createjs.Tween.get(@ambientSound).to({volume: 1.0}, 1000)
|
||||
|
||||
preloadTopHeroes: ->
|
||||
for heroID in ['captain', 'knight']
|
||||
url = "/db/thang.type/#{ThangType.heroes[heroID]}/version"
|
||||
continue if @supermodel.getModel url
|
||||
fullHero = new ThangType()
|
||||
fullHero.setURL url
|
||||
@supermodel.loadModel fullHero, 'thang'
|
||||
|
||||
|
||||
tutorials = [
|
||||
{
|
||||
|
|
|
@ -272,7 +272,7 @@ module.exports = class PlayLevelView extends RootView
|
|||
@insertSubView new ChatView levelID: @levelID, sessionID: @session.id, session: @session
|
||||
worldName = utils.i18n @level.attributes, 'name'
|
||||
@controlBar = @insertSubView new ControlBarView {worldName: worldName, session: @session, level: @level, supermodel: @supermodel}
|
||||
_.delay (=> Backbone.Mediator.publish('level:set-debug', debug: true)), 5000 if @isIPadApp() # if me.displayName() is 'Nick'
|
||||
#_.delay (=> Backbone.Mediator.publish('level:set-debug', debug: true)), 5000 if @isIPadApp() # if me.displayName() is 'Nick'
|
||||
|
||||
initVolume: ->
|
||||
volume = me.get('volume')
|
||||
|
|
Loading…
Reference in a new issue