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
09fe150d
Commit
09fe150d
authored
Apr 14, 2024
by
love_飞影
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: use service implements effect
parent
f2dd6118
Pipeline
#26463
passed with stages
in 7 minutes and 58 seconds
Changes
19
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
20 additions
and
31 deletions
+20
-31
src/api/ocgcore/ocgAdapter/stoc/stocChat.ts
src/api/ocgcore/ocgAdapter/stoc/stocChat.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/addCounter.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/addCounter.ts
+0
-2
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newTurn.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newTurn.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/recover.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/recover.ts
+0
-3
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/removeCounter.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/removeCounter.ts
+0
-2
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
+0
-2
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
+0
-3
src/service/duel/attack.ts
src/service/duel/attack.ts
+3
-0
src/service/duel/draw.ts
src/service/duel/draw.ts
+2
-0
src/service/duel/newPhase.ts
src/service/duel/newPhase.ts
+2
-0
src/service/duel/newTurn.ts
src/service/duel/newTurn.ts
+2
-0
src/service/duel/toss.ts
src/service/duel/toss.ts
+3
-0
src/service/duel/updateCounter.ts
src/service/duel/updateCounter.ts
+3
-0
src/service/duel/updateHp.ts
src/service/duel/updateHp.ts
+3
-1
src/service/room/hsPlayerEnter.ts
src/service/room/hsPlayerEnter.ts
+2
-0
No files found.
src/api/ocgcore/ocgAdapter/stoc/stocChat.ts
View file @
09fe150d
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
StocAdapter
,
YgoProPacket
}
from
"
../packet
"
;
...
...
@@ -16,7 +14,6 @@ export default class ChatAdapter implements StocAdapter {
constructor
(
packet
:
YgoProPacket
)
{
this
.
packet
=
packet
;
playEffect
(
AudioActionType
.
SOUND_CHAT
);
}
upcast
():
ygopro
.
YgoStocMsg
{
...
...
src/api/ocgcore/ocgAdapter/stoc/stocErrorMsg.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
StocAdapter
,
YgoProPacket
}
from
"
../packet
"
;
...
...
@@ -16,7 +14,6 @@ export default class ErrorMsg implements StocAdapter {
constructor
(
packet
:
YgoProPacket
)
{
this
.
packet
=
packet
;
playEffect
(
AudioActionType
.
SOUND_INFO
);
}
upcast
():
ygopro
.
YgoStocMsg
{
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/addCounter.ts
View file @
09fe150d
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
MsgUpdateCounter
=
ygopro
.
StocGameMessage
.
MsgUpdateCounter
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
/*
* Msg Add Counter
...
...
@@ -10,7 +9,6 @@ import { AudioActionType, playEffect } from "@/infra/audio";
* @usage - TODO
* */
export
default
(
data
:
Uint8Array
)
=>
{
playEffect
(
AudioActionType
.
SOUND_COUNTER_ADD
);
const
reader
=
new
BufferReaderExt
(
data
);
const
counterType
=
reader
.
inner
.
readUint16
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
View file @
09fe150d
...
...
@@ -2,7 +2,6 @@ import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
MsgAttack
=
ygopro
.
StocGameMessage
.
MsgAttack
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
/*
* Msg Attack
...
...
@@ -22,14 +21,12 @@ export default (data: Uint8Array) => {
target_location
.
zone
===
0
&&
target_location
.
sequence
===
0
)
{
playEffect
(
AudioActionType
.
SOUND_DIRECT_ATTACK
);
// 全零表示直接攻击玩家
return
new
MsgAttack
({
attacker_location
,
direct_attack
:
true
,
});
}
else
{
playEffect
(
AudioActionType
.
SOUND_ATTACK
);
return
new
MsgAttack
({
attacker_location
,
target_location
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/draw.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
/*
...
...
@@ -20,7 +18,6 @@ export default (data: Uint8Array) => {
let
cards
:
number
[]
=
[];
for
(
let
i
=
0
;
i
<
count
;
i
++
)
{
cards
.
push
(
reader
.
readUint32
());
playEffect
(
AudioActionType
.
SOUND_DRAW
);
}
return
new
ygopro
.
StocGameMessage
.
MsgDraw
({
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newPhase.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
/*
...
...
@@ -13,7 +11,6 @@ import { ygopro } from "../../../idl/ocgcore";
* */
export
default
(
data
:
Uint8Array
)
=>
{
playEffect
(
AudioActionType
.
SOUND_PHASE
);
const
reader
=
new
BufferReader
(
data
);
const
phase
=
reader
.
readUint16
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/newTurn.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
/*
...
...
@@ -13,7 +11,6 @@ import { ygopro } from "../../../idl/ocgcore";
* */
export
default
(
data
:
Uint8Array
)
=>
{
playEffect
(
AudioActionType
.
SOUND_NEXT_TURN
);
const
reader
=
new
BufferReader
(
data
);
const
player
=
reader
.
readUint8
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/recover.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
rust-src
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
/*
...
...
@@ -11,7 +9,6 @@ import { ygopro } from "../../../idl/ocgcore";
* @param value - 回复的Hp数值
* */
export
default
(
data
:
Uint8Array
)
=>
{
playEffect
(
AudioActionType
.
SOUND_RECOVER
);
const
reader
=
new
BufferReader
(
data
);
const
player
=
reader
.
readUint8
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/removeCounter.ts
View file @
09fe150d
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
MsgUpdateCounter
=
ygopro
.
StocGameMessage
.
MsgUpdateCounter
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
/*
* Msg Remove Counter
...
...
@@ -10,7 +9,6 @@ import { AudioActionType, playEffect } from "@/infra/audio";
* @usage - TODO
* */
export
default
(
data
:
Uint8Array
)
=>
{
playEffect
(
AudioActionType
.
SOUND_COUNTER_REMOVE
);
const
reader
=
new
BufferReaderExt
(
data
);
const
counterType
=
reader
.
inner
.
readUint16
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/toss.ts
View file @
09fe150d
import
{
BufferReader
}
from
"
../../../../../../rust-src/pkg/rust_src
"
;
import
{
ygopro
}
from
"
../../../idl/ocgcore
"
;
import
MsgToss
=
ygopro
.
StocGameMessage
.
MsgToss
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
/*
* Msg Toss
...
...
@@ -10,7 +9,6 @@ import { AudioActionType, playEffect } from "@/infra/audio";
* @usage 骰子/硬币结果
* */
export
default
(
data
:
Uint8Array
,
toss_type
:
MsgToss
.
TossType
)
=>
{
playEffect
(
AudioActionType
.
SOUND_DICE
);
const
reader
=
new
BufferReader
(
data
);
const
player
=
reader
.
readUint8
();
const
count
=
reader
.
readUint8
();
...
...
src/api/ocgcore/ocgAdapter/stoc/stocHsPlayerEnter.ts
View file @
09fe150d
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
ygopro
}
from
"
../../idl/ocgcore
"
;
import
{
StocAdapter
,
YgoProPacket
}
from
"
../packet
"
;
import
{
_cutoff_name
,
UTF16_BUFFER_MAX_LEN
}
from
"
../util
"
;
...
...
@@ -19,7 +17,6 @@ export default class HsPlayerEnterAdapter implements StocAdapter {
constructor
(
packet
:
YgoProPacket
)
{
this
.
packet
=
packet
;
playEffect
(
AudioActionType
.
SOUND_PLAYER_ENTER
);
}
upcast
():
ygopro
.
YgoStocMsg
{
...
...
src/service/duel/attack.ts
View file @
09fe150d
import
{
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
callCardAttack
}
from
"
@/ui/Duel/PlayMat/Card
"
;
...
...
@@ -16,10 +17,12 @@ export default async (attack: ygopro.StocGameMessage.MsgAttack) => {
if
(
attacker
)
{
if
(
attack
.
direct_attack
)
{
playEffect
(
AudioActionType
.
SOUND_DIRECT_ATTACK
);
await
callCardAttack
(
attacker
.
uuid
,
{
directAttack
:
true
,
});
}
else
{
playEffect
(
AudioActionType
.
SOUND_ATTACK
);
await
callCardAttack
(
attacker
.
uuid
,
{
directAttack
:
false
,
target
:
attack
.
target_location
,
...
...
src/service/duel/draw.ts
View file @
09fe150d
import
{
fetchCard
,
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
,
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
callCardMove
}
from
"
@/ui/Duel/PlayMat/Card
"
;
...
...
@@ -22,6 +23,7 @@ export default async (draw: ygopro.StocGameMessage.MsgDraw) => {
card
.
meta
=
meta
;
card
.
location
.
zone
=
ygopro
.
CardZone
.
HAND
;
card
.
location
.
sequence
=
Number
(
idx
)
+
handsLength
;
playEffect
(
AudioActionType
.
SOUND_DRAW
);
}
// 抽卡动画
...
...
src/service/duel/newPhase.ts
View file @
09fe150d
import
{
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
matStore
}
from
"
@/stores
"
;
export
default
(
newPhase
:
ygopro
.
StocGameMessage
.
MsgNewPhase
)
=>
{
playEffect
(
AudioActionType
.
SOUND_PHASE
);
// ts本身还没有这么智能,所以需要手动指定类型
matStore
.
phase
.
currentPhase
=
newPhase
.
phase_type
;
};
src/service/duel/newTurn.ts
View file @
09fe150d
import
{
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
matStore
}
from
"
@/stores
"
;
export
default
(
newTurn
:
ygopro
.
StocGameMessage
.
MsgNewTurn
)
=>
{
playEffect
(
AudioActionType
.
SOUND_NEXT_TURN
);
const
player
=
newTurn
.
player
;
matStore
.
currentPlayer
=
player
;
};
src/service/duel/toss.ts
View file @
09fe150d
...
...
@@ -2,6 +2,7 @@ import { fetchStrings, Region, ygopro } from "@/api";
import
{
sleep
}
from
"
@/infra
"
;
import
{
matStore
}
from
"
@/stores
"
;
import
MsgToss
=
ygopro
.
StocGameMessage
.
MsgToss
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
export
default
async
(
toss
:
MsgToss
)
=>
{
const
player
=
toss
.
player
;
...
...
@@ -11,8 +12,10 @@ export default async (toss: MsgToss) => {
for
(
const
x
of
toss
.
res
)
{
if
(
tossType
===
MsgToss
.
TossType
.
DICE
)
{
playEffect
(
AudioActionType
.
SOUND_DICE
);
matStore
.
tossResult
=
prefix
+
fetchStrings
(
Region
.
System
,
1624
)
+
x
;
}
else
if
(
tossType
===
MsgToss
.
TossType
.
COIN
)
{
playEffect
(
AudioActionType
.
SOUND_COIN
);
matStore
.
tossResult
=
prefix
+
fetchStrings
(
Region
.
System
,
1623
)
+
...
...
src/service/duel/updateCounter.ts
View file @
09fe150d
import
{
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
cardStore
}
from
"
@/stores
"
;
type
MsgUpdateCounter
=
ygopro
.
StocGameMessage
.
MsgUpdateCounter
;
...
...
@@ -12,8 +13,10 @@ export default (updateCounter: MsgUpdateCounter) => {
case
ygopro
.
StocGameMessage
.
MsgUpdateCounter
.
ActionType
.
ADD
:
{
if
(
counterType
in
target
.
counters
)
{
target
.
counters
[
counterType
]
+=
count
;
playEffect
(
AudioActionType
.
SOUND_COUNTER_ADD
);
}
else
{
target
.
counters
[
counterType
]
=
count
;
playEffect
(
AudioActionType
.
SOUND_COUNTER_REMOVE
);
}
break
;
}
...
...
src/service/duel/updateHp.ts
View file @
09fe150d
...
...
@@ -2,13 +2,15 @@ import { ygopro } from "@/api";
import
{
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
import
MsgUpdateHp
=
ygopro
.
StocGameMessage
.
MsgUpdateHp
;
import
{
AudioActionType
,
changeScene
}
from
"
@/infra/audio
"
;
import
{
AudioActionType
,
changeScene
,
playEffect
}
from
"
@/infra/audio
"
;
export
default
(
msgUpdateHp
:
MsgUpdateHp
)
=>
{
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
DAMAGE
)
{
playEffect
(
AudioActionType
.
SOUND_DAMAGE
);
fetchEsHintMeta
({
originMsg
:
"
玩家收到伤害时
"
});
// TODO: i18n
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
-=
msgUpdateHp
.
value
;
}
else
if
(
msgUpdateHp
.
type_
===
MsgUpdateHp
.
ActionType
.
RECOVER
)
{
playEffect
(
AudioActionType
.
SOUND_RECOVER
);
fetchEsHintMeta
({
originMsg
:
"
玩家生命值回复时
"
});
// TODO: i18n
matStore
.
initInfo
.
of
(
msgUpdateHp
.
player
).
life
+=
msgUpdateHp
.
value
;
}
...
...
src/service/room/hsPlayerEnter.ts
View file @
09fe150d
import
{
ygopro
}
from
"
@/api
"
;
import
{
AudioActionType
,
playEffect
}
from
"
@/infra/audio
"
;
import
{
roomStore
}
from
"
@/stores
"
;
export
default
function
handleHsPlayerEnter
(
pb
:
ygopro
.
YgoStocMsg
)
{
playEffect
(
AudioActionType
.
SOUND_PLAYER_ENTER
);
const
name
=
pb
.
stoc_hs_player_enter
.
name
;
const
pos
=
pb
.
stoc_hs_player_enter
.
pos
;
...
...
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