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
love_飞影
Neos
Commits
e2ad4284
Commit
e2ad4284
authored
Jul 29, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add chainSettnigs
parent
7a0a763c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
13 deletions
+43
-13
src/service/duel/selectChain.ts
src/service/duel/selectChain.ts
+9
-5
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+2
-1
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+8
-0
src/ui/Duel/PlayMat/Menu/index.tsx
src/ui/Duel/PlayMat/Menu/index.tsx
+24
-7
No files found.
src/service/duel/selectChain.ts
View file @
e2ad4284
import
{
sendSelectSingleResponse
,
ygopro
}
from
"
@/api
"
;
import
{
sendSelectSingleResponse
,
ygopro
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
ChainSetting
,
fetchSelectHintMeta
,
matStore
}
from
"
@/stores
"
;
import
{
fetchSelectHintMeta
}
from
"
@/stores
"
;
import
{
displaySelectActionsModal
}
from
"
@/ui/Duel/Message/SelectActionsModal
"
;
import
{
displaySelectActionsModal
}
from
"
@/ui/Duel/Message/SelectActionsModal
"
;
import
{
fetchCheckCardMeta
}
from
"
../utils
"
;
import
{
fetchCheckCardMeta
}
from
"
../utils
"
;
const
NeosConfig
=
useConfig
();
type
MsgSelectChain
=
ygopro
.
StocGameMessage
.
MsgSelectChain
;
type
MsgSelectChain
=
ygopro
.
StocGameMessage
.
MsgSelectChain
;
export
default
async
(
selectChain
:
MsgSelectChain
)
=>
{
export
default
async
(
selectChain
:
MsgSelectChain
)
=>
{
const
spCount
=
selectChain
.
special_count
;
const
spCount
=
selectChain
.
special_count
;
...
@@ -14,6 +11,13 @@ export default async (selectChain: MsgSelectChain) => {
...
@@ -14,6 +11,13 @@ export default async (selectChain: MsgSelectChain) => {
const
_hint0
=
selectChain
.
hint0
;
const
_hint0
=
selectChain
.
hint0
;
const
_hint1
=
selectChain
.
hint1
;
const
_hint1
=
selectChain
.
hint1
;
const
chains
=
selectChain
.
chains
;
const
chains
=
selectChain
.
chains
;
const
chainSetting
=
matStore
.
chainSetting
;
if
(
chainSetting
==
ChainSetting
.
CHAIN_IGNORE
)
{
// 如果玩家配置了忽略连锁,直接回应后端并返回
sendSelectSingleResponse
(
-
1
);
return
;
}
let
handle_flag
=
0
;
let
handle_flag
=
0
;
if
(
!
forced
)
{
if
(
!
forced
)
{
...
@@ -24,7 +28,7 @@ export default async (selectChain: MsgSelectChain) => {
...
@@ -24,7 +28,7 @@ export default async (selectChain: MsgSelectChain) => {
// 直接回答
// 直接回答
handle_flag
=
0
;
handle_flag
=
0
;
}
else
{
}
else
{
if
(
NeosConfig
.
chain
ALL
)
{
if
(
chainSetting
==
ChainSetting
.
CHAIN_
ALL
)
{
// 配置了全部连锁,则处理多张
// 配置了全部连锁,则处理多张
handle_flag
=
2
;
handle_flag
=
2
;
}
else
{
}
else
{
...
...
src/stores/matStore/store.ts
View file @
e2ad4284
...
@@ -3,7 +3,7 @@ import { proxy } from "valtio";
...
@@ -3,7 +3,7 @@ import { proxy } from "valtio";
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
type
{
InitInfo
,
MatState
}
from
"
./types
"
;
import
{
ChainSetting
,
InitInfo
,
MatState
}
from
"
./types
"
;
/**
/**
* 根据controller判断是自己还是对方。
* 根据controller判断是自己还是对方。
...
@@ -53,6 +53,7 @@ const initInfo: MatState["initInfo"] = proxy({
...
@@ -53,6 +53,7 @@ const initInfo: MatState["initInfo"] = proxy({
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
const
initialState
:
Omit
<
MatState
,
"
reset
"
>
=
{
chains
:
[],
chains
:
[],
chainSetting
:
ChainSetting
.
CHAIN_SMART
,
timeLimits
:
{
timeLimits
:
{
// 时间限制
// 时间限制
...
...
src/stores/matStore/types.ts
View file @
e2ad4284
...
@@ -20,6 +20,8 @@ export interface MatState extends NeosStore {
...
@@ -20,6 +20,8 @@ export interface MatState extends NeosStore {
chains
:
ygopro
.
CardLocation
[];
// 连锁的卡片位置
chains
:
ygopro
.
CardLocation
[];
// 连锁的卡片位置
chainSetting
:
ChainSetting
;
// 连锁类型
timeLimits
:
BothSide
<
number
>
&
{
timeLimits
:
BothSide
<
number
>
&
{
set
:
(
controller
:
number
,
time
:
number
)
=>
void
;
set
:
(
controller
:
number
,
time
:
number
)
=>
void
;
};
// 双方的时间限制
};
// 双方的时间限制
...
@@ -104,4 +106,10 @@ export enum HandResult {
...
@@ -104,4 +106,10 @@ export enum HandResult {
ROCK
=
2
,
ROCK
=
2
,
PAPER
=
3
,
PAPER
=
3
,
}
}
export
enum
ChainSetting
{
CHAIN_ALL
=
0
,
// 打开全部时点
CHAIN_IGNORE
=
1
,
// 关闭连锁时点
CHAIN_SMART
=
2
,
// 只打开关键时点
}
// <<< play mat state <<<
// <<< play mat state <<<
src/ui/Duel/PlayMat/Menu/index.tsx
View file @
e2ad4284
...
@@ -3,6 +3,7 @@ import {
...
@@ -3,6 +3,7 @@ import {
CheckOutlined
,
CheckOutlined
,
CloseCircleFilled
,
CloseCircleFilled
,
MessageFilled
,
MessageFilled
,
SettingOutlined
,
StepForwardFilled
,
StepForwardFilled
,
}
from
"
@ant-design/icons
"
;
}
from
"
@ant-design/icons
"
;
import
{
import
{
...
@@ -33,11 +34,12 @@ const { phase } = matStore;
...
@@ -33,11 +34,12 @@ const { phase } = matStore;
const
{
useToken
}
=
theme
;
const
{
useToken
}
=
theme
;
export
const
Menu
=
()
=>
{
export
const
Menu
=
()
=>
{
const
snapPhase
=
useSnapshot
(
phase
);
const
snapPhase
=
useSnapshot
(
phase
);
const
{
currentPlayer
}
=
useSnapshot
(
matStore
);
const
currentPhase
=
snapPhase
.
currentPhase
;
const
currentPhase
=
snapPhase
.
currentPhase
;
const
enableBp
=
snapPhase
.
enableBp
;
const
enableBp
=
snapPhase
.
enableBp
;
const
enableM2
=
snapPhase
.
enableM2
;
const
enableM2
=
snapPhase
.
enableM2
;
const
enableEp
=
snapPhase
.
enableEp
;
const
enableEp
=
snapPhase
.
enableEp
;
const
{
currentPlayer
}
=
useSnapshot
(
matStore
);
const
{
chainSetting
}
=
useSnapshot
(
matStore
);
const
clearAllIdleInteractivities
=
()
=>
{
const
clearAllIdleInteractivities
=
()
=>
{
for
(
const
card
of
cardStore
.
inner
)
{
for
(
const
card
of
cardStore
.
inner
)
{
...
@@ -108,6 +110,16 @@ export const Menu = () => {
...
@@ -108,6 +110,16 @@ export const Menu = () => {
danger
:
phase
===
PhaseType
.
END
,
danger
:
phase
===
PhaseType
.
END
,
}));
}));
const
chainSettingTexts
=
[
"
全部连锁
"
,
"
忽略连锁
"
,
"
智能连锁
"
];
const
chainSettingItems
:
MenuProps
[
"
items
"
]
=
chainSettingTexts
.
map
((
text
,
i
)
=>
({
label
:
text
,
onClick
:
()
=>
{
matStore
.
chainSetting
=
i
;
},
}))
.
map
((
item
,
i
)
=>
({
key
:
i
,
...
item
}));
const
surrenderMenuItems
:
MenuProps
[
"
items
"
]
=
[
const
surrenderMenuItems
:
MenuProps
[
"
items
"
]
=
[
{
{
label
:
"
取消
"
,
label
:
"
取消
"
,
...
@@ -135,17 +147,22 @@ export const Menu = () => {
...
@@ -135,17 +147,22 @@ export const Menu = () => {
{
phaseBind
.
find
(([
key
])
=>
key
===
currentPhase
)?.[
1
]
}
{
phaseBind
.
find
(([
key
])
=>
key
===
currentPhase
)?.[
1
]
}
</
Button
>
</
Button
>
</
DropdownWithTitle
>
</
DropdownWithTitle
>
<
DropdownWithTitle
title=
{
chainSettingTexts
[
chainSetting
]
}
menu=
{
{
items
:
chainSettingItems
,
selectable
:
true
,
defaultSelectedKeys
:
[
"
3
"
],
}
}
>
<
Button
icon=
{
<
SettingOutlined
/>
}
type=
"text"
></
Button
>
</
DropdownWithTitle
>
<
Tooltip
title=
"聊天室"
>
<
Tooltip
title=
"聊天室"
>
<
Button
<
Button
icon=
{
<
MessageFilled
/>
}
type=
"text"
></
Button
>
icon=
{
<
MessageFilled
/>
}
type=
"text"
disabled=
{
globalDisable
}
></
Button
>
</
Tooltip
>
</
Tooltip
>
<
DropdownWithTitle
<
DropdownWithTitle
title=
"是否投降?"
title=
"是否投降?"
menu=
{
{
items
:
surrenderMenuItems
}
}
menu=
{
{
items
:
surrenderMenuItems
}
}
disabled=
{
globalDisable
}
>
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
<
Button
icon=
{
<
CloseCircleFilled
/>
}
type=
"text"
></
Button
>
</
DropdownWithTitle
>
</
DropdownWithTitle
>
...
...
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