Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
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
hex
ygopro2
Commits
4aee470a
Commit
4aee470a
authored
Jun 14, 2025
by
hex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download qq avatar with https
parent
4694efba
Pipeline
#37630
failed
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
340 additions
and
182 deletions
+340
-182
Assets/SibylSystem/Room/Room.cs
Assets/SibylSystem/Room/Room.cs
+310
-158
Assets/SibylSystem/Servant.cs
Assets/SibylSystem/Servant.cs
+3
-1
Assets/transUI/UIselectableList.cs
Assets/transUI/UIselectableList.cs
+27
-23
No files found.
Assets/SibylSystem/Room/Room.cs
View file @
4aee470a
using
UnityEngine
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Text
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
YGOSharp.Network.Enums
;
using
System.Threading
;
using
System.Threading
;
using
UnityEngine
;
using
YGOSharp.Network.Enums
;
public
class
Room
:
WindowServantSP
public
class
Room
:
WindowServantSP
{
{
...
@@ -23,20 +23,26 @@ public class Room : WindowServantSP
...
@@ -23,20 +23,26 @@ public class Room : WindowServantSP
void
onSelected
()
void
onSelected
()
{
{
Config
.
Set
(
"deckInUse"
,
superScrollView
.
selectedString
);
Config
.
Set
(
"deckInUse"
,
superScrollView
.
selectedString
);
if
(
selftype
<
realPlayers
.
Length
&&
realPlayers
[
selftype
]
!=
null
&&
realPlayers
[
selftype
].
getIfPreped
())
if
(
selftype
<
realPlayers
.
Length
&&
realPlayers
[
selftype
]
!=
null
&&
realPlayers
[
selftype
].
getIfPreped
()
)
{
{
TcpHelper
.
CtosMessage_HsNotReady
();
TcpHelper
.
CtosMessage_HsNotReady
();
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
superScrollView
.
selectedString
+
".ydk"
));
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
superScrollView
.
selectedString
+
".ydk"
)
);
TcpHelper
.
CtosMessage_HsReady
();
TcpHelper
.
CtosMessage_HsReady
();
}
}
}
}
void
printFile
()
void
printFile
()
{
{
string
deckInUse
=
Config
.
Get
(
"deckInUse"
,
"wizard"
);
string
deckInUse
=
Config
.
Get
(
"deckInUse"
,
"wizard"
);
superScrollView
.
clear
();
superScrollView
.
clear
();
FileInfo
[]
fileInfos
=
(
new
DirectoryInfo
(
"deck"
)).
GetFiles
();
FileInfo
[]
fileInfos
=
(
new
DirectoryInfo
(
"deck"
)).
GetFiles
();
if
(
Config
.
Get
(
sort
,
"1"
)
==
"1"
)
if
(
Config
.
Get
(
sort
,
"1"
)
==
"1"
)
{
{
Array
.
Sort
(
fileInfos
,
UIHelper
.
CompareTime
);
Array
.
Sort
(
fileInfos
,
UIHelper
.
CompareTime
);
}
}
...
@@ -52,7 +58,9 @@ public class Room : WindowServantSP
...
@@ -52,7 +58,9 @@ public class Room : WindowServantSP
{
{
if
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
==
deckInUse
)
if
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
==
deckInUse
)
{
{
superScrollView
.
add
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
));
superScrollView
.
add
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
);
}
}
}
}
}
}
...
@@ -65,7 +73,9 @@ public class Room : WindowServantSP
...
@@ -65,7 +73,9 @@ public class Room : WindowServantSP
{
{
if
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
!=
deckInUse
)
if
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
!=
deckInUse
)
{
{
superScrollView
.
add
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
));
superScrollView
.
add
(
fileInfos
[
i
].
Name
.
Substring
(
0
,
fileInfos
[
i
].
Name
.
Length
-
4
)
);
}
}
}
}
}
}
...
@@ -151,23 +161,25 @@ public class Room : WindowServantSP
...
@@ -151,23 +161,25 @@ public class Room : WindowServantSP
public
void
StocMessage_HsPlayerEnter
(
BinaryReader
r
)
public
void
StocMessage_HsPlayerEnter
(
BinaryReader
r
)
{
{
string
name
=
r
.
ReadUnicode
(
20
);
string
name
=
r
.
ReadUnicode
(
20
);
int
pos
=
r
.
ReadByte
()
&
3
;
//Fuck this
int
pos
=
r
.
ReadByte
()
&
3
;
//Fuck this
RoomPlayer
player
=
new
RoomPlayer
();
RoomPlayer
player
=
new
RoomPlayer
();
player
.
name
=
name
;
player
.
name
=
name
;
player
.
prep
=
false
;
player
.
prep
=
false
;
if
(
Program
.
I
().
mycard
.
isMatching
&&
name
!=
"********"
)
// athletic match name mask
if
(
Program
.
I
().
mycard
.
isMatching
&&
name
!=
"********"
)
// athletic match name mask
{
{
(
new
Thread
(()
=>
(
{
new
Thread
(()
=>
string
errorMessage
=
MyCardHelper
.
DownloadFace
(
name
);
{
if
(
errorMessage
!=
null
)
string
errorMessage
=
MyCardHelper
.
DownloadFace
(
name
);
Program
.
PrintToChat
(
InterString
.
Get
(
"头像加载失败: "
)
+
errorMessage
);
if
(
errorMessage
!=
null
)
else
if
(
isShowed
)
Program
.
PrintToChat
(
InterString
.
Get
(
"头像加载失败: "
)
+
errorMessage
);
realize
();
else
if
(
isShowed
)
else
if
(
Program
.
I
().
ocgcore
.
isShowed
&&
Program
.
I
().
ocgcore
.
gameInfo
)
realize
();
Program
.
I
().
ocgcore
.
gameInfo
.
realize
();
else
if
(
Program
.
I
().
ocgcore
.
isShowed
&&
Program
.
I
().
ocgcore
.
gameInfo
)
})).
Start
();
Program
.
I
().
ocgcore
.
gameInfo
.
realize
();
}
})
).
Start
();
}
roomPlayers
[
pos
]
=
player
;
roomPlayers
[
pos
]
=
player
;
realize
();
realize
();
UIHelper
.
Flash
();
UIHelper
.
Flash
();
...
@@ -181,7 +193,7 @@ public class Room : WindowServantSP
...
@@ -181,7 +193,7 @@ public class Room : WindowServantSP
if
(
player
<
4
)
if
(
player
<
4
)
{
{
if
(
UIHelper
.
fromStringToBool
(
Config
.
Get
(
"ignoreOP_"
,
"0"
))
==
true
)
if
(
UIHelper
.
fromStringToBool
(
Config
.
Get
(
"ignoreOP_"
,
"0"
))
==
true
)
return
;
return
;
if
(
mode
!=
2
)
if
(
mode
!=
2
)
{
{
...
@@ -206,7 +218,7 @@ public class Room : WindowServantSP
...
@@ -206,7 +218,7 @@ public class Room : WindowServantSP
}
}
else
else
{
{
if
(
UIHelper
.
fromStringToBool
(
Config
.
Get
(
"ignoreWatcher_"
,
"0"
))
==
true
)
if
(
UIHelper
.
fromStringToBool
(
Config
.
Get
(
"ignoreWatcher_"
,
"0"
))
==
true
)
return
;
return
;
}
}
AddChatMsg
(
str
,
player
);
AddChatMsg
(
str
,
player
);
...
@@ -214,15 +226,16 @@ public class Room : WindowServantSP
...
@@ -214,15 +226,16 @@ public class Room : WindowServantSP
public
void
StocMessage_DeckCount
(
BinaryReader
r
)
public
void
StocMessage_DeckCount
(
BinaryReader
r
)
{
{
int
deck0
=
r
.
ReadInt16
();
int
deck0
=
r
.
ReadInt16
();
int
extra0
=
r
.
ReadInt16
();
int
extra0
=
r
.
ReadInt16
();
int
side0
=
r
.
ReadInt16
();
int
side0
=
r
.
ReadInt16
();
int
deck1
=
r
.
ReadInt16
();
int
deck1
=
r
.
ReadInt16
();
int
extra1
=
r
.
ReadInt16
();
int
extra1
=
r
.
ReadInt16
();
int
side1
=
r
.
ReadInt16
();
int
side1
=
r
.
ReadInt16
();
string
str
=
InterString
.
Get
(
"对方主卡组:[?]张"
,
deck1
.
ToString
())
+
string
str
=
InterString
.
Get
(
",额外卡组:[?]张"
,
extra1
.
ToString
())
+
InterString
.
Get
(
"对方主卡组:[?]张"
,
deck1
.
ToString
())
InterString
.
Get
(
",副卡组:[?]张"
,
side1
.
ToString
());
+
InterString
.
Get
(
",额外卡组:[?]张"
,
extra1
.
ToString
())
+
InterString
.
Get
(
",副卡组:[?]张"
,
side1
.
ToString
());
AddChatMsg
(
str
,
10
);
AddChatMsg
(
str
,
10
);
}
}
...
@@ -309,76 +322,99 @@ public class Room : WindowServantSP
...
@@ -309,76 +322,99 @@ public class Room : WindowServantSP
public
void
StocMessage_RoomList
(
BinaryReader
r
)
public
void
StocMessage_RoomList
(
BinaryReader
r
)
{
{
//requires a dedicated button and a list to show rooms.
//requires a dedicated button and a list to show rooms.
short
count
=
BitConverter
.
ToInt16
(
r
.
ReadBytes
(
2
),
0
);
short
count
=
BitConverter
.
ToInt16
(
r
.
ReadBytes
(
2
),
0
);
string
roomname
;
string
roomname
;
string
player1
=
""
;
string
player1
=
""
;
string
player2
=
""
;
string
player2
=
""
;
string
hoststr
=
String
.
Empty
;
string
hoststr
=
String
.
Empty
;
List
<
string
[
]>
roomList
=
new
List
<
string
[
]>
();
List
<
string
[
]>
roomList
=
new
List
<
string
[
]>
();
for
(
ushort
i
=
0
;
i
<
count
;
i
++)
for
(
ushort
i
=
0
;
i
<
count
;
i
++)
{
List
<
char
>
chars
=
new
List
<
char
>();
byte
[]
temp
=
r
.
ReadBytes
(
64
);
roomname
=
Encoding
.
UTF8
.
GetString
(
temp
);
roomname
=
roomname
.
Trim
(
new
char
[]
{
'\0'
});
int
room_status
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
int
room_duel_count
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
int
room_turn_count
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
temp
=
r
.
ReadBytes
(
128
);
player1
=
Encoding
.
UTF8
.
GetString
(
temp
);
player1
=
player1
.
Trim
(
new
char
[]
{
'\0'
});
int
player1_score
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
));
int
player1_lp
=
BitConverter
.
ToInt32
(
r
.
ReadBytes
(
4
),
0
);
temp
=
r
.
ReadBytes
(
128
);
player2
=
Encoding
.
UTF8
.
GetString
(
temp
);
player2
=
player2
.
Trim
(
new
char
[]
{
'\0'
});
int
player2_score
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
));
int
player2_lp
=
BitConverter
.
ToInt32
(
r
.
ReadBytes
(
4
),
0
);
if
(
room_status
==
0
)
{
{
List
<
char
>
chars
=
new
List
<
char
>();
player1
=
player1
.
Replace
(
"???"
,
" "
);
byte
[]
temp
=
r
.
ReadBytes
(
64
);
player2
=
player2
.
Replace
(
"???"
,
" "
);
roomname
=
Encoding
.
UTF8
.
GetString
(
temp
);
}
roomname
=
roomname
.
Trim
(
new
char
[]
{
'\0'
});
int
room_status
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
int
room_duel_count
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
int
room_turn_count
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
),
16
);
temp
=
r
.
ReadBytes
(
128
);
player1
=
Encoding
.
UTF8
.
GetString
(
temp
);
player1
=
player1
.
Trim
(
new
char
[]
{
'\0'
});
int
player1_score
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
));
int
player1_lp
=
BitConverter
.
ToInt32
(
r
.
ReadBytes
(
4
),
0
);
temp
=
r
.
ReadBytes
(
128
);
player2
=
Encoding
.
UTF8
.
GetString
(
temp
);
player2
=
player2
.
Trim
(
new
char
[]
{
'\0'
});
int
player2_score
=
Convert
.
ToInt16
(
BitConverter
.
ToString
(
r
.
ReadBytes
(
1
),
0
));
int
player2_lp
=
BitConverter
.
ToInt32
(
r
.
ReadBytes
(
4
),
0
);
if
(
room_status
==
0
)
{
player1
=
player1
.
Replace
(
"???"
,
" "
);
player2
=
player2
.
Replace
(
"???"
,
" "
);
}
string
roomTag
=
RoomNameFormatter
(
roomname
);
string
roomTag
=
RoomNameFormatter
(
roomname
);
string
[]
strings
=
new
string
[]
string
[]
strings
=
new
string
[]
{
{
room_duel_count
.
ToString
(),
room_duel_count
.
ToString
(),
room_turn_count
.
ToString
(),
room_turn_count
.
ToString
(),
roomname
,
roomname
,
player1_score
.
ToString
(),
player1_score
.
ToString
(),
player1_lp
.
ToString
(),
player1_lp
.
ToString
(),
player1
,
player1
,
player2
,
player2
,
player2_score
.
ToString
(),
player2_score
.
ToString
(),
player2_lp
.
ToString
(),
player2_lp
.
ToString
(),
hoststr
,
hoststr
,
room_status
.
ToString
(),
room_status
.
ToString
(),
roomTag
roomTag
,
};
};
switch
(
room_status
)
switch
(
room_status
)
{
{
case
0
:
case
0
:
{
{
hoststr
=
"[EFD334][未开始][FFFFFF] "
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
hoststr
=
break
;
"[EFD334][未开始][FFFFFF] "
}
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
break
;
}
case
1
:
case
1
:
{
{
hoststr
=
hoststr
=
"[A978ED][G:"
+
strings
[
0
]
+
",T:"
+
strings
[
1
]
+
"][FFFFFF] "
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
"[A978ED][G:"
break
;
+
strings
[
0
]
}
+
",T:"
+
strings
[
1
]
+
"][FFFFFF] "
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
break
;
}
case
2
:
case
2
:
{
{
hoststr
=
"[A978ED][G:"
+
strings
[
0
]
+
",Siding][FFFFFF] "
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
hoststr
=
break
;
"[A978ED][G:"
}
+
strings
[
0
]
+
",Siding][FFFFFF] "
+
strings
[
11
]
+
"[FFFFFF]"
+
strings
[
5
]
+
" VS "
+
strings
[
6
];
break
;
}
default
:
default
:
{
{
hoststr
=
String
.
Empty
;
hoststr
=
String
.
Empty
;
break
;
break
;
}
}
}
}
strings
[
9
]
=
hoststr
;
strings
[
9
]
=
hoststr
;
roomList
.
Add
(
strings
);
roomList
.
Add
(
strings
);
...
@@ -387,21 +423,24 @@ public class Room : WindowServantSP
...
@@ -387,21 +423,24 @@ public class Room : WindowServantSP
//Do something with the roomList.
//Do something with the roomList.
}
}
string
RoomNameFormatter
(
string
roomname
)
string
RoomNameFormatter
(
string
roomname
)
{
{
string
roomTag
=
String
.
Empty
;
string
roomTag
=
String
.
Empty
;
List
<
string
>
tags
=
new
List
<
string
>();
List
<
string
>
tags
=
new
List
<
string
>();
if
(
Regex
.
IsMatch
(
roomname
,
@"^S,RANDOM#\d{1,}"
))
if
(
Regex
.
IsMatch
(
roomname
,
@"^S,RANDOM#\d{1,}"
))
{
{
roomTag
=
"[8AE57E][Duel] "
;
roomTag
=
"[8AE57E][Duel] "
;
return
roomTag
;
return
roomTag
;
}
}
else
if
(
Regex
.
IsMatch
(
roomname
,
@"^M,RANDOM#\d{1,}"
))
else
if
(
Regex
.
IsMatch
(
roomname
,
@"^M,RANDOM#\d{1,}"
))
{
{
roomTag
=
"[42C1EC][Match] "
;
roomTag
=
"[42C1EC][Match] "
;
return
roomTag
;
return
roomTag
;
}
}
else
if
(
Regex
.
IsMatch
(
roomname
,
@"^AI#\S{0,},\d{1,}"
)||
Regex
.
IsMatch
(
roomname
,
@"^AI\S{0,}#\d{1,}"
))
else
if
(
Regex
.
IsMatch
(
roomname
,
@"^AI#\S{0,},\d{1,}"
)
||
Regex
.
IsMatch
(
roomname
,
@"^AI\S{0,}#\d{1,}"
)
)
{
{
roomTag
=
"[5E71FF][AI] "
;
roomTag
=
"[5E71FF][AI] "
;
return
roomTag
;
return
roomTag
;
...
@@ -438,7 +477,6 @@ public class Room : WindowServantSP
...
@@ -438,7 +477,6 @@ public class Room : WindowServantSP
else
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}T[,#])?(?(1)|(^T[#,]))"
))
else
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}T[,#])?(?(1)|(^T[#,]))"
))
{
{
tags
.
Add
(
"[D14291][TAG] "
);
tags
.
Add
(
"[D14291][TAG] "
);
}
}
}
}
else
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}TO[,#])?(?(1)|(^TO[#,]))"
))
else
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}TO[,#])?(?(1)|(^TO[#,]))"
))
...
@@ -446,7 +484,6 @@ public class Room : WindowServantSP
...
@@ -446,7 +484,6 @@ public class Room : WindowServantSP
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}OT[,#])?(?(1)|(^OT[#,]))"
))
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}OT[,#])?(?(1)|(^OT[#,]))"
))
{
{
tags
.
Add
(
"[11C69C][TCG/OCG]"
);
tags
.
Add
(
"[11C69C][TCG/OCG]"
);
}
}
else
else
{
{
...
@@ -475,15 +512,16 @@ public class Room : WindowServantSP
...
@@ -475,15 +512,16 @@ public class Room : WindowServantSP
{
{
tags
.
Add
(
"[42C1EC][Match]"
);
tags
.
Add
(
"[42C1EC][Match]"
);
}
}
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}S[,#])?(?(1)|(^S[#,]))"
)){
if
(
Regex
.
IsMatch
(
roomname
,
@"(\w{1,}[,^]{1}S[,#])?(?(1)|(^S[#,]))"
))
{
tags
.
Add
(
"[8AE57E][Duel]"
);
tags
.
Add
(
"[8AE57E][Duel]"
);
}
}
}
}
roomTag
=
String
.
Join
(
""
,
tags
.
ToArray
())
+
" "
;
roomTag
=
String
.
Join
(
""
,
tags
.
ToArray
())
+
" "
;
if
(
roomTag
==
" "
)
if
(
roomTag
==
" "
)
{
{
roomTag
=
"[ "
+
roomname
+
" ] "
;
roomTag
=
"[ "
+
roomname
+
" ] "
;
}
}
if
(
roomTag
.
Length
>
150
)
if
(
roomTag
.
Length
>
150
)
{
{
...
@@ -500,7 +538,7 @@ public class Room : WindowServantSP
...
@@ -500,7 +538,7 @@ public class Room : WindowServantSP
p
.
Data
=
new
BinaryMaster
();
p
.
Data
=
new
BinaryMaster
();
p
.
Data
.
writer
.
Write
(
data
);
p
.
Data
.
writer
.
Write
(
data
);
TcpHelper
.
AddRecordLine
(
p
);
TcpHelper
.
AddRecordLine
(
p
);
TcpHelper
.
SaveRecord
();
TcpHelper
.
SaveRecord
();
}
}
public
bool
duelEnded
=
false
;
public
bool
duelEnded
=
false
;
...
@@ -513,14 +551,13 @@ public class Room : WindowServantSP
...
@@ -513,14 +551,13 @@ public class Room : WindowServantSP
public
void
StocMessage_DuelStart
(
BinaryReader
r
)
public
void
StocMessage_DuelStart
(
BinaryReader
r
)
{
{
Program
.
I
().
ocgcore
.
setDefaultReturnServant
();
Program
.
I
().
ocgcore
.
setDefaultReturnServant
();
needSide
=
false
;
needSide
=
false
;
joinWithReconnect
=
true
;
joinWithReconnect
=
true
;
if
(
Program
.
I
().
deckManager
.
isShowed
)
if
(
Program
.
I
().
deckManager
.
isShowed
)
{
{
Program
.
I
().
deckManager
.
hide
();
Program
.
I
().
deckManager
.
hide
();
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"更换副卡组成功,请等待对手更换副卡组。"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"更换副卡组成功,请等待对手更换副卡组。"
),
null
);
}
}
if
(
isShowed
)
if
(
isShowed
)
{
{
...
@@ -544,24 +581,53 @@ public class Room : WindowServantSP
...
@@ -544,24 +581,53 @@ public class Room : WindowServantSP
is_host
=
((
type
>>
4
)
&
0xf
)
!=
0
;
is_host
=
((
type
>>
4
)
&
0xf
)
!=
0
;
if
(
is_host
)
if
(
is_host
)
{
{
if
(
selftype
<
4
&&
roomPlayers
[
selftype
]
!=
null
)
{
if
(
selftype
<
4
&&
roomPlayers
[
selftype
]
!=
null
)
{
roomPlayers
[
selftype
].
prep
=
false
;
roomPlayers
[
selftype
].
prep
=
false
;
}
}
UIHelper
.
shiftButton
(
startButton
(),
true
);
UIHelper
.
shiftButton
(
startButton
(),
true
);
lazyRoom
.
start
.
localScale
=
Vector3
.
one
;
lazyRoom
.
start
.
localScale
=
Vector3
.
one
;
lazyRoom
.
ready
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
+
30f
,
0
);
lazyRoom
.
ready
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
,
0
);
lazyRoom
.
duelist
.
localPosition
.
x
,
lazyRoom
.
observer
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
,
0
);
-
94.2f
+
30f
,
lazyRoom
.
start
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
,
0
);
0
);
lazyRoom
.
duelist
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
,
0
);
lazyRoom
.
observer
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
,
0
);
lazyRoom
.
start
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
,
0
);
}
}
else
else
{
{
UIHelper
.
shiftButton
(
startButton
(),
false
);
UIHelper
.
shiftButton
(
startButton
(),
false
);
lazyRoom
.
start
.
localScale
=
Vector3
.
zero
;
lazyRoom
.
start
.
localScale
=
Vector3
.
zero
;
lazyRoom
.
ready
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
,
0
);
lazyRoom
.
ready
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
,
0
);
lazyRoom
.
duelist
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
,
0
);
lazyRoom
.
duelist
.
localPosition
=
new
Vector3
(
lazyRoom
.
observer
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
,
0
);
lazyRoom
.
duelist
.
localPosition
.
x
,
lazyRoom
.
start
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
-
30f
,
0
);
-
94.2f
-
30f
,
0
);
lazyRoom
.
observer
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
,
0
);
lazyRoom
.
start
.
localPosition
=
new
Vector3
(
lazyRoom
.
duelist
.
localPosition
.
x
,
-
94.2f
-
30f
-
30f
-
30f
,
0
);
}
}
realize
();
realize
();
}
}
...
@@ -594,9 +660,10 @@ public class Room : WindowServantSP
...
@@ -594,9 +660,10 @@ public class Room : WindowServantSP
}
}
public
bool
needSide
=
false
;
public
bool
needSide
=
false
;
public
void
StocMessage_TeammateSurrender
(
BinaryReader
r
)
public
void
StocMessage_TeammateSurrender
(
BinaryReader
r
)
{
{
if
(
Program
.
I
().
ocgcore
.
surrended
)
if
(
Program
.
I
().
ocgcore
.
surrended
)
RMSshow_none
(
InterString
.
Get
(
"已申请投降,请等待队友同意。"
));
RMSshow_none
(
InterString
.
Get
(
"已申请投降,请等待队友同意。"
));
else
else
RMSshow_none
(
InterString
.
Get
(
"队友申请投降。若您同意,请点击投降按钮。"
));
RMSshow_none
(
InterString
.
Get
(
"队友申请投降。若您同意,请点击投降按钮。"
));
...
@@ -609,23 +676,31 @@ public class Room : WindowServantSP
...
@@ -609,23 +676,31 @@ public class Room : WindowServantSP
Program
.
I
().
ocgcore
.
surrended
=
false
;
Program
.
I
().
ocgcore
.
surrended
=
false
;
Program
.
I
().
ocgcore
.
returnServant
=
Program
.
I
().
deckManager
;
Program
.
I
().
ocgcore
.
returnServant
=
Program
.
I
().
deckManager
;
needSide
=
true
;
needSide
=
true
;
if
(
Program
.
I
().
ocgcore
.
condition
!=
Ocgcore
.
Condition
.
duel
||
joinWithReconnect
)
{
//Change side when reconnect
if
(
Program
.
I
().
ocgcore
.
condition
!=
Ocgcore
.
Condition
.
duel
||
joinWithReconnect
)
{
//Change side when reconnect
Program
.
I
().
ocgcore
.
onDuelResultConfirmed
();
Program
.
I
().
ocgcore
.
onDuelResultConfirmed
();
}
}
}
}
GameObject
handres
=
null
;
GameObject
handres
=
null
;
public
void
StocMessage_HandResult
(
BinaryReader
r
)
public
void
StocMessage_HandResult
(
BinaryReader
r
)
{
{
if
(
isShowed
)
if
(
isShowed
)
{
{
hide
();
hide
();
}
}
int
meResult
=
r
.
ReadByte
();
int
meResult
=
r
.
ReadByte
();
int
opResult
=
r
.
ReadByte
();
int
opResult
=
r
.
ReadByte
();
Program
.
I
().
new_ui_handShower
.
GetComponent
<
handShower
>().
me
=
meResult
-
1
;
Program
.
I
().
new_ui_handShower
.
GetComponent
<
handShower
>().
me
=
meResult
-
1
;
Program
.
I
().
new_ui_handShower
.
GetComponent
<
handShower
>().
op
=
opResult
-
1
;
Program
.
I
().
new_ui_handShower
.
GetComponent
<
handShower
>().
op
=
opResult
-
1
;
handres
=
create
(
Program
.
I
().
new_ui_handShower
,
Vector3
.
zero
,
Vector3
.
zero
,
false
,
Program
.
ui_main_2d
);
handres
=
create
(
Program
.
I
().
new_ui_handShower
,
Vector3
.
zero
,
Vector3
.
zero
,
false
,
Program
.
ui_main_2d
);
destroy
(
handres
,
10f
);
destroy
(
handres
,
10f
);
animationTime
=
1300
;
animationTime
=
1300
;
}
}
...
@@ -634,15 +709,26 @@ public class Room : WindowServantSP
...
@@ -634,15 +709,26 @@ public class Room : WindowServantSP
{
{
if
(
animationTime
!=
0
)
if
(
animationTime
!=
0
)
{
{
Program
.
go
(
animationTime
,
()
=>
Program
.
go
(
{
animationTime
,
RMSshow_FS
(
"StocMessage_SelectTp"
,
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"先攻"
),
value
=
"first"
},
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"后攻"
),
value
=
"second"
});
()
=>
});
{
RMSshow_FS
(
"StocMessage_SelectTp"
,
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"先攻"
),
value
=
"first"
},
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"后攻"
),
value
=
"second"
}
);
}
);
animationTime
=
0
;
animationTime
=
0
;
}
}
else
else
{
{
RMSshow_FS
(
"StocMessage_SelectTp"
,
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"先攻"
),
value
=
"first"
},
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"后攻"
),
value
=
"second"
});
RMSshow_FS
(
"StocMessage_SelectTp"
,
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"先攻"
),
value
=
"first"
},
new
messageSystemValue
{
hint
=
InterString
.
Get
(
"后攻"
),
value
=
"second"
}
);
}
}
}
}
...
@@ -679,26 +765,32 @@ public class Room : WindowServantSP
...
@@ -679,26 +765,32 @@ public class Room : WindowServantSP
public
void
StocMessage_SelectHand
(
BinaryReader
r
)
public
void
StocMessage_SelectHand
(
BinaryReader
r
)
{
{
if
(
animationTime
!=
0
)
if
(
animationTime
!=
0
)
{
{
Program
.
go
(
animationTime
,
()
=>
Program
.
go
(
{
animationTime
,
hide
();
()
=>
RMSshow_tp
(
"StocMessage_SelectHand"
{
,
new
messageSystemValue
{
hint
=
"jiandao"
,
value
=
"jiandao"
}
hide
();
,
new
messageSystemValue
{
hint
=
"shitou"
,
value
=
"shitou"
}
RMSshow_tp
(
,
new
messageSystemValue
{
hint
=
"bu"
,
value
=
"bu"
});
"StocMessage_SelectHand"
,
});
new
messageSystemValue
{
hint
=
"jiandao"
,
value
=
"jiandao"
},
new
messageSystemValue
{
hint
=
"shitou"
,
value
=
"shitou"
},
new
messageSystemValue
{
hint
=
"bu"
,
value
=
"bu"
}
);
}
);
animationTime
=
0
;
animationTime
=
0
;
}
}
else
else
{
{
hide
();
hide
();
RMSshow_tp
(
"StocMessage_SelectHand"
RMSshow_tp
(
,
new
messageSystemValue
{
hint
=
"jiandao"
,
value
=
"jiandao"
}
"StocMessage_SelectHand"
,
,
new
messageSystemValue
{
hint
=
"shitou"
,
value
=
"shitou"
}
new
messageSystemValue
{
hint
=
"jiandao"
,
value
=
"jiandao"
},
,
new
messageSystemValue
{
hint
=
"bu"
,
value
=
"bu"
});
new
messageSystemValue
{
hint
=
"shitou"
,
value
=
"shitou"
},
new
messageSystemValue
{
hint
=
"bu"
,
value
=
"bu"
}
);
}
}
}
}
...
@@ -706,7 +798,7 @@ public class Room : WindowServantSP
...
@@ -706,7 +798,7 @@ public class Room : WindowServantSP
{
{
int
msg
=
r
.
ReadByte
();
int
msg
=
r
.
ReadByte
();
int
code
=
0
;
int
code
=
0
;
switch
(
msg
)
switch
(
msg
)
{
{
case
1
:
case
1
:
r
.
ReadByte
();
r
.
ReadByte
();
...
@@ -736,22 +828,78 @@ public class Room : WindowServantSP
...
@@ -736,22 +828,78 @@ public class Room : WindowServantSP
switch
(
flag
)
switch
(
flag
)
{
{
case
1
:
// DECKERROR_LFLIST
case
1
:
// DECKERROR_LFLIST
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(数量不符合禁限卡表)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(数量不符合禁限卡表)"
),
null
);
break
;
break
;
case
2
:
// DECKERROR_OCGONLY
case
2
:
// DECKERROR_OCGONLY
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(OCG独有卡,不能在当前设置使用)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(OCG独有卡,不能在当前设置使用)"
),
null
);
break
;
break
;
case
3
:
// DECKERROR_TCGONLY
case
3
:
// DECKERROR_TCGONLY
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(TCG独有卡,不能在当前设置使用)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(TCG独有卡,不能在当前设置使用)"
),
null
);
break
;
break
;
case
4
:
// DECKERROR_UNKNOWNCARD
case
4
:
// DECKERROR_UNKNOWNCARD
if
(
code
<
100000000
)
if
(
code
<
100000000
)
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(服务器无法识别此卡,可能是服务器未更新)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(服务器无法识别此卡,可能是服务器未更新)"
),
null
);
else
else
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(服务器无法识别此卡,可能是服务器不支持先行卡或此先行卡已正式更新)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(服务器无法识别此卡,可能是服务器不支持先行卡或此先行卡已正式更新)"
),
null
);
break
;
break
;
case
5
:
// DECKERROR_CARDCOUNT
case
5
:
// DECKERROR_CARDCOUNT
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(数量过多)"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"卡组非法,请检查:[?]"
,
YGOSharp
.
CardsManager
.
Get
(
code
).
Name
)
+
"\r\n"
+
InterString
.
Get
(
"(数量过多)"
),
null
);
break
;
break
;
case
6
:
// DECKERROR_MAINCOUNT
case
6
:
// DECKERROR_MAINCOUNT
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"主卡组数量应为40-60张"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"主卡组数量应为40-60张"
),
null
);
...
@@ -768,7 +916,11 @@ public class Room : WindowServantSP
...
@@ -768,7 +916,11 @@ public class Room : WindowServantSP
}
}
break
;
break
;
case
3
:
case
3
:
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"更换副卡组失败,请检查卡片张数是否一致。"
),
null
);
RMSshow_onlyYes
(
""
,
InterString
.
Get
(
"更换副卡组失败,请检查卡片张数是否一致。"
),
null
);
break
;
break
;
case
4
:
case
4
:
r
.
ReadByte
();
r
.
ReadByte
();
...
@@ -786,7 +938,7 @@ public class Room : WindowServantSP
...
@@ -786,7 +938,7 @@ public class Room : WindowServantSP
public
void
StocMessage_GameMsg
(
BinaryReader
r
)
public
void
StocMessage_GameMsg
(
BinaryReader
r
)
{
{
showOcgcore
();
showOcgcore
();
Package
p
=
new
Package
();
Package
p
=
new
Package
();
p
.
Fuction
=
r
.
ReadByte
();
p
.
Fuction
=
r
.
ReadByte
();
p
.
Data
=
new
BinaryMaster
(
r
.
ReadToEnd
());
p
.
Data
=
new
BinaryMaster
(
r
.
ReadToEnd
());
...
@@ -850,17 +1002,11 @@ public class Room : WindowServantSP
...
@@ -850,17 +1002,11 @@ public class Room : WindowServantSP
Program
.
I
().
shiftToServant
(
Program
.
I
().
ocgcore
);
Program
.
I
().
shiftToServant
(
Program
.
I
().
ocgcore
);
}
}
public
void
StocMessage_CreateGame
(
BinaryReader
r
)
public
void
StocMessage_CreateGame
(
BinaryReader
r
)
{
}
{
}
public
void
StocMessage_LeaveGame
(
BinaryReader
r
)
public
void
StocMessage_LeaveGame
(
BinaryReader
r
)
{
}
{
}
public
void
StocMessage_TpResult
(
BinaryReader
r
)
public
void
StocMessage_TpResult
(
BinaryReader
r
)
{
}
{
}
public
class
RoomPlayer
public
class
RoomPlayer
{
{
...
@@ -912,9 +1058,11 @@ public class Room : WindowServantSP
...
@@ -912,9 +1058,11 @@ public class Room : WindowServantSP
}
}
else
else
{
{
description
+=
InterString
.
Get
(
"/大师规则[?]"
,
Program
.
I
().
ocgcore
.
MasterRule
.
ToString
())
+
"\r\n"
;
description
+=
InterString
.
Get
(
"/大师规则[?]"
,
Program
.
I
().
ocgcore
.
MasterRule
.
ToString
())
+
"\r\n"
;
}
}
description
+=
InterString
.
Get
(
"禁限卡表:[?]"
,
YGOSharp
.
BanlistManager
.
GetName
(
lflist
))
+
"\r\n"
;
description
+=
InterString
.
Get
(
"禁限卡表:[?]"
,
YGOSharp
.
BanlistManager
.
GetName
(
lflist
))
+
"\r\n"
;
if
(
rule
==
0
)
if
(
rule
==
0
)
{
{
description
+=
InterString
.
Get
(
"(OCG卡池)"
)
+
"\r\n"
;
description
+=
InterString
.
Get
(
"(OCG卡池)"
)
+
"\r\n"
;
...
@@ -976,7 +1124,7 @@ public class Room : WindowServantSP
...
@@ -976,7 +1124,7 @@ public class Room : WindowServantSP
{
{
realPlayers
[
i
].
SetNotNull
(
true
);
realPlayers
[
i
].
SetNotNull
(
true
);
realPlayers
[
i
].
setName
(
roomPlayers
[
i
].
name
);
realPlayers
[
i
].
setName
(
roomPlayers
[
i
].
name
);
realPlayers
[
i
].
SetIFcanKick
(
is_host
&&
(
i
!=
selftype
));
realPlayers
[
i
].
SetIFcanKick
(
is_host
&&
(
i
!=
selftype
));
realPlayers
[
i
].
setIfMe
(
i
==
selftype
);
realPlayers
[
i
].
setIfMe
(
i
==
selftype
);
realPlayers
[
i
].
setIfprepared
(
roomPlayers
[
i
].
prep
);
realPlayers
[
i
].
setIfprepared
(
roomPlayers
[
i
].
prep
);
if
(
mode
!=
2
)
if
(
mode
!=
2
)
...
@@ -1016,6 +1164,7 @@ public class Room : WindowServantSP
...
@@ -1016,6 +1164,7 @@ public class Room : WindowServantSP
}
}
lazyRoom
lazyRoom
=
null
;
lazyRoom
lazyRoom
=
null
;
void
ini
()
void
ini
()
{
{
for
(
int
i
=
0
;
i
<
4
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
...
@@ -1057,7 +1206,7 @@ public class Room : WindowServantSP
...
@@ -1057,7 +1206,7 @@ public class Room : WindowServantSP
}
}
UIHelper
.
trySetLableText
(
gameObject
,
"description_"
,
""
);
UIHelper
.
trySetLableText
(
gameObject
,
"description_"
,
""
);
for
(
int
i
=
0
;
i
<
4
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
{
realPlayers
[
i
]
=
UIHelper
.
getByName
<
lazyPlayer
>(
gameObject
,
i
.
ToString
());
realPlayers
[
i
]
=
UIHelper
.
getByName
<
lazyPlayer
>(
gameObject
,
i
.
ToString
());
}
}
...
@@ -1087,7 +1236,9 @@ public class Room : WindowServantSP
...
@@ -1087,7 +1236,9 @@ public class Room : WindowServantSP
}
}
if
(
arg2
)
if
(
arg2
)
{
{
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
Config
.
Get
(
"deckInUse"
,
"miaouwu"
)
+
".ydk"
));
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
Config
.
Get
(
"deckInUse"
,
"miaouwu"
)
+
".ydk"
)
);
TcpHelper
.
CtosMessage_HsReady
();
TcpHelper
.
CtosMessage_HsReady
();
}
}
else
else
...
@@ -1142,7 +1293,9 @@ public class Room : WindowServantSP
...
@@ -1142,7 +1293,9 @@ public class Room : WindowServantSP
}
}
else
else
{
{
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
Config
.
Get
(
"deckInUse"
,
"wizard"
)
+
".ydk"
));
TcpHelper
.
CtosMessage_UpdateDeck
(
new
YGOSharp
.
Deck
(
"deck/"
+
Config
.
Get
(
"deckInUse"
,
"wizard"
)
+
".ydk"
)
);
TcpHelper
.
CtosMessage_HsReady
();
TcpHelper
.
CtosMessage_HsReady
();
}
}
}
}
...
@@ -1162,5 +1315,4 @@ public class Room : WindowServantSP
...
@@ -1162,5 +1315,4 @@ public class Room : WindowServantSP
}
}
#
endregion
#
endregion
}
}
Assets/SibylSystem/Servant.cs
View file @
4aee470a
...
@@ -917,7 +917,7 @@ public class Servant
...
@@ -917,7 +917,7 @@ public class Servant
public
void
DownloadFace
()
public
void
DownloadFace
()
{
{
string
url
=
"http://q1.qlogo.cn/headimg_dl?dst_uin="
+
inputUrl
.
value
+
"&spec=100"
;
string
url
=
"http
s
://q1.qlogo.cn/headimg_dl?dst_uin="
+
inputUrl
.
value
+
"&spec=100"
;
string
facePath
=
"textures/face/"
+
nameFace
+
".jpg"
;
string
facePath
=
"textures/face/"
+
nameFace
+
".jpg"
;
// 如果输入的是一个完整的URL,则使用它
// 如果输入的是一个完整的URL,则使用它
if
(
inputUrl
.
value
.
Length
>=
4
&&
inputUrl
.
value
.
StartsWith
(
"http"
))
if
(
inputUrl
.
value
.
Length
>=
4
&&
inputUrl
.
value
.
StartsWith
(
"http"
))
...
@@ -939,6 +939,7 @@ public class Servant
...
@@ -939,6 +939,7 @@ public class Servant
if
(
success
)
if
(
success
)
{
{
Debug
.
Log
(
"头像下载成功,路径: "
+
facePath
);
Debug
.
Log
(
"头像下载成功,路径: "
+
facePath
);
Program
.
PrintToChat
(
"头像下载成功!"
);
// 将原来同步执行的刷新逻辑移动到这里
// 将原来同步执行的刷新逻辑移动到这里
// 确保文件确实存在并且已经被下载完毕
// 确保文件确实存在并且已经被下载完毕
if
(
File
.
Exists
(
facePath
))
if
(
File
.
Exists
(
facePath
))
...
@@ -961,6 +962,7 @@ public class Servant
...
@@ -961,6 +962,7 @@ public class Servant
else
else
{
{
Debug
.
LogError
(
"头像下载失败: "
+
url
);
Debug
.
LogError
(
"头像下载失败: "
+
url
);
Program
.
PrintToChat
(
"头像下载失败: "
+
url
);
}
}
}
}
)
)
...
...
Assets/transUI/UIselectableList.cs
View file @
4aee470a
using
UnityEngine
;
using
System
;
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System
;
using
UnityEngine
;
public
class
UIselectableList
:
MonoBehaviour
{
public
class
UIselectableList
:
MonoBehaviour
{
public
GameObject
mod
;
public
GameObject
mod
;
public
UIPanel
panel
;
public
UIPanel
panel
;
public
UIScrollBar
scrollBar
;
public
UIScrollBar
scrollBar
;
private
string
m_selectedString
;
private
string
m_selectedString
;
public
string
selectedString
public
string
selectedString
{
{
get
get
{
return
m_selectedString
;
}
{
return
m_selectedString
;
}
set
set
{
{
if
(
m_selectedString
!=
value
)
if
(
m_selectedString
!=
value
)
...
@@ -30,13 +28,15 @@ public class UIselectableList : MonoBehaviour {
...
@@ -30,13 +28,15 @@ public class UIselectableList : MonoBehaviour {
UIScrollView
uIScrollView
;
UIScrollView
uIScrollView
;
float
heightOfEach
=
35
;
float
heightOfEach
=
35
;
public
float
preHeight
=
0
;
public
float
preHeight
=
0
;
class
selection
class
selection
{
{
public
string
str
=
""
;
public
string
str
=
""
;
public
UIselectableListItem
obj
=
null
;
public
UIselectableListItem
obj
=
null
;
public
bool
selected
=
false
;
public
bool
selected
=
false
;
}
}
List
<
selection
>
selections
=
new
List
<
selection
>();
List
<
selection
>
selections
=
new
List
<
selection
>();
float
width
=
0
;
float
width
=
0
;
float
height
=
0
;
float
height
=
0
;
...
@@ -60,7 +60,6 @@ public class UIselectableList : MonoBehaviour {
...
@@ -60,7 +60,6 @@ public class UIselectableList : MonoBehaviour {
height
=
panel
.
GetViewSize
().
y
;
height
=
panel
.
GetViewSize
().
y
;
clear
();
clear
();
toTop
();
toTop
();
}
}
void
onScrollBarChange
()
void
onScrollBarChange
()
...
@@ -75,7 +74,7 @@ public class UIselectableList : MonoBehaviour {
...
@@ -75,7 +74,7 @@ public class UIselectableList : MonoBehaviour {
uIScrollView
.
transform
.
localPosition
.
x
,
uIScrollView
.
transform
.
localPosition
.
x
,
Y
,
Y
,
uIScrollView
.
transform
.
localPosition
.
z
uIScrollView
.
transform
.
localPosition
.
z
);
);
panel
.
clipOffset
=
new
Vector2
(
0
,
-
Y
);
panel
.
clipOffset
=
new
Vector2
(
0
,
-
Y
);
}
}
...
@@ -95,7 +94,7 @@ public class UIselectableList : MonoBehaviour {
...
@@ -95,7 +94,7 @@ public class UIselectableList : MonoBehaviour {
needRefresh
=
true
;
needRefresh
=
true
;
}
}
public
bool
Selected
()
public
bool
Selected
()
{
{
bool
returnValue
=
false
;
bool
returnValue
=
false
;
foreach
(
var
item
in
selections
)
foreach
(
var
item
in
selections
)
...
@@ -115,7 +114,7 @@ public class UIselectableList : MonoBehaviour {
...
@@ -115,7 +114,7 @@ public class UIselectableList : MonoBehaviour {
uIScrollView
.
transform
.
localPosition
.
x
,
uIScrollView
.
transform
.
localPosition
.
x
,
Y
,
Y
,
uIScrollView
.
transform
.
localPosition
.
z
uIScrollView
.
transform
.
localPosition
.
z
);
);
panel
.
clipOffset
=
new
Vector2
(
0
,
-
Y
);
panel
.
clipOffset
=
new
Vector2
(
0
,
-
Y
);
if
(
select
)
if
(
select
)
{
{
...
@@ -133,16 +132,19 @@ public class UIselectableList : MonoBehaviour {
...
@@ -133,16 +132,19 @@ public class UIselectableList : MonoBehaviour {
public
void
add
(
string
item
)
public
void
add
(
string
item
)
{
{
selections
.
Add
(
new
selection
selections
.
Add
(
{
new
selection
str
=
item
,
{
obj
=
null
,
str
=
item
,
selected
=
false
obj
=
null
,
});
selected
=
false
,
}
);
needRefresh
=
true
;
needRefresh
=
true
;
}
}
float
pre
=
0
;
float
pre
=
0
;
public
void
refresh
()
public
void
refresh
()
{
{
float
screenTop
=
panel
.
clipOffset
.
y
+
(
height
-
heightOfEach
)
/
2f
;
float
screenTop
=
panel
.
clipOffset
.
y
+
(
height
-
heightOfEach
)
/
2f
;
...
@@ -159,7 +161,7 @@ public class UIselectableList : MonoBehaviour {
...
@@ -159,7 +161,7 @@ public class UIselectableList : MonoBehaviour {
scrollBar
.
barSize
=
0.1f
;
scrollBar
.
barSize
=
0.1f
;
}
}
float
beginY
=
(
height
-
heightOfEach
)
/
2f
;
float
beginY
=
(
height
-
heightOfEach
)
/
2f
;
float
endY
=
beginY
+
heightOfEach
*
selections
.
Count
+
preHeight
-
height
;
float
endY
=
beginY
+
heightOfEach
*
selections
.
Count
+
preHeight
-
height
;
float
allHeight
=
endY
-
beginY
;
float
allHeight
=
endY
-
beginY
;
float
curHeight
=
uIScrollView
.
transform
.
localPosition
.
y
-
beginY
;
float
curHeight
=
uIScrollView
.
transform
.
localPosition
.
y
-
beginY
;
scrollBar
.
value
=
curHeight
/
allHeight
;
scrollBar
.
value
=
curHeight
/
allHeight
;
...
@@ -169,7 +171,7 @@ public class UIselectableList : MonoBehaviour {
...
@@ -169,7 +171,7 @@ public class UIselectableList : MonoBehaviour {
scrollBar
.
gameObject
.
SetActive
(
false
);
scrollBar
.
gameObject
.
SetActive
(
false
);
}
}
float
screenButtom
=
screenTop
-
height
+
heightOfEach
;
float
screenButtom
=
screenTop
-
height
+
heightOfEach
;
for
(
int
i
=
0
;
i
<
selections
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
selections
.
Count
;
i
++)
{
{
var
currentItem
=
selections
[
i
];
var
currentItem
=
selections
[
i
];
float
currentY
=
-
i
*
heightOfEach
-
preHeight
;
float
currentY
=
-
i
*
heightOfEach
-
preHeight
;
...
@@ -181,7 +183,9 @@ public class UIselectableList : MonoBehaviour {
...
@@ -181,7 +183,9 @@ public class UIselectableList : MonoBehaviour {
}
}
else
else
{
{
currentItem
.
obj
=
MonoBehaviour
.
Instantiate
<
GameObject
>(
mod
).
GetComponent
<
UIselectableListItem
>();
currentItem
.
obj
=
MonoBehaviour
.
Instantiate
<
GameObject
>(
mod
)
.
GetComponent
<
UIselectableListItem
>();
currentItem
.
obj
.
List
=
this
;
currentItem
.
obj
.
List
=
this
;
currentItem
.
obj
.
transform
.
SetParent
(
panel
.
transform
,
false
);
currentItem
.
obj
.
transform
.
SetParent
(
panel
.
transform
,
false
);
currentItem
.
obj
.
lable
.
width
=
(
int
)
width
-
10
;
currentItem
.
obj
.
lable
.
width
=
(
int
)
width
-
10
;
...
@@ -213,9 +217,9 @@ public class UIselectableList : MonoBehaviour {
...
@@ -213,9 +217,9 @@ public class UIselectableList : MonoBehaviour {
}
}
}
}
void
Update
()
{
void
Update
()
{
refresh
();
refresh
();
}
}
public
void
refreshForOneFrame
()
public
void
refreshForOneFrame
()
...
...
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