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
BBeretta
Neos
Commits
536ed9e6
Commit
536ed9e6
authored
May 14, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/animation/attack' into 'main'
Feat/animation/attack See merge request
mycard/Neos!193
parents
848d06a7
e53123ee
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
110 additions
and
11 deletions
+110
-11
neos.config.json
neos.config.json
+2
-1
neos.config.prod.json
neos.config.prod.json
+2
-1
src/api/ocgcore/ocgAdapter/protoDecl.ts
src/api/ocgcore/ocgAdapter/protoDecl.ts
+1
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
+36
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
+6
-0
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
+0
-6
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
+0
-1
src/service/duel/attack.ts
src/service/duel/attack.ts
+29
-1
src/service/duel/reloadField.ts
src/service/duel/reloadField.ts
+1
-0
src/service/duel/start.ts
src/service/duel/start.ts
+3
-0
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+2
-0
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+2
-0
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+2
-0
src/ui/Duel/PlayMat/Mat.tsx
src/ui/Duel/PlayMat/Mat.tsx
+24
-1
No files found.
neos.config.json
View file @
536ed9e6
...
@@ -74,7 +74,8 @@
...
@@ -74,7 +74,8 @@
},
},
"commonDelay"
:
200
,
"commonDelay"
:
200
,
"moveDelay"
:
500
,
"moveDelay"
:
500
,
"chainingDelay"
:
800
"chainingDelay"
:
800
,
"attackDelay"
:
500
},
},
"unimplementedWhiteList"
:[
"unimplementedWhiteList"
:[
1
,
1
,
...
...
neos.config.prod.json
View file @
536ed9e6
...
@@ -74,7 +74,8 @@
...
@@ -74,7 +74,8 @@
},
},
"commonDelay"
:
200
,
"commonDelay"
:
200
,
"moveDelay"
:
500
,
"moveDelay"
:
500
,
"chainingDelay"
:
800
"chainingDelay"
:
800
,
"attackDelay"
:
500
},
},
"unimplementedWhiteList"
:[
"unimplementedWhiteList"
:[
1
,
1
,
...
...
src/api/ocgcore/ocgAdapter/protoDecl.ts
View file @
536ed9e6
...
@@ -56,3 +56,4 @@ export const MSG_ADD_COUNTER = 101;
...
@@ -56,3 +56,4 @@ export const MSG_ADD_COUNTER = 101;
export
const
MSG_REMOVE_COUNTER
=
102
;
export
const
MSG_REMOVE_COUNTER
=
102
;
export
const
MSG_SELECT_COUNTER
=
22
;
export
const
MSG_SELECT_COUNTER
=
22
;
export
const
MSG_SORT_CARD
=
25
;
export
const
MSG_SORT_CARD
=
25
;
export
const
MSG_ATTACK
=
110
;
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/attack.ts
0 → 100644
View file @
536ed9e6
import
{
ygopro
}
from
"
@/api/ocgcore/idl/ocgcore
"
;
import
{
BufferReaderExt
}
from
"
../../bufferIO
"
;
import
MsgAttack
=
ygopro
.
StocGameMessage
.
MsgAttack
;
/*
* Msg Attack
*
* @param attacker_location - 攻击者位置
* @param target_location - 攻击目标位置,可能为空
* @param direct_attack - 是否直接攻击玩家
* */
export
default
(
data
:
Uint8Array
)
=>
{
const
reader
=
new
BufferReaderExt
(
data
);
const
attacker_location
=
reader
.
readCardLocation
();
const
target_location
=
reader
.
readCardLocation
();
if
(
target_location
.
controler
==
0
&&
target_location
.
location
==
0
&&
target_location
.
sequence
==
0
)
{
// 全零表示直接攻击玩家
return
new
MsgAttack
({
attacker_location
,
direct_attack
:
true
,
});
}
else
{
return
new
MsgAttack
({
attacker_location
,
target_location
,
direct_attack
:
false
,
});
}
};
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/mod.ts
View file @
536ed9e6
...
@@ -7,6 +7,7 @@ import { ygopro } from "../../../idl/ocgcore";
...
@@ -7,6 +7,7 @@ import { ygopro } from "../../../idl/ocgcore";
import
{
StocAdapter
,
YgoProPacket
}
from
"
../../packet
"
;
import
{
StocAdapter
,
YgoProPacket
}
from
"
../../packet
"
;
import
*
as
GAME_MSG
from
"
../../protoDecl
"
;
import
*
as
GAME_MSG
from
"
../../protoDecl
"
;
import
MsgAddCounter
from
"
./addCounter
"
;
import
MsgAddCounter
from
"
./addCounter
"
;
import
MsgAttack
from
"
./attack
"
;
import
MsgDamage
from
"
./damage
"
;
import
MsgDamage
from
"
./damage
"
;
import
MsgDrawAdapter
from
"
./draw
"
;
import
MsgDrawAdapter
from
"
./draw
"
;
import
MsgHintAdapter
from
"
./hint
"
;
import
MsgHintAdapter
from
"
./hint
"
;
...
@@ -190,6 +191,11 @@ export default class GameMsgAdapter implements StocAdapter {
...
@@ -190,6 +191,11 @@ export default class GameMsgAdapter implements StocAdapter {
break
;
break
;
}
}
case
GAME_MSG
.
MSG_ATTACK
:
{
gameMsg
.
attack
=
MsgAttack
(
gameData
);
break
;
}
default
:
{
default
:
{
gameMsg
.
unimplemented
=
new
ygopro
.
StocGameMessage
.
MsgUnimplemented
({
gameMsg
.
unimplemented
=
new
ygopro
.
StocGameMessage
.
MsgUnimplemented
({
command
:
func
,
command
:
func
,
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.json
View file @
536ed9e6
...
@@ -106,12 +106,6 @@
...
@@ -106,12 +106,6 @@
{
"fieldName"
:
"location"
,
"fieldType"
:
"CardLocation"
}
{
"fieldName"
:
"location"
,
"fieldType"
:
"CardLocation"
}
]
]
},
},
"110"
:
{
"protoType"
:
"attack"
,
"fields"
:
[
{
"fieldName"
:
"location"
,
"fieldType"
:
"CardLocation"
}
]
},
"112"
:
{
"112"
:
{
"protoType"
:
"attack_disable"
,
"protoType"
:
"attack_disable"
,
"fields"
:
[]
"fields"
:
[]
...
...
src/api/ocgcore/ocgAdapter/stoc/stocGameMsg/penetrate.ts
View file @
536ed9e6
...
@@ -29,7 +29,6 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
...
@@ -29,7 +29,6 @@ const MsgConstructorMap: Map<string, Constructor> = new Map([
[
"
sp_summoning
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoning
],
[
"
sp_summoning
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoning
],
[
"
sp_summoned
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoned
],
[
"
sp_summoned
"
,
ygopro
.
StocGameMessage
.
MsgSpSummoned
],
[
"
chaining
"
,
ygopro
.
StocGameMessage
.
MsgChaining
],
[
"
chaining
"
,
ygopro
.
StocGameMessage
.
MsgChaining
],
[
"
attack
"
,
ygopro
.
StocGameMessage
.
MsgAttack
],
[
"
attack_disable
"
,
ygopro
.
StocGameMessage
.
MsgAttackDisabled
],
[
"
attack_disable
"
,
ygopro
.
StocGameMessage
.
MsgAttackDisabled
],
[
"
chain_solved
"
,
ygopro
.
StocGameMessage
.
MsgChainSolved
],
[
"
chain_solved
"
,
ygopro
.
StocGameMessage
.
MsgChainSolved
],
]);
]);
...
...
src/service/duel/attack.ts
View file @
536ed9e6
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
fetchEsHintMeta
}
from
"
@/stores
"
;
import
{
fetchEsHintMeta
,
matStore
}
from
"
@/stores
"
;
export
default
(
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
)
=>
{
export
default
(
attack
:
ygopro
.
StocGameMessage
.
MsgAttack
)
=>
{
fetchEsHintMeta
({
fetchEsHintMeta
({
originMsg
:
"
「[?]」攻击时
"
,
originMsg
:
"
「[?]」攻击时
"
,
location
:
attack
.
attacker_location
,
location
:
attack
.
attacker_location
,
});
});
const
attacker
=
matStore
.
in
(
attack
.
attacker_location
.
location
)
.
of
(
attack
.
attacker_location
.
controler
)
.
at
(
attack
.
attacker_location
.
sequence
);
if
(
attacker
)
{
if
(
attack
.
direct_attack
)
{
attacker
.
directAttack
=
true
;
setTimeout
(()
=>
(
attacker
.
directAttack
=
false
),
500
);
}
else
{
const
target
=
matStore
.
in
(
attack
.
target_location
.
location
)
.
of
(
attack
.
target_location
.
controler
)
.
at
(
attack
.
target_location
.
sequence
);
if
(
target
)
{
attacker
.
attackTarget
=
{
sequence
:
attack
.
target_location
.
sequence
,
opponent
:
!
matStore
.
isMe
(
attack
.
target_location
.
controler
),
...
target
,
};
setTimeout
(()
=>
(
attacker
.
attackTarget
=
undefined
),
500
);
}
}
}
};
};
src/service/duel/reloadField.ts
View file @
536ed9e6
...
@@ -52,6 +52,7 @@ function reloadDuelField(
...
@@ -52,6 +52,7 @@ function reloadDuelField(
counters
:
{},
counters
:
{},
focus
:
false
,
focus
:
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
reload
:
true
,
reload
:
true
,
};
};
});
});
...
...
src/service/duel/start.ts
View file @
536ed9e6
...
@@ -41,6 +41,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -41,6 +41,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
},
focus
:
false
,
focus
:
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
counters
:
{},
counters
:
{},
idleInteractivities
:
[],
idleInteractivities
:
[],
});
});
...
@@ -59,6 +60,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -59,6 +60,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
},
focus
:
false
,
focus
:
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
counters
:
{},
counters
:
{},
idleInteractivities
:
[],
idleInteractivities
:
[],
});
});
...
@@ -78,6 +80,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -78,6 +80,7 @@ export default (start: ygopro.StocGameMessage.MsgStart) => {
},
},
focus
:
false
,
focus
:
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
counters
:
{},
counters
:
{},
idleInteractivities
:
[],
idleInteractivities
:
[],
});
});
...
...
src/service/onSocketMessage.ts
View file @
536ed9e6
...
@@ -126,6 +126,8 @@ function handleDelay(stoc: ygopro.YgoStocMsg): number {
...
@@ -126,6 +126,8 @@ function handleDelay(stoc: ygopro.YgoStocMsg): number {
matStore
.
delay
=
NeosConfig
.
ui
.
moveDelay
+
500
;
matStore
.
delay
=
NeosConfig
.
ui
.
moveDelay
+
500
;
}
else
if
(
stoc
.
stoc_game_msg
.
gameMsg
==
"
chaining
"
)
{
}
else
if
(
stoc
.
stoc_game_msg
.
gameMsg
==
"
chaining
"
)
{
matStore
.
delay
=
NeosConfig
.
ui
.
chainingDelay
;
matStore
.
delay
=
NeosConfig
.
ui
.
chainingDelay
;
}
else
if
(
stoc
.
stoc_game_msg
.
gameMsg
==
"
attack
"
)
{
matStore
.
delay
=
NeosConfig
.
ui
.
attackDelay
+
200
;
}
}
}
}
...
...
src/stores/matStore/store.ts
View file @
536ed9e6
...
@@ -43,6 +43,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
...
@@ -43,6 +43,7 @@ class CardArray extends Array<CardState> implements ArrayCardState {
},
},
focus
:
focus
??
false
,
focus
:
focus
??
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
counters
:
{},
counters
:
{},
idleInteractivities
:
[],
idleInteractivities
:
[],
});
});
...
@@ -164,6 +165,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
...
@@ -164,6 +165,7 @@ const genBlock = (zone: ygopro.CardZone, n: number) =>
},
},
focus
:
false
,
focus
:
false
,
chaining
:
false
,
chaining
:
false
,
directAttack
:
false
,
idleInteractivities
:
[],
idleInteractivities
:
[],
counters
:
{},
counters
:
{},
}));
}));
...
...
src/stores/matStore/types.ts
View file @
536ed9e6
...
@@ -132,6 +132,8 @@ export interface CardState {
...
@@ -132,6 +132,8 @@ export interface CardState {
};
// 位置信息,叫location的原因是为了和ygo对齐
};
// 位置信息,叫location的原因是为了和ygo对齐
focus
:
boolean
;
// 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
focus
:
boolean
;
// 用于实现动画效果,当这个字段为true时,该张卡片会被放大并在屏幕中央展示
chaining
:
boolean
;
// 是否在连锁中
chaining
:
boolean
;
// 是否在连锁中
directAttack
:
boolean
;
// 是否正在直接攻击为玩家
attackTarget
?:
CardState
&
{
sequence
:
number
;
opponent
:
boolean
};
// 攻击目标。(嵌套结构可行么?)
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
idleInteractivities
:
Interactivity
<
number
>
[];
// IDLE状态下的互动信息
placeInteractivity
?:
Interactivity
<
{
placeInteractivity
?:
Interactivity
<
{
controler
:
number
;
controler
:
number
;
...
...
src/ui/Duel/PlayMat/Mat.tsx
View file @
536ed9e6
...
@@ -107,7 +107,11 @@ export const Mat = () => {
...
@@ -107,7 +107,11 @@ export const Mat = () => {
card
.
focus
||
card
.
focus
||
(
card
.
chaining
&&
card
.
location
.
zone
==
YgoZone
.
HAND
)
(
card
.
chaining
&&
card
.
location
.
zone
==
YgoZone
.
HAND
)
}
}
fly=
{
card
.
chaining
&&
card
.
location
.
zone
!=
YgoZone
.
HAND
}
fly=
{
(
card
.
chaining
&&
card
.
location
.
zone
!=
YgoZone
.
HAND
)
||
card
.
attackTarget
!==
undefined
||
card
.
directAttack
}
opponent=
{
card
.
opponent
}
opponent=
{
card
.
opponent
}
onClick=
{
onClick=
{
card
.
location
.
zone
==
YgoZone
.
SZONE
||
card
.
location
.
zone
==
YgoZone
.
SZONE
||
...
@@ -128,6 +132,21 @@ export const Mat = () => {
...
@@ -128,6 +132,21 @@ export const Mat = () => {
function
cardStateToRow
(
state
:
RenderCard
):
number
{
function
cardStateToRow
(
state
:
RenderCard
):
number
{
if
(
state
.
focus
)
return
2
;
if
(
state
.
focus
)
return
2
;
if
(
state
.
directAttack
)
{
// 正在直接攻击玩家
if
(
state
.
opponent
)
{
return
4.5
;
}
else
{
return
-
0.5
;
}
}
if
(
state
.
attackTarget
)
{
// 正在攻击怪兽
return
(
cardStateToRow
(
state
.
attackTarget
)
-
0.2
*
(
state
.
attackTarget
.
opponent
?
-
1
:
1
)
);
}
if
(
state
.
opponent
)
{
if
(
state
.
opponent
)
{
switch
(
state
.
location
.
zone
)
{
switch
(
state
.
location
.
zone
)
{
case
YgoZone
.
EXTRA
:
case
YgoZone
.
EXTRA
:
...
@@ -169,6 +188,10 @@ function cardStateToRow(state: RenderCard): number {
...
@@ -169,6 +188,10 @@ function cardStateToRow(state: RenderCard): number {
function
cardStateToCol
(
state
:
RenderCard
):
number
{
function
cardStateToCol
(
state
:
RenderCard
):
number
{
if
(
state
.
focus
)
return
2
;
if
(
state
.
focus
)
return
2
;
if
(
state
.
attackTarget
)
{
// 正在攻击对方怪兽
return
cardStateToCol
(
state
.
attackTarget
);
}
if
(
state
.
opponent
)
{
if
(
state
.
opponent
)
{
switch
(
state
.
location
.
zone
)
{
switch
(
state
.
location
.
zone
)
{
case
YgoZone
.
EXTRA
:
case
YgoZone
.
EXTRA
:
...
...
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