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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
BBeretta
Neos
Commits
f04069c0
Commit
f04069c0
authored
Mar 11, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate CustomRoomContent
parent
6682e09b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
16 deletions
+141
-16
src/ui/Match/CustomRoomContent/index.tsx
src/ui/Match/CustomRoomContent/index.tsx
+138
-13
src/ui/Match/MatchModal/index.tsx
src/ui/Match/MatchModal/index.tsx
+3
-3
No files found.
src/ui/Match/CustomRoomContent/index.tsx
View file @
f04069c0
import
{
CopyOutlined
,
KeyOutlined
}
from
"
@ant-design/icons
"
;
import
{
Button
,
Checkbox
,
Input
}
from
"
antd
"
;
import
React
from
"
react
"
;
import
type
{
CheckboxProps
}
from
"
antd
"
;
import
{
App
,
Button
,
Checkbox
,
Input
}
from
"
antd
"
;
import
React
,
{
ChangeEvent
,
useEffect
}
from
"
react
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
defaultOptions
,
getPrivateRoomID
,
Options
}
from
"
@/api
"
;
import
{
accountStore
}
from
"
@/stores
"
;
import
{
Select
}
from
"
@/ui/Shared
"
;
import
styles
from
"
./index.module.scss
"
;
interface
CustomRoomProps
{
options
:
Options
;
isPrivate
:
boolean
;
}
const
defaultProps
:
CustomRoomProps
=
{
options
:
defaultOptions
,
isPrivate
:
true
,
// 暂时只支持私密模式
};
export
const
mcCustomRoomStore
=
proxy
<
CustomRoomProps
>
(
defaultProps
);
export
const
CustomRoomContent
:
React
.
FC
=
()
=>
{
const
{
message
}
=
App
.
useApp
();
const
user
=
useSnapshot
(
accountStore
).
user
;
const
{
options
}
=
useSnapshot
(
mcCustomRoomStore
);
useEffect
(()
=>
{
if
(
!
user
)
{
message
.
error
(
"
请先登录萌卡账号!
"
);
}
},
[
user
]);
const
onCopy
=
async
()
=>
{};
const
onChangeStartLP
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
mcCustomRoomStore
.
options
.
start_lp
=
Number
(
event
.
target
.
value
);
};
const
onChangeStartHand
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
mcCustomRoomStore
.
options
.
start_hand
=
Number
(
event
.
target
.
value
);
};
const
onChangeDrawCount
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
mcCustomRoomStore
.
options
.
draw_count
=
Number
(
event
.
target
.
value
);
};
const
onChangeRule
=
(
value
:
any
)
=>
{
mcCustomRoomStore
.
options
.
rule
=
value
;
};
const
onChangeMode
=
(
value
:
any
)
=>
{
mcCustomRoomStore
.
options
.
mode
=
value
;
};
const
onChangeDuelRule
=
(
value
:
any
)
=>
{
mcCustomRoomStore
.
options
.
duel_rule
=
value
;
};
const
onChangeNoCheckDeck
:
CheckboxProps
[
"
onChange
"
]
=
(
e
)
=>
{
mcCustomRoomStore
.
options
.
no_check_deck
=
e
.
target
.
checked
;
};
const
onChangeNoShuffleDeck
:
CheckboxProps
[
"
onChange
"
]
=
(
e
)
=>
{
mcCustomRoomStore
.
options
.
no_shuffle_deck
=
e
.
target
.
checked
;
};
const
onChangeAutoDeath
:
CheckboxProps
[
"
onChange
"
]
=
(
e
)
=>
{
mcCustomRoomStore
.
options
.
auto_death
=
e
.
target
.
checked
;
};
return
(
<
div
className=
{
styles
.
container
}
>
<
p
>
创建/加入私密房间
</
p
>
...
...
@@ -15,33 +70,103 @@ export const CustomRoomContent: React.FC = () => {
房间密码
<
KeyOutlined
/>
</
div
>
<
Input
className=
{
styles
.
input
}
type=
"text"
/>
<
Button
icon=
{
<
CopyOutlined
/>
}
/>
<
Input
className=
{
styles
.
input
}
value=
{
getPrivateRoomID
(
user
?.
external_id
??
0
)
}
type=
"number"
readOnly
/>
<
Button
icon=
{
<
CopyOutlined
/>
}
onClick=
{
onCopy
}
/>
</
div
>
<
div
className=
{
styles
[
"
digit-option
"
]
}
>
<
div
className=
{
styles
.
title
}
>
初始LP
</
div
>
<
Input
className=
{
styles
.
input
}
type=
"text"
/>
<
Input
className=
{
styles
.
input
}
value=
{
options
.
start_lp
}
onChange=
{
onChangeStartLP
}
type=
"number"
/>
</
div
>
<
div
className=
{
styles
[
"
digit-option
"
]
}
>
<
div
className=
{
styles
.
title
}
>
初始手牌数
</
div
>
<
Input
className=
{
styles
.
input
}
type=
"text"
/>
<
Input
className=
{
styles
.
input
}
value=
{
options
.
start_hand
}
onChange=
{
onChangeStartHand
}
type=
"number"
/>
</
div
>
<
div
className=
{
styles
[
"
digit-option
"
]
}
>
<
div
className=
{
styles
.
title
}
>
每回合抽卡
</
div
>
<
Input
className=
{
styles
.
input
}
type=
"text"
/>
<
Input
className=
{
styles
.
input
}
value=
{
options
.
draw_count
}
onChange=
{
onChangeDrawCount
}
type=
"number"
/>
</
div
>
<
div
className=
{
styles
[
"
select-option
"
]
}
>
<
Select
title=
"卡片允许"
/>
<
Select
title=
"卡片允许"
value=
{
options
.
rule
}
options=
{
[
{
value
:
0
,
label
:
"
OCG
"
},
{
value
:
1
,
label
:
"
TCG
"
},
{
value
:
2
,
label
:
"
简体中文
"
},
{
value
:
3
,
label
:
"
自制卡
"
},
{
value
:
4
,
label
:
"
专有卡禁止
"
},
{
value
:
5
,
label
:
"
所有卡片
"
},
]
}
onChange=
{
onChangeRule
}
/>
</
div
>
<
div
className=
{
styles
[
"
select-option
"
]
}
>
<
Select
title=
"决斗模式"
/>
<
Select
title=
"决斗模式"
value=
{
options
.
mode
}
options=
{
[
{
value
:
0
,
label
:
"
单局模式
"
},
{
value
:
1
,
label
:
"
比赛模式
"
},
//
{
value
:
2
,
label
:
"
TAG
"
},
]
}
onChange=
{
onChangeMode
}
/>
</
div
>
<
div
className=
{
styles
[
"
select-option
"
]
}
>
<
Select
title=
"决斗规则"
/>
<
Select
title=
"决斗规则"
value=
{
options
.
duel_rule
}
options=
{
[
{
value
:
1
,
label
:
"
大师规则1
"
},
{
value
:
2
,
label
:
"
大师规则2
"
},
{
value
:
3
,
label
:
"
大师规则3
"
},
{
value
:
4
,
label
:
"
新大师规则
"
},
{
value
:
5
,
label
:
"
大师规则2020
"
},
]
}
onChange=
{
onChangeDuelRule
}
/>
</
div
>
<
Checkbox
className=
{
styles
.
check
}
>
不检查卡组
</
Checkbox
>
<
Checkbox
className=
{
styles
.
check
}
>
不切洗卡组
</
Checkbox
>
<
Checkbox
className=
{
styles
.
check
}
>
40分自动加时
</
Checkbox
>
<
Checkbox
className=
{
styles
.
check
}
checked=
{
options
.
no_check_deck
}
onChange=
{
onChangeNoCheckDeck
}
>
不检查卡组
</
Checkbox
>
<
Checkbox
className=
{
styles
.
check
}
checked=
{
options
.
no_shuffle_deck
}
onChange=
{
onChangeNoShuffleDeck
}
>
不切洗卡组
</
Checkbox
>
<
Checkbox
className=
{
styles
.
check
}
checked=
{
options
.
auto_death
}
onChange=
{
onChangeAutoDeath
}
>
40分自动加时
</
Checkbox
>
</
div
>
);
};
...
...
src/ui/Match/MatchModal/index.tsx
View file @
f04069c0
...
...
@@ -40,13 +40,13 @@ export const MatchModal: React.FC = ({}) => {
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
navigate
=
useNavigate
();
le
t
handlePlayerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
cons
t
handlePlayerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setPlayer
(
event
.
target
.
value
);
};
le
t
handleServerChange
=
(
value
:
any
)
=>
{
cons
t
handleServerChange
=
(
value
:
any
)
=>
{
setServerId
(
value
);
};
le
t
handlePasswdChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
cons
t
handlePasswdChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setPasswd
(
event
.
target
.
value
);
};
...
...
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