Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Changelog update and crucial bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
creepycats committed Oct 20, 2021
1 parent 2a451be commit 73faa0f
Show file tree
Hide file tree
Showing 30 changed files with 357 additions and 38 deletions.
Binary file modified GatoClientElectron/.vs/GatoClientElectron/v16/.suo
Binary file not shown.
4 changes: 2 additions & 2 deletions GatoClientElectron/.vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"",
"\\app",
"\\app\\scripts",
"\\app\\settings"
"\\app\\splash"
],
"SelectedNode": "\\app\\main.js",
"SelectedNode": "\\app\\splash\\splashPreload.js",
"PreviewInSolutionExplorer": false
}
Binary file modified GatoClientElectron/.vs/slnx.sqlite
Binary file not shown.
3 changes: 3 additions & 0 deletions GatoClientElectron/app/.vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file added GatoClientElectron/app/.vs/slnx.sqlite
Binary file not shown.
27 changes: 27 additions & 0 deletions GatoClientElectron/app/changelog/changelog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<head>
<link rel="stylesheet" href="css/changelog.css">
</head>
<body>
<div class="titleHolder">
<img src="images/logo.png" class="titleImage" width="75" height="75">
<h3 class="title">Gatoclient Changelog</h3>
</div>
<div class="container">
<div id="content">
<form action="">
<div>
<h2>General</h2>
<p>Added Changelog Menu</p>
<p>Changed Krunker Update Log Button to Gatoclient</p>
<p>Updated Some CSS to fit the Update Log (More Soon)</p>
</div>
<div>
<h2>Fixes</h2>
<p>Fixed FPS Uncap (again...)</p>
<p>Another Potential Update Splash Screen Fix</p>
<p>Fixed my cat...</p>
</div>
</form>
</div>
</div>
</body>
77 changes: 77 additions & 0 deletions GatoClientElectron/app/changelog/css/changelog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@font-face {
font-family: BaiJamjuree-Light;
src: url(../fonts/BaiJamjuree-Light.ttf);
font-weight: normal;
}
@font-face {
font-family: BaiJamjuree-Bold;
src: url(../fonts/BaiJamjuree-Bold.ttf);
font-weight: normal;
}
body {
background-image: url("../images/background.jpg");
background-size: cover;
background-repeat: no-repeat;
background-color: #cccccc;
font-family: BaiJamjuree-Light;
color:white;
padding: 0px 0px 0px 0px;
overflow: hidden !important;
}
.titleHolder {
margin: 0px 20px 0px 0px;
overflow: auto;
color:#f1f1f1;
font-size: 24px;
border:solid #fff;
border-radius:4px;
padding:10px 30px 0px 30px;
background-color: rgba(0,0,0,0.2);
width:400px;
border-width: 0px 2px 0px 2px;
}
.titleImage {
float: left
}
.titleImage img {
display: block
}
.title {
margin-left: 80px;
font-family: BaiJamjuree-Bold;
position:relative;
top:-5px;
}
h2 {
overflow: auto;
color:#f1f1f1;
border:solid #fff;
border-width: 0px 2px 0px 2px;
border-radius:4px;
padding:10px 30px 10px 30px;
background-color: rgba(0,0,0,0.2);
width:400px;
margin-top:8px;
margin-bottom:8px;
font-family: BaiJamjuree-Bold;
}
p {
overflow: auto;
color:#d4d4d4;
border:solid #b5b5b5;
border-width: 0px 2px 0px 2px;
border-radius:4px;
padding:10px 30px 10px 30px;
background-color: rgba(0,0,0,0.2);
width:400px;
margin-top:2px;
margin-bottom:2px;
}
p:nth-child(even) {
padding:10px 30px 10px 30px;
background-color: rgba(92, 92, 92,0.4);
}
p:nth-child(odd) {
padding:10px 30px 10px 30px;
background-color: rgba(48, 48, 48,0.3);
}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 113 additions & 35 deletions GatoClientElectron/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,31 @@ ipcMain.on('openSettings', (event) => {
})
});

