Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
MDPro3
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
JQY
MDPro3
Commits
520a62fd
Commit
520a62fd
authored
Nov 18, 2025
by
J114514
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
受伤后语音
parent
d04b70b3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
40 deletions
+111
-40
Assets/Scripts/MDPro3/Duel/Message/VoiceMessage.cs
Assets/Scripts/MDPro3/Duel/Message/VoiceMessage.cs
+111
-40
No files found.
Assets/Scripts/MDPro3/Duel/Message/VoiceMessage.cs
View file @
520a62fd
...
...
@@ -34,7 +34,7 @@ namespace MDPro3.Duel
private
bool
lastVoiceIsRelease
;
private
readonly
List
<
VoiceData
>
voiceData
=
new
();
private
readonly
List
<
VoiceData
>
delay
VoiceData
=
new
();
private
readonly
List
<
VoiceData
>
alone
VoiceData
=
new
();
#
endregion
...
...
@@ -136,7 +136,82 @@ namespace MDPro3.Duel
}
private
async
UniTask
PlayAloneVoiceAsync
(
List
<
VoiceData
>
vdsource
)
{
var
voiceData
=
new
List
<
VoiceData
>(
vdsource
);
var
paths
=
GetVoicePaths
(
voiceData
);
var
clips
=
new
List
<
AudioClip
>[
paths
.
Length
];
for
(
int
i
=
0
;
i
<
clips
.
Length
;
i
++)
clips
[
i
]
=
new
List
<
AudioClip
>();
for
(
int
i
=
0
;
i
<
paths
.
Length
;
i
++)
{
for
(
int
j
=
0
;
j
<
paths
[
i
].
Count
;
j
++)
{
try
{
var
clip
=
await
AudioManager
.
LoadAudioFileUniAsync
(
paths
[
i
][
j
],
AudioType
.
OGGVORBIS
);
clips
[
i
].
Add
(
clip
);
}
catch
(
Exception
ex
)
{
Debug
.
LogException
(
ex
);
}
}
}
for
(
int
i
=
0
;
i
<
clips
.
Length
;
i
++)
{
for
(
int
j
=
0
;
j
<
clips
[
i
].
Count
;
j
++)
{
if
(
j
==
0
)
await
UniTask
.
WaitForSeconds
(
voiceData
[
i
].
delay
);
var
line
=
GetLine
(
Path
.
GetFileNameWithoutExtension
(
paths
[
i
][
j
]),
voiceData
[
i
].
isHero
);
if
(
line
!=
null
)
{
var
item
=
ABLoader
.
LoadMasterDuelGameObject
(
voiceData
[
i
].
isHero
?
"DuelChatItemMe"
:
"DuelChatItemOp"
);
item
.
transform
.
SetParent
(
Core
.
transform
.
GetChild
(
0
),
false
);
var
handler
=
item
.
GetComponent
<
ChatItemHandler
>();
handler
.
text
=
line
.
text
;
if
(
clips
[
i
][
j
]
==
null
)
{
Debug
.
LogError
(
"Voice File "
+
paths
[
i
][
j
]
+
" not Found!"
);
return
;
}
handler
.
time
=
clips
[
i
][
j
].
length
;
handler
.
frame
=
line
.
frame
;
if
(
voiceData
[
i
].
isHero
)
{
if
(
Core
.
duelChat0
!=
null
)
Core
.
duelChat0
.
BeGray
();
Core
.
duelChat0
=
handler
;
}
else
{
if
(
Core
.
duelChat1
!=
null
)
Core
.
duelChat1
.
BeGray
();
Core
.
duelChat1
=
handler
;
}
Core
.
SetCharacterFace
(
voiceData
[
i
].
isHero
?
heroString
:
rivalString
,
line
.
face
,
voiceData
[
i
].
isHero
,
0f
);
Core
.
SetCharacterFace
(
voiceData
[
i
].
isHero
?
heroString
:
rivalString
,
1
,
voiceData
[
i
].
isHero
,
clips
[
i
][
j
].
length
-
0.1f
);
}
AudioManager
.
PlayVoice
(
clips
[
i
][
j
]);
if
(
voiceData
[
i
].
wait
)
await
UniTask
.
WaitForSeconds
(
clips
[
i
][
j
].
length
);
}
}
}
private
bool
NeedVoice
()
{
return
Config
.
GetBool
(
OcgCore
.
condition
+
"Voice"
,
false
);
...
...
@@ -179,48 +254,44 @@ namespace MDPro3.Duel
}
voiceData
.
Clear
();
if
(
delayVoiceData
.
Count
>
0
)
{
for
(
int
i
=
0
;
i
<
delayVoiceData
.
Count
;
i
++)
voiceData
.
Add
(
delayVoiceData
[
i
]);
delayVoiceData
.
Clear
();
}
await
base
.
Process
(
p
);
if
(
voiceData
.
Count
==
0
)
return
;
var
needrecacc
=
OcgCore
.
Accing
&&(
voiceData
.
Count
>
0
||
aloneVoiceData
.
Count
>
0
);
// EDIT VOICE CODE
var
needrecacc
=
false
;
if
(
OcgCore
.
Accing
)
if
(
voiceData
.
Count
>
0
)
{
Core
.
GetUI
<
MDPro3
.
UI
.
ServantUI
.
OcgCoreUI
>().
OnNor
();
needrecacc
=
true
;
}
Core
.
GetUI
<
MDPro3
.
UI
.
ServantUI
.
OcgCoreUI
>().
OnNor
();
var
voiceTask
=
PlayVoiceAsync
();
// if (!isInstantMessage)
// {
// }
// else if (needrecacc)
// {
// UniTask.Create(
// async () =>
// {
// }
// );
// }
var
clickTask
=
UniTask
.
WaitUntil
(()
=>
UserInput
.
MouseLeftDown
);
await
UniTask
.
WhenAny
(
voiceTask
,
clickTask
);
//Edit Voice code
if
(!
OcgCore
.
Accing
&&
needrecacc
)
{
Core
.
GetUI
<
MDPro3
.
UI
.
ServantUI
.
OcgCoreUI
>().
OnAcc
();
}
}
if
(
aloneVoiceData
.
Count
>
0
)
{
UniTask
.
Create
(
async
()
=>
{
Core
.
GetUI
<
MDPro3
.
UI
.
ServantUI
.
OcgCoreUI
>().
OnNor
();
var
voiceTask
=
PlayAloneVoiceAsync
(
aloneVoiceData
);
var
clickTask
=
UniTask
.
WaitUntil
(()
=>
UserInput
.
MouseLeftDown
);
aloneVoiceData
.
Clear
();
await
UniTask
.
WhenAny
(
voiceTask
,
clickTask
);
if
(!
OcgCore
.
Accing
&&
needrecacc
)
{
Core
.
GetUI
<
MDPro3
.
UI
.
ServantUI
.
OcgCoreUI
>().
OnAcc
();
}
});
}
...
...
@@ -713,7 +784,7 @@ namespace MDPro3.Duel
data
.
isHero
=
player
==
0
;
data
.
wait
=
true
;
data
.
delay
=
0f
;
delay
VoiceData
.
Add
(
data
);
alone
VoiceData
.
Add
(
data
);
var
data2
=
new
VoiceData
();
if
(
DamageIsBig
(
value
))
...
...
@@ -724,7 +795,7 @@ namespace MDPro3.Duel
data2
.
isHero
=
player
==
0
;
data2
.
wait
=
true
;
data2
.
delay
=
0.26f
;
delay
VoiceData
.
Add
(
data2
);
alone
VoiceData
.
Add
(
data2
);
// isInstantMessage = true;
...
...
@@ -754,7 +825,7 @@ namespace MDPro3.Duel
data
.
isHero
=
player
==
0
;
data
.
wait
=
true
;
data
.
delay
=
0f
;
delay
VoiceData
.
Add
(
data
);
alone
VoiceData
.
Add
(
data
);
var
data2
=
new
VoiceData
();
if
(
DamageIsBig
(
value
))
...
...
@@ -765,7 +836,7 @@ namespace MDPro3.Duel
data2
.
isHero
=
player
==
0
;
data2
.
wait
=
true
;
data2
.
delay
=
0.26f
;
delay
VoiceData
.
Add
(
data2
);
alone
VoiceData
.
Add
(
data2
);
// isInstantMessage = true;
...
...
@@ -814,7 +885,7 @@ namespace MDPro3.Duel
data
.
isHero
=
player
==
0
;
data
.
wait
=
true
;
data
.
delay
=
0f
;
delay
VoiceData
.
Add
(
data
);
alone
VoiceData
.
Add
(
data
);
var
data2
=
new
VoiceData
();
if
(
DamageIsBig
(
diff
))
...
...
@@ -825,7 +896,7 @@ namespace MDPro3.Duel
data2
.
isHero
=
player
==
0
;
data2
.
wait
=
true
;
data2
.
delay
=
0.26f
;
delay
VoiceData
.
Add
(
data2
);
alone
VoiceData
.
Add
(
data2
);
// isInstantMessage = true;
...
...
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