Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bal 185 gp new games #186

Merged
merged 4 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions Balance/Distraction/Games/GamesView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ struct GamesView: View {
VStack(spacing: 20) {
sudokuGame
crossoverGame
solitaireGame
mahjongGame
twocerofoureightGame
bouncingGame
dailyWordGame
simonGame
colorsGame
bejeweledGame
tetrisGame
}
.padding(10)
.ignoresSafeArea(.all)
Expand All @@ -38,6 +47,132 @@ struct GamesView: View {
GamesCellView(image: "notesIcon", text: "Random Notes")
}
}

var bejeweledGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Bejeweled Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://www.bubbleshooter.net/game/bejeweled/", titleGame: "Bejeweled")
}
)
) {
GamesCellView(image: "bejeweledIcon", text: "Bejeweled")
}
}

var tetrisGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Tetris Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://www.lumpty.com/amusements/Games/Tetris/tetris.html", titleGame: "Tetris")
}
)
) {
GamesCellView(image: "tetrisIcon", text: "Tetris")
}
}

var colorsGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "4Colors Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/4-colors/", titleGame: "4 Colors")
}
)
) {
GamesCellView(image: "colorsIcon", text: "4 Colors")
}
}

var simonGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Simon Says Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/simon-says/", titleGame: "Simon Says")
}
)
) {
GamesCellView(image: "simonIcon", text: "Simon Says")
}
}

var dailyWordGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Daily Word Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/daily-word-search/", titleGame: "Daily Word")
}
)
) {
GamesCellView(image: "wordIcon", text: "Daily Word")
}
}

var bouncingGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Bouncing Ball Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/bouncing-balls/", titleGame: "Bouncing Ball")
}
)
) {
GamesCellView(image: "bouncingIcon", text: "Bouncing")
}
}

var twocerofoureightGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "2048 Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://play2048.co/", titleGame: "2048")
}
)
) {
GamesCellView(image: "2048Icon", text: "2048")
}
}

var mahjongGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Mahjong Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/mahjong/", titleGame: "Mahjong")
}
)
) {
GamesCellView(image: "mahjongIcon", text: "Mahjong")
}
}

var solitaireGame: some View {
NavigationLink(
destination: ActivityLogBaseView(
viewName: "Solitaire Game",
isDirectChildToContainer: true,
content: {
GamesWebView(gameLink: "https://freegames.org/solitaire/", titleGame: "Solitaire")
}
)
) {
GamesCellView(image: "solitarioIcon", text: "Solitaire")
}
}

var crossoverGame: some View {
NavigationLink(
Expand Down
21 changes: 12 additions & 9 deletions Balance/Distraction/Games/GamesWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ struct GamesWebView: View {
var titleGame: String

var body: some View {
HeaderMenu(title: titleGame)
WebView(webView: webViewStore.webView)
.edgesIgnoringSafeArea(.bottom)
.onAppear {
guard let sudokuLink = URL(string: gameLink) else {
return
VStack(spacing: 0) {
HeaderMenu(title: titleGame)
WebView(webView: webViewStore.webView)
.edgesIgnoringSafeArea(.bottom)
.offset(x: 0, y: -22)
.onAppear {
guard let sudokuLink = URL(string: gameLink) else {
return
}
self.webViewStore.webView.load(URLRequest(url: sudokuLink))
}
self.webViewStore.webView.load(URLRequest(url: sudokuLink))
}
.background(backgroundColor)
.background(backgroundColor)
}
}

init(gameLink: String, titleGame: String) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "2048Icon.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Balance/Supporting Files/Assets.xcassets/GAMES/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "bejeweledIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "bouncingIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "colorsIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "mahjongIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "simonIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "solitarioIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "tetrisIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "wordIcon.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.