diff --git a/Release/com.f00d4tehg0dz.cookieclicker.streamDeckPlugin b/Release/com.f00d4tehg0dz.cookieclicker.streamDeckPlugin index 9f0f951..5d72781 100644 Binary files a/Release/com.f00d4tehg0dz.cookieclicker.streamDeckPlugin and b/Release/com.f00d4tehg0dz.cookieclicker.streamDeckPlugin differ diff --git a/com.f00d4tehg0dz.cookieclicker.sdPlugin/cookieclicker.html b/com.f00d4tehg0dz.cookieclicker.sdPlugin/cookieclicker.html index 51db074..f081284 100644 --- a/com.f00d4tehg0dz.cookieclicker.sdPlugin/cookieclicker.html +++ b/com.f00d4tehg0dz.cookieclicker.sdPlugin/cookieclicker.html @@ -2,7 +2,7 @@ - + com.f00d4tehg0dz.cookieclicker @@ -12,19 +12,19 @@
-
Enter Name for LeaderBoard
- - +
Name
+ +
LeaderBoard
- +
Instructions

Click the cookie to make more cookies
- Cookie Title upgrades and inserts multiplier as you reach cookie clicker milestones + Cookie titles upgrade and X a multiplier as you reach cookie clicker milestones

You can learn more about this plugin by visiting its

