Skip to content

Commit

Permalink
replace images with better ones, UI layout adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
kiroj305 committed Feb 1, 2024
1 parent 4654872 commit 0e251ac
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 17 deletions.
Binary file modified flame_demo/assets/images/Skull_alien_goofy_skull.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 modified flame_demo/assets/images/Star_many_pointed_star.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 flame_demo/assets/images/button_background.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 modified flame_demo/assets/images/hourglass_3.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 modified flame_demo/assets/images/key_3.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 modified flame_demo/assets/images/normal_Du_Temples_flying_machine.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 modified flame_demo/assets/images/normal_lock.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 modified flame_demo/assets/images/normal_money.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 modified flame_demo/assets/images/spinning_wheel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions flame_demo/lib/clickable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class Doohickey extends KeyframedAnimationComponent with Tappable {
void onMount() {
super.onMount();
game = findGame() as PylonsGame;
size = Vector2(200, 200);
position = Vector2(100, 400);
size = Vector2(100, 100);
position = Vector2(180, 30);
}

@override
Expand Down
2 changes: 1 addition & 1 deletion flame_demo/lib/game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PylonsGame extends FlameGame with HasTappables {
bool dispatchedAction = false;

@override
Color backgroundColor() => const Color(0xFFFF00FF);
Color backgroundColor() => const Color(0xFFAA00FF);

@override
Future<void> onLoad() async {
Expand Down
1 change: 1 addition & 0 deletions flame_demo/lib/hud/hud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Hud extends StatelessWidget {
"${Provider.of<GameStateNotifier>(context).whatsits.toInt()}";
return SizedBox.expand(child: Provider.of<GameStateNotifier>(context, listen: false).initialized ? Column(
children: [
const Spacer(),
TextDisplay(text: text),
UpgradeButton(recipe: recipeGetThingamabob, imagePath: imagePathThingamabob, caption: captionThingamabob, callback: () {
gameStateNotifier.updateThingamabob(true);
Expand Down
2 changes: 1 addition & 1 deletion flame_demo/lib/hud/loading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Loading extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Expanded(child: Container(
color: Colors.grey,
color: Colors.black12,
child: const Center(child: Text("Please wait...", style: TextStyle(color: Colors.white))),
));
}
Expand Down
2 changes: 1 addition & 1 deletion flame_demo/lib/hud/text_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class TextDisplay extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Text(text, style: const TextStyle(fontSize: 42, color: Colors.white, backgroundColor: Colors.black45));
return Text(text, style: const TextStyle(fontSize: 30, color: Colors.white, backgroundColor: Colors.transparent));
}
}
55 changes: 43 additions & 12 deletions flame_demo/lib/hud/upgrade_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ import '../main.dart';
import '../pylons_component.dart';
import '../recipe.dart';

List<Item> _dummyCb () => [];
List<Item> _dummyCb() => [];

class UpgradeButton extends StatelessWidget {
const UpgradeButton({Key? key, required this.recipe, required this.imagePath, required this.caption, required this.callback, this.itemFunc = _dummyCb}) : super(key: key);
const UpgradeButton(
{Key? key,
required this.recipe,
required this.imagePath,
required this.caption,
required this.callback,
this.itemFunc = _dummyCb})
: super(key: key);

final Recipe recipe;
final String imagePath;
Expand All @@ -20,14 +27,38 @@ class UpgradeButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialButton(onPressed: PylonsComponent.instance.ready && recipe.executeCheck(Provider.of<GameStateNotifier>(context)) ? () {
PylonsComponent.instance.executeRecipe(recipe.sdkRecipe, itemFunc(), [
(exec) { callback(); }
]);
} : null, child: PylonsComponent.instance.ready && recipe.executeCheck(Provider.of<GameStateNotifier>(context, listen: false)) ?
Container(color: Colors.grey, child:Row(children: [
Expanded(child: Image.asset(imagePath, height: 70)),
Expanded(child: Text(caption, style: const TextStyle(fontSize: 16, color: Colors.white)))
]) ): null);
return MaterialButton(
onPressed: PylonsComponent.instance.ready &&
recipe.executeCheck(Provider.of<GameStateNotifier>(context))
? () {
PylonsComponent.instance
.executeRecipe(recipe.sdkRecipe, itemFunc(), [
(exec) {
callback();
}
]);
}
: null,
child: PylonsComponent.instance.ready &&
recipe.executeCheck(
Provider.of<GameStateNotifier>(context, listen: false))
? Container(
padding:
const EdgeInsets.symmetric(horizontal: 50, vertical: 20),
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/button_background.png"),
fit: BoxFit.cover,
),
),
// color: Colors.grey,
child: Row(children: [
Expanded(child: Image.asset(imagePath, height: 70)),
Expanded(
child: Text(caption,
style: const TextStyle(
fontSize: 16, color: Colors.white)))
]))
: null);
}
}
}
1 change: 1 addition & 0 deletions flame_demo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ flutter_icons:
flutter:

assets:
- assets/images/button_background.png
- assets/images/normal_money.png
- assets/images/Skull_alien_goofy_skull.png
- assets/images/spinning_wheel.png
Expand Down

0 comments on commit 0e251ac

Please sign in to comment.