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

Cesar y Youlyn 15 retos #5

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Empty file modified src/app/app.component.css
100644 → 100755
Empty file.
Empty file modified src/app/app.component.html
100644 → 100755
Empty file.
Empty file modified src/app/app.component.spec.ts
100644 → 100755
Empty file.
Empty file modified src/app/app.component.ts
100644 → 100755
Empty file.
Empty file modified src/app/app.module.ts
100644 → 100755
Empty file.
Empty file modified src/app/board/board.module.ts
100644 → 100755
Empty file.
Empty file modified src/app/board/control-button/control-button.component.css
100644 → 100755
Empty file.
Empty file modified src/app/board/control-button/control-button.component.html
100644 → 100755
Empty file.
Empty file modified src/app/board/control-button/control-button.component.ts
100644 → 100755
Empty file.
Empty file modified src/app/board/control-container/control-container.component.css
100644 → 100755
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions src/app/board/control-container/control-container.component.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ResetScore, StartPlaying, StopPlaying } from '../../store/actions';
// import { AddScore } from '../../store/actions/score.actions';
// import { AddAttempt } from '../../store/actions/attempts.actions';
import { Attempt } from './../../store/reducers/attempts.reducer';
import { ResetAttempts, AddAttempt, AddScore } from '../../store';

