Skip to content

Commit

Permalink
fixed credits navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
aruhant committed Feb 7, 2024
1 parent 21af9ca commit fe93722
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"coming_soon": "Coming Soon!",
"close": "Close",
"credits": "Credits",
"credits_intro": "Credits~Title Music:\nBSBARU Music\nhttps://www.youtube.com/watch?v=sFSnHaWRuvQ~Ramayana Translations:\nValmiki Ramayana\nhttps://www.valmiki.iitk.ac.in~Game Design & Development:\nAruhant Mehta\nhttps://aruhant.github.io/",
"lanka_dahan_intro": "As the sun dipped below the horizon, casting an amber glow over the ancient city of Lanka, you, Fearless Hanuman, found yourself ensnared. Ravana, the ten-headed demon king, had captured you—the mighty ape warrior.~His eyes gleamed with malice as he spoke:\n\n“कपीनां किल लाङ्गूलमिष्टं भवति भूषणम्।\nतदस्य दीप्यतां शीघ्रं तेन दग्धेन गच्छतु।।5.53.3।।”\n\nTranslation: “The tail of a monkey is dear to them. It is like an ornament to them. Set it blaze swiftly with fire, and let him go.”~But you are Hanuman—the wind-swift, the leaper of oceans, the loyal servant of Lord Rama. You have the blessings of Maa Sita.~The flames dance upon your fur, but it is as cold as ice.\nAs your heart beats with courage, a mischief twinkled in your eyes. \nYou would turn Lanka into an inferno, a beacon of defiance.~Cross the sprawling city, avoid detection, and unleash the flames of retribution. \n\nRemember, Fearless Hanuman, you have but one chance. If captured, the level resets. The city awaits your wrath, and Lanka trembles in anticipation.\n\nNote: Inspired by the epic Ramayana, this game level is a fictional adaptation.",
"win_message": "You have successfully destroyed Lanka!"
}
7 changes: 6 additions & 1 deletion app/lib/level_picker/level_slector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class LevelTile extends StatelessWidget {
onPressed: () {
if (level.isAvailable) {
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => LevelIntro(level: level.map!),
builder: (context) => LevelIntro(
level: level.map!,
onFinished: (context) => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => GameEngine(level: level.map!)))),
));
}
},
Expand Down
9 changes: 4 additions & 5 deletions app/lib/title_screen/level_intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import 'package:ramayana/game/game_engine.dart';
import 'package:ramayana/utils/logging.dart';

class LevelIntro extends StatefulWidget {
const LevelIntro({Key? key, required this.level}) : super(key: key);
const LevelIntro({Key? key, required this.onFinished, required this.level})
: super(key: key);
final Function (BuildContext c ) onFinished;
final String level;

@override
Expand Down Expand Up @@ -86,10 +88,7 @@ class _LevelIntroState extends State<LevelIntro> {
_animationStopped = false;
});
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GameEngine(level: widget.level)));
widget.onFinished(context);
}
}
}
20 changes: 16 additions & 4 deletions app/lib/title_screen/title_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ class _TitleScreenState extends State<TitleScreen> {
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
LevelIntro(level: 'credits'))),
builder: (context) => LevelIntro(
level: 'credits',
onFinished: (context) =>
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
TitleScreen()))))),
child: Text(
'credits'.tr(),
style: TextStyle(color: Colors.black87),
Expand Down Expand Up @@ -98,8 +104,14 @@ class _TitleScreenState extends State<TitleScreen> {
onPressed: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
LevelIntro(level: 'lanka_dahan'))),
builder: (context) => LevelIntro(
level: 'lanka_dahan',
onFinished: (context) =>
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => GameEngine(
level: 'lanka_dahan')))))),
// const GameEngine(level: 'lanka_dahan'))),
child: Text('start_game'.tr())),
],
Expand Down

0 comments on commit fe93722

Please sign in to comment.