mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 11:39:17 +01:00
ip for click to play
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fluent_ui/fluent_ui.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:reboot_launcher/src/model/fortnite_version.dart';
|
||||
import 'package:reboot_launcher/src/model/game_type.dart';
|
||||
import 'package:ini/ini.dart';
|
||||
import 'package:reboot_launcher/src/util/os.dart';
|
||||
import 'package:system_theme/system_theme.dart';
|
||||
import 'package:reboot_launcher/src/util/server.dart';
|
||||
|
||||
class SettingsController extends GetxController {
|
||||
late final GetStorage _storage;
|
||||
@@ -15,7 +12,7 @@ class SettingsController extends GetxController {
|
||||
late final TextEditingController rebootDll;
|
||||
late final TextEditingController consoleDll;
|
||||
late final TextEditingController craniumDll;
|
||||
late final RxBool autoUpdate;
|
||||
late final TextEditingController matchmakingIp;
|
||||
|
||||
SettingsController() {
|
||||
_storage = GetStorage("settings");
|
||||
@@ -23,9 +20,23 @@ class SettingsController extends GetxController {
|
||||
rebootDll = _createController("reboot", "reboot.dll");
|
||||
consoleDll = _createController("console", "console.dll");
|
||||
craniumDll = _createController("cranium", "cranium.dll");
|
||||
autoUpdate = RxBool(_storage.read("auto_update") ?? true);
|
||||
matchmakingIp = TextEditingController(text: _storage.read("ip") ?? "127.0.0.1");
|
||||
matchmakingIp.addListener(() async {
|
||||
var text = matchmakingIp.text;
|
||||
_storage.write("ip", text);
|
||||
if(await serverConfig.exists()){
|
||||
var config = Config.fromString(await serverConfig.readAsString());
|
||||
if(text.contains(":")){
|
||||
config.set("GameServer", "ip", text.substring(0, text.indexOf(":")));
|
||||
config.set("GameServer", "port", text.substring(text.indexOf(":") + 1));
|
||||
}else {
|
||||
config.set("GameServer", "ip", text);
|
||||
config.set("GameServer", "port", "7777");
|
||||
}
|
||||
|
||||
autoUpdate.listen((value) => _storage.write("auto_update", value));
|
||||
serverConfig.writeAsString(config.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
TextEditingController _createController(String key, String name) {
|
||||
|
||||
Reference in New Issue
Block a user