projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some fixes, work on Eightpieces draft, add a few capturing variants
[vchess.git]
/
client
/
src
/
views
/
MyGames.vue
diff --git
a/client/src/views/MyGames.vue
b/client/src/views/MyGames.vue
index
88b6906
..
c9c34f3
100644
(file)
--- a/
client/src/views/MyGames.vue
+++ b/
client/src/views/MyGames.vue
@@
-45,7
+45,7
@@
export default {
};
},
created: function() {
};
},
created: function() {
- GameStorage.getAll(
true,
localGames => {
+ GameStorage.getAll(localGames => {
localGames.forEach(g => g.type = "live");
this.decorate(localGames);
this.liveGames = localGames;
localGames.forEach(g => g.type = "live");
this.decorate(localGames);
this.liveGames = localGames;
@@
-114,22
+114,19
@@
export default {
.classList.add("somethingnew");
}
},
.classList.add("somethingnew");
}
},
- // Called at loading to augment games with
priority
+ myTurn infos
+ // Called at loading to augment games with
myColor
+ myTurn infos
decorate: function(games) {
games.forEach(g => {
decorate: function(games) {
games.forEach(g => {
- g.priority = 0;
+ g.myColor =
+ (g.type == "corr" && g.players[0].uid == this.st.user.id) ||
+ (g.type == "live" && g.players[0].sid == this.st.user.sid)
+ ? 'w'
+ : 'b';
+ // If game is over, myTurn doesn't exist:
if (g.score == "*") {
if (g.score == "*") {
- g.priority++;
- const myColor =
- (g.type == "corr" && g.players[0].uid == this.st.user.id) ||
- (g.type == "live" && g.players[0].sid == this.st.user.sid)
- ? 'w'
- : 'b';
const rem = g.movesCount % 2;
const rem = g.movesCount % 2;
- if ((rem == 0 &&
myColor == 'w') || (rem == 1 && myColor == 'b')) {
+ if ((rem == 0 &&
g.myColor == 'w') || (rem == 1 && g.myColor == 'b'))
g.myTurn = true;
g.myTurn = true;
- g.priority++;
- }
}
});
},
}
});
},
@@
-148,11
+145,7
@@
export default {
// "notifything" --> "thing":
const thing = data.code.substr(6);
game[thing] = info[thing];
// "notifything" --> "thing":
const thing = data.code.substr(6);
game[thing] = info[thing];
- if (thing == "score") game.priority = 0;
- else {
- game.priority = 3 - game.priority; //toggle turn
- game.myTurn = !game.myTurn;
- }
+ if (thing == "turn") game.myTurn = !game.myTurn;
this.$forceUpdate();
this.tryShowNewsIndicator(type);
break;
this.$forceUpdate();
this.tryShowNewsIndicator(type);
break;
@@
-173,15
+166,9
@@
export default {
},
gameInfo
);
},
gameInfo
);
- // Compute priority:
- game.priority = 1; //at least: my running game
- if (
+ game.myTurn =
(type == "corr" && game.players[0].uid == this.st.user.id) ||
(type == "corr" && game.players[0].uid == this.st.user.id) ||
- (type == "live" && game.players[0].sid == this.st.user.sid)
- ) {
- game.priority++;
- game.myTurn = true;
- }
+ (type == "live" && game.players[0].sid == this.st.user.sid);
gamesArrays[type].push(game);
this.$forceUpdate();
this.tryShowNewsIndicator(type);
gamesArrays[type].push(game);
this.$forceUpdate();
this.tryShowNewsIndicator(type);