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
3
Merge Requests
3
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
32c15388
Commit
32c15388
authored
Mar 23, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add checkCardModalV3
parent
a66f5ae6
Pipeline
#20891
passed with stages
in 21 minutes and 13 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
150 additions
and
3 deletions
+150
-3
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+8
-0
src/reducers/duel/modal/checkCardModalV3Slice.ts
src/reducers/duel/modal/checkCardModalV3Slice.ts
+14
-2
src/reducers/duel/modal/mod.ts
src/reducers/duel/modal/mod.ts
+7
-1
src/ui/Duel/checkCardModalV3.tsx
src/ui/Duel/checkCardModalV3.tsx
+119
-0
src/ui/Duel/main.tsx
src/ui/Duel/main.tsx
+2
-0
No files found.
src/reducers/duel/mod.ts
View file @
32c15388
...
@@ -58,6 +58,8 @@ import {
...
@@ -58,6 +58,8 @@ import {
setCheckCardModalV3AllLevelImpl
,
setCheckCardModalV3AllLevelImpl
,
setCheckCardModalV3OverFlowImpl
,
setCheckCardModalV3OverFlowImpl
,
setCheckCardModalV3ResponseAbleImpl
,
setCheckCardModalV3ResponseAbleImpl
,
resetCheckCardModalV3Impl
,
setCheckCardModalV3SelectedImpl
,
}
from
"
./modal/mod
"
;
}
from
"
./modal/mod
"
;
import
{
import
{
MonsterState
,
MonsterState
,
...
@@ -176,8 +178,10 @@ const initialState: DuelState = {
...
@@ -176,8 +178,10 @@ const initialState: DuelState = {
checkCardModalV3
:
{
checkCardModalV3
:
{
isOpen
:
false
,
isOpen
:
false
,
overflow
:
false
,
overflow
:
false
,
allLevel
:
0
,
mustSelectList
:
[],
mustSelectList
:
[],
selectAbleList
:
[],
selectAbleList
:
[],
selectedList
:
[],
},
},
},
},
};
};
...
@@ -270,6 +274,8 @@ const duelSlice = createSlice({
...
@@ -270,6 +274,8 @@ const duelSlice = createSlice({
setCheckCardModalV3AllLevel
:
setCheckCardModalV3AllLevelImpl
,
setCheckCardModalV3AllLevel
:
setCheckCardModalV3AllLevelImpl
,
setCheckCardModalV3OverFlow
:
setCheckCardModalV3OverFlowImpl
,
setCheckCardModalV3OverFlow
:
setCheckCardModalV3OverFlowImpl
,
setCheckCardModalV3ResponseAble
:
setCheckCardModalV3ResponseAbleImpl
,
setCheckCardModalV3ResponseAble
:
setCheckCardModalV3ResponseAbleImpl
,
resetCheckCardModalV3
:
resetCheckCardModalV3Impl
,
setCheckCardModalV3Selected
:
setCheckCardModalV3SelectedImpl
,
// 通用的`Reducer`
// 通用的`Reducer`
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
...
@@ -379,6 +385,8 @@ export const {
...
@@ -379,6 +385,8 @@ export const {
setCheckCardModalV3AllLevel
,
setCheckCardModalV3AllLevel
,
setCheckCardModalV3OverFlow
,
setCheckCardModalV3OverFlow
,
setCheckCardModalV3ResponseAble
,
setCheckCardModalV3ResponseAble
,
resetCheckCardModalV3
,
setCheckCardModalV3Selected
,
}
=
duelSlice
.
actions
;
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
return
state
.
duel
.
meInitInfo
!=
null
;
...
...
src/reducers/duel/modal/checkCardModalV3Slice.ts
View file @
32c15388
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
CaseReducer
,
CaseReducer
,
createAsyncThunk
,
createAsyncThunk
,
}
from
"
@reduxjs/toolkit
"
;
}
from
"
@reduxjs/toolkit
"
;
import
{
fetchCard
}
from
"
../../../api/cards
"
;
import
{
CardMeta
,
fetchCard
}
from
"
../../../api/cards
"
;
import
{
RootState
}
from
"
../../../store
"
;
import
{
RootState
}
from
"
../../../store
"
;
// 更新打开状态
// 更新打开状态
...
@@ -46,6 +46,17 @@ export const setCheckCardModalV3ResponseAbleImpl: DuelReducer<boolean> = (
...
@@ -46,6 +46,17 @@ export const setCheckCardModalV3ResponseAbleImpl: DuelReducer<boolean> = (
state
.
modalState
.
checkCardModalV3
.
responseable
=
action
.
payload
;
state
.
modalState
.
checkCardModalV3
.
responseable
=
action
.
payload
;
};
};
export
const
setCheckCardModalV3SelectedImpl
:
DuelReducer
<
{
meta
:
CardMeta
;
level1
:
number
;
level2
:
number
;
response
:
number
;
}[]
>
=
(
state
,
action
)
=>
{
state
.
modalState
.
checkCardModalV3
.
selectedList
=
action
.
payload
;
};
// 增加卡牌选项
// 增加卡牌选项
export
const
fetchCheckCardMetasV3
=
createAsyncThunk
(
export
const
fetchCheckCardMetasV3
=
createAsyncThunk
(
"
duel/fetchCheckCardMetaV3
"
,
"
duel/fetchCheckCardMetaV3
"
,
...
@@ -113,10 +124,11 @@ export const resetCheckCardModalV3Impl: CaseReducer<DuelState> = (state) => {
...
@@ -113,10 +124,11 @@ export const resetCheckCardModalV3Impl: CaseReducer<DuelState> = (state) => {
const
modalState
=
state
.
modalState
.
checkCardModalV3
;
const
modalState
=
state
.
modalState
.
checkCardModalV3
;
modalState
.
isOpen
=
false
;
modalState
.
isOpen
=
false
;
modalState
.
overflow
=
false
;
modalState
.
overflow
=
false
;
modalState
.
allLevel
=
undefined
;
modalState
.
allLevel
=
0
;
modalState
.
responseable
=
undefined
;
modalState
.
responseable
=
undefined
;
modalState
.
mustSelectList
=
[];
modalState
.
mustSelectList
=
[];
modalState
.
selectAbleList
=
[];
modalState
.
selectAbleList
=
[];
modalState
.
selectedList
=
[];
};
};
export
const
selectCheckCardModalV3
=
(
state
:
RootState
)
=>
export
const
selectCheckCardModalV3
=
(
state
:
RootState
)
=>
...
...
src/reducers/duel/modal/mod.ts
View file @
32c15388
...
@@ -75,7 +75,7 @@ export interface ModalState {
...
@@ -75,7 +75,7 @@ export interface ModalState {
checkCardModalV3
:
{
checkCardModalV3
:
{
isOpen
:
boolean
;
isOpen
:
boolean
;
overflow
:
boolean
;
overflow
:
boolean
;
allLevel
?
:
number
;
allLevel
:
number
;
selectMin
?:
number
;
selectMin
?:
number
;
selectMax
?:
number
;
selectMax
?:
number
;
responseable
?:
boolean
;
responseable
?:
boolean
;
...
@@ -91,6 +91,12 @@ export interface ModalState {
...
@@ -91,6 +91,12 @@ export interface ModalState {
level2
:
number
;
level2
:
number
;
response
:
number
;
response
:
number
;
}[];
}[];
selectedList
:
{
meta
:
CardMeta
;
level1
:
number
;
level2
:
number
;
response
:
number
;
}[];
};
};
}
}
...
...
src/ui/Duel/checkCardModalV3.tsx
0 → 100644
View file @
32c15388
import
React
from
"
react
"
;
import
{
useAppSelector
}
from
"
../../hook
"
;
import
{
store
}
from
"
../../store
"
;
import
{
Modal
,
Button
,
Card
,
Row
,
Col
}
from
"
antd
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
sendSelectCardResponse
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
{
resetCheckCardModalV3
,
setCheckCardModalV3IsOpen
,
setCheckCardModalV3ResponseAble
,
setCheckCardModalV3Selected
,
}
from
"
../../reducers/duel/mod
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
{
selectCheckCardModalV3
}
from
"
../../reducers/duel/modal/checkCardModalV3Slice
"
;
const
CheckCardModalV3
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
state
=
useAppSelector
(
selectCheckCardModalV3
);
const
isOpen
=
state
.
isOpen
;
const
min
=
state
.
selectMin
||
0
;
const
max
=
state
.
selectMax
||
0
;
const
mustSelectOptions
=
state
.
mustSelectList
;
const
selectAbleOptions
=
state
.
selectAbleList
;
const
selectedOptions
=
state
.
selectedList
;
const
overflow
=
state
.
overflow
;
const
LevelSum
=
state
.
allLevel
;
const
Level1Sum
=
mustSelectOptions
.
concat
(
selectedOptions
)
.
map
((
option
)
=>
option
.
level1
)
.
reduce
((
sum
,
current
)
=>
sum
+
current
,
0
);
const
Level2Sum
=
mustSelectOptions
.
concat
(
selectedOptions
)
.
map
((
option
)
=>
option
.
level2
)
.
reduce
((
sum
,
current
)
=>
sum
+
current
,
0
);
const
responseable
=
(
overflow
?
Level1Sum
>=
LevelSum
||
Level2Sum
>=
LevelSum
:
Level1Sum
==
LevelSum
||
Level2Sum
==
LevelSum
)
&&
selectedOptions
.
length
<=
max
&&
selectedOptions
.
length
>=
min
;
const
onFinish
=
()
=>
{
sendSelectCardResponse
(
mustSelectOptions
.
concat
(
selectedOptions
).
map
((
option
)
=>
option
.
response
)
);
dispatch
(
setCheckCardModalV3IsOpen
(
false
));
dispatch
(
resetCheckCardModalV3
());
dispatch
(
setCheckCardModalV3ResponseAble
(
false
));
};
return
(
<
Modal
title=
{
`请选择卡片,最少${min}张,最多${max}张`
}
open=
{
isOpen
}
closable=
{
false
}
footer=
{
<>
<
Button
disabled=
{
!
responseable
}
onClick=
{
onFinish
}
>
finish
</
Button
>
</>
}
width=
{
800
}
>
<
CheckCard
.
Group
bordered
size=
"small"
multiple=
{
true
}
onChange=
{
(
values
:
any
)
=>
{
setCheckCardModalV3Selected
(
values
);
}
}
>
<
Row
>
{
selectAbleOptions
.
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
CheckCard
title=
{
option
.
meta
.
text
.
name
}
description=
{
option
.
meta
.
text
.
desc
}
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
meta
.
id
.
toString
()
}
src=
{
`${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
}
style=
{
{
width
:
100
}
}
/>
}
value=
{
option
}
/>
</
Col
>
);
})
}
</
Row
>
</
CheckCard
.
Group
>
<
p
>
必须选择的卡片
</
p
>
<
Row
>
{
selectedOptions
.
map
((
option
,
idx
)
=>
{
return
(
<
Col
span=
{
4
}
key=
{
idx
}
>
<
Card
hoverable
style=
{
{
width
:
120
}
}
cover=
{
<
img
alt=
{
option
.
meta
.
id
.
toString
()
}
src=
{
`${NeosConfig.cardImgUrl}/${option.meta.id}.jpg`
}
/>
}
/>
</
Col
>
);
})
}
</
Row
>
</
Modal
>
);
};
export
default
CheckCardModalV3
;
src/ui/Duel/main.tsx
View file @
32c15388
...
@@ -26,6 +26,7 @@ import { Row } from "antd";
...
@@ -26,6 +26,7 @@ import { Row } from "antd";
import
SendBox
from
"
./sendBox
"
;
import
SendBox
from
"
./sendBox
"
;
import
PlayerStatus
from
"
./status
"
;
import
PlayerStatus
from
"
./status
"
;
import
Alert
from
"
./alert
"
;
import
Alert
from
"
./alert
"
;
import
CheckCardModalV3
from
"
./checkCardModalV3
"
;
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const
NeosDuel
=
()
=>
{
const
NeosDuel
=
()
=>
{
...
@@ -46,6 +47,7 @@ const NeosDuel = () => {
...
@@ -46,6 +47,7 @@ const NeosDuel = () => {
<
PositionModal
/>
<
PositionModal
/>
<
OptionModal
/>
<
OptionModal
/>
<
CheckCardModalV2
/>
<
CheckCardModalV2
/>
<
CheckCardModalV3
/>
</>
</>
);
);
};
};
...
...
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