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
a4ce41af
Commit
a4ce41af
authored
Mar 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add win ui
parent
14051878
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
src/reducers/duel/mod.ts
src/reducers/duel/mod.ts
+13
-0
src/ui/Duel/hintNotification.tsx
src/ui/Duel/hintNotification.tsx
+24
-0
No files found.
src/reducers/duel/mod.ts
View file @
a4ce41af
...
...
@@ -3,6 +3,7 @@
*
* */
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
{
createSlice
,
PayloadAction
}
from
"
@reduxjs/toolkit
"
;
import
{
InitInfo
,
infoInitImpl
,
updateHpImpl
}
from
"
./initInfoSlice
"
;
import
{
TimeLimit
,
updateTimeLimitImpl
}
from
"
./timeLimit
"
;
...
...
@@ -102,6 +103,7 @@ import {
removeExtraDeckImpl
,
addExtraDeckIdleInteractivitiesImpl
,
}
from
"
./extraDeckSlice
"
;
import
MsgWin
=
ygopro
.
StocGameMessage
.
MsgWin
;
export
interface
DuelState
{
selfType
?:
number
;
...
...
@@ -139,6 +141,8 @@ export interface DuelState {
phase
?:
PhaseState
;
result
?:
MsgWin
.
ActionType
;
// UI相关
modalState
:
ModalState
;
}
...
...
@@ -250,6 +254,11 @@ const duelSlice = createSlice({
// 通用的`Reducer`
clearAllIdleInteractivities
:
clearAllIdleInteractivitiesImpl
,
clearAllPlaceInteractivities
:
clearAllPlaceInteractivitiesImpl
,
// 对局结果`Reducer`
setResult
:
(
state
,
action
:
PayloadAction
<
MsgWin
.
ActionType
>
)
=>
{
state
.
result
=
action
.
payload
;
},
},
extraReducers
(
builder
)
{
handsCase
(
builder
);
...
...
@@ -329,8 +338,12 @@ export const {
setCheckCardModalV2ResponseAble
,
clearAllIdleInteractivities
,
clearAllPlaceInteractivities
,
setResult
,
}
=
duelSlice
.
actions
;
export
const
selectDuelHsStart
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
meInitInfo
!=
null
;
};
export
const
selectDuelResult
=
(
state
:
RootState
)
=>
{
return
state
.
duel
.
result
;
};
export
default
duelSlice
.
reducer
;
src/ui/Duel/hintNotification.tsx
View file @
a4ce41af
...
...
@@ -3,11 +3,17 @@ import { useAppSelector } from "../../hook";
import
{
selectMeHint
,
selectOpHint
}
from
"
../../reducers/duel/hintSlice
"
;
import
{
selectCurrentPhase
}
from
"
../../reducers/duel/phaseSlice
"
;
import
{
notification
}
from
"
antd
"
;
import
{
selectDuelResult
}
from
"
../../reducers/duel/mod
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
ygopro
}
from
"
../../api/ocgcore/idl/ocgcore
"
;
import
MsgWin
=
ygopro
.
StocGameMessage
.
MsgWin
;
const
HintNotification
=
()
=>
{
const
meHint
=
useAppSelector
(
selectMeHint
);
const
opHint
=
useAppSelector
(
selectOpHint
);
const
currentPhase
=
useAppSelector
(
selectCurrentPhase
);
const
result
=
useAppSelector
(
selectDuelResult
);
const
navigate
=
useNavigate
();
const
[
api
,
contextHolder
]
=
notification
.
useNotification
();
useEffect
(()
=>
{
...
...
@@ -37,6 +43,24 @@ const HintNotification = () => {
}
},
[
currentPhase
]);
useEffect
(()
=>
{
if
(
result
)
{
const
message
=
result
==
MsgWin
.
ActionType
.
Win
?
"
胜利
"
:
MsgWin
.
ActionType
.
Defeated
?
"
失败
"
:
"
未知结果
"
;
api
.
info
({
message
,
placement
:
"
bottom
"
,
onClose
()
{
navigate
(
"
/
"
);
},
});
}
},
[
result
]);
return
<>
{
contextHolder
}
</>;
};
...
...
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