我已经使用Phaser制作了一个游戏,希望我的用户能够在一个带有“名称:”字段的表单上填写他们的姓名,然后单击提交按钮,提交他们刚刚输入的名称以及他们的高分。
这是我的javascript页面代码:
yarn
所以他们的高分已经保存在下面的变量中,并输出在上面的页面中
fitz:tesseractOcrSample fitzmode$ yarn install
yarn install v1.7.0
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/Users/fitzmode/Downloads/react-native-tesseract-ocr-master/tesseractOcrSample/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
我想抓住这个,并通过在上面的脚本中添加一些内容以表单的形式提交它的名字-但是呢?
提交表单时,需要执行以下功能以将其发布到app42排行榜服务-请参阅我的两个//注释:
Game.Leader = function(game) {
buttonContinue = null;
state = null;
};
Game.Leader.prototype = {
create: function() {
this.showLeader();
},
showLeader: function() {
this.game.add.sprite(0, 0, 'screen-leader');
this.game.add.sprite(640-213-70, 80, 'spread');
this.state = 'Leader';
this.buttonContinue = this.add.button((640-200)/2, 960-103-1, 'button-restartsmall', this.startGame, this);
this.game.add.button(640-213-10, 20, 'twitter', function() {window.open("https://www.xxxxxxxx.com/", "_blank");}, this);
this.game.add.button(640-133-10, 20, 'whatsapp', function() {window.open("https://www.xxxxxxxx.com", "_blank");}, this);
this.game.add.button(640-293-10, 20, 'face', function() {window.open("https://www.xxxxxxxx.com", "_blank");}, this);
this.game.add.button(640-194-265, 700, 'button-leader2', function() {window.open("leader.htm", "_self");}, this);
this.game.add.sprite(640-194-220, 300, 'highscore-text');
highscoreText = this.game.add.text(290, 360, "0", { font: "40px ComicBook", fill: "#FFCC00", align: "right" });
storageAPI.initUnset('highscore',0);
var highscore = storageAPI.get('highscore');
highscoreText.setText(highscore);
},
startGame: function() {
this.game.state.start('Game');
}
};
那么问题:
非常感谢您的帮助!