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
750541f9
Commit
750541f9
authored
Aug 23, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add name input and idialog when download button is clicked + change font-family of dialogs
parent
c19a76c3
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
116 additions
and
10 deletions
+116
-10
app.component.ts
src/app/app.component.ts
+28
-9
app.module.ts
src/app/app.module.ts
+3
-1
scenario.ts
src/app/class/scenario/scenario.ts
+1
-0
clean-dialog.component.scss
...mponents/dialogs/clean-dialog/clean-dialog.component.scss
+4
-0
create-dialog.component.scss
...onents/dialogs/create-dialog/create-dialog.component.scss
+4
-0
save-dialog.component.html
...components/dialogs/save-dialog/save-dialog.component.html
+9
-0
save-dialog.component.scss
...components/dialogs/save-dialog/save-dialog.component.scss
+24
-0
save-dialog.component.spec.ts
...ponents/dialogs/save-dialog/save-dialog.component.spec.ts
+23
-0
save-dialog.component.ts
...p/components/dialogs/save-dialog/save-dialog.component.ts
+16
-0
suppress-dialog.component.scss
...ts/dialogs/suppress-dialog/suppress-dialog.component.scss
+4
-0
No files found.
src/app/app.component.ts
View file @
750541f9
...
@@ -25,6 +25,8 @@ import { OtherReward } from './class/rewards/other-reward/other-reward';
...
@@ -25,6 +25,8 @@ import { OtherReward } from './class/rewards/other-reward/other-reward';
import
{
PrerequireRessource
}
from
'./class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
PrerequireRessource
}
from
'./class/prerequires/prerequire-ressource/prerequire-ressource'
;
import
{
TooltipService
}
from
'./services/tooltip/tooltip.service'
;
import
{
TooltipService
}
from
'./services/tooltip/tooltip.service'
;
import
{
ZoomService
}
from
'./services/zoom/zoom.service'
;
import
{
ZoomService
}
from
'./services/zoom/zoom.service'
;
import
{
MatDialog
}
from
'@angular/material/dialog'
;
import
{
SaveDialogComponent
}
from
'./components/dialogs/save-dialog/save-dialog.component'
;
@
Component
({
@
Component
({
selector
:
'app-root'
,
selector
:
'app-root'
,
...
@@ -38,7 +40,7 @@ export class AppComponent {
...
@@ -38,7 +40,7 @@ export class AppComponent {
@
ViewChild
(
'fileInput'
)
fileInput
:
any
;
@
ViewChild
(
'fileInput'
)
fileInput
:
any
;
constructor
(
private
cdr
:
ChangeDetectorRef
,
protected
pieceDetailsService
:
PieceDetailsService
,
protected
tooltipService
:
TooltipService
,
constructor
(
private
cdr
:
ChangeDetectorRef
,
protected
pieceDetailsService
:
PieceDetailsService
,
protected
tooltipService
:
TooltipService
,
private
elementRef
:
ElementRef
,
private
zoomService
:
ZoomService
)
{
private
elementRef
:
ElementRef
,
private
zoomService
:
ZoomService
,
private
dialog
:
MatDialog
)
{
pieceDetailsService
.
piece
=
this
.
scenario
;
pieceDetailsService
.
piece
=
this
.
scenario
;
this
.
scenario
.
missions
.
forEach
(
mission
=>
{
this
.
scenario
.
missions
.
forEach
(
mission
=>
{
...
@@ -54,15 +56,32 @@ export class AppComponent {
...
@@ -54,15 +56,32 @@ export class AppComponent {
}
}
downloadFile
():
void
{
downloadFile
():
void
{
let
fileName
:
string
=
this
.
scenario
.
projectName
;
const
dialogRef
=
this
.
dialog
.
open
(
SaveDialogComponent
,
{
data
:
{
fileName
:
fileName
,
result
:
false
}
});
dialogRef
.
afterClosed
().
subscribe
(
data
=>
{
if
(
data
.
result
)
{
if
(
data
.
fileName
==
''
)
{
fileName
=
"Scénario - RLG Maker"
;
}
else
{
this
.
scenario
.
projectName
=
data
.
fileName
;
fileName
=
data
.
fileName
+
' - RLG Maker'
;
}
const
jsonString
=
JSON
.
stringify
(
this
.
scenario
);
const
jsonString
=
JSON
.
stringify
(
this
.
scenario
);
const
blob
=
new
Blob
([
jsonString
],
{
type
:
'application/json'
});
const
blob
=
new
Blob
([
jsonString
],
{
type
:
'application/json'
});
const
url
=
URL
.
createObjectURL
(
blob
);
const
url
=
URL
.
createObjectURL
(
blob
);
const
link
=
document
.
createElement
(
'a'
);
const
link
=
document
.
createElement
(
'a'
);
link
.
download
=
'scenario.json'
;
link
.
download
=
fileName
;
link
.
href
=
url
;
link
.
href
=
url
;
link
.
click
();
link
.
click
();
URL
.
revokeObjectURL
(
url
);
URL
.
revokeObjectURL
(
url
);
}
}
});
}
selectFile
():
void
{
selectFile
():
void
{
this
.
fileInput
.
nativeElement
.
click
();
this
.
fileInput
.
nativeElement
.
click
();
...
...
src/app/app.module.ts
View file @
750541f9
...
@@ -37,6 +37,7 @@ import { MouseWheelZoomDirective } from './directives/mouse-wheel-zoom.directive
...
@@ -37,6 +37,7 @@ import { MouseWheelZoomDirective } from './directives/mouse-wheel-zoom.directive
import
{
CleanDialogComponent
}
from
'./components/dialogs/clean-dialog/clean-dialog.component'
;
import
{
CleanDialogComponent
}
from
'./components/dialogs/clean-dialog/clean-dialog.component'
;
import
{
CreateDialogComponent
}
from
'./components/dialogs/create-dialog/create-dialog.component'
;
import
{
CreateDialogComponent
}
from
'./components/dialogs/create-dialog/create-dialog.component'
;
import
{
GameCharactersComponent
}
from
'./pieces/game-characters/game-characters.component'
;
import
{
GameCharactersComponent
}
from
'./pieces/game-characters/game-characters.component'
;
import
{
SaveDialogComponent
}
from
'./components/dialogs/save-dialog/save-dialog.component'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
declarations
:
[
...
@@ -66,7 +67,8 @@ import { GameCharactersComponent } from './pieces/game-characters/game-character
...
@@ -66,7 +67,8 @@ import { GameCharactersComponent } from './pieces/game-characters/game-character
SuppressDialogComponent
,
SuppressDialogComponent
,
CleanDialogComponent
,
CleanDialogComponent
,
CreateDialogComponent
,
CreateDialogComponent
,
GameCharactersComponent
GameCharactersComponent
,
SaveDialogComponent
],
],
imports
:
[
imports
:
[
BrowserModule
,
BrowserModule
,
...
...
src/app/class/scenario/scenario.ts
View file @
750541f9
...
@@ -14,4 +14,5 @@ export class Scenario {
...
@@ -14,4 +14,5 @@ export class Scenario {
gameRules
:
string
=
''
;
gameRules
:
string
=
''
;
ressources
:
Ressource
[]
=
[];
ressources
:
Ressource
[]
=
[];
comments
:
Comment
[]
=
[];
comments
:
Comment
[]
=
[];
projectName
:
string
=
''
;
}
}
\ No newline at end of file
src/app/components/dialogs/clean-dialog/clean-dialog.component.scss
View file @
750541f9
h2
{
font-family
:
'Glacial Indifference Bold'
;
}
button
{
button
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
\ No newline at end of file
src/app/components/dialogs/create-dialog/create-dialog.component.scss
View file @
750541f9
h2
{
font-family
:
'Glacial Indifference Bold'
,
sans-serif
;
}
button
{
button
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
\ No newline at end of file
src/app/components/dialogs/save-dialog/save-dialog.component.html
0 → 100644
View file @
750541f9
<h2
mat-dialog-title
>
Télécharger le scénario
</h2>
<mat-dialog-content>
<label
for=
"name"
>
Nom du projet :
</label>
<input
name=
"name"
type=
"text"
placeholder=
"Mon Scénario"
[(
ngModel
)]="
data
.
fileName
"
/>
</mat-dialog-content>
<mat-dialog-actions
align=
"center"
>
<button
mat-button
mat-dialog-close
>
Annuler
</button>
<button
mat-button
(
click
)="
data
.
result =
true"
[
mat-dialog-close
]="
data
"
cdkFocusInitial
>
Télécharger
</button>
</mat-dialog-actions>
\ No newline at end of file
src/app/components/dialogs/save-dialog/save-dialog.component.scss
0 → 100644
View file @
750541f9
h2
{
font-family
:
'Glacial Indifference Bold'
,
sans-serif
;
}
mat-dialog-content
{
display
:
flex
;
flex-direction
:
column
;
text-align
:
center
;
label
{
font-size
:
17px
;
margin-bottom
:
5px
;
}
input
{
text-align
:
center
;
border-radius
:
5px
;
height
:
25px
;
}
}
button
{
margin-top
:
20px
;
}
\ No newline at end of file
src/app/components/dialogs/save-dialog/save-dialog.component.spec.ts
0 → 100644
View file @
750541f9
import
{
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
SaveDialogComponent
}
from
'./save-dialog.component'
;
describe
(
'SaveDialogComponent'
,
()
=>
{
let
component
:
SaveDialogComponent
;
let
fixture
:
ComponentFixture
<
SaveDialogComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
declarations
:
[
SaveDialogComponent
]
})
.
compileComponents
();
fixture
=
TestBed
.
createComponent
(
SaveDialogComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/dialogs/save-dialog/save-dialog.component.ts
0 → 100644
View file @
750541f9
import
{
Component
,
OnInit
,
Inject
}
from
'@angular/core'
;
import
{
MAT_DIALOG_DATA
}
from
'@angular/material/dialog'
;
@
Component
({
selector
:
'app-save-dialog'
,
templateUrl
:
'./save-dialog.component.html'
,
styleUrls
:
[
'./save-dialog.component.scss'
]
})
export
class
SaveDialogComponent
implements
OnInit
{
constructor
(@
Inject
(
MAT_DIALOG_DATA
)
public
data
:
{
fileName
:
string
,
result
:
boolean
})
{
}
ngOnInit
():
void
{
}
}
src/app/components/dialogs/suppress-dialog/suppress-dialog.component.scss
View file @
750541f9
h2
{
font-family
:
'Glacial Indifference Bold'
,
sans-serif
;
}
button
{
button
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
\ No newline at end of file
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