@@ -47,26 +47,24 @@ } let settings = $SD.actionInfo.payload.settings; + if (settings.nameKey) { $("#nameKey").val(settings.nameKey); } - if (settings.nameKey == null) { - $("#nameKey").val(null); - } }); } + function openGithub() { - console.log("hel") - $SD.api.openUrl($SD.actionInfo.context, - "https://github.com/f00d4tehg0dz/elgato-streamdeck-cookie-clicker") - } - - function openLeaderBoard() { - $SD.api.openUrl($SD.actionInfo.context, - "https://cookie-clicker-leader-board-react.vercel.app/") - } + + $SD.api.openUrl($SD.actionInfo.context, + "https://github.com/f00d4tehg0dz/elgato-streamdeck-cookie-clicker") + } + + function openLeaderBoard() { + $SD.api.openUrl($SD.actionInfo.context, + "https://cookie-clicker-leader-board-react.vercel.app/") + } $(document).ready(function () { - $("#updateButton").click(function () { let nameKey = $("#nameKey").val(); @@ -80,6 +78,21 @@ $SD.api.sendToPlugin(uuid, actionName, payload); } }); + + $("#saveButton").click(function () { + let nameKey = $("#nameKey").val(); + + if (!$("#nameKey").val()) { + return; + } + if ($SD && $SD.connection) { + let payload = {}; + let saveBtn = true; + payload.nameKey = nameKey; + payload.saveBtn = saveBtn; + $SD.api.sendToPlugin(uuid,actionName, payload); + } + }); }); diff --git a/com.f00d4tehg0dz.cookieclicker.sdPlugin/js/app.js b/com.f00d4tehg0dz.cookieclicker.sdPlugin/js/app.js index c9c442d..42b7cf0 100644 --- a/com.f00d4tehg0dz.cookieclicker.sdPlugin/js/app.js +++ b/com.f00d4tehg0dz.cookieclicker.sdPlugin/js/app.js @@ -16,9 +16,10 @@ if ($SD) { }); $SD.on(actionName + ".willAppear", function(jsonObj) { - let settings = jsonObj.payload.settings; - - if (settings.automaticRefresh) { + let uuid = jsonObj.context; + let settings = jsonObj.payload; + //setLeaderBoardScore(settings, uuid); + if (settings.nameKey) { initiateStatus(jsonObj.context, jsonObj.payload.settings); } @@ -27,14 +28,24 @@ if ($SD) { $SD.on(actionName + ".sendToPlugin", function(jsonObj) { let uuid = jsonObj.context; let settings = jsonObj.payload; - setLeaderBoardScore(settings, uuid); - //$SD.api.setSettings(jsonObj.context, jsonObj.payload); - //initiateStatus(jsonObj.context, jsonObj.payload); + + if (!settings.saveBtn == true) { + $SD.api.setSettings(jsonObj.context, jsonObj.payload); + setLeaderBoardScore(settings, uuid); + initiateStatus(jsonObj.context, jsonObj.payload); + } + else { + initiateStatus(jsonObj.context, jsonObj.payload.settings); + $SD.api.setSettings(jsonObj.context, jsonObj.payload); + } + }); + // When pressed, Cookie Clicker Activates! $SD.on(actionName + ".keyUp", function(jsonObj) { - initiateStatus(jsonObj.context, jsonObj.payload.settings); + setLeaderBoardScore(settings, uuid); + setNumberIncrease(jsonObj.context, jsonObj.payload.settings) console.log(); }); @@ -65,6 +76,10 @@ if ($SD) { getResults(result => resultCallback(result, context, settings)); } + function setNumberIncrease(context, settings) { + $SD.api.setTitle(context, "Updating"); + getResultsIncrease(result => resultCallback(result, context, settings)); + } function numbersBoard(result) { var resultString = result.number; ctx.font = 'bold 48px Arial'; @@ -190,7 +205,7 @@ if ($SD) { ctx.clearRect(0, 0, canvas.width, canvas.height); } - function getResults(updateTitleFn) { + function getResultsIncrease(updateTitleFn) { // 1x if (localStorage.score >= 0) { @@ -243,4 +258,46 @@ if ($SD) { } } + function getResults(updateTitleFn) { + + // 1x + if (localStorage.score >= 0) { + updateTitleFn(JSON.parse(JSON.stringify({ + "number": localStorage.score, + "title": "Grandma", + }))); + } + + // 2x + if (localStorage.score >= 30) { + updateTitleFn(JSON.parse(JSON.stringify({ + "number": localStorage.score, + "title": "Baker", + }))); + } + + // 10x + if (localStorage.score >= 500) { + updateTitleFn(JSON.parse(JSON.stringify({ + "number": localStorage.score, + "title": "Factory", + }))); + } + + // 30x + if (localStorage.score >= 1000) { + updateTitleFn(JSON.parse(JSON.stringify({ + "number": localStorage.score, + "title": "Plant", + }))); + } + // 1000x + if (localStorage.score >= 100000) { + updateTitleFn(JSON.parse(JSON.stringify({ + "number": localStorage.score, + "title": "S. Plant", + }))); + } + } + } \ No newline at end of file diff --git a/com.f00d4tehg0dz.cookieclicker.sdPlugin/manifest.json b/com.f00d4tehg0dz.cookieclicker.sdPlugin/manifest.json index da99fe6..6c4d614 100644 --- a/com.f00d4tehg0dz.cookieclicker.sdPlugin/manifest.json +++ b/com.f00d4tehg0dz.cookieclicker.sdPlugin/manifest.json @@ -18,15 +18,15 @@ ], "SDKVersion": 2, "Author": "Adrian Chrysanthou", - "Category": "Cookie Clicker [f00d4tehg0dz]", + "Category": "Cookie Clicker", "CategoryIcon": "icons/category-icon", "CodePath": "index.html", - "Description": "A CookieClicker Status plugin developed by Adrian Chrysanthou. You can find more information about this plugin at https://github.com/f00d4tehg0dz/elgato-streamdeck-cookie-clicker. Please report any issues you see on the project's Github page. I welcome any feedback.", + "Description": "A CookieClicker Status plugin developed by Adrian Chrysanthou. Please report any issues you see on the project's Github page. I welcome any feedback.", "Name": "Cookie Clicker", "Icon": "icon", "URL": "https://github.com/f00d4tehg0dz/elgato-streamdeck-cookie-clicker", "PropertyInspectorPath": "cookieclicker.html", - "Version": "3.4", + "Version": "3.3", "OS": [ { "Platform": "mac",