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
baichixing
Neos
Commits
78548c51
Commit
78548c51
authored
Sep 06, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复组卡页卡组全删后出现的crash,卡片选择弹窗区分敌我卡片
parent
07eb4ed6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
8 deletions
+22
-8
src/stores/deckStore.ts
src/stores/deckStore.ts
+2
-0
src/stores/sideStore.ts
src/stores/sideStore.ts
+1
-3
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+5
-3
src/ui/Duel/Message/SelectCardsModal/index.module.scss
src/ui/Duel/Message/SelectCardsModal/index.module.scss
+7
-0
src/ui/Duel/Message/SelectCardsModal/index.tsx
src/ui/Duel/Message/SelectCardsModal/index.tsx
+7
-2
No files found.
src/stores/deckStore.ts
View file @
78548c51
...
@@ -13,6 +13,8 @@ export interface IDeck {
...
@@ -13,6 +13,8 @@ export interface IDeck {
side
:
number
[];
side
:
number
[];
}
}
export
const
emptyDeck
:
IDeck
=
{
deckName
:
""
,
main
:
[],
extra
:
[],
side
:
[]
};
export
const
deckStore
=
proxy
({
export
const
deckStore
=
proxy
({
decks
:
[]
as
IDeck
[],
decks
:
[]
as
IDeck
[],
...
...
src/stores/sideStore.ts
View file @
78548c51
import
{
proxy
}
from
"
valtio
"
;
import
{
proxy
}
from
"
valtio
"
;
import
{
IDeck
}
from
"
./deckStore
"
;
import
{
emptyDeck
,
IDeck
}
from
"
./deckStore
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
import
{
type
NeosStore
}
from
"
./shared
"
;
export
enum
SideStage
{
export
enum
SideStage
{
...
@@ -13,8 +13,6 @@ export enum SideStage {
...
@@ -13,8 +13,6 @@ export enum SideStage {
WAITING
=
8
,
// 观战者等待双方玩家
WAITING
=
8
,
// 观战者等待双方玩家
}
}
const
emptyDeck
:
IDeck
=
{
deckName
:
""
,
main
:
[],
extra
:
[],
side
:
[]
};
class
SideStore
implements
NeosStore
{
class
SideStore
implements
NeosStore
{
stage
:
SideStage
=
SideStage
.
NONE
;
stage
:
SideStage
=
SideStage
.
NONE
;
deck
:
IDeck
=
emptyDeck
;
deck
:
IDeck
=
emptyDeck
;
...
...
src/ui/BuildDeck/index.tsx
View file @
78548c51
...
@@ -29,7 +29,7 @@ import { subscribeKey } from "valtio/utils";
...
@@ -29,7 +29,7 @@ import { subscribeKey } from "valtio/utils";
import
{
type
CardMeta
,
searchCards
}
from
"
@/api
"
;
import
{
type
CardMeta
,
searchCards
}
from
"
@/api
"
;
import
{
isExtraDeckCard
,
isToken
}
from
"
@/common
"
;
import
{
isExtraDeckCard
,
isToken
}
from
"
@/common
"
;
import
{
FtsConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
FtsConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
deckStore
,
type
IDeck
,
initStore
}
from
"
@/stores
"
;
import
{
deckStore
,
emptyDeck
,
type
IDeck
,
initStore
}
from
"
@/stores
"
;
import
{
import
{
Background
,
Background
,
DeckCard
,
DeckCard
,
...
@@ -74,7 +74,9 @@ export const loader: LoaderFunction = async () => {
...
@@ -74,7 +74,9 @@ export const loader: LoaderFunction = async () => {
export
const
Component
:
React
.
FC
=
()
=>
{
export
const
Component
:
React
.
FC
=
()
=>
{
const
snapDecks
=
useSnapshot
(
deckStore
);
const
snapDecks
=
useSnapshot
(
deckStore
);
const
{
progress
}
=
useSnapshot
(
initStore
.
sqlite
);
const
{
progress
}
=
useSnapshot
(
initStore
.
sqlite
);
const
[
selectedDeck
,
setSelectedDeck
]
=
useState
<
IDeck
>
(
deckStore
.
decks
[
0
]);
const
[
selectedDeck
,
setSelectedDeck
]
=
useState
<
IDeck
>
(
deckStore
.
decks
.
at
(
0
)
??
emptyDeck
,
);
const
{
message
}
=
App
.
useApp
();
const
{
message
}
=
App
.
useApp
();
...
@@ -107,7 +109,7 @@ export const Component: React.FC = () => {
...
@@ -107,7 +109,7 @@ export const Component: React.FC = () => {
decks=
{
snapDecks
.
decks
}
decks=
{
snapDecks
.
decks
}
selected=
{
selectedDeck
.
deckName
}
selected=
{
selectedDeck
.
deckName
}
onSelect=
{
(
name
)
=>
onSelect=
{
(
name
)
=>
setSelectedDeck
(
deckStore
.
get
(
name
)
??
deckStore
.
decks
[
0
]
)
setSelectedDeck
(
deckStore
.
get
(
name
)
??
emptyDeck
)
}
}
onDelete=
{
async
(
name
)
=>
await
deckStore
.
delete
(
name
)
}
onDelete=
{
async
(
name
)
=>
await
deckStore
.
delete
(
name
)
}
onDownload=
{
(
name
)
=>
{
onDownload=
{
(
name
)
=>
{
...
...
src/ui/Duel/Message/SelectCardsModal/index.module.scss
View file @
78548c51
...
@@ -45,6 +45,13 @@
...
@@ -45,6 +45,13 @@
margin-inline-end
:
0
;
margin-inline-end
:
0
;
margin-block-end
:
0
;
margin-block-end
:
0
;
flex-shrink
:
0
;
flex-shrink
:
0
;
&
.opponent
{
&
:
:
before
{
background-color
:
#dc0034
33
;
box-shadow
:
0
0
0
2px
#d22d2d
inset
;
}
}
}
}
.card
{
.card
{
...
...
src/ui/Duel/Message/SelectCardsModal/index.tsx
View file @
78548c51
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
Button
,
Card
,
Segmented
,
Space
,
Tooltip
}
from
"
antd
"
;
import
{
Button
,
Card
,
Segmented
,
Space
,
Tooltip
}
from
"
antd
"
;
import
classnames
from
"
classnames
"
;
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
INTERNAL_Snapshot
as
Snapshot
,
useSnapshot
}
from
"
valtio
"
;
import
{
INTERNAL_Snapshot
as
Snapshot
,
useSnapshot
}
from
"
valtio
"
;
import
{
type
CardMeta
,
Region
,
type
ygopro
}
from
"
@/api
"
;
import
{
type
CardMeta
,
Region
,
type
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
fetchStrings
}
from
"
@/api
"
;
import
{
CardType
,
matStore
}
from
"
@/stores
"
;
import
{
CardType
,
isMe
,
matStore
}
from
"
@/stores
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
YgoCard
}
from
"
@/ui/Shared
"
;
import
{
groupBy
}
from
"
../../utils
"
;
import
{
groupBy
}
from
"
../../utils
"
;
...
@@ -176,7 +177,11 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
...
@@ -176,7 +177,11 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
className=
{
styles
.
card
}
className=
{
styles
.
card
}
/>
/>
}
}
className=
{
styles
[
"
check-card
"
]
}
className=
{
classnames
(
styles
[
"
check-card
"
],
{
[
styles
.
opponent
]:
card
.
location
?.
controller
!==
undefined
&&
!
isMe
(
card
.
location
.
controller
),
})
}
value=
{
card
}
value=
{
card
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
showCardModal
(
card
);
showCardModal
(
card
);
...
...
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