diff --git a/cmd/frontend/src/components/items/InspirationWindow.vue b/cmd/frontend/src/components/items/InspirationWindow.vue
index f52c9f1..ffd1611 100644
--- a/cmd/frontend/src/components/items/InspirationWindow.vue
+++ b/cmd/frontend/src/components/items/InspirationWindow.vue
@@ -1,31 +1,43 @@
-
-
-
Inspiration
-
-
-
- {{ game }}
-
-
-
+
+
+
+
+ {{ game }}
+
+
+
diff --git a/cmd/frontend/src/components/items/extraButtons.vue b/cmd/frontend/src/components/items/extraButtons.vue
index 4f23296..4e54646 100644
--- a/cmd/frontend/src/components/items/extraButtons.vue
+++ b/cmd/frontend/src/components/items/extraButtons.vue
@@ -1,109 +1,111 @@
-
+
diff --git a/cmd/frontend/src/components/items/playersWindow.vue b/cmd/frontend/src/components/items/playersWindow.vue
index 331e825..5dfe650 100644
--- a/cmd/frontend/src/components/items/playersWindow.vue
+++ b/cmd/frontend/src/components/items/playersWindow.vue
@@ -1,46 +1,46 @@
-
-
-
-
-
{{ player.playerName }}: {{ player.score }}
+
+
+

+

+
Players

-
-
-

-
-
-
-
-
-
-
-
-
+
+
+
+
{{ player.playerName }}: {{ player.score }}
+
![]()
+
+
+

