Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
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
Neos
Commits
5b09d7aa
Commit
5b09d7aa
authored
Sep 12, 2022
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update handleButtonClick and fmt code
parent
d0bdf00f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1321 additions
and
1095 deletions
+1321
-1095
src/JoinHome.tsx
src/JoinHome.tsx
+35
-6
src/api/ocgcore.ts
src/api/ocgcore.ts
+1286
-1089
No files found.
src/JoinHome.tsx
View file @
5b09d7aa
...
...
@@ -3,8 +3,8 @@ import { ygopro } from "./api/ocgcore";
export
default
function
JoinHome
(
props
:
{
addr
:
string
})
{
const
ws
=
useRef
<
WebSocket
|
null
>
(
null
);
const
[
user
n
ame
,
setUsername
]
=
useState
(
""
);
const
[
pass
w
d
,
setPasswd
]
=
useState
(
""
);
const
[
user
N
ame
,
setUsername
]
=
useState
(
""
);
const
[
pass
W
d
,
setPasswd
]
=
useState
(
""
);
const
[
isJoined
,
setJoined
]
=
useState
(
false
);
useEffect
(()
=>
{
...
...
@@ -26,7 +26,7 @@ export default function JoinHome(props: { addr: string }) {
return
()
=>
{
if
(
wsCurrent
.
readyState
==
1
)
{
wsCurrent
.
close
()
wsCurrent
.
close
()
;
}
};
},
[
ws
]);
...
...
@@ -47,7 +47,36 @@ export default function JoinHome(props: { addr: string }) {
}
else
{
const
wsCurrent
=
ws
.
current
;
// todo
if
(
userName
!=
null
&&
userName
.
length
!=
0
&&
passWd
!=
null
&&
passWd
.
length
!=
0
)
{
console
.
log
(
"
ready to send playerInfo and joinGame packet, userName=
"
+
userName
+
"
, passWd=
"
+
passWd
);
const
playerInfo
=
new
ygopro
.
YgoCtosMsg
({
ctos_player_info
:
new
ygopro
.
CtosPlayerInfo
({
name
:
userName
,
}),
});
wsCurrent
.
send
(
playerInfo
.
serialize
());
const
joinGame
=
new
ygopro
.
YgoCtosMsg
({
ctos_join_game
:
new
ygopro
.
CtosJoinGame
({
version
:
4947
,
gameid
:
0
,
passwd
:
passWd
,
}),
});
wsCurrent
.
send
(
joinGame
.
serialize
());
}
}
};
...
...
@@ -57,7 +86,7 @@ export default function JoinHome(props: { addr: string }) {
<
input
type=
"text"
title=
"username"
value=
{
user
n
ame
}
value=
{
user
N
ame
}
onChange=
{
handleUsernameChange
}
></
input
>
</
p
>
...
...
@@ -65,7 +94,7 @@ export default function JoinHome(props: { addr: string }) {
<
input
type=
"text"
title=
"passwd"
value=
{
pass
w
d
}
value=
{
pass
W
d
}
onChange=
{
handlePasswdChange
}
></
input
>
</
p
>
...
...
src/api/ocgcore.ts
View file @
5b09d7aa
This diff is collapsed.
Click to expand it.
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