Apoptyzm Posted July 25, 2015 Share Posted July 25, 2015 I have to say that moving from 2.3 to 2.4.1 solved some of my issues with performance on low fps, and i love it, but somehow on phone nothing works.On Chrome i get my first screen and input doesn't work, and on stock browser(and-4.0.4) i get blank screen. Everything works on PC. I get no errors in mobile Chrome js console. Did i miss something in release notes? Link to comment Share on other sites More sharing options...
rich Posted July 25, 2015 Share Posted July 25, 2015 What does the first screen do? You have to understand it's next to impossible for anyone to help you given what has been posted so far. Ideally we need a URL to test or at the very least a bit of code to run. Link to comment Share on other sites More sharing options...
Apoptyzm Posted July 30, 2015 Author Share Posted July 30, 2015 So my gameplay works as intended, but menu buttons do not. Since my game starts with a menu i can't do anything at start. Before creating menu screen i stop the simulation with:GameController.prototype.pauseSimulation = function () { this.game.physics.arcade.isPaused=true; pause_simulation = true; this.game.time.events.stop(false);};Since Phaser ver. 2.something it doesn't stop input listeners. Then i have this "store" view that won't react:/* global debug, Sound, zsummary_text, Phaser *//** * Store Screen with upgrades and powerups to unlock * @param {type} Phaser_game * @param {type} Powerups_manager * @returns {UpgradesView} */function UpgradesView(Phaser_game, Powerups_manager) { this.game = Phaser_game; this.profile; this.upgrades= new Upgrades(this.game);;//UpgradesData this.PowerupsMng = Powerups_manager; this.sprites;//group this.icons;//group this.buyBtn; this.label; this.tint= { DEFAULT: 0xffffff, BLOCKED: 0xff0000, AVAILABLE: 0xffffff, UPGRADED: 0x0000ff }; this.highlightedupgradekey; this.INVALID=-1; this.reset(); };UpgradesView.prototype.reset = function (){ this.sprites = this.game.add.group(); this.icons = this.game.add.group(); this.upgrades.reset(); this.highlightedupgradekey=this.INVALID;; var style = { font: 'bold 16pt Arial', fill: 'white', align: 'left', wordWrap: true, wordWrapWidth: 450 }; this.label = this.game.add.text(200, 700, " ", style); this.label.fixedToCamera = (true); if(debug===true) console.log('UpgradesView reset'); //load profile data};UpgradesView.prototype.preload = function (){ this.upgrades.preload(); this.game.load.image("summary-background", 'img/summaryscreen/summary-background.jpg'); this.game.load.image("button-play", 'img/buttons/button-play.png '); if(debug===true) console.log('UpgradesView preload');};UpgradesView.prototype.create = function (){ this.upgrades.create(); if(debug===true) console.log('UpgradesView create');};UpgradesView.prototype.show = function (){ //this.summary.createSummary(); //TODO: potential leak this.reset(); this.upgrades.loadData(); //this.updateProfile(); this.createBackground(); this.createUpgradesGrid(); this.createPlayButton(); this.createMenuButton(); this.createBuyButton(); //this.background.reset(this.game.camera.x+400+WindowGameW*(0.5),this.game.camera.y +WindowGameH*(0.5),1); //this.background.visible=true; if(debug===true) console.log('UpgradesView show');};UpgradesView.prototype.hide = function (){ //this.background.visible=false; this.sprites.destroy(); this.icons.destroy(); this.label.destroy(); //this.background.destroy(); //this.play_again_btn.destroy(); //this.game.world.remove(this.play_again_btn);};UpgradesView.prototype.onPlayAgainBtn= function(){ if(debug===true) console.log('UpgradesView onPlayAgainBtn'); this.hide(); this.game.deadfish.gamecontroller.gotoStartGame(); Sound.playButtonPress();};UpgradesView.prototype.onMenuBtn= function(){ this.hide(); this.game.deadfish.gamecontroller.gotoStartGame(); Sound.playButtonPress(); if(debug===true) console.log('UpgradesView onPlayAgainBtn Click');};UpgradesView.prototype.updateProfile= function(){ //this.game.deadfish.player.getProfile().updateFromLevelData(this.summary.getSummary());};UpgradesView.prototype.getSummaryData= function(){ //return this.summary.getSummary();};UpgradesView.prototype.createPlayButton = function (){ //this.play_again_btn = game.add.text(this.game.camera.x+100,this.game.camera.y, 'Fafarafa', { font: '28px Arial', fill: '#f0f' }); this.play_again_btn = this.game.add.sprite(WindowGameW-200,WindowGameH-200, 'button-play'); this.play_again_btn.inputEnabled = true; this.play_again_btn.events.onInputUp.add(this.onPlayAgainBtn.bind(this)); this.play_again_btn.fixedToCamera = (true); this.play_again_btn.z=zsummary_text+1; this.sprites.add(this.play_again_btn);};UpgradesView.prototype.createMenuButton = function (){ //this.play_again_btn = game.add.text(this.game.camera.x+100,this.game.camera.y, 'Fafarafa', { font: '28px Arial', fill: '#f0f' }); var MenuButton = this.game.add.sprite(WindowGameW-200,WindowGameH-100, 'button-play'); MenuButton.inputEnabled = true; MenuButton.events.onInputUp.add(this.onMenuBtn.bind(this)); MenuButton.fixedToCamera = (true); MenuButton.z=zsummary_text+1; this.sprites.add(MenuButton);};UpgradesView.prototype.createBuyButton = function (){ //this.play_again_btn = game.add.text(this.game.camera.x+100,this.game.camera.y, 'Fafarafa', { font: '28px Arial', fill: '#f0f' }); this.buyBtn = this.game.add.sprite(50,800, 'button-play'); this.buyBtn.inputEnabled = true; this.buyBtn.events.onInputUp.add(this.onBuyBtnClick.bind(this)); this.buyBtn.fixedToCamera = (true); this.buyBtn.z=zsummary_text+1; this.sprites.add(this.buyBtn);};UpgradesView.prototype.createBackground = function (){ //this.background = game.add.sprite(this.game.camera.x+WindowGameW*(0.5),this.game.camera.y+WindowGameH*0.0, 'summary-background'); //this.background = game.add.sprite(this.game.camera.x,this.game.camera.y, 'summary-background'); this.background = this.game.add.sprite(WindowGameW*(0.5),WindowGameH*0.5, 'summary-background'); var ratio = WindowGameW / this.background.width; this.background.scale.x=ratio; this.background.scale.y=ratio; this.background.alpha=1; this.background.anchor.set(0.5); this.background.inputEnabled = false; this.background.z=zsummary_screen; this.background.fixedToCamera = (true); //this.background.tint = 0xcccccc; this.sprites.add(this.background);};UpgradesView.prototype.createUpgradesGrid = function (){ var upperx=10; var uppery=100; var rows=2; var columns =6; var stepx=WindowGameW/columns; var stepy=80; var profile =this.game.deadfish.player.getProfile(); var spr; var key=0;//index // for (var y=0; y< rows; y++){ for(var x=0;x<columns;x++){ //sprite spr = game.add.sprite(upperx + stepx*x,uppery + stepy*y, this.upgrades.assets[key]); spr.inputEnabled = true; spr.z=zsummary_text; spr.name = this.upgrades.assets[key]; spr.key = key; spr.fixedToCamera = (true); spr.events.onInputUp.add(this.onUpgradeClick.bind(this)); //set color status if(this.upgrades.isUpgraded(key)) spr.tint = this.tint.UPGRADED; else if(this.upgrades.getUpgradeCost(key) > profile.getMoney() ) spr.tint = this.tint.BLOCKED; else spr.tint = this.tint.AVAILABLE; key++; this.icons.add(spr); } } //powerups key=0; uppery = uppery + stepy*(rows+1); var offset = this.upgrades.getKeysLen(); for (var y=0; y< rows; y++){ for(var x=0;x<columns;x++){ //sprite //jebany hack, żeby się dało iterować liste indexem numerowym.. var becausejskey ; var i=0; for(var t in this.PowerupsMng.KEYS){ if(i===key){ becausejskey = t; break; } i++; } //var is=this.game.cache.checkImageKey(this.PowerupsMng.KEYS[becausejskey] ); //is=this.game.cache.checkImageKey("points_multi.png" ); spr = game.add.sprite(upperx + stepx*x,uppery + stepy*y, this.PowerupsMng.KEYS[becausejskey]); spr.inputEnabled = true; spr.z=zsummary_text; spr.scale.setTo(2); spr.name = this.PowerupsMng.KEYS[becausejskey]; spr.key = offset+key; spr.fixedToCamera = (true); spr.events.onInputUp.add(this.onUpgradeClick.bind(this)); //set color status if(this.upgrades.isUpgraded(spr.key)) spr.tint = this.tint.UPGRADED; else if(this.upgrades.getUpgradeCost(spr.key) > profile.getMoney() ) spr.tint = this.tint.BLOCKED; else spr.tint = this.tint.AVAILABLE; key++; this.icons.add(spr); } } };UpgradesView.prototype.onBuyBtnClick = function (spr, pointer){ if(this.highlightedupgradekey===this.INVALID) alert("onBuyButton error"); if(this.upgrades.isUpgraded(this.highlightedupgradekey)) return; else if(this.upgrades.getUpgradeCost(this.highlightedupgradekey) > this.game.deadfish.player.getProfile().getMoney() ) return; this.upgrades.upgrade(this.highlightedupgradekey); //this.upgrades.applyUpgrade(this.highlightedupgradekey); this.updateAllTints(); this.updateBuyBtnTint(spr); this.updateLabel(spr); //snd Sound.playBuyItem(); if(debug===true) console.log('UpgradesView onBuyBtnClick');};//when someone clicks upgrade iconUpgradesView.prototype.onUpgradeClick = function (spr, pointer){ var icon; if(this.highlightedupgradekey !==this.INVALID){ icon = this.icons.getAt(this.highlightedupgradekey); icon.scale= this.lasthighlightedscale; } this.highlightedupgradekey = spr.key; icon =this.icons.getAt(spr.key); this.lasthighlightedscale = icon.scale; icon.scale = new Phaser.Point(icon.scale.x*1.5,icon.scale.y*1.5); this.updateLabel(spr); this.updateBuyBtnTint(spr);};UpgradesView.prototype.updateTint = function (spr){ if(this.upgrades.isUpgraded(spr.key)) spr.tint = this.tint.UPGRADED; else if(this.upgrades.getUpgradeCost(spr.key) > this.game.deadfish.player.getProfile().getMoney() ) spr.tint = this.tint.BLOCKED; else spr.tint = this.tint.AVAILABLE;};UpgradesView.prototype.updateBuyBtnTint = function (spr){ if(this.upgrades.isUpgraded(spr.key)) this.buyBtn.tint = this.tint.UPGRADED; else if(this.upgrades.getUpgradeCost(spr.key) > this.game.deadfish.player.getProfile().getMoney() ) this.buyBtn.tint = this.tint.BLOCKED; else this.buyBtn.tint = this.tint.AVAILABLE;};UpgradesView.prototype.updateAllTints = function (){ this.icons.forEach( this.updateTint ,this);};UpgradesView.prototype.updateLabel = function (sprite){ var money = this.game.deadfish.player.getProfile().getMoney(); this.label.setText( this.upgrades.labels[sprite.key] + "\n\nmoney: "+money);}; Link to comment Share on other sites More sharing options...
rich Posted July 30, 2015 Share Posted July 30, 2015 Upgrade to 2.4.2 which was released yesterday, it will solve this. Link to comment Share on other sites More sharing options...
Recommended Posts