mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
Minor fixes
This commit is contained in:
@@ -23,6 +23,7 @@ class GameController extends GetxController {
|
|||||||
late final Rx<List<FortniteVersion>> versions;
|
late final Rx<List<FortniteVersion>> versions;
|
||||||
late final Rxn<FortniteVersion> _selectedVersion;
|
late final Rxn<FortniteVersion> _selectedVersion;
|
||||||
late final RxBool started;
|
late final RxBool started;
|
||||||
|
late final RxBool autoStartGameServer;
|
||||||
GameInstance? instance;
|
GameInstance? instance;
|
||||||
|
|
||||||
GameController() {
|
GameController() {
|
||||||
@@ -47,6 +48,8 @@ class GameController extends GetxController {
|
|||||||
customLaunchArgs = TextEditingController(text: _storage.read("custom_launch_args" ?? ""));
|
customLaunchArgs = TextEditingController(text: _storage.read("custom_launch_args" ?? ""));
|
||||||
customLaunchArgs.addListener(() => _storage.write("custom_launch_args", customLaunchArgs.text));
|
customLaunchArgs.addListener(() => _storage.write("custom_launch_args", customLaunchArgs.text));
|
||||||
started = RxBool(false);
|
started = RxBool(false);
|
||||||
|
autoStartGameServer = RxBool(_storage.read("auto_game_server") ?? true);
|
||||||
|
autoStartGameServer.listen((value) => _storage.write("auto_game_server", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
FortniteVersion? getVersionByName(String name) {
|
FortniteVersion? getVersionByName(String name) {
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/material.dart' show Icons;
|
import 'package:flutter/material.dart' show Icons;
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -11,6 +13,7 @@ import 'package:reboot_launcher/src/ui/widget/home/version_selector.dart';
|
|||||||
import 'package:reboot_launcher/src/ui/widget/shared/setting_tile.dart';
|
import 'package:reboot_launcher/src/ui/widget/shared/setting_tile.dart';
|
||||||
|
|
||||||
import '../../util/checks.dart';
|
import '../../util/checks.dart';
|
||||||
|
import '../../util/os.dart';
|
||||||
|
|
||||||
class LauncherPage extends StatefulWidget {
|
class LauncherPage extends StatefulWidget {
|
||||||
final GlobalKey<NavigatorState> navigatorKey;
|
final GlobalKey<NavigatorState> navigatorKey;
|
||||||
@@ -66,6 +69,13 @@ class _GamePageState extends State<_GamePage> {
|
|||||||
final GameController _gameController = Get.find<GameController>();
|
final GameController _gameController = Get.find<GameController>();
|
||||||
final SettingsController _settingsController = Get.find<SettingsController>();
|
final SettingsController _settingsController = Get.find<SettingsController>();
|
||||||
late final RxBool _showPasswordTrailing = RxBool(_gameController.password.text.isNotEmpty);
|
late final RxBool _showPasswordTrailing = RxBool(_gameController.password.text.isNotEmpty);
|
||||||
|
final StreamController _matchmakingStream = StreamController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_settingsController.matchmakingIp.addListener(() => _matchmakingStream.add(null));
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Column(
|
Widget build(BuildContext context) => Column(
|
||||||
@@ -118,6 +128,9 @@ class _GamePageState extends State<_GamePage> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16.0,
|
height: 16.0,
|
||||||
),
|
),
|
||||||
|
StreamBuilder(
|
||||||
|
stream: _matchmakingStream.stream,
|
||||||
|
builder: (context, value) =>
|
||||||
SettingTile(
|
SettingTile(
|
||||||
title: "Matchmaking host",
|
title: "Matchmaking host",
|
||||||
subtitle: "Enter the IP address of the game server hosting the match",
|
subtitle: "Enter the IP address of the game server hosting the match",
|
||||||
@@ -127,7 +140,18 @@ class _GamePageState extends State<_GamePage> {
|
|||||||
validator: checkMatchmaking,
|
validator: checkMatchmaking,
|
||||||
autovalidateMode: AutovalidateMode.always
|
autovalidateMode: AutovalidateMode.always
|
||||||
),
|
),
|
||||||
|
expandedContentSpacing: isLocalHost(_settingsController.matchmakingIp.text) ? SettingTile.kDefaultSpacing : 0,
|
||||||
expandedContent: [
|
expandedContent: [
|
||||||
|
!isLocalHost(_settingsController.matchmakingIp.text) ? const SizedBox() : SettingTile(
|
||||||
|
title: "Automatically start game server",
|
||||||
|
subtitle: "This option is available when the matchmaker is set to localhost",
|
||||||
|
contentWidth: null,
|
||||||
|
content: Obx(() => ToggleSwitch(
|
||||||
|
checked: _gameController.autoStartGameServer(),
|
||||||
|
onChanged: (value) => _gameController.autoStartGameServer.value = value
|
||||||
|
)),
|
||||||
|
isChild: true
|
||||||
|
),
|
||||||
SettingTile(
|
SettingTile(
|
||||||
title: "Browse available servers",
|
title: "Browse available servers",
|
||||||
subtitle: "Discover new game servers that fit your play-style",
|
subtitle: "Discover new game servers that fit your play-style",
|
||||||
@@ -141,6 +165,7 @@ class _GamePageState extends State<_GamePage> {
|
|||||||
isChild: true
|
isChild: true
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16.0,
|
height: 16.0,
|
||||||
|
|||||||
@@ -178,6 +178,10 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!_gameController.autoStartGameServer()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var version = _gameController.selectedVersion!;
|
var version = _gameController.selectedVersion!;
|
||||||
await _startGameProcesses(version, true, false);
|
await _startGameProcesses(version, true, false);
|
||||||
return true;
|
return true;
|
||||||
@@ -198,7 +202,12 @@ class _LaunchButtonState extends State<LaunchButton> {
|
|||||||
return kDefaultPlayerName;
|
return kDefaultPlayerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
var username = _gameController.username.text.replaceAll(RegExp("[^A-Za-z0-9]"), "").trim();
|
var username = _gameController.username.text;
|
||||||
|
if(_gameController.password.text.isNotEmpty){
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
username = _gameController.username.text.replaceAll(RegExp("[^A-Za-z0-9]"), "").trim();
|
||||||
if(username.isEmpty){
|
if(username.isEmpty){
|
||||||
return kDefaultPlayerName;
|
return kDefaultPlayerName;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user