Skip to content

Commit

Permalink
Merge pull request #67 from ChicoState/friendsNfighting
Browse files Browse the repository at this point in the history
Changed the shop so that you can buy profile pictures and themes, added other things that other pages require.
  • Loading branch information
TaigaODonnell authored Dec 3, 2024
2 parents 35e6c53 + efaf583 commit b31d269
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 94 deletions.
Binary file added fightme_webapp/assets/images/default-avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions fightme_webapp/lib/Cosmetics/profile_pictures.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
// Enter in the source link of the image. Later implementation will handle it.

List<String> profilePictures = [
"assets/images/default-avatar.png",
"assets/images/dummyKnight.png",
"assets/images/knight-green.png",
"assets/images/fknight-green.png",
"assets/images/knight-grey.png",
];

// Structure: [element in profilePictures, price]
List<List<int>> buyableProfilePictures = [
[2, 4000],
[3, 8000],
];
6 changes: 6 additions & 0 deletions fightme_webapp/lib/Cosmetics/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ List<ColorScheme> themes = [
const ColorScheme(brightness: Brightness.light, primary: Colors.tealAccent, onPrimary: Colors.black, secondary: Colors.pinkAccent, onSecondary: Colors.black, surface: Colors.deepPurple, onSurface: Colors.black, error: Colors.red, onError: Colors.black),
];

// TODO: Match the element in themes.
List<String> themeNames = [
"Default",
"Dark",
"Vaporwave",
];

// Structure: [element in themes, price]
List<List<int>> buyableThemes = [
[2, 6000],
];
5 changes: 4 additions & 1 deletion fightme_webapp/lib/Models/fight_game_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ enum Move {attack, defense, magic, none}

class FightGameSession {
int id = 0;
int winnerID = 0;
User user1 = User("");
int user1hp = 5;
Move user1move = Move.none;
Expand All @@ -15,6 +16,7 @@ class FightGameSession {

FightGameSession(User curUser, otherUser) {
id = 0;
winnerID = 0;
user1 = curUser;
user1hp = 5;
user1move = Move.none;
Expand All @@ -26,11 +28,12 @@ class FightGameSession {

FightGameSession.practice(User curUser) {
id = 0;
winnerID = 0;
user1 = curUser;
user1hp = 5;
user1move = Move.none;
user2 = User("Dummy");
// TODO: Set Dummy's profile picture to a picture of something like a straw man.
user2.pfp = 1;
user2.attackScore = curUser.attackScore;
user2.defenseScore = curUser.defenseScore;
user2.magicScore = curUser.magicScore;
Expand Down
10 changes: 10 additions & 0 deletions fightme_webapp/lib/chat_page_web_socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ class ChatPageState extends State<ChatPage> {
labelText: "Message",
),
onSubmitted: (value) async {
if (value.length > 255) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
duration: Duration(seconds: 3),
content: Text('You exceeded the character limit.'),
)
);
}
else {
_sendMessage(value); // Send message via WebSocket
randomNumber = Random().nextInt(100);
print("I received $randomNumber");
Expand All @@ -162,6 +171,7 @@ class ChatPageState extends State<ChatPage> {
statsProvider.updateGamerscore(widget.currentUser.gamerScore + 1);
}
textEditControl.clear();
}
},
),
],
Expand Down
10 changes: 8 additions & 2 deletions fightme_webapp/lib/chats_master_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'Models/chatroom.dart';
// import 'chat_page.dart';
import 'chat_page_web_socket.dart';
import 'Cosmetics/profile_pictures.dart';
import 'Models/user.dart';
import 'package:fightme_webapp/Models/httpservice.dart';
import 'pending_requests.dart';
Expand Down Expand Up @@ -59,9 +60,14 @@ class ChatsMasterPageState extends State<ChatsMasterPage> {
)));
},
child: ListTile(
leading: const Icon(Icons.account_circle_sharp),
leading: ClipRRect(
borderRadius: BorderRadius.circular(80.0),
child: Image.asset(profilePictures[user.pfp], fit: BoxFit.cover, width: 60, height: 60),
),
title: user.id != 0 ? Text(user.name) : const Text("Group"),
subtitle: room.messages.isEmpty ? const Text("") : Text(room.messages.last.content),
subtitle: room.messages.isEmpty ? const Text("") : Text(room.messages.last.content, overflow: TextOverflow.fade,
maxLines: 1,
softWrap: false),
)
);
}
Expand Down
Loading

0 comments on commit b31d269

Please sign in to comment.