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
cf314eab
Commit
cf314eab
authored
Aug 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish side migration 90%
parent
0f2427e4
Pipeline
#23298
passed with stages
in 13 minutes and 29 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
182 deletions
+133
-182
src/ui/Duel/Main.tsx
src/ui/Duel/Main.tsx
+1
-3
src/ui/NeosRouter.tsx
src/ui/NeosRouter.tsx
+1
-1
src/ui/NewSide/index.tsx
src/ui/NewSide/index.tsx
+0
-101
src/ui/Side/ChangeSideModal/index.tsx
src/ui/Side/ChangeSideModal/index.tsx
+0
-75
src/ui/Side/TpModal.module.scss
src/ui/Side/TpModal.module.scss
+0
-0
src/ui/Side/TpModal.tsx
src/ui/Side/TpModal.tsx
+0
-0
src/ui/Side/index.module.scss
src/ui/Side/index.module.scss
+0
-0
src/ui/Side/index.tsx
src/ui/Side/index.tsx
+131
-2
No files found.
src/ui/Duel/Main.tsx
View file @
cf314eab
...
@@ -2,7 +2,6 @@ import React, { useEffect } from "react";
...
@@ -2,7 +2,6 @@ import React, { useEffect } from "react";
import
{
resetUniverse
}
from
"
@/stores
"
;
import
{
resetUniverse
}
from
"
@/stores
"
;
import
{
ChangeSideModal
,
TpModal
}
from
"
../Side
"
;
import
{
import
{
Alert
,
Alert
,
AnnounceModal
,
AnnounceModal
,
...
@@ -23,6 +22,7 @@ import { LifeBar, Mat, Menu, Underlying } from "./PlayMat";
...
@@ -23,6 +22,7 @@ import { LifeBar, Mat, Menu, Underlying } from "./PlayMat";
export
const
Component
:
React
.
FC
=
()
=>
{
export
const
Component
:
React
.
FC
=
()
=>
{
useEffect
(()
=>
{
useEffect
(()
=>
{
return
()
=>
{
return
()
=>
{
// FIXME
// Duel组件卸载的时候初始化一些store
// Duel组件卸载的时候初始化一些store
resetUniverse
();
resetUniverse
();
};
};
...
@@ -47,8 +47,6 @@ export const Component: React.FC = () => {
...
@@ -47,8 +47,6 @@ export const Component: React.FC = () => {
<
AnnounceModal
/>
<
AnnounceModal
/>
<
SimpleSelectCardsModal
/>
<
SimpleSelectCardsModal
/>
<
EndModal
/>
<
EndModal
/>
<
ChangeSideModal
/>
<
TpModal
/>
</>
</>
);
);
};
};
...
...
src/ui/NeosRouter.tsx
View file @
cf314eab
...
@@ -30,7 +30,7 @@ const router = createBrowserRouter([
...
@@ -30,7 +30,7 @@ const router = createBrowserRouter([
},
},
{
{
path
:
"
/side
"
,
path
:
"
/side
"
,
lazy
:
()
=>
import
(
"
./
New
Side
"
),
lazy
:
()
=>
import
(
"
./Side
"
),
},
},
],
],
},
},
...
...
src/ui/NewSide/index.tsx
deleted
100644 → 0
View file @
0f2427e4
import
{
CheckOutlined
,
UndoOutlined
}
from
"
@ant-design/icons
"
;
import
{
App
,
Button
,
Space
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
DndProvider
}
from
"
react-dnd
"
;
import
{
HTML5Backend
}
from
"
react-dnd-html5-backend
"
;
import
{
CardMeta
,
fetchCard
}
from
"
@/api
"
;
import
{
isExtraDeckCard
}
from
"
@/common
"
;
import
{
deckStore
,
IDeck
}
from
"
@/stores
"
;
import
{
CardDetail
}
from
"
../BuildDeck/CardDetail
"
;
import
{
Background
,
DeckZone
,
ScrollableArea
,
Type
}
from
"
../Shared
"
;
import
{
Chat
}
from
"
../WaitRoom/Chat
"
;
import
styles
from
"
./index.module.scss
"
;
export
const
Component
:
React
.
FC
=
()
=>
{
const
{
message
}
=
App
.
useApp
();
const
{
decks
}
=
deckStore
;
const
initialDeck
=
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
]));
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
initialDeck
);
const
[
selectedCard
,
setSelectedCard
]
=
useState
(
0
);
const
canAdd
=
(
card
:
CardMeta
,
type
:
Type
,
_source
:
Type
|
"
search
"
)
=>
{
const
cardType
=
card
.
data
.
type
??
0
;
if
(
(
type
===
"
extra
"
&&
!
isExtraDeckCard
(
cardType
))
||
(
type
===
"
main
"
&&
isExtraDeckCard
(
cardType
))
)
{
return
{
result
:
false
,
reason
:
"
卡片种类不符合
"
};
}
else
{
return
{
result
:
true
,
reason
:
""
};
}
};
const
onChange
=
(
card
:
CardMeta
,
source
:
Type
|
"
search
"
,
destination
:
Type
,
)
=>
{
setDeck
((
prev
)
=>
{
const
deck
=
{
...
prev
};
if
(
source
!==
"
search
"
)
{
const
removeIndex
=
deck
[
source
].
findIndex
((
id
)
=>
id
===
card
.
id
);
if
(
removeIndex
!==
-
1
)
{
deck
[
source
].
splice
(
removeIndex
,
1
);
}
}
deck
[
destination
].
push
(
card
.
id
);
return
deck
;
});
};
const
onReset
=
()
=>
{
setDeck
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
message
.
info
(
"
重置成功
"
);
};
return
(
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Background
/>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
sider
}
>
<
Chat
/>
</
div
>
<
div
className=
{
styles
.
content
}
>
<
div
className=
{
styles
[
"
deck-container
"
]
}
>
<
Space
className=
{
styles
.
title
}
>
<
div
>
请拖动更换副卡组
</
div
>
<
Space
style=
{
{
marginRight
:
6
}
}
>
<
Button
type=
"text"
size=
"small"
icon=
{
<
UndoOutlined
/>
}
onClick=
{
onReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
size=
"small"
icon=
{
<
CheckOutlined
/>
}
>
确定
</
Button
>
</
Space
>
</
Space
>
<
ScrollableArea
className=
{
styles
[
"
deck-zone
"
]
}
>
{
([
"
main
"
,
"
extra
"
,
"
side
"
]
as
const
).
map
((
type
)
=>
(
<
DeckZone
key=
{
type
}
type=
{
type
}
cards=
{
[...
deck
[
type
]].
map
((
id
)
=>
fetchCard
(
id
))
}
canAdd=
{
canAdd
}
onChange=
{
onChange
}
onElementClick=
{
(
card
)
=>
setSelectedCard
(
card
.
id
)
}
/>
))
}
</
ScrollableArea
>
</
div
>
</
div
>
<
div
className=
{
styles
[
"
detail-container
"
]
}
>
<
CardDetail
code=
{
selectedCard
}
open=
{
true
}
onClose=
{
()
=>
{}
}
/>
</
div
>
</
div
>
</
DndProvider
>
);
};
src/ui/Side/ChangeSideModal/index.tsx
deleted
100644 → 0
View file @
0f2427e4
import
{
App
,
Button
,
Modal
}
from
"
antd
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
DndProvider
}
from
"
react-dnd
"
;
import
{
HTML5Backend
}
from
"
react-dnd-html5-backend
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
sendUpdateDeck
}
from
"
@/api
"
;
import
{
roomStore
,
SideStage
,
sideStore
}
from
"
@/stores
"
;
import
{
DeckEditor
}
from
"
../../BuildDeck
"
;
import
{
editDeckStore
}
from
"
../../BuildDeck/store
"
;
import
{
iDeckToEditingDeck
}
from
"
../../BuildDeck/utils
"
;
import
{
Background
}
from
"
../../Shared
"
;
export
const
ChangeSideModal
:
React
.
FC
=
()
=>
{
const
{
message
}
=
App
.
useApp
();
const
{
deckName
,
main
,
extra
,
side
}
=
useSnapshot
(
editDeckStore
);
const
{
stage
}
=
useSnapshot
(
sideStore
);
const
{
errorMsg
}
=
useSnapshot
(
roomStore
);
const
cardMeta2Id
=
(
meta
:
CardMeta
)
=>
meta
.
id
;
const
handleSummit
=
()
=>
{
const
newDeck
=
{
deckName
:
deckName
,
main
:
main
.
map
(
cardMeta2Id
),
extra
:
extra
.
map
(
cardMeta2Id
),
side
:
side
.
map
(
cardMeta2Id
),
};
sendUpdateDeck
(
newDeck
);
editDeckStore
.
edited
=
false
;
};
useEffect
(()
=>
{
if
(
stage
===
SideStage
.
SIDE_CHANGED
)
{
message
.
info
(
"
副卡组更换成功,请耐心等待其他玩家更换卡组
"
);
}
},
[
stage
]);
useEffect
(()
=>
{
if
(
errorMsg
!==
undefined
&&
errorMsg
!==
""
)
{
message
.
error
(
errorMsg
);
roomStore
.
errorMsg
=
undefined
;
}
},
[
errorMsg
]);
return
(
<
Modal
title=
"请选择更换副卡组"
open=
{
stage
===
SideStage
.
SIDE_CHANGING
||
stage
===
SideStage
.
SIDE_CHANGED
}
width=
{
700
}
closable=
{
false
}
footer=
{
<
Button
disabled=
{
stage
>
SideStage
.
SIDE_CHANGING
}
onClick=
{
handleSummit
}
>
副卡组更换完毕
</
Button
>
}
>
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Background
/>
<
DeckEditor
deck=
{
sideStore
.
deck
}
onClear=
{
()
=>
message
.
error
(
"
对局中清空卡组不怕找不回来吗?!
"
)
}
onSave=
{
()
=>
message
.
error
(
"
点击右下角按钮确认副卡组更换完毕
"
)
}
onReset=
{
async
()
=>
{
editDeckStore
.
set
(
await
iDeckToEditingDeck
(
sideStore
.
deck
));
}
}
/>
</
DndProvider
>
</
Modal
>
);
};
src/ui/Side/TpModal
/index
.module.scss
→
src/ui/Side/TpModal.module.scss
View file @
cf314eab
File moved
src/ui/Side/TpModal
/index
.tsx
→
src/ui/Side/TpModal.tsx
View file @
cf314eab
File moved
src/ui/
New
Side/index.module.scss
→
src/ui/Side/index.module.scss
View file @
cf314eab
File moved
src/ui/Side/index.tsx
View file @
cf314eab
export
*
from
"
./ChangeSideModal
"
;
import
{
CheckOutlined
,
UndoOutlined
}
from
"
@ant-design/icons
"
;
export
*
from
"
./TpModal
"
;
import
{
App
,
Button
,
Space
}
from
"
antd
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
DndProvider
}
from
"
react-dnd
"
;
import
{
HTML5Backend
}
from
"
react-dnd-html5-backend
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
fetchCard
,
sendUpdateDeck
}
from
"
@/api
"
;
import
{
isExtraDeckCard
}
from
"
@/common
"
;
import
{
IDeck
,
roomStore
,
SideStage
,
sideStore
}
from
"
@/stores
"
;
import
{
CardDetail
}
from
"
../BuildDeck/CardDetail
"
;
import
{
Background
,
DeckZone
,
ScrollableArea
,
Type
}
from
"
../Shared
"
;
import
{
Chat
}
from
"
../WaitRoom/Chat
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
TpModal
}
from
"
./TpModal
"
;
export
const
Component
:
React
.
FC
=
()
=>
{
const
{
message
}
=
App
.
useApp
();
const
{
deck
:
sideDeck
}
=
sideStore
;
const
{
stage
}
=
useSnapshot
(
sideStore
);
const
{
errorMsg
}
=
useSnapshot
(
roomStore
);
const
initialDeck
=
JSON
.
parse
(
JSON
.
stringify
(
sideDeck
));
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
initialDeck
);
const
[
selectedCard
,
setSelectedCard
]
=
useState
(
0
);
const
navigate
=
useNavigate
();
const
canAdd
=
(
card
:
CardMeta
,
type
:
Type
,
_source
:
Type
|
"
search
"
)
=>
{
const
cardType
=
card
.
data
.
type
??
0
;
if
(
(
type
===
"
extra
"
&&
!
isExtraDeckCard
(
cardType
))
||
(
type
===
"
main
"
&&
isExtraDeckCard
(
cardType
))
)
{
return
{
result
:
false
,
reason
:
"
卡片种类不符合
"
};
}
else
{
return
{
result
:
true
,
reason
:
""
};
}
};
const
onChange
=
(
card
:
CardMeta
,
source
:
Type
|
"
search
"
,
destination
:
Type
,
)
=>
{
setDeck
((
prev
)
=>
{
const
deck
=
{
...
prev
};
if
(
source
!==
"
search
"
)
{
const
removeIndex
=
deck
[
source
].
findIndex
((
id
)
=>
id
===
card
.
id
);
if
(
removeIndex
!==
-
1
)
{
deck
[
source
].
splice
(
removeIndex
,
1
);
}
}
deck
[
destination
].
push
(
card
.
id
);
return
deck
;
});
};
const
onReset
=
()
=>
{
setDeck
(
JSON
.
parse
(
JSON
.
stringify
(
sideDeck
)));
message
.
info
(
"
重置成功
"
);
};
const
onSummit
=
()
=>
sendUpdateDeck
(
deck
);
useEffect
(()
=>
{
if
(
stage
===
SideStage
.
SIDE_CHANGED
)
{
message
.
info
(
"
副卡组更换成功,请耐心等待其他玩家更换卡组
"
);
}
if
(
stage
===
SideStage
.
DUEL_START
)
{
// 决斗开始,跳转
navigate
(
"
/duel
"
);
}
},
[
stage
]);
useEffect
(()
=>
{
if
(
errorMsg
!==
undefined
&&
errorMsg
!==
""
)
{
message
.
error
(
errorMsg
);
roomStore
.
errorMsg
=
undefined
;
}
},
[
errorMsg
]);
return
(
<
DndProvider
backend=
{
HTML5Backend
}
>
<
Background
/>
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
.
sider
}
>
<
Chat
/>
</
div
>
<
div
className=
{
styles
.
content
}
>
<
div
className=
{
styles
[
"
deck-container
"
]
}
>
<
Space
className=
{
styles
.
title
}
>
<
div
>
请拖动更换副卡组
</
div
>
<
Space
style=
{
{
marginRight
:
6
}
}
>
<
Button
type=
"text"
size=
"small"
icon=
{
<
UndoOutlined
/>
}
onClick=
{
onReset
}
>
重置
</
Button
>
<
Button
type=
"primary"
size=
"small"
icon=
{
<
CheckOutlined
/>
}
disabled=
{
stage
>
SideStage
.
SIDE_CHANGING
}
onClick=
{
onSummit
}
>
确定
</
Button
>
</
Space
>
</
Space
>
<
ScrollableArea
className=
{
styles
[
"
deck-zone
"
]
}
>
{
([
"
main
"
,
"
extra
"
,
"
side
"
]
as
const
).
map
((
type
)
=>
(
<
DeckZone
key=
{
type
}
type=
{
type
}
cards=
{
[...
deck
[
type
]].
map
((
id
)
=>
fetchCard
(
id
))
}
canAdd=
{
canAdd
}
onChange=
{
onChange
}
onElementClick=
{
(
card
)
=>
setSelectedCard
(
card
.
id
)
}
/>
))
}
</
ScrollableArea
>
</
div
>
</
div
>
<
div
className=
{
styles
[
"
detail-container
"
]
}
>
<
CardDetail
code=
{
selectedCard
}
open=
{
true
}
onClose=
{
()
=>
{}
}
/>
</
div
>
</
div
>
<
TpModal
/>
</
DndProvider
>
);
};
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