From f24f3af3779e04c5c1f6e65be3d9b84461a43715 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Thu, 14 Jul 2022 18:05:52 -0700 Subject: [PATCH 1/5] just another normal everyday feature, nothing to see here --- src/ui/components/TopBar.css | 26 ++++++++++++++++++ src/ui/components/TopBar.tsx | 51 +++++++++++++++++++++++++++++++++++- src/utils/configuration.ts | 1 + 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/ui/components/TopBar.css b/src/ui/components/TopBar.css index f6469f8..30b3239 100644 --- a/src/ui/components/TopBar.css +++ b/src/ui/components/TopBar.css @@ -25,4 +25,30 @@ #version { margin: 0px 6px; color: #434343; +} + +#unassumingButton { + font-weight: bold; + margin: 0px 6px; + color: #141414; + + transition: color 0.2s ease-in-out; +} + +#unassumingButton:hover { + color: #434343; +} + +#unassumingButton.spin { + color: #fff; + animation: spin 0.5s ease-in-out; +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } } \ No newline at end of file diff --git a/src/ui/components/TopBar.tsx b/src/ui/components/TopBar.tsx index f1fac63..01b23ec 100644 --- a/src/ui/components/TopBar.tsx +++ b/src/ui/components/TopBar.tsx @@ -10,6 +10,7 @@ import gameBtn from '../../resources/icons/game.svg' import Tr from '../../utils/language' import './TopBar.css' +import { getConfig, setConfigOption } from '../../utils/configuration' interface IProps { optFunc: () => void; @@ -19,13 +20,21 @@ interface IProps { interface IState { version: string; + clicks: number; + intv: NodeJS.Timeout | null; } export default class TopBar extends React.Component { constructor(props: IProps) { super(props) - this.state = { version: '0.0.0' } + this.state = { + version: '0.0.0', + clicks: 0, + intv: null + } + + this.activateClick = this.activateClick.bind(this) } async componentDidMount() { @@ -41,6 +50,36 @@ export default class TopBar extends React.Component { appWindow.minimize() } + async activateClick() { + const config = await getConfig() + + // They already got it, no need to reactivate + if (config.swag_mode) return + + if (this.state.clicks === 2) { + setTimeout(() => { + // Gotta clear it so it goes back to regular colors + this.setState({ + clicks: 0 + }) + }, 600) + + // Activate... SWAG MODE + await setConfigOption('swag_mode', true) + + return + } + + if (this.state.clicks < 3) { + this.setState({ + clicks: this.state.clicks + 1, + intv: setTimeout(() => this.setState({ clicks: 0 }), 1500) + }) + + return + } + } + render() { return (
@@ -50,6 +89,16 @@ export default class TopBar extends React.Component { {this.state?.version}
+ { + /** + * HEY YOU + * + * If you're looking at the source code to find the swag mode thing, that's okay! If you're not, move along... + * Just do me a favor and don't go telling everyone about how you found it. If you are just helping someone who + * for some reason needs it, that's fine, but not EVERYONE needs it, which is why it exists in the first place. + */ + } +
?
close diff --git a/src/utils/configuration.ts b/src/utils/configuration.ts index 5ce8863..81def4b 100644 --- a/src/utils/configuration.ts +++ b/src/utils/configuration.ts @@ -43,6 +43,7 @@ export interface Configuration { theme: string https_enabled: boolean debug_enabled: boolean + swag_mode?: boolean } export async function setConfigOption(key: string, value: any): Promise { From 88a1740b91b348af0c14e2947a6e10df4f420fc4 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Thu, 14 Jul 2022 18:49:49 -0700 Subject: [PATCH 2/5] normal feature --- src-tauri/lang/en.json | 3 + src/resources/icons/akebi_trans.svg | 67 +++++++++++++++++++++++ src/ui/components/ServerLaunchSection.tsx | 1 - src/ui/components/menu/Options.tsx | 37 ++++++++++++- src/utils/configuration.ts | 3 + 5 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 src/resources/icons/akebi_trans.svg diff --git a/src-tauri/lang/en.json b/src-tauri/lang/en.json index 052f13d..854a73c 100644 --- a/src-tauri/lang/en.json +++ b/src-tauri/lang/en.json @@ -57,5 +57,8 @@ "gc_stable_data": "Download the current stable Grasscutter data files, which does not come with a jar file. This is useful for updating.", "gc_dev_data": "Download the latest development Grasscutter data files, which does not come with a jar file. This is useful for updating.", "resources": "These are also required to run a Grasscutter server. This button will be grey if you have an existing resources folder with contents inside" + }, + "swag": { + "akebi": "Set Akebi Executable" } } \ No newline at end of file diff --git a/src/resources/icons/akebi_trans.svg b/src/resources/icons/akebi_trans.svg new file mode 100644 index 0000000..f4dc592 --- /dev/null +++ b/src/resources/icons/akebi_trans.svg @@ -0,0 +1,67 @@ + + + + + + + + diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index 3644310..559a523 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -205,7 +205,6 @@ export default class ServerLaunchSection extends React.Component
- ) } diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 433c126..2ee3f92 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -28,6 +28,10 @@ interface IState { themes: string[] theme: string encryption: boolean + swag: boolean + + // Swag stuff + akebi_path: string } export default class Options extends React.Component { @@ -44,12 +48,17 @@ export default class Options extends React.Component { bg_url_or_path: '', themes: ['default'], theme: '', - encryption: false + encryption: false, + swag: false, + + // Swag stuff + akebi_path: '', } this.setGameExec = this.setGameExec.bind(this) this.setGrasscutterJar = this.setGrasscutterJar.bind(this) this.setJavaPath = this.setJavaPath.bind(this) + this.setAkebi = this.setAkebi.bind(this) this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this) this.setCustomBackground = this.setCustomBackground.bind(this) this.toggleEncryption = this.toggleEncryption.bind(this) @@ -74,7 +83,11 @@ export default class Options extends React.Component { bg_url_or_path: config.customBackground || '', themes: (await getThemeList()).map(t => t.name), theme: config.theme || 'default', - encryption: await translate(encEnabled ? 'options.enabled' : 'options.disabled') + encryption: await translate(encEnabled ? 'options.enabled' : 'options.disabled'), + swag: config.swag_mode || false, + + // Swag stuff + akebi_path: config.akebi_path || '', }) this.forceUpdate() @@ -104,6 +117,14 @@ export default class Options extends React.Component { }) } + setAkebi(value: string) { + setConfigOption('akebi_path', value) + + this.setState({ + akebi_path: value + }) + } + async setLanguage(value: string) { await setConfigOption('language', value) window.location.reload() @@ -178,6 +199,18 @@ export default class Options extends React.Component { + { + this.state.swag && ( + + ) + }