mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 10:35:44 +00:00
Fix front-end (#36)
* Change join to start * Unorder data channel * GC after room close * Update Frontend * Remove fade in fadeout
This commit is contained in:
parent
2b7671c26b
commit
3c811bc259
4 changed files with 17 additions and 8 deletions
4
static/gameboy2.html
vendored
4
static/gameboy2.html
vendored
|
|
@ -42,8 +42,8 @@
|
|||
|
||||
|
||||
<div id="color-button-holder">
|
||||
<div id="btn-select" unselectable="on" class="btn unselectable" value="select">Y</div>
|
||||
<div id="btn-start" unselectable="on" class="btn unselectable" value="start">X</div>
|
||||
<div id="btn-select" unselectable="on" class="btn unselectable" value="select">Select</div>
|
||||
<div id="btn-start" unselectable="on" class="btn unselectable" value="start">Start</div>
|
||||
<div id="btn-a" unselectable="on" class="btn unselectable" value="a">A</div>
|
||||
<div id="btn-b" unselectable="on" class="btn unselectable" value="b">B</div>
|
||||
</div>
|
||||
|
|
|
|||
13
static/js/controller.js
vendored
13
static/js/controller.js
vendored
|
|
@ -5,9 +5,9 @@ function showMenuScreen() {
|
|||
$("#game-screen").hide();
|
||||
$("#menu-screen").hide();
|
||||
// show
|
||||
$("#game-screen").show().delay(DEBUG?0:1000).fadeOut(400, () => {
|
||||
$("#game-screen").show().delay(DEBUG?0:0).fadeOut(0, () => {
|
||||
log("Loading menu screen");
|
||||
$("#menu-screen").fadeIn(400, () => {
|
||||
$("#menu-screen").fadeIn(0, () => {
|
||||
chooseGame(gameIdx, true);
|
||||
screenState = "menu";
|
||||
});
|
||||
|
|
@ -19,9 +19,9 @@ function showMenuScreen() {
|
|||
function chooseGame(idx, force = false) {
|
||||
if (idx < 0 || (idx == gameIdx && !force) || idx >= gameList.length) return false;
|
||||
|
||||
$("#menu-screen #box-art").fadeOut(DEBUG?0:400, function () {
|
||||
$("#menu-screen #box-art").fadeOut(DEBUG?0:0, function () {
|
||||
$(this).attr("src", `/static/img/boxarts/${gameList[idx].name}.png`);
|
||||
$(this).fadeIn(400, function () {
|
||||
$(this).fadeIn(0, function () {
|
||||
$("#menu-screen #title p").html(gameList[idx].name);
|
||||
});
|
||||
});
|
||||
|
|
@ -109,8 +109,13 @@ function doButtonUp(name) {
|
|||
break;
|
||||
|
||||
case "join":
|
||||
case "a":
|
||||
case "b":
|
||||
case "start":
|
||||
case "select":
|
||||
startGame();
|
||||
// log("select game");
|
||||
break;
|
||||
}
|
||||
} else if (screenState === "game") {
|
||||
setState(name, false);
|
||||
|
|
|
|||
2
static/js/ws.js
vendored
2
static/js/ws.js
vendored
|
|
@ -209,7 +209,7 @@ function startGame() {
|
|||
|
||||
// clear menu screen
|
||||
stopInputTimer();
|
||||
$("#menu-screen").fadeOut(DEBUG?0:400, function() {
|
||||
$("#menu-screen").fadeOut(DEBUG?0:0, function() {
|
||||
$("#game-screen").show();
|
||||
});
|
||||
// end clear
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package worker
|
|||
|
||||
import (
|
||||
"log"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/giongto35/cloud-game/config"
|
||||
"github.com/giongto35/cloud-game/cws"
|
||||
|
|
@ -105,7 +107,9 @@ func (h *Handler) RouteOverlord() {
|
|||
if room.IsPCInRoom(session.peerconnection) {
|
||||
h.detachPeerConn(session.peerconnection)
|
||||
}
|
||||
//session.Close()
|
||||
start := time.Now()
|
||||
runtime.GC()
|
||||
log.Printf("GC takes %s\n", time.Since(start))
|
||||
|
||||
return cws.EmptyPacket
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue