mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
ELECTRON: Use steamworks.js to integrate with Steamworks SDK (#1563)
This commit is contained in:
@@ -5,6 +5,7 @@ const Store = require("electron-store");
|
||||
const utils = require("./utils");
|
||||
const storage = require("./storage");
|
||||
const store = new Store();
|
||||
const { steamworksClient } = require("./steamworksUtils");
|
||||
|
||||
function getMenu(window) {
|
||||
const canZoomIn = utils.getZoomFactor() <= 2;
|
||||
@@ -54,7 +55,7 @@ function getMenu(window) {
|
||||
},
|
||||
{
|
||||
label: "Export Scripts",
|
||||
click: async () => window.webContents.send("trigger-scripts-export"),
|
||||
click: () => window.webContents.send("trigger-scripts-export"),
|
||||
},
|
||||
{
|
||||
type: "separator",
|
||||
@@ -74,7 +75,7 @@ function getMenu(window) {
|
||||
{
|
||||
label: "Load From File",
|
||||
click: async () => {
|
||||
const defaultPath = await storage.getSaveFolder(window);
|
||||
const defaultPath = storage.getSaveFolder(window);
|
||||
const result = await dialog.showOpenDialog(window, {
|
||||
title: "Load From File",
|
||||
defaultPath: defaultPath,
|
||||
@@ -103,7 +104,7 @@ function getMenu(window) {
|
||||
click: async () => {
|
||||
try {
|
||||
const saveData = await storage.getSteamCloudSaveData();
|
||||
await storage.pushSaveGameForImport(window, saveData, false);
|
||||
storage.pushSaveGameForImport(window, saveData, false);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
utils.writeToast(window, "Could not load from Steam Cloud", "error", 5000);
|
||||
@@ -126,7 +127,7 @@ function getMenu(window) {
|
||||
{
|
||||
label: "Auto-Save to Steam Cloud",
|
||||
type: "checkbox",
|
||||
enabled: !global.greenworksError,
|
||||
enabled: steamworksClient !== undefined,
|
||||
checked: storage.isCloudEnabled(),
|
||||
click: (menuItem) => {
|
||||
storage.setCloudEnabledConfig(menuItem.checked);
|
||||
@@ -166,8 +167,8 @@ function getMenu(window) {
|
||||
},
|
||||
{
|
||||
label: "Open Saves Directory",
|
||||
click: async () => {
|
||||
const path = await storage.getSaveFolder(window);
|
||||
click: () => {
|
||||
const path = storage.getSaveFolder(window);
|
||||
shell.openPath(path);
|
||||
},
|
||||
},
|
||||
@@ -289,10 +290,15 @@ function getMenu(window) {
|
||||
},
|
||||
{
|
||||
label: "Delete Steam Cloud Data",
|
||||
enabled: !global.greenworksError,
|
||||
click: async () => {
|
||||
enabled: steamworksClient !== undefined,
|
||||
click: () => {
|
||||
if (steamworksClient.cloud.listFiles().length === 0) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await storage.deleteCloudFile();
|
||||
if (!storage.deleteCloudFile()) {
|
||||
log.warn("Cannot delete Steam Cloud data");
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user