Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
srvpro
Commits
1109ce18
Commit
1109ce18
authored
Aug 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix i18ns
parent
9ad14874
Pipeline
#4781
failed with stages
in 23 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
40 deletions
+55
-40
ygopro.coffee
ygopro.coffee
+10
-7
ygopro.js
ygopro.js
+45
-33
No files found.
ygopro.coffee
View file @
1109ce18
...
@@ -8,13 +8,16 @@ loadJSON = require('load-json-file').sync
...
@@ -8,13 +8,16 @@ loadJSON = require('load-json-file').sync
@
i18ns
=
loadJSON
'./data/i18n.json'
@
i18ns
=
loadJSON
'./data/i18n.json'
@
i18nR
=
{}
@
i18nR
=
{}
for
lang
,
data
of
@
i18ns
@
reloadI18nR
=
()
->
@
i18nR
[
lang
]
=
{}
for
lang
,
data
of
@
i18ns
for
key
,
text
of
data
@
i18nR
[
lang
]
=
{}
@
i18nR
[
lang
][
key
]
=
{
for
key
,
text
of
data
regex
:
new
RegExp
(
"
\\
$
\\
{"
+
key
+
"
\\
}"
,
'g'
),
@
i18nR
[
lang
][
key
]
=
{
text
:
text
regex
:
new
RegExp
(
"
\\
$
\\
{"
+
key
+
"
\\
}"
,
'g'
),
}
text
:
text
}
reloadI18nR
()
YGOProMessagesHelper
=
require
(
"./YGOProMessages.js"
).
YGOProMessagesHelper
# 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
YGOProMessagesHelper
=
require
(
"./YGOProMessages.js"
).
YGOProMessagesHelper
# 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
@
helper
=
new
YGOProMessagesHelper
(
9000
)
@
helper
=
new
YGOProMessagesHelper
(
9000
)
...
...
ygopro.js
View file @
1109ce18
// Generated by CoffeeScript 2.5.1
// Generated by CoffeeScript 2.5.1
(
function
()
{
(
function
()
{
var
Struct
,
YGOProMessagesHelper
,
_
,
data
,
key
,
lang
,
loadJSON
,
ref
,
text
,
translateHandler
;
var
Struct
,
YGOProMessagesHelper
,
_
,
loadJSON
,
translateHandler
;
_
=
require
(
'
underscore
'
);
_
=
require
(
'
underscore
'
);
...
@@ -16,18 +16,30 @@
...
@@ -16,18 +16,30 @@
this
.
i18nR
=
{};
this
.
i18nR
=
{};
ref
=
this
.
i18ns
;
this
.
reloadI18nR
=
function
()
{
for
(
lang
in
ref
)
{
var
data
,
key
,
lang
,
ref
,
results
,
text
;
data
=
ref
[
lang
];
ref
=
this
.
i18ns
;
this
.
i18nR
[
lang
]
=
{};
results
=
[];
for
(
key
in
data
)
{
for
(
lang
in
ref
)
{
text
=
data
[
key
];
data
=
ref
[
lang
];
this
.
i18nR
[
lang
][
key
]
=
{
this
.
i18nR
[
lang
]
=
{};
regex
:
new
RegExp
(
"
\\
$
\\
{
"
+
key
+
"
\\
}
"
,
'
g
'
),
results
.
push
((
function
()
{
text
:
text
var
results1
;
};
results1
=
[];
for
(
key
in
data
)
{
text
=
data
[
key
];
results1
.
push
(
this
.
i18nR
[
lang
][
key
]
=
{
regex
:
new
RegExp
(
"
\\
$
\\
{
"
+
key
+
"
\\
}
"
,
'
g
'
),
text
:
text
});
}
return
results1
;
}).
call
(
this
));
}
}
}
return
results
;
};
reloadI18nR
();
YGOProMessagesHelper
=
require
(
"
./YGOProMessages.js
"
).
YGOProMessagesHelper
;
// 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
YGOProMessagesHelper
=
require
(
"
./YGOProMessages.js
"
).
YGOProMessagesHelper
;
// 为 SRVPro2 准备的库,这里拿这个库只用来测试,SRVPro1 对异步支持不是特别完善,因此不会有很多异步优化
...
@@ -84,20 +96,20 @@
...
@@ -84,20 +96,20 @@
//util
//util
this
.
stoc_send_chat
=
function
(
client
,
msg
,
player
=
8
)
{
this
.
stoc_send_chat
=
function
(
client
,
msg
,
player
=
8
)
{
var
i
,
len
,
line
,
o
,
r
,
ref
1
,
ref2
;
var
i
,
len
,
line
,
o
,
r
,
ref
,
ref1
;
if
(
!
client
)
{
if
(
!
client
)
{
console
.
log
(
"
err stoc_send_chat
"
);
console
.
log
(
"
err stoc_send_chat
"
);
return
;
return
;
}
}
ref
1
=
_
.
lines
(
msg
);
ref
=
_
.
lines
(
msg
);
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
line
=
ref
1
[
i
];
line
=
ref
[
i
];
if
(
player
>=
10
)
{
if
(
player
>=
10
)
{
line
=
"
[Server]:
"
+
line
;
line
=
"
[Server]:
"
+
line
;
}
}
ref
2
=
this
.
i18nR
[
client
.
lang
];
ref
1
=
this
.
i18nR
[
client
.
lang
];
for
(
o
in
ref
2
)
{
for
(
o
in
ref
1
)
{
r
=
ref
2
[
o
];
r
=
ref
1
[
o
];
line
=
line
.
replace
(
r
.
regex
,
r
.
text
);
line
=
line
.
replace
(
r
.
regex
,
r
.
text
);
}
}
this
.
stoc_send
(
client
,
'
CHAT
'
,
{
this
.
stoc_send
(
client
,
'
CHAT
'
,
{
...
@@ -108,21 +120,21 @@
...
@@ -108,21 +120,21 @@
};
};
this
.
stoc_send_chat_to_room
=
function
(
room
,
msg
,
player
=
8
)
{
this
.
stoc_send_chat_to_room
=
function
(
room
,
msg
,
player
=
8
)
{
var
client
,
i
,
j
,
len
,
len1
,
ref
1
,
ref2
;
var
client
,
i
,
j
,
len
,
len1
,
ref
,
ref1
;
if
(
!
room
)
{
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_chat_to_room
"
);
console
.
log
(
"
err stoc_send_chat_to_room
"
);
return
;
return
;
}
}
ref
1
=
room
.
players
;
ref
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
1
[
i
];
client
=
ref
[
i
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send_chat
(
client
,
msg
,
player
);
this
.
stoc_send_chat
(
client
,
msg
,
player
);
}
}
}
}
ref
2
=
room
.
watchers
;
ref
1
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
2
.
length
;
j
<
len1
;
j
++
)
{
for
(
j
=
0
,
len1
=
ref
1
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
2
[
j
];
client
=
ref
1
[
j
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send_chat
(
client
,
msg
,
player
);
this
.
stoc_send_chat
(
client
,
msg
,
player
);
}
}
...
@@ -130,14 +142,14 @@
...
@@ -130,14 +142,14 @@
};
};
this
.
stoc_send_hint_card_to_room
=
function
(
room
,
card
)
{
this
.
stoc_send_hint_card_to_room
=
function
(
room
,
card
)
{
var
client
,
i
,
j
,
len
,
len1
,
ref
1
,
ref2
;
var
client
,
i
,
j
,
len
,
len1
,
ref
,
ref1
;
if
(
!
room
)
{
if
(
!
room
)
{
console
.
log
(
"
err stoc_send_hint_card_to_room
"
);
console
.
log
(
"
err stoc_send_hint_card_to_room
"
);
return
;
return
;
}
}
ref
1
=
room
.
players
;
ref
=
room
.
players
;
for
(
i
=
0
,
len
=
ref
1
.
length
;
i
<
len
;
i
++
)
{
for
(
i
=
0
,
len
=
ref
.
length
;
i
<
len
;
i
++
)
{
client
=
ref
1
[
i
];
client
=
ref
[
i
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
curmsg
:
2
,
...
@@ -147,9 +159,9 @@
...
@@ -147,9 +159,9 @@
});
});
}
}
}
}
ref
2
=
room
.
watchers
;
ref
1
=
room
.
watchers
;
for
(
j
=
0
,
len1
=
ref
2
.
length
;
j
<
len1
;
j
++
)
{
for
(
j
=
0
,
len1
=
ref
1
.
length
;
j
<
len1
;
j
++
)
{
client
=
ref
2
[
j
];
client
=
ref
1
[
j
];
if
(
client
)
{
if
(
client
)
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
this
.
stoc_send
(
client
,
'
GAME_MSG
'
,
{
curmsg
:
2
,
curmsg
:
2
,
...
...
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