Skip to content

MultiController One View #51

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

Open
wants to merge 1 commit 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
42 changes: 0 additions & 42 deletions src/pages/doom/doom.html

This file was deleted.

4 changes: 0 additions & 4 deletions src/pages/doom/doom.scss

This file was deleted.

9 changes: 5 additions & 4 deletions src/pages/doom/doom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Storage } from '@ionic/storage';

@Component({
selector: 'page-doom',
templateUrl: 'doom.html'
templateUrl: '../gameBoard/board.html'
})
export class DoomPage {
constructor(public navCtrl: NavController, private shareService: ShareService, private storage: Storage) {}
Expand All @@ -20,6 +20,7 @@ export class DoomPage {
colors: Array<string> = [];
fail: number = 0;
record: number;
activeTimer: boolean = false;

getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min;
Expand Down Expand Up @@ -85,16 +86,16 @@ export class DoomPage {
this.colors = [];
this.setDifficulty();

let nb_color: number = this.nbColors[this.difficulty];
let color:string = "";
let len: number = this.nbColors[this.difficulty];
for(let k:number = 1 ; k <= len ; k++){
for(let k:number = 1; k <= nb_color ; k++){
do
{
color = this.generateColorCode();
} while(this.isColorAlreadyChoose(color) === true)
this.colors.push(color);
}
this.goodColor = this.colors[Math.floor(Math.random() * this.colors.length)];
this.goodColor = this.colors[this.getRandomInt(0, nb_color - 1)];
}
goToNavPage() {
this.navCtrl.pop()
Expand Down
42 changes: 0 additions & 42 deletions src/pages/easy/easy.html

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/easy/easy.scss

This file was deleted.

9 changes: 5 additions & 4 deletions src/pages/easy/easy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Storage } from '@ionic/storage';

@Component({
selector: 'page-easy',
templateUrl: 'easy.html',
templateUrl: '../gameBoard/board.html',
})
export class EasyPage {

Expand All @@ -23,6 +23,7 @@ export class EasyPage {
colors: Array<string> = [];
fail: number = 0;
record: number;
activeTimer: boolean = false;

getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min;
Expand All @@ -33,7 +34,7 @@ export class EasyPage {
}

setDifficulty(): number {
if (this.point === 0 && this.point < 5) return this.difficulty = 0;
if (this.point === 0 && this.point < 5) return this.difficulty = 0;
if (this.point >= 5 && this.point < 10) return this.difficulty = 1;
if (this.point >= 10 && this.point < 15) return this.difficulty = 2;
if (this.point >= 15) return this.difficulty = 3;
Expand Down Expand Up @@ -82,14 +83,14 @@ export class EasyPage {

let nb_color: number = this.nbColors[this.difficulty];
let color: string = "";
for(let k:number = 1 ; k <= nb_color; k++){
for(let k:number = 0; k < nb_color; k++){
do
{
color = this.generateColorCode();
} while(this.isColorAlreadyChoose(color) === true)
this.colors.push(color);
}
this.goodColor = this.colors[Math.floor(Math.random() * this.colors.length)];
this.goodColor = this.colors[this.getRandomInt(0, nb_color - 1)];
}
goToNavPage(): void {
this.navCtrl.pop()
Expand Down
File renamed without changes.
File renamed without changes.
42 changes: 0 additions & 42 deletions src/pages/hard/hard.html

This file was deleted.

4 changes: 0 additions & 4 deletions src/pages/hard/hard.scss

This file was deleted.

7 changes: 4 additions & 3 deletions src/pages/hard/hard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Storage } from '@ionic/storage';

@Component({
selector: 'page-hard',
templateUrl: 'hard.html'
templateUrl: '../gameBoard/board.html'
})
export class HardPage {
constructor(public navCtrl: NavController, public navParams: NavParams, private shareService: ShareService, private storage: Storage) {
Expand Down Expand Up @@ -46,6 +46,7 @@ export class HardPage {
colors: Array<string> = [];
fail: number = 0;
record: number;
activeTimer: boolean = false;

getRandomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min;
Expand Down Expand Up @@ -128,14 +129,14 @@ export class HardPage {
let color: string = "";

this.colorType = this.possible[this.getRandomInt(0, this.possible.length - 1)];
for(let k:number = 1 ; k <= nb_color; k++){
for(let k:number = 1; k <= nb_color; k++){
do
{
color = this.generateColorCode(this.colorType);
} while(this.isColorAlreadyChoose(color) === true)
this.colors.push(color);
}
this.goodColor = this.colors[Math.floor(Math.random() * this.colors.length)];
this.goodColor = this.colors[this.getRandomInt(0, nb_color - 1)];
}
goToNavPage(): void {
this.navCtrl.pop()
Expand Down
6 changes: 3 additions & 3 deletions src/pages/normal/normal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Storage } from '@ionic/storage';

@Component({
selector: 'page-normal',
templateUrl: 'normal.html',
templateUrl: '../gameBoard/board.html',
})
export class NormalPage {

Expand Down Expand Up @@ -105,14 +105,14 @@ export class NormalPage {

let nb_color: number = this.nbColors[this.difficulty];
let color: string = "";
for(let k:number = 1 ; k <= nb_color ; k++){
for(let k:number = 1; k <= nb_color ; k++){
do
{
color = this.generateColorCode();
} while(this.isColorAlreadyChoose(color) === true)
this.colors.push(color);
}
this.goodColor = this.colors[Math.floor(Math.random() * this.colors.length)];
this.goodColor = this.colors[this.getRandomInt(0, nb_color - 1)];
}
ionViewWillLeave(): void {
this.navParams.get("parentPage").ngOnInit();
Expand Down