Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RELOAD-346, RELOAD-323 #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added LocalFiles/images/back_button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions LocalFiles/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h3>Server IP</h3>
</div>
<div id="loading" style="display:none">
</div>
<div id="back" onclick="back();"><img src="images/back_button.png"></img></div>

</div>

Expand Down
42 changes: 30 additions & 12 deletions LocalFiles/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
function loadGameData() {

mosync.app.screenSetOrientation(mosync.SCREEN_ORIENTATION_PORTRAIT);

backImg = document.getElementById("back");

document.addEventListener("deviceready", function () {
// initialization of global vars
// about player data like phone id
Expand All @@ -62,17 +63,18 @@
deviceName = device.name;
document.getElementById('menu').style.display = "block";

}, true);
document.addEventListener("backbutton", function (){
if(multiplayerMode){
socket.disconnect();
menu();
return;
}

mosync.rlog("1mState : " + mState);

document.addEventListener("backbutton", function (){
if(multiplayerMode){
socket.disconnect();
menu();
}
back();

if( mState = 0 ) {
mosync.bridge.send(["close"]);
}
}, true);

}, true);
}
Expand All @@ -92,10 +94,25 @@
multiplayerMode = false;
document.getElementById('menu').style.display = "none";
document.getElementById('gameCanvas').style.display = "block";
document.getElementById('back').style.position.top = "-50px";
initialize();
}

function back() {
mosync.rlog(mState);
if( mState === 0 ) {
mosync.app.exit();
} else if (mState === 0.1) {
menu();
return;
} else if (mState >= 1) {
menu();
return;
}
}

function showMultiplayer() {
mState = 0.1;
document.getElementById('single').style.display = 'none';
document.getElementById('multi').style.marginTop = "70%";
document.getElementById('connectionControls').style.display = 'block';
Expand Down Expand Up @@ -208,7 +225,9 @@

mState = 0;
mosync.rlog("Disconnection");
socket.disconnect();
if(multiplayerMode) {
socket.disconnect();
}
menu();
} else if (touch.pageY > (mGameFieldTop+mGameFieldSize*10)){

Expand Down Expand Up @@ -1013,7 +1032,6 @@
function drawScore()
{
mContext.font = "40px TrebuchetMS";

mContext.save();

if(mOrientation == 2)
Expand Down
Loading