+
+
+
+
+
+
+
+
+
diff --git a/cmd/frontend/src/components/items/settingsModal.vue b/cmd/frontend/src/components/items/settingsModal.vue
index d9a9005..9b6e3ff 100644
--- a/cmd/frontend/src/components/items/settingsModal.vue
+++ b/cmd/frontend/src/components/items/settingsModal.vue
@@ -32,6 +32,16 @@
/>
+
{}); */
if (!trackAddedToQue) {
- await this.APIaddToQue();
+ await this.APIaddPlayed();
}
+ await this.APIaddToQue();
await this.APIgetPlaylistHistory();
this.$refs.audioPlayer.play();
@@ -139,6 +144,15 @@ export default {
this.$refs.audioPlayer.play();
});
},
+ playMatchSound() {
+ this.$refs.audioPlayer.pause();
+ this.currentTrackSrcFile = "sounds/sound0.mp3";
+ this.$store.dispatch("setSpecialTrackIsPlaying", true);
+ this.$nextTick(() => {
+ this.$refs.audioPlayer.currentTime = 0;
+ this.$refs.audioPlayer.play();
+ });
+ },
playWinningSound() {
this.$refs.audioPlayer.pause();
this.currentTrackSrcFile = "sounds/winning.mp3";
@@ -208,6 +222,21 @@ export default {
});
});
},
+ APIaddPlayed() {
+ return new Promise((resolve, reject) => {
+ this.axios({
+ method: "get",
+ url: `${arne.hostname}/music/addPlayed`,
+ })
+ .then(() => {
+ resolve(false);
+ })
+ .catch(function(error) {
+ console.log(error);
+ reject();
+ });
+ });
+ },
APIaddToQue() {
return new Promise((resolve, reject) => {
this.axios({
diff --git a/cmd/frontend/src/components/layout/TheMain.vue b/cmd/frontend/src/components/layout/TheMain.vue
index fa9b7c0..986d16f 100644
--- a/cmd/frontend/src/components/layout/TheMain.vue
+++ b/cmd/frontend/src/components/layout/TheMain.vue
@@ -1,29 +1,30 @@
-
+
diff --git a/cmd/frontend/src/main.js b/cmd/frontend/src/main.js
index 25094a8..5970a49 100644
--- a/cmd/frontend/src/main.js
+++ b/cmd/frontend/src/main.js
@@ -30,6 +30,7 @@ const store = createStore({
/* Options */
stopAfterCurrent: true,
hideNextTrack: true,
+ addPlayed: true,
lowPlayed: false,
};
},
@@ -67,6 +68,9 @@ const store = createStore({
changePlayerWelcomed(state, payload) {
state.listOfPlayers[payload.indexOfPlayer].welcomed = payload.playerWelcomeTrueOrFalse;
},
+ changePlayerMatchPoint(state, payload) {
+ state.listOfPlayers[payload.indexOfPlayer].matchPoint = payload.playerMatchPointTrueOrFalse;
+ },
changePlayerProfile(state, payload) {
state.listOfPlayers[payload.indexOfPlayer].profile = payload.profileSrc;
},
@@ -76,6 +80,9 @@ const store = createStore({
resetPlayerWelcomed(state, payload) {
state.listOfPlayers = payload;
},
+ resetPlayerMatchPoint(state, payload) {
+ state.listOfPlayers = payload;
+ },
updateLocalPlaylist(state, payload) {
state.localPlaylist.push(payload);
},
@@ -94,6 +101,9 @@ const store = createStore({
updateHideNextTitle(state, payload) {
state.hideNextTrack = payload;
},
+ updateAddPlayed(state, payload) {
+ state.addPlayed = payload;
+ },
updateLowPlayed(state, payload) {
state.lowPlayed = payload;
},
@@ -135,6 +145,7 @@ const store = createStore({
playerName: payload,
score: 0,
welcomed: false,
+ matchPoint: false,
profile: "characters/noCharacter.png",
};
newPlayerList.push(newPlayer);
@@ -162,6 +173,17 @@ const store = createStore({
playerWelcomeTrueOrFalse,
});
},
+ changePlayerMatchPoint(context, payload) {
+ let copyOfPlayerList = this.state.listOfPlayers;
+ let indexOfPlayer = copyOfPlayerList.findIndex(
+ (player) => player.playerName === payload.playerName
+ );
+ let playerMatchPointTrueOrFalse = payload.matchPointSet;
+ context.commit("changePlayerMatchPoint", {
+ indexOfPlayer,
+ playerMatchPointTrueOrFalse,
+ });
+ },
changePlayerProfile(context, payload) {
let copyOfPlayerList = this.state.listOfPlayers;
let indexOfPlayer = copyOfPlayerList.findIndex(
@@ -189,6 +211,14 @@ const store = createStore({
}
context.commit("resetPlayerWelcomed", copyOfPlayerList);
},
+ resetPlayerMatchPoint(context) {
+ /* The JSON.parse and JSON.stringify parts are used to make a copy that doesn't affect the original */
+ let copyOfPlayerList = JSON.parse(JSON.stringify(this.state.listOfPlayers));
+ for (let i = 0; i < copyOfPlayerList.length; i++) {
+ copyOfPlayerList[i].matchPoint = false;
+ }
+ context.commit("resetPlayerMatchPoint", copyOfPlayerList);
+ },
updateLocalPlaylist(context, payload) {
context.commit("updateLocalPlaylist", payload);
},
@@ -207,6 +237,9 @@ const store = createStore({
updateHideNextTitle(context, payload) {
context.commit("updateHideNextTitle", payload);
},
+ updateAddPlayed(context, payload) {
+ context.commit("updateAddPlayed", payload);
+ },
updateLowPlayed(context, payload) {
context.commit("updateLowPlayed", payload);
},
diff --git a/pkg/api/music.go b/pkg/api/music.go
index 9800c67..b0861b3 100644
--- a/pkg/api/music.go
+++ b/pkg/api/music.go
@@ -88,3 +88,8 @@ func (m *Music) AddLatestToQue(ctx *gin.Context) {
server.AddLatestToQue()
ctx.Status(http.StatusOK)
}
+
+func (m *Music) AddLatestPlayed(ctx *gin.Context) {
+ server.AddLatestPlayed()
+ ctx.Status(http.StatusOK)
+}
diff --git a/pkg/conf/conf.go b/pkg/conf/conf.go
index 12899ac..86676f3 100644
--- a/pkg/conf/conf.go
+++ b/pkg/conf/conf.go
@@ -79,6 +79,7 @@ func SetupRestServer(swagger embed.FS) {
musicGroup.GET("all/random", music.GetAllGamesRandom)
musicGroup.PUT("played", music.PutPlayed)
musicGroup.GET("addQue", music.AddLatestToQue)
+ musicGroup.GET("addPlayed", music.AddLatestPlayed)
}
index := api.NewIndex()
diff --git a/pkg/server/music.go b/pkg/server/music.go
index 7651bb2..dca83a6 100644
--- a/pkg/server/music.go
+++ b/pkg/server/music.go
@@ -36,12 +36,17 @@ func Reset() {
func AddLatestToQue() {
if lastFetched.Path != "" {
currentSong = len(songQue)
- db.AddGamePlayed(lastFetched.GameId)
songQue = append(songQue, lastFetched)
lastFetched = models.SongData{}
}
}
+func AddLatestPlayed() {
+ if lastFetched.Path != "" {
+ db.AddGamePlayed(lastFetched.GameId)
+ }
+}
+
func GetRandomSong() string {
if games == nil || len(games) == 0 {
games = db.FindAllGames()