Commit 7327d477 authored by Romain DELEAU's avatar Romain DELEAU

implement role

parent 0ad05cee
...@@ -19,53 +19,52 @@ ...@@ -19,53 +19,52 @@
<div [style.width]="'400px'" *ngIf="step == null"></div> <div [style.width]="'400px'" *ngIf="step == null"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="container-scenario-chronologie">
<div class="container-scenario-chronologie-title">Chronologie du rôle</div>
<div class="container-scenario-chronologie-steps">
<app-step [style.z-index]="2"></app-step>
<app-step [style.z-index]="1"></app-step>
</div>
</div>
<div style="display: flex;"> <div style="display: flex;">
<div class="container-scenario-main-missions-mission-missionPieces" [style.z-index]="3"> <div class="container-scenario-main-missions-mission-missionPieces" [style.z-index]="3">
<app-educational-objective [educationnalObjective]="mission.educationnalObjective"></app-educational-objective> <app-educational-objective [educationnalObjective]="mission.educationnalObjective"></app-educational-objective>
<app-mission-context [style.z-index]="2" [missionContext]="mission.context"></app-mission-context> <app-mission-context [style.z-index]="2" [missionContext]="mission.context"></app-mission-context>
</div> </div>
<div class="container-scenario-main-missions-mission-roles" [style.z-index]="2"> <div class="container-scenario-main-missions-mission-roles" [style.z-index]="2">
<div class="container-scenario-main-missions-mission-roles-role"> <div class="container-scenario-main-missions-mission-roles-role" *ngFor="let role of mission.roles">
<app-role [style.z-index]="10"></app-role>
<div class="container-scenario-main-missions-mission-roles-role-tasks" <div style="display: flex; flex-direction: column;">
[style.z-index]="1"> <div class="container-scenario-main-missions-mission-roles-role-chronologie">
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks" <div class="container-scenario-main-missions-mission-roles-role-chronologie-title">Chronologie du rôle</div>
[style.z-index]="2"> <div class="container-scenario-main-missions-mission-roles-role-chronologie-steps">
<app-task [style.z-index]="3"></app-task>
<app-task [style.z-index]="2"></app-task> <div *ngFor="let step of role.chronologie, let i = index" [style.z-index]="role.chronologie.length-i">
<app-repeat-task [style.z-index]="1"></app-repeat-task> <app-step *ngIf="step != null" [step]="step"></app-step>
</div> <div [style.width]="'400px'" *ngIf="step == null"></div>
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks" </div>
[style.z-index]="2">
<app-annexe-task [style.z-index]="3"></app-annexe-task> </div>
<app-optionnal-task [style.z-index]="2"></app-optionnal-task>
<app-final-task [style.z-index]="1"></app-final-task>
</div>
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks"
[style.z-index]="2">
<app-random-event [style.z-index]="2"></app-random-event>
</div> </div>
</div>
</div> <div style="display: flex; flex-direction: row;">
<div class="container-scenario-main-missions-mission-roles-role"> <app-role [style.z-index]="2" [role]="role"></app-role>
<app-role [style.z-index]="10"></app-role> <div class="container-scenario-main-missions-mission-roles-role-tasks"
<div class="container-scenario-main-missions-mission-roles-role-tasks" [style.z-index]="1">
[style.z-index]="1"> <div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks"
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks" [style.z-index]="2"> [style.z-index]="2">
<app-task [style.z-index]="3"></app-task> <app-task [style.z-index]="3"></app-task>
<app-annexe-task [style.z-index]="2"></app-annexe-task> <app-task [style.z-index]="2"></app-task>
<app-random-event [style.z-index]="1"></app-random-event> <app-repeat-task [style.z-index]="1"></app-repeat-task>
</div>
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks"
[style.z-index]="2">
<app-annexe-task [style.z-index]="3"></app-annexe-task>
<app-optionnal-task [style.z-index]="2"></app-optionnal-task>
<app-final-task [style.z-index]="1"></app-final-task>
</div>
<div class="container-scenario-main-missions-mission-roles-role-tasks-inlineTasks"
[style.z-index]="2">
<app-random-event [style.z-index]="2"></app-random-event>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
&-scenario { &-scenario {
&-chronologie { &-chronologie {
margin-bottom: 100px; margin-bottom: 400px;
position: relative; position: relative;
left: 800px; left: 800px;
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
flex-direction: column; flex-direction: column;
margin-bottom: 100px; margin-bottom: 100px;
position: relative; position: relative;
top: -868px; top: -734px;
&-missionPieces { &-missionPieces {
display: flex; display: flex;
...@@ -73,10 +73,30 @@ ...@@ -73,10 +73,30 @@
&-roles { &-roles {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative;
top: -359px;
&-role { &-role {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-bottom: 50px;
&-chronologie {
margin-bottom: 25px;
margin-left: 400px;
&-title {
font-family: 'Glacial Indifference Bold';
font-size: 20px;
margin-bottom: 10px;
}
&-steps {
display: flex;
flex-direction: row;
height: 300px;
}
}
&-tasks { &-tasks {
display: flex; display: flex;
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Scenario } from './class/scenario/scenario'; import { Scenario } from './class/scenario/scenario';
import { Step } from './class/step/step';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
......
export class Ressource { export class Ressource {
name: string = ''; name: string = '';
number: string = ''; number: string = '1';
type: string = ''; type: string = 'ressource';
} }
import { Character } from "../../character/character"; import { Character } from "../../character/character";
import { Reward } from "../reward"; import { Reward } from "../reward";
export class CharacterReward implements Reward { export class CharacterReward extends Reward {
constructor() {
super('character');
}
character!: Character; character!: Character;
} }
import { Reward } from "../reward"; import { Reward } from "../reward";
export class ObjectiveReward implements Reward { export class ObjectiveReward extends Reward {
constructor() {
super('objective');
}
name: string = ''; name: string = '';
} }
import { Ressource } from "../../ressource/ressource"; import { Ressource } from "../../ressource/ressource";
import { Reward } from "../reward"; import { Reward } from "../reward";
export class ObjectsReward implements Reward{ export class ObjectsReward extends Reward{
constructor() {
super('objects');
}
objects: Ressource[] = [new Ressource()]; objects: Ressource[] = [new Ressource()];
} }
import { OtherReward } from './other-reward';
describe('OtherReward', () => {
it('should create an instance', () => {
expect(new OtherReward()).toBeTruthy();
});
});
import { Reward } from "../reward";
export class OtherReward extends Reward {
constructor() {
super('other');
}
text: string = '';
}
import { Role } from "../../role/role"; import { Role } from "../../role/role";
import { Reward } from "../reward"; import { Reward } from "../reward";
export class QuestReward implements Reward { export class QuestReward extends Reward {
constructor() {
super('quest');
}
quest!: Role; quest!: Role;
} }
export interface Reward { export abstract class Reward {
constructor(type: string) {
this.type = type;
}
type: string;
} }
import { Ressource } from "../../ressource/ressource"; import { Ressource } from "../../ressource/ressource";
import { Reward } from "../reward"; import { Reward } from "../reward";
export class SkillReward implements Reward { export class SkillReward extends Reward {
constructor() {
super('skill');
}
skill!: Ressource; skill!: Ressource;
} }
import { RoleEducationnalObjective } from './role-educationnal-objective';
describe('RoleEducationnalObjective', () => {
it('should create an instance', () => {
expect(new RoleEducationnalObjective()).toBeTruthy();
});
});
export class RoleEducationnalObjective {
objective: string = "";
}
...@@ -4,13 +4,14 @@ import { Ressource } from "../ressource/ressource"; ...@@ -4,13 +4,14 @@ import { Ressource } from "../ressource/ressource";
import { SupplementaryRole } from "../supplementary-role/supplementary-role"; import { SupplementaryRole } from "../supplementary-role/supplementary-role";
import { Reward } from "../rewards/reward"; import { Reward } from "../rewards/reward";
import { RoleOccurrence } from "../role-occurrence/role-occurrence"; import { RoleOccurrence } from "../role-occurrence/role-occurrence";
import { RoleEducationnalObjective } from "../role-educationnal-objective/role-educationnal-objective";
export class Role { export class Role {
intitule: string = ''; intitule: string = '';
questName: string = ''; questName: string = '';
description: string = ''; description: string = '';
educationnalObjectives: string[] = ['']; educationnalObjectives: RoleEducationnalObjective[] = [new RoleEducationnalObjective()];
rewards: Reward[] = []; rewards: Reward[] = [];
stuff: string = ''; stuff: string = '';
ressources: Ressource[] = []; ressources: Ressource[] = [];
......
export class SupplementaryRole { export class SupplementaryRole {
name: string = ''; name: string = '';
color: string = ''; color: string = '#000000';
objectives: string = ''; objectives: string = '';
skills: string = ''; skills: string = '';
rules: string = ''; rules: string = '';
......
This diff is collapsed.
...@@ -204,9 +204,18 @@ ...@@ -204,9 +204,18 @@
} }
} }
&-add {
margin-top: 10px;
button {
width: 100%;
}
}
&-reward { &-reward {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-top: 10px;
select { select {
height: 50px; height: 50px;
...@@ -323,14 +332,6 @@ ...@@ -323,14 +332,6 @@
margin-top: 5px; margin-top: 5px;
} }
} }
&-add {
margin-top: 10px;
button {
width: 100%;
}
}
} }
} }
...@@ -408,7 +409,6 @@ ...@@ -408,7 +409,6 @@
&-supplementary { &-supplementary {
padding-bottom: 10px; padding-bottom: 10px;
background: linear-gradient(302deg, rgb(2, 0, 36) 0%, rgb(2, 0, 36) 50%, #9ad5ec 50%, #9ad5ec 100%);
width: 398px; width: 398px;
position: relative; position: relative;
left: -34px; left: -34px;
......
import { Component, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { Ressource } from 'src/app/class/ressource/ressource';
import { CharacterReward } from 'src/app/class/rewards/character-reward/character-reward';
import { ObjectiveReward } from 'src/app/class/rewards/objective-reward/objective-reward';
import { ObjectsReward } from 'src/app/class/rewards/objects-reward/objects-reward';
import { OtherReward } from 'src/app/class/rewards/other-reward/other-reward';
import { QuestReward } from 'src/app/class/rewards/quest-reward/quest-reward';
import { Reward } from 'src/app/class/rewards/reward';
import { SkillReward } from 'src/app/class/rewards/skill-reward/skill-reward';
import { RoleEducationnalObjective } from 'src/app/class/role-educationnal-objective/role-educationnal-objective';
import { Role } from 'src/app/class/role/role';
import { SupplementaryRole } from 'src/app/class/supplementary-role/supplementary-role';
@Component({ @Component({
selector: 'app-role', selector: 'app-role',
...@@ -7,6 +18,8 @@ import { Component, OnInit } from '@angular/core'; ...@@ -7,6 +18,8 @@ import { Component, OnInit } from '@angular/core';
}) })
export class RoleComponent implements OnInit { export class RoleComponent implements OnInit {
@Input() role: Role = new Role();
constructor() { } constructor() { }
ngOnInit(): void { ngOnInit(): void {
...@@ -31,4 +44,78 @@ export class RoleComponent implements OnInit { ...@@ -31,4 +44,78 @@ export class RoleComponent implements OnInit {
} }
addEducationnalObjective(): void {
this.role.educationnalObjectives.push(new RoleEducationnalObjective());
}
removeEducationnalObjective(index: number): void {
this.role.educationnalObjectives.splice(index, 1);
}
addRessource(): void {
this.role.ressources.push(new Ressource());
}
removeRessource(index: number): void {
this.role.ressources.splice(index, 1);
}
addSupplementaryRole(): void {
this.role.supplementaryRoles.push(new SupplementaryRole());
}
removeSupplementaryRole(index: number) {
this.role.supplementaryRoles.splice(index, 1);
}
addReward(): void {
this.role.rewards.push(new QuestReward());
}
changeRewardType(index: number, type: string): void {
switch(type) {
case 'objects': this.role.rewards[index] = new ObjectsReward(); break;
case 'quest': this.role.rewards[index] = new QuestReward(); break;
case 'skill': this.role.rewards[index] = new SkillReward(); break;
case 'objective': this.role.rewards[index] = new ObjectiveReward(); break;
case 'character': this.role.rewards[index] = new CharacterReward(); break;
case 'other': this.role.rewards[index] = new OtherReward(); break;
}
}
removeReward(index: number): void {
this.role.rewards.splice(index, 1);
}
getObjectiveReward(index: number): ObjectiveReward {
return this.role.rewards[index] as ObjectiveReward;
}
getQuestReward(index: number): QuestReward {
return this.role.rewards[index] as QuestReward;
}
getCharacterReward(index: number): CharacterReward {
return this.role.rewards[index] as CharacterReward;
}
getSkillReward(index: number): SkillReward {
return this.role.rewards[index] as SkillReward;
}
getOtherReward(index: number): OtherReward {
return this.role.rewards[index] as OtherReward;
}
getObjectsReward(index: number): ObjectsReward {
return this.role.rewards[index] as ObjectsReward;
}
addObject(index: number): void {
this.getObjectsReward(index).objects.push(new Ressource);
}
removeObject(i: number, j: number): void {
this.getObjectsReward(i).objects.splice(j, 1);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment