mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 17:53:55 +00:00
feat: update achievement audio and refactors
This commit is contained in:
@@ -62,29 +62,35 @@ export const mergeAchievements = async (
|
||||
};
|
||||
});
|
||||
|
||||
if (newAchievements.length) {
|
||||
const achievement = newAchievements.at(-1)!;
|
||||
const achievementInfo = JSON.parse(
|
||||
localGameAchievement?.achievements || "[]"
|
||||
).find((steamAchievement) => {
|
||||
return achievement.name === steamAchievement.name;
|
||||
});
|
||||
if (newAchievements.length && publishNotification) {
|
||||
const achievementsInfo = newAchievements
|
||||
.map((achievement) => {
|
||||
return JSON.parse(localGameAchievement?.achievements || "[]").find(
|
||||
(steamAchievement) => {
|
||||
return achievement.name === steamAchievement.name;
|
||||
}
|
||||
);
|
||||
})
|
||||
.filter((achievement) => achievement)
|
||||
.map((achievement) => {
|
||||
return {
|
||||
displayName: achievement.displayName,
|
||||
iconUrl: achievement.icon,
|
||||
};
|
||||
});
|
||||
|
||||
if (publishNotification) {
|
||||
WindowManager.notificationWindow?.webContents.send(
|
||||
"on-achievement-unlocked",
|
||||
objectId,
|
||||
shop,
|
||||
achievementInfo.displayName,
|
||||
achievementInfo.icon
|
||||
);
|
||||
WindowManager.notificationWindow?.webContents.send(
|
||||
"on-achievement-unlocked",
|
||||
objectId,
|
||||
shop,
|
||||
achievementsInfo
|
||||
);
|
||||
|
||||
WindowManager.notificationWindow?.setBounds({ y: 50 });
|
||||
WindowManager.notificationWindow?.setBounds({ y: 50 });
|
||||
|
||||
setTimeout(() => {
|
||||
WindowManager.notificationWindow?.setBounds({ y: -9999 });
|
||||
}, 4000);
|
||||
}
|
||||
setTimeout(() => {
|
||||
WindowManager.notificationWindow?.setBounds({ y: -9999 });
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
const mergedLocalAchievements = unlockedAchievements.concat(newAchievements);
|
||||
|
||||
@@ -29,12 +29,12 @@ export const watchProcesses = async () => {
|
||||
if (games.length === 0) return;
|
||||
const processes = await PythonInstance.getProcessList();
|
||||
|
||||
const processSet = new Set(processes.map((process) => process.exe));
|
||||
|
||||
for (const game of games) {
|
||||
const executablePath = game.executablePath!;
|
||||
|
||||
const gameProcess = processes.find((runningProcess) => {
|
||||
return executablePath == runningProcess.exe;
|
||||
});
|
||||
const gameProcess = processSet.has(executablePath);
|
||||
|
||||
if (gameProcess) {
|
||||
if (gamesPlaytime.has(game.id)) {
|
||||
|
||||
Reference in New Issue
Block a user