// When Changelog Clicked Open Changelog
ipcMain.on('openChangelog', (event) => {
// Settings Menu Initialized
let chlgWindow = new BrowserWindow({
width: 490,
height: 725,
resizable: false
});
chlgWindow.loadURL(path.join(__dirname, 'changelog/changelog.html'));
chlgWindow.show();
chlgWindow.center();
chlgWindow.removeMenu();

// Close on main close
mainWindow.on('close', function () {
if (chlgWindow != null)
chlgWindow.close();
})

// Fix Object Destroyed Error with Closing
chlgWindow.on('close', function () {
chlgWindow = null;
})
});

// Save settings when sent to main process
let inputs;
ipcMain.on('savedSettings', (event, preferences) => {
Expand All @@ -89,49 +114,110 @@ ipcMain.on('savedSettings', (event, preferences) => {
ipcMain.on('preloadNeedSettings', (event) => {
mainWindow.webContents.send('preloadSettings', path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json"));
});
ipcMain.on('splashNeedInfo', (event) => {
splashWindow.webContents.send('splashInfo', app.getVersion());
});

//Listen for app to get ready
app.on('ready', function () {
// Before we can read the settings, we need to make sure they exist, if they don't, then we create a template
if (fs.existsSync(path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json")) == false) {
fs.writeFileSync(path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json"), '{ "fpsUncap": false, "discordrpc": true, "skyColor": false, "skyColorValue": "#FF0000" }', { flag: 'wx' }, function (err) {
if (err) throw err;
console.log("It's saved!");
});
}
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}

// Read settings to apply them to the command line arguments
let filePath = path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json");
let userPrefs = JSON.parse(fs.readFileSync(filePath));
if (userPrefs['fpsUncap'] == true) {
app.commandLine.appendSwitch('disable-frame-rate-limit');
app.commandLine.appendSwitch("disable-gpu-vsync");
}
// Before we can read the settings, we need to make sure they exist, if they don't, then we create a template
if (fs.existsSync(path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json")) == false) {
fs.writeFileSync(path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json"), '{ "fpsUncap": false, "discordrpc": true, "skyColor": false, "skyColorValue": "#FF0000" }', { flag: 'wx' }, function (err) {
if (err) throw err;
console.log("It's saved!");
});
}

// Read settings to apply them to the command line arguments
let filePath = path.join(app.getPath("documents"), "GatoclientResourceSwapper/settings.json");
let userPrefs = JSON.parse(fs.readFileSync(filePath));
if (userPrefs['fpsUncap'] == true) {
app.commandLine.appendSwitch('disable-frame-rate-limit');
app.commandLine.appendSwitch("disable-gpu-vsync");
}
// Heres some unused command line switches that I am too lazy to implement right now
// app.commandLine.appendSwitch("autoplay-policy", "no-user-gesture-required");
// app.commandLine.appendSwitch("disable-accelerated-2d-canvas", "true");
// app.commandLine.appendSwitch("in-process-gpu");

//Make the window
mainWindow = new BrowserWindow({
//Listen for app to get ready
app.on('ready', function () {
// Make Splash Screen
splashWindow = new BrowserWindow({
autoHideMenuBar: true,
frame: false,
skipTaskbar: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
preload: path.join(__dirname, 'splash/splashPreload.js')
}
});
mainWindow.setSize(1600, 900);
mainWindow.loadURL(url.format({
pathname: 'https://krunker.io',
splashWindow.setAlwaysOnTop(true, 'pop-up-menu');
splashWindow.loadURL(url.format({
pathname: path.join(__dirname, 'splash/splash.html'),
icon: __dirname + 'src/cat.ico' // Doesn't work anymore just ignore it
}));
mainWindow.center();
mainWindow.removeMenu();
var mainWindowIsFullscreen = false;
splashWindow.setSize(512, 256);
splashWindow.center();
splashWindow.removeMenu();

// Check for updates
mainWindow.once('ready-to-show', () => {
autoUpdater.checkForUpdatesAndNotify();
splashWindow.once('ready-to-show', () => {
autoUpdate();
});
async function autoUpdate() {
return new Promise((resolve, reject) => {
autoUpdater.checkForUpdatesAndNotify();

// Testing Only
launchGame();
resolve();

// Splash screen no update
autoUpdater.on('update-not-available', () => {
launchGame();
resolve();
});
// Splash screen update shits
autoUpdater.on('update-available', () => {
splashWindow.webContents.send('newVersion');
mainWindow.close();
});
autoUpdater.on('update-downloaded', () => {
autoUpdater.quitAndInstall();
});
});
}
// Splash Screen Shit
function launchGame() {
splashWindow.webContents.send('latest');
setTimeout(() => launchMainWindow(), 2000);
setTimeout(() => splashWindow.destroy(), 2000);
}

//Make the window
mainWindow = new BrowserWindow({
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
}
});
mainWindow.hide();

function launchMainWindow() {
mainWindow.show();
mainWindow.setSize(1600, 900);
mainWindow.loadURL(url.format({
pathname: 'https://krunker.io',
icon: __dirname + 'src/cat.ico' // Doesn't work anymore just ignore it
}));
mainWindow.center();
mainWindow.removeMenu();
var mainWindowIsFullscreen = false;
}

// Rich Presence
ipcMain.handle("rpc-activity",
Expand Down Expand Up @@ -189,14 +275,6 @@ app.on('ready', function () {
})
});

// Handle Updating
autoUpdater.on('update-available', () => {
// mainWindow.webContents.send('update_available');
});
autoUpdater.on('update-downloaded', () => {
autoUpdater.quitAndInstall();
});

// Just to make sure the Client Closes fully
app.on('window-close-all', () => {
app.quit();
Expand Down
8 changes: 8 additions & 0 deletions GatoClientElectron/app/packagedCSS/main_custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,12 @@
transform:translate(-50%,-50%);
position:fixed;
top:55%;
}

/* Flashing Updates Box */
#updateAd{
box-shadow:unset;
animation-name:freeKRPulse;
animation-duration:2s;
animation-iteration-count:infinite
}
30 changes: 30 additions & 0 deletions GatoClientElectron/app/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,36 @@ document.addEventListener("DOMContentLoaded", (event) => {
const { ipcRenderer } = require('electron');
ipcRenderer.send('preloadNeedSettings');
menuItem.addEventListener("click", (event) => { ipcRenderer.send('openSettings'); });

// Remove the broken revjet ad
if (document.contains(document.getElementById("revjet_container"))) {
document.getElementById("revjet_container").remove();
}

// Changelogs
const oldIcon = document.getElementById("updateAdIcon");
const updateHolder = document.getElementById("updateAd");
oldIcon.remove();
const newIcon = document.createElement("img");
newIcon.setAttribute("id", "helpPIcon");
newIcon.setAttribute("src", "https://cdn.discordapp.com/attachments/661004708852269080/899301043672842250/settingIcon.png");
updateHolder.insertBefore(newIcon, updateHolder.children[0]);
const updateDetailText = document.getElementById("updateAdVersion");
const HelpTextHoldersArray = document.querySelectorAll("#helpTxtHol");
console.log(HelpTextHoldersArray);
const updateDetailHolder = HelpTextHoldersArray[5];
updateDetailText.remove();
const newDetailText = document.createElement("div");
newDetailText.setAttribute("id", "helpGuidOpn");
newDetailText.innerHTML = "Gatoclient Updates";
updateDetailHolder.appendChild(newDetailText);

// Changelogs Click Event
const updateAdHolder = document.getElementById("updateAd");
updateAdHolder.removeAttribute("onclick");
updateAdHolder.addEventListener("click", (event) => {
ipcRenderer.send('openChangelog');
});
})

// Fix settings importing
Expand Down
Binary file not shown.
Binary file added GatoClientElectron/app/splash/images/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 73faa0f

Please sign in to comment.