diff --git a/src/resources/icons/akebi_trans.svg b/src/resources/icons/akebi.svg similarity index 100% rename from src/resources/icons/akebi_trans.svg rename to src/resources/icons/akebi.svg diff --git a/src/ui/components/ServerLaunchSection.css b/src/ui/components/ServerLaunchSection.css index 1ed8762..be805ae 100644 --- a/src/ui/components/ServerLaunchSection.css +++ b/src/ui/components/ServerLaunchSection.css @@ -62,20 +62,27 @@ display: flex; flex-direction: row; justify-content: space-between; - align-items: center; + align-items: flex-start; height: 100%; max-height: 60px; } -#officialPlay { - width: 60% +.ServerLaunchButtons .BigButton { + margin-right: 8px; } +#officialPlay { + max-width: 60%; + flex-grow: 1; +} + +#akebiLaunch, #serverLaunch { width: 5%; } +.AkebiIcon, .ServerIcon { height: 20px; filter: invert(28%) sepia(28%) saturate(1141%) hue-rotate(352deg) brightness(96%) contrast(88%); diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index 559a523..19dee52 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -8,6 +8,8 @@ import { translate } from '../../utils/language' import { invoke } from '@tauri-apps/api/tauri' import Server from '../../resources/icons/server.svg' +import Akebi from '../../resources/icons/akebi.svg' + import './ServerLaunchSection.css' import {dataDir} from '@tauri-apps/api/path' @@ -29,6 +31,8 @@ interface IState { httpsLabel: string; httpsEnabled: boolean; + + swag: boolean; } export default class ServerLaunchSection extends React.Component { @@ -45,11 +49,13 @@ export default class ServerLaunchSection extends React.Component portPlaceholder: '', portHelpText: '', httpsLabel: '', - httpsEnabled: false + httpsEnabled: false, + swag: false } this.toggleGrasscutter = this.toggleGrasscutter.bind(this) this.playGame = this.playGame.bind(this) + this.launchAkebi = this.launchAkebi.bind(this) this.setIp = this.setIp.bind(this) this.setPort = this.setPort.bind(this) this.toggleHttps = this.toggleHttps.bind(this) @@ -69,6 +75,7 @@ export default class ServerLaunchSection extends React.Component portHelpText: await translate('help.port_help_text'), httpsLabel: await translate('main.https_enable'), httpsEnabled: config.https_enabled || false, + swag: config.swag_mode || false }) } @@ -85,7 +92,7 @@ export default class ServerLaunchSection extends React.Component await saveConfig(config) } - async playGame() { + async playGame(exe?: string, proc_name?: string) { const config = await getConfig() if (!config.game_install_path) return alert('Game path not set!') @@ -107,7 +114,7 @@ export default class ServerLaunchSection extends React.Component // Set IP await invoke('set_proxy_addr', { addr: (this.state.httpsEnabled ? 'https':'http') + '://' + this.state.ip + ':' + this.state.port }) await invoke('enable_process_watcher', { - process: game_exe + process: proc_name || game_exe }) // Connect to proxy @@ -133,11 +140,11 @@ export default class ServerLaunchSection extends React.Component // Launch the program const gameExists = await invoke('dir_exists', { - path: config.game_install_path + path: exe || config.game_install_path }) - if (gameExists) await invoke('run_program', { path: config.game_install_path }) - else alert('Game not found! At: ' + config.game_install_path) + if (gameExists) await invoke('run_program', { path: exe || config.game_install_path }) + else alert('Game not found! At: ' + (exe || config.game_install_path)) } async launchServer() { @@ -161,6 +168,16 @@ export default class ServerLaunchSection extends React.Component }) } + async launchAkebi() { + const config = await getConfig() + + // Get game exe from game path, so we can watch it + const pathArr = config.game_install_path.replace(/\\/g, '/').split('/') + const gameExec = pathArr[pathArr.length - 1] + + await this.playGame(config.akebi_path, gameExec) + } + setIp(text: string) { this.setState({ ip: text @@ -211,6 +228,13 @@ export default class ServerLaunchSection extends React.Component
{this.state.buttonLabel} + { + this.state.swag && ( + + + + ) + }