diff --git a/README.md b/README.md new file mode 100644 index 0000000..f5aa186 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Garry's Mod Addon Tool \ No newline at end of file diff --git a/index.html b/index.html index 2e99033..b1882e9 100644 --- a/index.html +++ b/index.html @@ -62,6 +62,7 @@
Please select an icon for your addon
+Must be a JPEG/JPG
Do you already have a addon.json?
(file names seprated by a comma)
Created addon.json!
+Upload to the Workshop?
- - +Uploading to the workshop...
+ +Uploaded!
+ +Error:
+ +Saved!
diff --git a/index.js b/index.js index a294b36..80543c8 100644 --- a/index.js +++ b/index.js @@ -30,6 +30,7 @@ function createWindow() { backgroundColor: "#262626", titleBarStyle: "hidden", frame: false, + icon: "src/img/icon.png", webPreferences: { nodeIntegration: true } @@ -77,9 +78,9 @@ ipcMain.on('checkIfDirectoryExists', (event, file) => { }) ipcMain.on('getAddonInfo', () => { - console.log('trying to get addon info') + console.log('Trying to get addon info...') sendClientAddonInfo() - console.log(settings.get('gmodDirectory')) + console.log("User's Gmod Directory:" + settings.get('gmodDirectory')) }) var ADDON_IDS = [] @@ -95,8 +96,7 @@ function sendClientAddonInfo() { fixedArray[i] = fixedArray[i].replace('/r', ''); ADDON_IDS.push([fixedArray[i].substr(0, 11).replace(/\s/g, '').toString()]) } - - console.log('sent to client!') + console.log('Sent to client!') mainWindow.webContents.send('message', ADDON_IDS); }); } @@ -105,6 +105,7 @@ ipcMain.on('createJsonFile', (event, json, dir) => { console.log(json, dir) fs.writeFileSync(dir + "\\addon.json", json, 'utf8', (err) => { console.log("An error occured while writing JSON Object to File.\n", err); + mainWindow.webContents.send('error', "Error writing directory."); }) }) @@ -118,16 +119,23 @@ ipcMain.on('createGMAFile', (event, addonDir) => { var addonGMADir = fixedArray; console.log("GMA location: " + addonGMADir); mainWindow.webContents.send('addonGMALocation', addonGMADir); - }) -}) + }); +}); ipcMain.on('uploadToWorkshop', (event, gmaDir, iconDir) => { const gmpublish = spawn(settings.get('gmodDirectory') + '\\bin\\gmpublish.exe', ['create', '-icon', iconDir, '-addon', gmaDir]); gmpublish.stdout.on('data', (data) => { - console.log(data.toString()); + var arrayOfOutput = data.toString().split('\n') + var fixedArray = arrayOfOutput.slice(arrayOfOutput.length - 8, arrayOfOutput.length - 7) + fixedArray = fixedArray[0].replace(/\D/, '') + fixedArray = fixedArray.substr(5, fixedArray.length) + console.log(fixedArray) + mainWindow.webContents.send('currentAddonID', fixedArray); }) }) + + // gmpublish.exe create -icon path/to/image512x512.jpg -addon path/to/gma.gma \ No newline at end of file diff --git a/src/css/style.css b/src/css/style.css index 1812e4d..6894f19 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -164,7 +164,7 @@ header { text-align: center; } -#update_existing_addon, #directory_selection, #create_new_addon, #jsonCreator, #gmaPrep, #addonjsonPrompt, #addon_management_prompt, #createGMA, #uploadToWorkshopPrompt, #addonIconPrompt { +#update_existing_addon, #directory_selection, #create_new_addon, #jsonCreator, #gmaPrep, #addonjsonPrompt, #addon_management_prompt, #createGMA, #uploadToWorkshopPrompt, #addonIconPrompt, #uploading, #new_addon, #errorNote { display: none; } @@ -232,6 +232,11 @@ header { margin: 0 } +.addon_existing a { + color: white; + display: none; +} + .removeBackOption { width: 100px; } diff --git a/src/img/icon.png b/src/img/icon.png new file mode 100644 index 0000000..8f2860b Binary files /dev/null and b/src/img/icon.png differ diff --git a/src/js/script.js b/src/js/script.js index 8f84a9b..385697a 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -144,9 +144,6 @@ $(document).ready(() => { $('#addonIconCheck').css('background-color', '#56bd56'); $('#addonIconCheck').prop('disabled', false); $('#addonIconCheck').css('cursor', 'pointer'); - win.setBounds({ - height: 350 - }) } else { $('#addonIconCheck').css('background-color', '#0f0f0f'); $('#addonIconCheck').prop('disabled', true); @@ -193,6 +190,7 @@ $(document).ready(() => { var divToGoBack = $(target).data('divtohide'); var divToShow = $(target).data('divtoshow'); console.log(divToGoBack, divToShow) + // Checks for resize data, if it exists, pass it to goBack() if ($(target).data('resize') != null) { var resizeInfo = JSON.parse("[" + $(target).data('resize') + "]"); } @@ -203,7 +201,7 @@ $(document).ready(() => { $('#back_button_addon_creation').fadeOut(); }) - // General function for transitioning between div tags + // General function for transitioning between div tags (with a shitty name) function goBack(divToFadeOut, divToFadeIn, resizeInfo) { $(divToFadeOut).fadeOut(() => { if (resizeInfo != null) { @@ -221,7 +219,7 @@ $(document).ready(() => { // This check is done to make sure this only gets executed once if (!donePopulatingAddonList) { for (let i = 0; i < addon_data.length; i++) { - $('#yourAddons').append("" + addon_data[i].title + "
" + addon_data[i].title + "
View on Steam