-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from Sybit-Education/feature/eatdrink
Feature/eatdrink
- Loading branch information
Showing
7 changed files
with
152 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@48,400,0,0" /> | ||
|
||
<div class="container_all"> | ||
<aside> | ||
<button (click)="feed()" class="btn w-100"><span class="material-symbols-outlined">restaurant</span></button> | ||
<button (click)="drink()" class="btn w-100"><span class="material-symbols-outlined">water_full</span></button> | ||
</aside> | ||
<main> | ||
<app-show-sygotchi></app-show-sygotchi> | ||
</main> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.container_all{ | ||
display:grid; | ||
grid-template-columns: 1fr 2fr; | ||
margin: 0; | ||
padding: 0; | ||
main{ | ||
background-image: url("../../assets/images/KitchenBackground.jpeg"); | ||
background-size: 100% 100%; | ||
background-repeat:no-repeat; | ||
background-position: 0% 0%; | ||
height: 91.21vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
} | ||
aside{ | ||
padding: 30px; | ||
background-color: #EFD3D2; | ||
display: flex; | ||
justify-content: space-evenly; | ||
flex-direction: column; | ||
.color-container{ | ||
display:flex; | ||
justify-content: space-evenly; | ||
} | ||
.btn{ | ||
border: 0; | ||
.material-symbols-outlined{ | ||
font-variation-settings: | ||
'FILL' 0, | ||
'wght' 400, | ||
'GRAD' 0, | ||
'opsz' 48; | ||
font-size: 15rem; | ||
} | ||
} | ||
} | ||
} | ||
@media screen and (max-width: 630px) { | ||
.container_all{ | ||
display: flex; | ||
flex-direction: column-reverse; | ||
height: 91.21vh; | ||
aside{ | ||
display: flex; | ||
flex-direction: row; | ||
.btn .material-symbols-outlined{ | ||
font-variation-settings: | ||
'FILL' 0, | ||
'wght' 400, | ||
'GRAD' 0, | ||
'opsz' 48; | ||
font-size: 10rem; | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { SyGotchi } from '../entities/syGotchi'; | ||
import { ActionsService } from '../services/actions.service'; | ||
import { selectSygotchi } from '../store/sygotchi.selectors'; | ||
import { Store } from '@ngrx/store'; | ||
import { setSygotchi } from '../store/sygotchi.actions'; | ||
|
||
@Component({ | ||
selector: 'app-kitchen', | ||
templateUrl: './kitchen.component.html', | ||
styleUrls: ['./kitchen.component.scss'] | ||
}) | ||
export class KitchenComponent implements OnInit{ | ||
isHungry: number | ||
isThirsty: number | ||
message = {text: '', error: false} | ||
sygotchi: SyGotchi | ||
showMessage: boolean = false | ||
|
||
constructor(private actionsService: ActionsService, private store: Store) {} | ||
|
||
ngOnInit() { | ||
this.store.select(selectSygotchi) | ||
.subscribe( | ||
syGotchi => { | ||
this.isHungry = syGotchi.hunger | ||
this.isThirsty = syGotchi.thirst | ||
this.sygotchi = syGotchi | ||
} | ||
) | ||
} | ||
feed(){ | ||
if(this.isHungry <= 90){ | ||
this.actionsService.feedSygotchi() | ||
.subscribe | ||
(res => { | ||
this.message.text = 'Sygotchi ist jetzt satt!' | ||
this.messageHandler() | ||
this.store.dispatch(setSygotchi({sygotchi: res as SyGotchi})) | ||
}, | ||
() => { | ||
this.message.error = true | ||
this.message.text = 'Sygotchi hat keinen Hunger mehr!' | ||
this.messageHandler() | ||
}) | ||
} | ||
} | ||
drink(){ | ||
if(this.isThirsty <= 90){ | ||
this.actionsService.drinkSygotchi().subscribe | ||
(res => { | ||
this.message.text = 'Sygotchi ist jetzt sitt!' | ||
this.messageHandler() | ||
this.store.dispatch(setSygotchi({sygotchi: res as SyGotchi})) | ||
}, | ||
() => { | ||
this.message.error = true | ||
this.message.text = 'Sygotchi hat keinen Durst mehr!' | ||
this.messageHandler() | ||
}) | ||
} | ||
} | ||
messageHandler() { | ||
this.showMessage = true | ||
setTimeout(() => { | ||
this.showMessage = false | ||
}, 7000) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.