Update download mods function with more feedback
This commit is contained in:
parent
d8345d08fa
commit
239eac82b2
2 changed files with 19 additions and 9 deletions
|
@ -149,7 +149,8 @@ class GameServerPageState extends State<GameServerPage> {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text("Scanning mods...")));
|
SnackBar(content: Text("Scanning mods...")));
|
||||||
|
|
||||||
for (Mod M in settings.inst!.mods) {
|
for (Mod M in settings.inst!.mods.toList()) {
|
||||||
|
var index = settings.inst!.mods.indexOf(M);
|
||||||
// Assemble final path.
|
// Assemble final path.
|
||||||
String modsPath = PathHelper.builder(settings.game_path)
|
String modsPath = PathHelper.builder(settings.game_path)
|
||||||
.resolve("mods")
|
.resolve("mods")
|
||||||
|
@ -172,6 +173,12 @@ class GameServerPageState extends State<GameServerPage> {
|
||||||
|
|
||||||
M.mod_pak = name;
|
M.mod_pak = name;
|
||||||
M.mod_hash = hash;
|
M.mod_hash = hash;
|
||||||
|
|
||||||
|
print("Discovered mod file: ${name}");
|
||||||
|
print("Hash: ${hash}");
|
||||||
|
|
||||||
|
// Update the mod instance
|
||||||
|
settings.inst!.mods[index] = M;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +186,9 @@ class GameServerPageState extends State<GameServerPage> {
|
||||||
setState(() {
|
setState(() {
|
||||||
settings.Write();
|
settings.Write();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text("Mods have been scanned")));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
16
lib/mod.dart
16
lib/mod.dart
|
@ -5,17 +5,17 @@ part 'mod.g.dart';
|
||||||
|
|
||||||
@HiveType(typeId: 2)
|
@HiveType(typeId: 2)
|
||||||
class Mod {
|
class Mod {
|
||||||
@HiveField(0)
|
@HiveField(0, defaultValue: "")
|
||||||
String mod_name;
|
String mod_name = "";
|
||||||
|
|
||||||
@HiveField(1)
|
@HiveField(1, defaultValue: 0)
|
||||||
int mod_id;
|
int mod_id = 0;
|
||||||
|
|
||||||
@HiveField(2)
|
@HiveField(2, defaultValue: "")
|
||||||
String mod_pak;
|
String mod_pak = "";
|
||||||
|
|
||||||
@HiveField(3)
|
@HiveField(3, defaultValue: "")
|
||||||
String mod_hash;
|
String mod_hash = "";
|
||||||
|
|
||||||
bool newMod = false;
|
bool newMod = false;
|
||||||
String _id = "";
|
String _id = "";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue