Skip to content

Commit

Permalink
feat: Finifh helldivers RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisL61 committed Nov 17, 2024
1 parent 7b70d9c commit 2193a75
Show file tree
Hide file tree
Showing 28 changed files with 419 additions and 194 deletions.
Binary file added assets/helldivers/difficulties/challenging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/easy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/extreme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/hard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/helldive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/impossible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/suicide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/helldivers/difficulties/trivial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 30 additions & 1 deletion games_richpresence/assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,34 @@
"_the_finals_select_gamemode": "Select a gamemode",
"_the_finals_in_game": "In game",

"_the_final_team_rpc": "{players} / {max_players} players"
"_the_final_team_rpc": "{players} / {max_players} players",

"_helldivers_objective_defense": "Defense",
"_helldivers_objective_liberation": "Liberation",

"_helldivers_difficulty_trivial": "Trivial",
"_helldivers_difficulty_easy": "Easy",
"_helldivers_difficulty_medium": "Medium",
"_helldivers_difficulty_challenging": "Challenging",
"_helldivers_difficulty_hard": "Hard",
"_helldivers_difficulty_extreme": "Extreme",
"_helldivers_difficulty_suicide": "Suicidal",
"_helldivers_difficulty_impossible": "Impossible",
"_helldivers_difficulty_helldive": "Helldive",
"_helldivers_difficulty_super_helldive": "Super helldive",

"_helldivers_select_planet": "Select a planet",
"_helldivers_select_difficulty": "Select a difficulty",

"_helldivers_team_panel_title": "HELLDIVER'S TEAM",
"_helldivers_team_panel_subtitle" : "SUPEREARTH FORCE",
"_helldivers_team_panel_description": "Liberate the galaxy by sharing how many helldivers are in your destroyer.",

"_helldivers_map_panel_title": "GALACTIC MAP",
"_helldivers_map_panel_subtitle": "SUPEREARTH GALAXY",
"_helldivers_map_panel_description": "Select the region you are currently fighting in.",

"_helldivers_in_game": "In game",
"_helldivers_activity_rpc": "{planet} ({enemy}) | {difficulty_level} - {difficulty}",
"_helldivers_team_rpc": "{players} / {max_players} players"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:flutter/widgets.dart';
import 'package:games_richpresence/gen/assets.gen.dart';

class HelldiversButton extends StatefulWidget {
final String text;
final Widget child;
final Function onClick;

const HelldiversButton({super.key, required this.text, required this.onClick});
const HelldiversButton({super.key, required this.child, required this.onClick});

@override
State<HelldiversButton> createState() => _HelldiversButtonState();
Expand All @@ -31,14 +31,7 @@ class _HelldiversButtonState extends State<HelldiversButton> {
image: AssetImage(Assets.helldivers.buttons.buttonBackground.path), repeat: ImageRepeat.repeat),
),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Text(
widget.text,
style: TextStyle(
color: Color.fromRGBO(255, 255, 255, 1),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
child: widget.child
),
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/widgets.dart';
import 'package:games_richpresence/components/helldivers/atoms/buttons/button.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/difficulties.dart';

class DifficultyButton extends StatefulWidget {
final Difficulties difficulty;
final Function onClick;
const DifficultyButton({super.key, required this.difficulty, required this.onClick});

@override
State<DifficultyButton> createState() => _DifficultyButtonState();
}

class _DifficultyButtonState extends State<DifficultyButton> {
@override
Widget build(BuildContext context) {
return HelldiversButton(
onClick: () {
widget.onClick();
},
child: Container(
height: 30,
width: 300,
child: Row(
children: [
SizedBox(width: 100, child: Image.asset(widget.difficulty.icon)),
SizedBox(width: 20),
Text(tr(widget.difficulty.name),
style: TextStyle(color: Color.fromRGBO(255, 255, 255, 1), fontSize: 20, fontWeight: FontWeight.bold))
],
),
));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:flutter/widgets.dart';
import 'package:games_richpresence/components/helldivers/atoms/buttons/button.dart';

class HelldiversTextButton extends StatelessWidget {
final String text;
final Function onClick;
const HelldiversTextButton({super.key, required this.text, required this.onClick});

@override
Widget build(BuildContext context) {
return HelldiversButton(
child: Text(
text,
style: TextStyle(
color: Color.fromRGBO(255, 255, 255, 1),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
onClick: onClick);
}
}
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/difficulties.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/faction.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/objective.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/planets.dart';

class HelldiversPlanetPanel extends StatelessWidget {
final HelldiversPlanet planet;
final bool showObjectiveStats;
final Difficulties? difficulty;

const HelldiversPlanetPanel({super.key, required this.planet});
const HelldiversPlanetPanel({super.key, required this.planet, this.showObjectiveStats = true, this.difficulty});

@override
Widget build(BuildContext context) {
return Container(
width:350,
width: 350,
child: Column(
children: [
if (planet.objective != null)
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Image(image: AssetImage(planet.objective!.icon), width: 20, height: 20),
SizedBox(width: 10),
Text(
planet.objective!.name,
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
],
children: [
if (planet.objective != null)
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
),
padding: EdgeInsets.symmetric(horizontal: 8),
child: Row(
children: [
Image(image: AssetImage(planet.objective!.icon), width: 20, height: 20),
SizedBox(width: 10),
Text(
tr(planet.objective!.name).toUpperCase(),
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
),
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: Color(0xFFffe702),
width: 2,
],
),
),
),
padding: EdgeInsets.all(2),
child: Column(
children: [
Container(
Container(
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: Color(0xFFffe702),
width: 2,
),
),
padding: EdgeInsets.all(2),
child: Column(
children: [
Container(
width: 350,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
Expand Down Expand Up @@ -79,66 +83,78 @@ class HelldiversPlanetPanel extends StatelessWidget {
style: TextStyle(color: planet.owner.color, fontSize: 16, fontWeight: FontWeight.bold),
),
],
))
)),

if (difficulty != null)
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(difficulty!.icon, width: 50, height: 50),
),
]),
Image.network(
planet.biomeImage,
width: 350,
height: 100,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
width: 350,
height: 100,
color: Color(0xFF3F3F3F),
),
Stack(
children: [
Image.network(
planet.biomeImage,
width: 350,
height: 70,
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) => Container(
width: 350,
height: 70,
color: Color(0xFF3F3F3F),
),
),
],
),
],
),
),
if (planet.objectiveProgression != null && planet.ennemy != null) SizedBox(height: 2),
if (planet.objectiveProgression != null && planet.ennemy != null)
Container(
width:350,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: planet.owner.color,
width: 2,
),
),
padding: EdgeInsets.all(4),
child: Row(
children: [
SizedBox(width: 2),
Text(
(planet.objectiveProgression! * 100).toStringAsFixed(2) + "%",
style: TextStyle(
color: Colors.white,
fontSize: 20,
if (planet.objectiveProgression != null && planet.ennemy != null && showObjectiveStats)
SizedBox(height: 2),
if (planet.objectiveProgression != null && planet.ennemy != null && showObjectiveStats)
Container(
width: 350,
decoration: BoxDecoration(
color: Color.fromRGBO(0, 0, 0, 0.8),
border: Border.all(
color: planet.owner.color,
width: 2,
),
),
SizedBox(width: 10),
Flexible(
child: Container(
color: HelldiversFactions.humans.color,
height: 20,
),
flex: (planet.objectiveProgression! * 100).floor(),
),
SizedBox(width:2),
Flexible(
child: Container(
color: planet.ennemy!.color,
height: 20,
),
flex: ((1 - planet.objectiveProgression!) * 100).floor(),
padding: EdgeInsets.all(4),
child: Row(
children: [
SizedBox(width: 2),
Text(
(planet.objectiveProgression! * 100).toStringAsFixed(2) + "%",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
SizedBox(width: 10),
Flexible(
child: Container(
color: HelldiversFactions.humans.color,
height: 20,
),
flex: (planet.objectiveProgression! * 100).floor(),
),
SizedBox(width: 2),
Flexible(
child: Container(
color: planet.ennemy!.color,
height: 20,
),
flex: ((1 - planet.objectiveProgression!) * 100).floor(),
),
],
),
],
),
)],
)),
],
),
)
],
)),
],
),
);
}
}
3 changes: 3 additions & 0 deletions games_richpresence/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:games_richpresence/pages/helldivers/activity_select/difficulty_activity_select_page.dart';
import 'package:games_richpresence/pages/helldivers/activity_select/difficulty_activity_select_page_view_model.dart';
import 'package:games_richpresence/pages/helldivers/activity_select/planet_select_page.dart';
import 'package:games_richpresence/pages/home/home.dart';
import 'package:easy_localization/easy_localization.dart';
Expand Down Expand Up @@ -39,6 +41,7 @@ class _MyAppState extends State<MyApp> {
TheFinalsGamemodesCategoriesPage.route: (context) => TheFinalsGamemodesCategoriesPage(),
TheFinalsGamemodesPageRoute.route: (context) => TheFinalsGamemodesPageRoute(),
HelldiversPlanetSelectPage.route: (context) => HelldiversPlanetSelectPage(),
DifficultyActivitySelectPage.route: (context) => DifficultyActivitySelectPage(),
},
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:games_richpresence/model/class/game_activities/helldivers/difficulties.dart';
import 'package:games_richpresence/model/class/game_activities/helldivers/planets.dart';

class HelldiversActivity {
Difficulties? difficulty;
HelldiversPlanet? planet;

HelldiversActivity({required this.difficulty, required this.planet});
}
Loading

0 comments on commit 2193a75

Please sign in to comment.