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
839c193f
Commit
839c193f
authored
Mar 15, 2026
by
Senator John
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch' into 'master'
Patch See merge request
!40
parents
585fec25
1612c01b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
123 additions
and
45 deletions
+123
-45
Assets/Scripts/MDPro3/Duel/Message/DuelMessage.cs
Assets/Scripts/MDPro3/Duel/Message/DuelMessage.cs
+2
-1
Assets/Scripts/MDPro3/Servant/OcgCore.cs
Assets/Scripts/MDPro3/Servant/OcgCore.cs
+26
-10
Assets/Scripts/MDPro3/UI/UIWidget/Deck/CardInfoDetail.cs
Assets/Scripts/MDPro3/UI/UIWidget/Deck/CardInfoDetail.cs
+95
-34
No files found.
Assets/Scripts/MDPro3/Duel/Message/DuelMessage.cs
View file @
839c193f
...
@@ -509,7 +509,8 @@ namespace MDPro3.Duel
...
@@ -509,7 +509,8 @@ namespace MDPro3.Duel
/*var lenth = */
reader
.
ReadInt16
();
/*var lenth = */
reader
.
ReadInt16
();
var
buffer
=
reader
.
ReadToEnd
();
var
buffer
=
reader
.
ReadToEnd
();
var
text
=
Encoding
.
UTF8
.
GetString
(
buffer
,
0
,
buffer
.
Length
);
var
text
=
Encoding
.
UTF8
.
GetString
(
buffer
,
0
,
buffer
.
Length
);
MessageManager
.
Cast
(
text
);
if
(
OcgCore
.
ShouldShowSystemMessages
())
MessageManager
.
Cast
(
text
);
return
UniTask
.
CompletedTask
;
return
UniTask
.
CompletedTask
;
}
}
...
...
Assets/Scripts/MDPro3/Servant/OcgCore.cs
View file @
839c193f
...
@@ -763,24 +763,38 @@ namespace MDPro3.Servant
...
@@ -763,24 +763,38 @@ namespace MDPro3.Servant
GetUI
<
OcgCoreUI
>().
DuelErrorLog
.
Show
(
error
);
GetUI
<
OcgCoreUI
>().
DuelErrorLog
.
Show
(
error
);
}
}
public
static
bool
ShouldShowPlayerMessages
()
{
if
(
condition
==
Condition
.
Duel
&&
!
Config
.
GetBool
(
"DuelPlayerMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Watch
&&
!
Config
.
GetBool
(
"WatchPlayerMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Replay
&&
!
Config
.
GetBool
(
"ReplayPlayerMessage"
,
true
))
return
false
;
return
true
;
}
public
static
bool
ShouldShowSystemMessages
()
{
if
(
condition
==
Condition
.
Duel
&&
!
Config
.
GetBool
(
"DuelSystemMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Watch
&&
!
Config
.
GetBool
(
"WatchSystemMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Replay
&&
!
Config
.
GetBool
(
"ReplaySystemMessage"
,
true
))
return
false
;
return
true
;
}
public
bool
GetMessageConfig
(
int
player
)
public
bool
GetMessageConfig
(
int
player
)
{
{
if
(
player
<
4
||
player
==
7
)
if
(
player
<
4
||
player
==
7
)
{
{
if
(
condition
==
Condition
.
Duel
&&
!
Config
.
GetBool
(
"DuelPlayerMessage"
,
true
))
if
(!
ShouldShowPlayerMessages
())
return
false
;
if
(
condition
==
Condition
.
Watch
&&
!
Config
.
GetBool
(
"WatchPlayerMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Replay
&&
!
Config
.
GetBool
(
"ReplayPlayerMessage"
,
true
))
return
false
;
return
false
;
}
}
else
else
{
{
if
(
condition
==
Condition
.
Duel
&&
!
Config
.
GetBool
(
"DuelSystemMessage"
,
true
))
if
(!
ShouldShowSystemMessages
())
return
false
;
if
(
condition
==
Condition
.
Watch
&&
!
Config
.
GetBool
(
"WatchSystemMessage"
,
true
))
return
false
;
if
(
condition
==
Condition
.
Replay
&&
!
Config
.
GetBool
(
"ReplaySystemMessage"
,
true
))
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
@@ -1464,6 +1478,8 @@ namespace MDPro3.Servant
...
@@ -1464,6 +1478,8 @@ namespace MDPro3.Servant
public
static
void
PrintDuelLog
(
string
content
)
public
static
void
PrintDuelLog
(
string
content
)
{
{
lastDuelLog
=
content
;
lastDuelLog
=
content
;
if
(!
ShouldShowSystemMessages
())
return
;
MessageManager
.
Cast
(
content
);
MessageManager
.
Cast
(
content
);
}
}
...
...
Assets/Scripts/MDPro3/UI/UIWidget/Deck/CardInfoDetail.cs
View file @
839c193f
...
@@ -647,29 +647,42 @@ namespace MDPro3.UI
...
@@ -647,29 +647,42 @@ namespace MDPro3.UI
_
=
SaveCardsAsync
(
CardsManager
.
GetAllCardCodes
(),
cts
.
Token
);
_
=
SaveCardsAsync
(
CardsManager
.
GetAllCardCodes
(),
cts
.
Token
);
}
}
private
static
Texture2D
CreateSaveTextureCopy
(
Texture2D
source
)
{
var
copy
=
new
Texture2D
(
source
.
width
,
source
.
height
,
TextureFormat
.
RGBA32
,
false
);
copy
.
SetPixels
(
source
.
GetPixels
());
copy
.
Apply
();
return
copy
;
}
private
bool
SaveCardPicture
(
int
code
,
Texture2D
tex
)
private
bool
SaveCardPicture
(
int
code
,
Texture2D
tex
)
{
{
if
(!
Directory
.
Exists
(
Program
.
PATH_CARD_PIC
))
if
(!
Directory
.
Exists
(
Program
.
PATH_CARD_PIC
))
Directory
.
CreateDirectory
(
Program
.
PATH_CARD_PIC
);
Directory
.
CreateDirectory
(
Program
.
PATH_CARD_PIC
);
Texture2D
workingTexture
=
tex
;
bool
destroyWorkingTexture
=
false
;
try
try
{
{
var
size
=
Settings
.
Data
.
SavedCardSize
;
var
size
=
Settings
.
Data
.
SavedCardSize
;
if
(
size
.
Length
>
1
&&
size
[
0
]
>
0
&&
size
[
1
]
>
0
)
if
(
size
.
Length
>
1
&&
size
[
0
]
>
0
&&
size
[
1
]
>
0
)
if
(
size
[
0
]
!=
tex
.
width
||
size
[
1
]
!=
tex
.
height
)
if
(
size
[
0
]
!=
tex
.
width
||
size
[
1
]
!=
tex
.
height
)
tex
=
TextureManager
.
ResizeTexture2D
(
tex
,
size
[
0
],
size
[
1
]);
{
workingTexture
=
TextureManager
.
ResizeTexture2D
(
CreateSaveTextureCopy
(
tex
),
size
[
0
],
size
[
1
]);
destroyWorkingTexture
=
true
;
}
byte
[]
pic
;
byte
[]
pic
;
string
fullPath
;
string
fullPath
;
var
format
=
Settings
.
Data
.
SavedCardFormat
.
ToLower
();
var
format
=
Settings
.
Data
.
SavedCardFormat
.
ToLower
();
if
(
format
==
Program
.
EXPANSION_PNG
)
if
(
format
==
Program
.
EXPANSION_PNG
)
{
{
pic
=
tex
.
EncodeToPNG
();
pic
=
workingTexture
.
EncodeToPNG
();
fullPath
=
Program
.
PATH_CARD_PIC
+
code
+
Program
.
EXPANSION_PNG
;
fullPath
=
Program
.
PATH_CARD_PIC
+
code
+
Program
.
EXPANSION_PNG
;
}
}
else
else
{
{
pic
=
tex
.
EncodeToJPG
(
85
);
pic
=
workingTexture
.
EncodeToJPG
(
85
);
fullPath
=
Program
.
PATH_CARD_PIC
+
code
+
Program
.
EXPANSION_JPG
;
fullPath
=
Program
.
PATH_CARD_PIC
+
code
+
Program
.
EXPANSION_JPG
;
}
}
...
@@ -680,68 +693,116 @@ namespace MDPro3.UI
...
@@ -680,68 +693,116 @@ namespace MDPro3.UI
{
{
return
false
;
return
false
;
}
}
finally
{
if
(
destroyWorkingTexture
&&
workingTexture
!=
null
)
Destroy
(
workingTexture
);
}
}
}
private
async
UniTask
SaveCardsAsync
(
List
<
int
>
cards
,
CancellationToken
token
)
private
async
UniTask
SaveCardsAsync
(
List
<
int
>
cards
,
CancellationToken
token
)
{
{
var
time
=
Time
.
time
;
var
time
=
Time
.
time
;
UI
.
Popup
.
PopupProgress
popupProgress
=
null
;
var
pop
=
await
Addressables
.
InstantiateAsync
(
"Popup/PopupProgress.prefab"
).
WithCancellation
(
token
);
pop
.
transform
.
SetParent
(
Program
.
instance
.
ui_
.
popup
,
false
);
var
popupProgress
=
pop
.
GetComponent
<
UI
.
Popup
.
PopupProgress
>();
popupProgress
.
args
=
new
List
<
string
>
{
InterString
.
Get
(
"卡图保存中"
)
};
popupProgress
.
cancelAction
=
StopSaving
;
popupProgress
.
text
.
text
=
string
.
Empty
;
popupProgress
.
progressBar
.
value
=
0f
;
popupProgress
.
Show
();
await
UniTask
.
WaitForSeconds
(
popupProgress
.
transitionTime
,
cancellationToken
:
token
);
int
errorCount
=
0
;
int
errorCount
=
0
;
errorLog
=
string
.
Empty
;
errorLog
=
string
.
Empty
;
var
errorLogPath
=
Program
.
PATH_CARD_PIC
+
"MissingAndFailedCards.txt"
;
var
errorLogPath
=
Program
.
PATH_CARD_PIC
+
"MissingAndFailedCards.txt"
;
if
(
File
.
Exists
(
errorLogPath
))
if
(
!
Directory
.
Exists
(
Program
.
PATH_CARD_PIC
))
File
.
Delete
(
errorLogPath
);
Directory
.
CreateDirectory
(
Program
.
PATH_CARD_PIC
);
for
(
int
i
=
0
;
i
<
cards
.
Count
;
i
++)
try
{
{
var
result
=
await
SaveCardAsync
(
cards
[
i
],
token
);
var
pop
=
await
Addressables
.
InstantiateAsync
(
"Popup/PopupProgress.prefab"
).
WithCancellation
(
token
);
if
(!
result
)
pop
.
transform
.
SetParent
(
Program
.
instance
.
ui_
.
popup
,
false
);
popupProgress
=
pop
.
GetComponent
<
UI
.
Popup
.
PopupProgress
>();
popupProgress
.
args
=
new
List
<
string
>
{
InterString
.
Get
(
"卡图保存中"
)
};
popupProgress
.
cancelAction
=
StopSaving
;
popupProgress
.
text
.
text
=
string
.
Empty
;
popupProgress
.
progressBar
.
value
=
0f
;
popupProgress
.
Show
();
await
UniTask
.
WaitForSeconds
(
popupProgress
.
transitionTime
,
cancellationToken
:
token
);
if
(
File
.
Exists
(
errorLogPath
))
File
.
Delete
(
errorLogPath
);
for
(
int
i
=
0
;
i
<
cards
.
Count
;
i
++)
{
{
errorCount
++;
token
.
ThrowIfCancellationRequested
();
errorLog
+=
cards
[
i
].
ToString
()
+
Program
.
STRING_LINE_BREAK
;
var
result
=
await
SaveCardAsync
(
cards
[
i
],
token
);
if
(!
result
)
{
errorCount
++;
errorLog
+=
cards
[
i
].
ToString
()
+
Program
.
STRING_LINE_BREAK
;
}
popupProgress
.
text
.
text
=
(
i
+
1
)
+
Program
.
STRING_SLASH
+
cards
.
Count
+
Program
.
STRING_LINE_BREAK
+
InterString
.
Get
(
"错误:"
)
+
errorCount
;
popupProgress
.
progressBar
.
value
=
cards
.
Count
==
0
?
1f
:
(
float
)(
i
+
1
)
/
cards
.
Count
;
if
((
i
+
1
)
%
8
==
0
||
i
==
cards
.
Count
-
1
)
await
UniTask
.
Yield
(
PlayerLoopTiming
.
Update
,
token
);
}
}
catch
(
OperationCanceledException
)
when
(
token
.
IsCancellationRequested
)
{
}
finally
{
popupProgress
?.
Hide
();
if
(!
string
.
IsNullOrEmpty
(
errorLog
))
File
.
WriteAllText
(
errorLogPath
,
errorLog
);
if
(
cts
!=
null
&&
cts
.
Token
==
token
)
{
cts
.
Dispose
();
cts
=
null
;
}
}
popupProgress
.
text
.
text
=
i
+
Program
.
STRING_SLASH
+
cards
.
Count
+
Program
.
STRING_LINE_BREAK
+
InterString
.
Get
(
"错误:"
)
+
errorCount
;
popupProgress
.
progressBar
.
value
=
(
float
)
i
/
cards
.
Count
;
if
(
cards
.
Count
<=
100
)
await
UniTask
.
Yield
(
cancellationToken
:
token
);
}
}
popupProgress
.
Hide
();
if
(
errorCount
>
0
)
File
.
WriteAllText
(
errorLogPath
,
errorLog
);
//Debug.Log($"Time Used: {Time.time - time}");
//Debug.Log($"Time Used: {Time.time - time}");
}
}
private
async
UniTask
<
bool
>
SaveCardAsync
(
int
code
,
CancellationToken
token
)
private
async
UniTask
<
bool
>
SaveCardAsync
(
int
code
,
CancellationToken
token
)
{
{
token
.
ThrowIfCancellationRequested
();
var
format
=
Settings
.
Data
.
SavedCardFormat
;
var
format
=
Settings
.
Data
.
SavedCardFormat
;
if
(
format
!=
Program
.
EXPANSION_PNG
)
if
(
format
!=
Program
.
EXPANSION_PNG
)
format
=
Program
.
EXPANSION_JPG
;
format
=
Program
.
EXPANSION_JPG
;
if
(
File
.
Exists
(
Program
.
PATH_CARD_PIC
+
code
+
format
))
if
(
File
.
Exists
(
Program
.
PATH_CARD_PIC
+
code
+
format
))
return
true
;
return
true
;
var
tex
=
await
CardImageLoader
.
LoadCardAsync
(
code
,
false
,
token
,
true
);
Texture2D
tex
=
null
;
if
(!
SaveCardPicture
(
code
,
(
Texture2D
)
tex
)
try
||
!
CardImageLoader
.
lastCardFoundArt
{
||
!
CardImageLoader
.
lastCardRenderSucceed
)
tex
=
await
CardImageLoader
.
LoadCardAsync
(
code
,
false
,
token
,
true
)
as
Texture2D
;
if
(
tex
==
null
)
return
false
;
if
(!
SaveCardPicture
(
code
,
tex
)
||
!
CardImageLoader
.
lastCardFoundArt
||
!
CardImageLoader
.
lastCardRenderSucceed
)
return
false
;
return
true
;
}
catch
(
OperationCanceledException
)
when
(
token
.
IsCancellationRequested
)
{
throw
;
}
catch
{
return
false
;
return
false
;
return
true
;
}
finally
{
var
unknownCard
=
TextureManager
.
container
!=
null
?
TextureManager
.
container
.
unknownCard
.
texture
:
null
;
if
(
tex
!=
null
&&
tex
!=
unknownCard
)
CardImageLoader
.
ReleaseCard
(
code
);
}
}
}
private
void
StopSaving
()
private
void
StopSaving
()
{
{
cts
?.
Cancel
();
cts
?.
Cancel
();
cts
?.
Dispose
();
cts
?.
Dispose
();
cts
=
null
;
if
(!
string
.
IsNullOrEmpty
(
errorLog
))
if
(!
string
.
IsNullOrEmpty
(
errorLog
))
File
.
WriteAllText
(
Program
.
PATH_CARD_PIC
+
"MissingAndFailedCards.txt"
,
errorLog
);
File
.
WriteAllText
(
Program
.
PATH_CARD_PIC
+
"MissingAndFailedCards.txt"
,
errorLog
);
}
}
...
...
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