FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Monogatari/src/engine/characters.ts at develop · Monogatari/Monogatari · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Monogatari
/
Monogatari
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
127
Star
880
Code
Issues
24
Pull requests
3
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Monogatari
/
src
/
engine
/
characters.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (57 loc) · 2.13 KB
Breadcrumbs
Monogatari
/
src
/
engine
/
characters.ts
Copy path
File metadata and controls
69 lines (57 loc) · 2.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import
type
{
VisualNovelEngine
}
from
'../lib/types/Monogatari'
;
import
type
{
Character
}
from
'../lib/types'
;
import
deeply
from
'deeply'
;
const
merge
=
deeply
.
bind
(
{
}
)
;
export
function
characters
(
engine
:
VisualNovelEngine
,
object
:
Record
<
string
,
Character
>
|
null
=
null
)
:
Record
<
string
,
Character
>
{
if
(
object
!==
null
)
{
// const identifiers = Object.keys (object);
// for (const id of identifiers) {
// engine.character (id, object[id]);
// }
engine
.
_characters
=
merge
(
engine
.
_characters
,
object
)
as
Record
<
string
,
Character
>
;
}
return
engine
.
_characters
;
}
export
function
character
(
engine
:
VisualNovelEngine
,
id
:
string
,
object
:
Partial
<
Character
>
|
null
=
null
)
:
Character
|
undefined
{
if
(
object
!==
null
)
{
if
(
typeof
engine
.
_characters
[
id
]
!==
'undefined'
)
{
engine
.
_characters
[
id
]
=
merge
(
engine
.
_characters
[
id
]
,
object
)
as
Character
;
}
else
{
engine
.
_characters
[
id
]
=
object
as
Character
;
}
}
else
{
const
character
=
engine
.
_characters
[
id
]
;
// Translate the old character properties into the new ones
if
(
typeof
character
!==
'undefined'
)
{
if
(
typeof
character
.
Images
===
'object'
)
{
character
.
sprites
=
merge
(
{
}
,
character
.
Images
)
;
delete
character
.
Images
;
}
if
(
typeof
character
.
Directory
===
'string'
)
{
character
.
directory
=
character
.
Directory
;
delete
character
.
Directory
;
}
if
(
typeof
character
.
Color
===
'string'
)
{
character
.
color
=
character
.
Color
;
delete
character
.
Color
;
}
if
(
typeof
character
.
Name
===
'string'
)
{
character
.
name
=
character
.
Name
;
delete
character
.
Name
;
}
if
(
typeof
character
.
Face
===
'string'
)
{
character
.
default_expression
=
character
.
Face
;
delete
character
.
Face
;
}
if
(
typeof
character
.
Side
===
'object'
)
{
character
.
expressions
=
character
.
Side
;
delete
character
.
Side
;
}
if
(
typeof
character
.
TypeAnimation
===
'boolean'
)
{
character
.
type_animation
=
character
.
TypeAnimation
;
delete
character
.
TypeAnimation
;
}
}
return
character
;
}
}
Back
|
FazBrowse Home
|
New Git URL