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
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
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
赤子奈落
MDPro3
Commits
b3287b74
Commit
b3287b74
authored
Mar 11, 2026
by
Senator John
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch' into 'master'
Patch See merge request
!31
parents
b6115d85
68e86f5c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
10 deletions
+98
-10
Assets/Scripts/MDPro3/Managers/AudioManager.cs
Assets/Scripts/MDPro3/Managers/AudioManager.cs
+70
-7
Assets/Scripts/MDPro3/Net/OnlineService.cs
Assets/Scripts/MDPro3/Net/OnlineService.cs
+28
-3
No files found.
Assets/Scripts/MDPro3/Managers/AudioManager.cs
View file @
b3287b74
...
@@ -7,6 +7,7 @@ using System.IO;
...
@@ -7,6 +7,7 @@ using System.IO;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.AddressableAssets
;
using
UnityEngine.AddressableAssets
;
using
UnityEngine.Networking
;
using
UnityEngine.Networking
;
using
UnityEngine.ResourceManagement.AsyncOperations
;
namespace
MDPro3
namespace
MDPro3
{
{
...
@@ -122,6 +123,73 @@ namespace MDPro3
...
@@ -122,6 +123,73 @@ namespace MDPro3
private
static
LastSE
lastSE
=
new
();
private
static
LastSE
lastSE
=
new
();
public
static
string
nextMuteSE
;
public
static
string
nextMuteSE
;
private
static
readonly
Dictionary
<
string
,
bool
>
seAddressExists
=
new
();
private
const
string
OneShotSuffix
=
"_oneshot"
;
private
static
async
UniTask
<
bool
>
HasSEAddress
(
string
path
)
{
if
(
string
.
IsNullOrEmpty
(
path
))
return
false
;
if
(
seAddressExists
.
TryGetValue
(
path
,
out
var
exists
))
return
exists
;
var
handle
=
Addressables
.
LoadResourceLocationsAsync
(
path
,
typeof
(
AudioClip
));
try
{
await
handle
.
Task
;
exists
=
handle
.
Status
==
AsyncOperationStatus
.
Succeeded
&&
handle
.
Result
!=
null
&&
handle
.
Result
.
Count
>
0
;
}
catch
{
exists
=
false
;
}
finally
{
if
(
handle
.
IsValid
())
Addressables
.
Release
(
handle
);
}
seAddressExists
[
path
]
=
exists
;
return
exists
;
}
private
static
async
UniTask
<
string
>
ResolveSEAddress
(
string
path
)
{
if
(
await
HasSEAddress
(
path
))
return
path
;
if
(
path
.
EndsWith
(
OneShotSuffix
,
StringComparison
.
OrdinalIgnoreCase
))
{
var
fallbackPath
=
path
.
Substring
(
0
,
path
.
Length
-
OneShotSuffix
.
Length
);
if
(
await
HasSEAddress
(
fallbackPath
))
return
fallbackPath
;
}
return
null
;
}
private
static
async
UniTaskVoid
PlaySEInternal
(
string
path
,
float
volumeScale
)
{
var
resolvedPath
=
await
ResolveSEAddress
(
path
);
if
(
string
.
IsNullOrEmpty
(
resolvedPath
))
return
;
var
handle
=
Addressables
.
LoadAssetAsync
<
AudioClip
>(
resolvedPath
);
try
{
await
handle
.
Task
;
}
catch
{
return
;
}
if
(
handle
.
Status
==
AsyncOperationStatus
.
Succeeded
&&
handle
.
Result
!=
null
&&
se
!=
null
)
se
.
PlayOneShot
(
handle
.
Result
,
volumeScale
);
}
public
static
void
PlaySE
(
string
path
,
float
volumeScale
=
1
)
public
static
void
PlaySE
(
string
path
,
float
volumeScale
=
1
)
{
{
...
@@ -142,12 +210,7 @@ namespace MDPro3
...
@@ -142,12 +210,7 @@ namespace MDPro3
lastSE
.
time
=
Time
.
time
;
lastSE
.
time
=
Time
.
time
;
lastSE
.
seName
=
path
;
lastSE
.
seName
=
path
;
var
handle
=
Addressables
.
LoadAssetAsync
<
AudioClip
>(
path
);
_
=
PlaySEInternal
(
path
,
volumeScale
);
handle
.
Completed
+=
(
result
)
=>
{
if
(
result
.
Result
!=
null
)
se
.
PlayOneShot
(
result
.
Result
,
volumeScale
);
};
}
}
public
void
PlayShuffleSE
()
public
void
PlayShuffleSE
()
...
...
Assets/Scripts/MDPro3/Net/OnlineService.cs
View file @
b3287b74
...
@@ -63,7 +63,16 @@ namespace MDPro3.Net
...
@@ -63,7 +63,16 @@ namespace MDPro3.Net
using
var
request
=
UnityWebRequest
.
Get
(
URL_GENESYS_LFLIST
);
using
var
request
=
UnityWebRequest
.
Get
(
URL_GENESYS_LFLIST
);
request
.
timeout
=
15
;
request
.
timeout
=
15
;
try
{
await
request
.
SendWebRequest
();
await
request
.
SendWebRequest
();
}
catch
{
MessageManager
.
Cast
(
InterString
.
Get
(
"下载Genesys禁卡表失败。"
));
return
;
}
if
(
request
.
result
==
UnityWebRequest
.
Result
.
Success
)
if
(
request
.
result
==
UnityWebRequest
.
Result
.
Success
)
{
{
File
.
WriteAllText
(
PATH_GENESYS_LFLIST
,
request
.
downloadHandler
.
text
);
File
.
WriteAllText
(
PATH_GENESYS_LFLIST
,
request
.
downloadHandler
.
text
);
...
@@ -218,7 +227,16 @@ namespace MDPro3.Net
...
@@ -218,7 +227,16 @@ namespace MDPro3.Net
using
var
request
=
UnityWebRequest
.
Get
(
URL_MYCARD_APPS
);
using
var
request
=
UnityWebRequest
.
Get
(
URL_MYCARD_APPS
);
request
.
timeout
=
15
;
request
.
timeout
=
15
;
try
{
await
request
.
SendWebRequest
();
await
request
.
SendWebRequest
();
}
catch
{
Program
.
Debug
(
"下载MyCard apps.json失败。"
);
return
;
}
if
(
request
.
result
==
UnityWebRequest
.
Result
.
Success
)
if
(
request
.
result
==
UnityWebRequest
.
Result
.
Success
)
{
{
File
.
WriteAllText
(
PATH_MYCARD_APPS
,
request
.
downloadHandler
.
text
);
File
.
WriteAllText
(
PATH_MYCARD_APPS
,
request
.
downloadHandler
.
text
);
...
@@ -256,7 +274,14 @@ namespace MDPro3.Net
...
@@ -256,7 +274,14 @@ namespace MDPro3.Net
{
{
using
var
headRequest
=
UnityWebRequest
.
Head
(
url
);
using
var
headRequest
=
UnityWebRequest
.
Head
(
url
);
headRequest
.
timeout
=
8
;
headRequest
.
timeout
=
8
;
try
{
await
headRequest
.
SendWebRequest
();
await
headRequest
.
SendWebRequest
();
}
catch
{
return
null
;
}
if
(
headRequest
.
result
!=
UnityWebRequest
.
Result
.
Success
)
if
(
headRequest
.
result
!=
UnityWebRequest
.
Result
.
Success
)
{
{
...
...
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