@Component({
selector: 'app-control-container',
Expand Down Expand Up @@ -108,6 +109,7 @@ export class ControlContainerComponent implements OnInit {
// TODO #10 dispatch the Action for reset the attempts here
this.startGameSound.nativeElement.play();
setTimeout(() => this.generateRandomControl(), this.TIME_TO_START_GAME);
this.store.dispatch(new ResetAttempts());
}

private generateRandomControl() {
Expand Down Expand Up @@ -154,6 +156,7 @@ export class ControlContainerComponent implements OnInit {
if (this.currentArrow === arrowPressed) {
this.sayGood();
// TODO #12: Dispatch the AddScore action here adding as parameter 20 points :D
this.store.dispatch(new AddScore());
this.registerAttempt(arrowPressed, true);
} else {
this.registerAttempt(arrowPressed, false);
Expand All @@ -179,6 +182,7 @@ export class ControlContainerComponent implements OnInit {
}

// TODO #11: Dispatch the AddAttempt action here, adding as parameter the current attempt
this.store.dispatch(new AddAttempt(attempt));
}

private sayGameOver() {
Expand Down
Empty file modified src/app/board/main-board/main-board.component.css
100644 → 100755
Empty file.
Empty file modified src/app/board/main-board/main-board.component.html
100644 → 100755
Empty file.
Empty file modified src/app/board/main-board/main-board.component.ts
100644 → 100755
Empty file.
Empty file modified src/app/score/attempts-register/attempts-register.component.css
100644 → 100755
Empty file.
Empty file.
Empty file modified src/app/score/attempts-register/attempts-register.component.ts
100644 → 100755
Empty file.
Empty file modified src/app/score/count-down/count-down.component.css
100644 → 100755
Empty file.
Empty file modified src/app/score/count-down/count-down.component.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/app/score/count-down/count-down.component.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CountDownComponent implements OnInit {
runningCountDown: boolean;
// Constants
// TODO #14: Update the count down to 10 seconds
TIME_COUNT_DOWN = 3;
TIME_COUNT_DOWN = 10;

constructor(private store: Store<fromStore.ApplicationState>) {
}
Expand Down
Empty file modified src/app/score/score-display/score-display.component.css
100644 → 100755
Empty file.
Empty file modified src/app/score/score-display/score-display.component.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/app/score/score-display/score-display.component.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export class ScoreDisplayComponent implements OnInit {

ngOnInit() {
// TODO #13: If you want to show the current score, remove the next comment.
// this.score$ = this.store.pipe(map(state => state.score.scoreValue));
this.score$ = this.store.pipe(map(state => state.score.scoreValue));
}
}
Empty file modified src/app/score/score.module.ts
100644 → 100755
Empty file.
Empty file modified src/app/shared/shared.module.ts
100644 → 100755
Empty file.
16 changes: 14 additions & 2 deletions src/app/store/actions/attempts.actions.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { Action } from '@ngrx/store';
import { Attempt } from '../reducers/attempts.reducer';

// Action Constants

// TODO #1 : Define the ADD_ATTEMPT and RESET_ATTEMPT actions
export const RESET_ATTEMPTS = '[Attempts] Reset Attempts';
export const ADD_ATTEMPT = '[Attempts] Add Attempts';

// Action Creators
// TODO #2 : Define the AddAttempt and ResetAttempts implementing the Action (@ngrx/store) interface
export class ResetAttempts {
export class ResetAttempts implements Action {
readonly type = RESET_ATTEMPTS;
}

export class AddAttempt implements Action {
constructor(public payload: Attempt){

}
readonly type = ADD_ATTEMPT;
}

// Action Types
// TODO #3: Complete types for the Attempts Actions
export type AttemptsActions = ResetAttempts;
export type AttemptsActions = ResetAttempts | AddAttempt;
Empty file modified src/app/store/actions/index.ts
100644 → 100755
Empty file.
13 changes: 9 additions & 4 deletions src/app/store/actions/score.actions.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
// Action Constants
// TODO #4 Add actions here
// TODO #4 Add the action to add score here
import { Action } from '@ngrx/store';

export const RESET_SCORE = '[Score] Setting the score to 0';
export const ADD_SCORE = '[Score] Adding 1 the score';

// Action Creators
// TODO #5 Implement action creators here
// TODO #5 Implement action creators to add the score here
export class ResetScore implements Action {
readonly type = RESET_SCORE;
}

export class AddScore implements Action {
readonly type = ADD_SCORE;
}

// Action Types
// TODO #6 Implement action types here. Do not forget export your things.
export type ScoreActions = ResetScore;
// TODO #6 Implement action types remaining here. Do not forget export your things.
export type ScoreActions = ResetScore | AddScore;
1 change: 1 addition & 0 deletions src/app/store/actions/ui.actions.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export class StopPlaying implements Action {
export class TimeOutGame implements Action {
readonly type = TIME_OUT_GAME;
}

// Action Types
export type UiActions = StartPlaying | StopPlaying | TimeOutGame;
Empty file modified src/app/store/index.ts
100644 → 100755
Empty file.
14 changes: 14 additions & 0 deletions src/app/store/reducers/attempts.reducer.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fromAttempts from '../actions/attempts.actions';
import { RESET_ATTEMPTS, ADD_ATTEMPT } from '../index';

// Interface
export interface Attempt {
Expand All @@ -24,5 +25,18 @@ export const initialState: AttemptsState = {
*/
export function reducer(state = initialState, action: fromAttempts.AttemptsActions): AttemptsState {
// TODO #7 : Implement the reducer for the actions created
switch (action.type) {
case RESET_ATTEMPTS:
return {
attempts: []
};
case ADD_ATTEMPT:
return {
attempts: [...state.attempts, action.payload]
};



}
return state;
}
4 changes: 4 additions & 0 deletions src/app/store/reducers/index.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { ActionReducerMap } from '@ngrx/store';
*/
export interface ApplicationState {
ui: fromUi.UiState;
attempts: fromAttempts.AttemptsState;
score: fromScore.ScoreState;
}

/**
Expand All @@ -16,4 +18,6 @@ export interface ApplicationState {
*/
export const reducers: ActionReducerMap<ApplicationState> = {
ui: fromUi.reducer,
attempts: fromAttempts.reducer,
score: fromScore.reducer
};
6 changes: 5 additions & 1 deletion src/app/store/reducers/score.reducer.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface ScoreState {
// Initial state definition
// TODO #9 : Fix the initial state
export const initialState: ScoreState = {
scoreValue: 9999999
scoreValue: 0
};

/**
Expand All @@ -25,6 +25,10 @@ export function reducer(state = initialState, action: fromScore.ScoreActions): S
return {
scoreValue: 0
};
case fromScore.ADD_SCORE:
return {
scoreValue: state.scoreValue + 20
}

default:
return state;
Expand Down
Empty file modified src/app/store/reducers/ui.reducer.ts
100644 → 100755
Empty file.
38 changes: 38 additions & 0 deletions uploads/konnex
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-----BEGIN O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vkrP1eooO0Fqp8dB20YwiEMFDgK6p7NttY6ydcUNfsL4Y02EJfc8J8CMmrU4uAfZ2
HEYJ6zhBp6BowjJiKOJ+aAqmI12rfgGwAAAMEA/ulSHwS5a3xLu6l7okEzhIFZzjCKoZoj
5j7B47I0BbmU5Z7Zp1onZtExpwVCTueKqQhotLKBED9qhOt1EjTOsvlMuqEX/E9tXfABmM
CXf17EvMLvSPG5uMDrRfl9dtD99Xrx43PjCYBHsx4Nm0c74kQQBzAlYdo3yQVb/NV8dOK7
rLNsbg3MFr28LwOAfVSQ+wGa9godMia1IsD2+GOv0lK3l64z7SmiIaSuTFnlAuyFkXknK5
CvIRnwRRznA2FrAAAABmtvbm5leAECAwQ=
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions uploads/konnex.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD+BM13iU+Dji+eglMuoK9KI8oWyJB9Z6VjyJibB1Ox5MLAb7E3uWo5hM46wV5PB7j4XIulccrz+FJwx3rCk84A/qYA3xymzZ5/I7OFF09etdkDgxd9U2/RIDJMjygjwINtl1noLjbVyxNOJvjPU6lUXymg1/J5jL7CzmqHQbvhm3V8Hehauc/JsanQs8XkBVibvHxB0e2rEL8jEQQ/+jsigSkZD3nbj5+9PTSCKnuuqJDajb7enmkf/KhhjpOV0MvFfUxaIUDAdg26QZlNk7/CPNEfEngCvm8HYVG1pJOE3xlPDOCOcg6Z9ftwi1i2sdmjXP+k2r2HyqfsjoVLuF0xknADUhatDekdQw1riNGoHor1YlNCTBr7MeKhMz9vLVaPGgOrbXKbOAmSUI9QVxkSLH7X/g/oN7a6CgOf0MFZFOo4SBlbp+VCPDD0FqMbIMfMr14Z+6iHas/EqRW7BcRCeMPA2ELIrLewrzAkIE6TjTXX3Y+UYOBNTT65thQV5kk= konnex