Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RLG Maker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Romain DELEAU
RLG Maker
Commits
8f6e79aa
Commit
8f6e79aa
authored
Jun 20, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dynamic rules
parent
7c466741
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
25 deletions
+23
-25
app.component.html
src/app/app.component.html
+1
-1
rules.component.html
src/app/sider-pieces/rules/rules.component.html
+6
-23
rules.component.ts
src/app/sider-pieces/rules/rules.component.ts
+16
-1
No files found.
src/app/app.component.html
View file @
8f6e79aa
...
...
@@ -103,7 +103,7 @@
</div>
<div
class=
"container-sider"
>
<app-rules
class=
"container-sider-element"
></app-rules>
<app-rules
class=
"container-sider-element"
[
scenario
]="
scenario
"
></app-rules>
<app-role-occurence
class=
"container-sider-element"
></app-role-occurence>
<app-supplementary-task
class=
"container-sider-element"
></app-supplementary-task>
<app-repeat
class=
"container-sider-element"
></app-repeat>
...
...
src/app/sider-pieces/rules/rules.component.html
View file @
8f6e79aa
...
...
@@ -2,41 +2,24 @@
<div
class=
"piece-form"
>
<div
class=
"piece-form-rules"
>
<div
class=
"piece-form-title"
>
Règles du jeu
</div>
<textarea></textarea>
<textarea
[(
ngModel
)]="
scenario
.
gameRules
"
></textarea>
</div>
<div
class=
"piece-form-ressources"
>
<div
class=
"piece-form-title"
>
Ressources / objets
</div>
<div
class=
"piece-form-ressources-object"
>
<div
class=
"piece-form-ressources-object-infos"
>
<div
class=
"piece-form-ressources-object-infos"
*
ngFor=
"let ressource of scenario.ressources; let i = index"
>
<div
class=
"piece-form-ressources-object-infos-name"
>
<label
for=
"name"
>
Nom
</label>
<input
name=
"name"
type=
"text"
/>
<input
name=
"name"
type=
"text"
[(
ngModel
)]="
ressource
.
name
"
/>
</div>
<div
class=
"piece-form-ressources-object-infos-quantity"
>
<label
for=
"quantity"
>
Quantité
</label>
<input
name=
"quantity"
type=
"text"
/>
<input
name=
"quantity"
type=
"text"
[(
ngModel
)]="
ressource
.
number
"
/>
</div>
<button
mat-button
><mat-icon
fontIcon=
"remove"
></mat-icon></button>
<button
mat-button
(
click
)="
removeRessource
(
i
)"
><mat-icon
fontIcon=
"remove"
></mat-icon></button>
</div>
<div
class=
"piece-form-ressources-object-infos"
>
<div
class=
"piece-form-ressources-object-infos-name"
>
<label
for=
"name"
>
Nom
</label>
<input
name=
"name"
type=
"text"
/>
</div>
<div
class=
"piece-form-ressources-object-infos-quantity"
>
<label
for=
"quantity"
>
Quantité
</label>
<input
name=
"quantity"
type=
"text"
/>
</div>
<button
mat-button
><mat-icon
fontIcon=
"remove"
></mat-icon></button>
</div>
<button
mat-button
><mat-icon
fontIcon=
"add"
></mat-icon></button>
<button
mat-button
(
click
)="
addRessource
()"
><mat-icon
fontIcon=
"add"
></mat-icon></button>
</div>
</div>
<div
class=
"piece-form-validate"
>
<button
mat-button
>
Valider
</button>
</div>
</div>
</div>
\ No newline at end of file
src/app/sider-pieces/rules/rules.component.ts
View file @
8f6e79aa
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
Input
,
OnInit
}
from
'@angular/core'
;
import
{
Ressource
}
from
'src/app/class/ressource/ressource'
;
import
{
Scenario
}
from
'src/app/class/scenario/scenario'
;
@
Component
({
selector
:
'app-rules'
,
...
...
@@ -7,9 +9,22 @@ import { Component, OnInit } from '@angular/core';
})
export
class
RulesComponent
implements
OnInit
{
@
Input
()
scenario
:
Scenario
=
new
Scenario
();
constructor
()
{
}
ngOnInit
():
void
{
console
.
log
(
this
.
scenario
.
ressources
)
}
addRessource
():
void
{
this
.
scenario
.
ressources
.
push
(
new
Ressource
());
console
.
log
(
'ajout ressource'
);
}
removeRessource
(
index
:
number
):
void
{
this
.
scenario
.
ressources
.
splice
(
index
,
1
);
console
.
log
(
'retrait ressource'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment