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
f0dd5248
Commit
f0dd5248
authored
Jun 30, 2023
by
chechunchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle RockPaperScissors
parent
8988e67a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
12 deletions
+28
-12
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+1
-1
src/service/duel/rockPaperScissors.ts
src/service/duel/rockPaperScissors.ts
+10
-3
src/service/duel/selectOption.ts
src/service/duel/selectOption.ts
+2
-1
src/ui/Duel/Message/OptionModal.tsx
src/ui/Duel/Message/OptionModal.tsx
+8
-5
src/ui/Duel/PlayMat/Card/index.tsx
src/ui/Duel/PlayMat/Card/index.tsx
+7
-2
No files found.
src/service/duel/gameMsg.ts
View file @
f0dd5248
...
...
@@ -330,7 +330,7 @@ async function _handleGameMsg(pb: ygopro.YgoStocMsg) {
break
;
}
case
"
rock_paper_scissors
"
:
{
onMsgRockPaperScissors
(
msg
.
rock_paper_scissors
);
await
onMsgRockPaperScissors
(
msg
.
rock_paper_scissors
);
break
;
}
...
...
src/service/duel/rockPaperScissors.ts
View file @
f0dd5248
import
{
ygopro
}
from
"
@/api
"
;
import
{
displayOptionModal
}
from
"
@/ui/Duel/Message
"
;
export
default
(
mora
:
ygopro
.
StocGameMessage
.
MsgRockPaperScissors
)
=>
{
console
.
log
(
mora
);
// TODO
export
default
async
(
mora
:
ygopro
.
StocGameMessage
.
MsgRockPaperScissors
)
=>
{
const
_player
=
mora
.
player
;
// TODO: I18n
await
displayOptionModal
(
"
请选择猜拳
"
,
[
{
msg
:
"
剪刀
"
,
response
:
1
},
{
msg
:
"
石头
"
,
response
:
2
},
{
msg
:
"
布
"
,
response
:
3
},
]);
};
src/service/duel/selectOption.ts
View file @
f0dd5248
import
{
fetchCard
,
getCardStr
,
ygopro
}
from
"
@/api
"
;
import
{
fetchCard
,
fetchStrings
,
getCardStr
,
ygopro
}
from
"
@/api
"
;
import
MsgSelectOption
=
ygopro
.
StocGameMessage
.
MsgSelectOption
;
import
{
displayOptionModal
}
from
"
@/ui/Duel/Message
"
;
export
default
async
(
selectOption
:
MsgSelectOption
)
=>
{
const
options
=
selectOption
.
options
;
await
displayOptionModal
(
fetchStrings
(
"
!system
"
,
556
),
await
Promise
.
all
(
options
.
map
(
async
({
code
,
response
})
=>
{
const
meta
=
await
fetchCard
(
code
>>
4
);
...
...
src/ui/Duel/Message/OptionModal.tsx
View file @
f0dd5248
...
...
@@ -5,6 +5,7 @@ import { proxy, useSnapshot } from "valtio";
import
{
type
CardMeta
,
fetchStrings
,
getCardStr
,
sendSelectIdleCmdResponse
,
sendSelectOptionResponse
,
...
...
@@ -15,6 +16,7 @@ import { NeosModal } from "./NeosModal";
type
Options
=
{
msg
:
string
;
response
:
number
}[];
const
defaultStore
=
{
title
:
""
,
isOpen
:
false
,
options
:
[]
satisfies
Options
as
Options
,
};
...
...
@@ -23,7 +25,7 @@ const store = proxy(defaultStore);
export
const
OptionModal
=
()
=>
{
const
snap
=
useSnapshot
(
store
);
const
{
isOpen
,
options
}
=
snap
;
const
{
title
,
isOpen
,
options
}
=
snap
;
const
[
selected
,
setSelected
]
=
useState
<
number
|
undefined
>
(
undefined
);
...
...
@@ -36,7 +38,7 @@ export const OptionModal = () => {
return
(
<
NeosModal
title=
"请选择需要发动的效果"
title=
{
title
}
open=
{
isOpen
}
footer=
{
<
Button
disabled=
{
selected
===
undefined
}
onClick=
{
onClick
}
>
...
...
@@ -54,9 +56,10 @@ export const OptionModal = () => {
};
let
rs
:
(
v
?:
any
)
=>
void
=
()
=>
{};
export
const
displayOptionModal
=
async
(
options
:
Options
)
=>
{
store
.
isOpen
=
tru
e
;
export
const
displayOptionModal
=
async
(
title
:
string
,
options
:
Options
)
=>
{
store
.
title
=
titl
e
;
store
.
options
=
options
;
store
.
isOpen
=
true
;
await
new
Promise
((
resolve
)
=>
(
rs
=
resolve
));
store
.
isOpen
=
false
;
};
...
...
@@ -87,6 +90,6 @@ export const handleEffectActivation = async (
response
:
effect
.
response
,
};
});
await
displayOptionModal
(
options
);
// 主动发动效果,所以不需要await,但是以后可能要留心
await
displayOptionModal
(
fetchStrings
(
"
!system
"
,
556
),
options
);
// 主动发动效果,所以不需要await,但是以后可能要留心
}
};
src/ui/Duel/PlayMat/Card/index.tsx
View file @
f0dd5248
...
...
@@ -6,7 +6,12 @@ import classnames from "classnames";
import
React
,
{
type
CSSProperties
,
useEffect
,
useState
}
from
"
react
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
getCardStr
,
sendSelectIdleCmdResponse
,
ygopro
}
from
"
@/api
"
;
import
{
fetchStrings
,
getCardStr
,
sendSelectIdleCmdResponse
,
ygopro
,
}
from
"
@/api
"
;
import
{
eventbus
,
Task
}
from
"
@/infra
"
;
import
{
cardStore
,
CardType
,
Interactivity
,
InteractType
}
from
"
@/stores
"
;
import
{
showCardModal
as
displayCardModal
}
from
"
@/ui/Duel/Message/CardModal
"
;
...
...
@@ -250,7 +255,7 @@ const handleEffectActivation = (
response
:
effect
.
response
,
};
});
displayOptionModal
(
options
);
// 主动发动效果,所以不需要await,但是以后可能要留心
displayOptionModal
(
fetchStrings
(
"
!system
"
,
556
),
options
);
// 主动发动效果,所以不需要await,但是以后可能要留心
}
};
...
...
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