Survivalcraft API 1.8.2.3
v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
CommunityServerManager.cs
浏览该文件的文档.
1
namespace
Game
{
2
public
static
class
CommunityServerManager
{
3
public
enum
Type
{
4
Original
= 0,
5
Chinese
= 1
6
}
7
8
public
class
Info
: IEquatable<Info> {
9
public
Type
Type
;
10
public
string
Name
;
11
public
string
ApiUrl
;
12
public
string
WebsiteUrl
;
13
14
public
Info
(
Type
type,
string
name,
string
apiUrl,
string
websiteUrl =
null
) {
15
Type
= type;
16
Name
= name;
17
ApiUrl
= apiUrl;
18
WebsiteUrl
= websiteUrl;
19
}
20
21
public
bool
Equals
(
Info
other) {
22
if
(other is
null
) {
23
return
false
;
24
}
25
if
(ReferenceEquals(
this
, other)) {
26
return
true
;
27
}
28
return
Type
== other.Type &&
Name
== other.Name &&
ApiUrl
== other.ApiUrl &&
WebsiteUrl
== other.
WebsiteUrl
;
29
}
30
31
public
override
string
ToString
() {
32
return
$
"{(int)Type}^^{Name}^^{ApiUrl}^^{WebsiteUrl}"
;
33
}
34
35
public
static
Info
FromString
(
string
str) {
36
string
[] parts = str.Split(
"^^"
);
37
if
(parts.Length == 4 &&
int
.TryParse(parts[0], out
int
type)) {
38
return
new
Info
((
Type
)type, parts[1], parts[2], parts[3]);
39
}
40
return
null
;
41
}
42
43
public
Info
Clone
() =>
new
(
Type
,
Name
,
ApiUrl
,
WebsiteUrl
);
44
}
45
#if BROWSER
46
public
static
Info
DefaultOriginalInfo
=
new
(
Type
.Original,
string
.Empty,
"https://cloudflare-cors-anywhere.weathered-shadow-6c41.workers.dev/?https://scresdir.appspot.com/resource"
);
47
public
static
Info
DefaultChineseInfo
=
new
(
Type
.Chinese,
string
.Empty,
"https://cloudflare-cors-anywhere.weathered-shadow-6c41.workers.dev/?https://m.schub.top/"
,
"https://test.suancaixianyu.cn/#/modList/0"
);
48
#else
49
public
static
Info
DefaultOriginalInfo
=
new
(
Type
.Original,
string
.Empty,
"https://scresdir.appspot.com/resource"
);
50
public
static
Info
DefaultChineseInfo
=
new
(
Type
.Chinese,
string
.Empty,
"https://m.schub.top/"
,
"https://test.suancaixianyu.cn/#/modList/0"
);
51
#endif
52
53
public
static
List<Info>
UserInfos
= [];
54
public
static
Info
CurrentOriginalInfo
=
DefaultOriginalInfo
;
55
public
static
Info
CurrentChineseInfo
=
DefaultChineseInfo
;
56
57
public
static
IEnumerable<Info>
GetAllInfos
() {
58
if
(
SettingsManager
.
OriginalCommunityContentMode
==
CommunityContentMode
.Disabled) {
59
if
(
SettingsManager
.
CommunityContentMode
!=
CommunityContentMode
.Disabled) {
60
yield
return
DefaultChineseInfo
;
61
}
62
}
63
else
if
(
SettingsManager
.
CommunityContentMode
==
CommunityContentMode
.Disabled) {
64
yield
return
DefaultOriginalInfo
;
65
}
66
else
{
67
yield
return
DefaultOriginalInfo
;
68
yield
return
DefaultChineseInfo
;
69
}
70
foreach
(
Info
info
in
UserInfos
) {
71
yield
return
info;
72
}
73
}
74
75
public
static
void
ChangeOriginalInfo
(
Info
info) {
76
if
(
CurrentOriginalInfo
!= info && info.
Type
==
Type
.Original) {
77
OriginalCommunityContentManager
.
m_feedbackCache
.Clear();
78
OriginalCommunityContentManager
.
m_idToAddressMap
.Clear();
79
CurrentOriginalInfo
= info;
80
}
81
}
82
83
public
static
void
ChangeChineseInfo
(
Info
info) {
84
if
(
CurrentChineseInfo
!= info && info.
Type
==
Type
.Chinese) {
85
CommunityContentManager
.
m_feedbackCache
.Clear();
86
CommunityContentManager
.
m_idToAddressMap
.Clear();
87
foreach
(
IExternalContentProvider
provider
in
ExternalContentManager
.
m_providers
) {
88
if
(provider is
SchubExternalContentProvider
schubProvider) {
89
provider.
Logout
();
90
}
91
}
92
CurrentChineseInfo
= info;
93
}
94
}
95
}
96
}
Game.CommunityContentManager
定义
CommunityContentManager.cs:11
Game.CommunityContentManager.m_idToAddressMap
static Dictionary< string, string > m_idToAddressMap
定义
CommunityContentManager.cs:13
Game.CommunityContentManager.m_feedbackCache
static Dictionary< string, bool > m_feedbackCache
定义
CommunityContentManager.cs:14
Game.CommunityServerManager.Info
定义
CommunityServerManager.cs:8
Game.CommunityServerManager.Info.Name
string Name
定义
CommunityServerManager.cs:10
Game.CommunityServerManager.Info.ToString
override string ToString()
定义
CommunityServerManager.cs:31
Game.CommunityServerManager.Info.FromString
static Info FromString(string str)
定义
CommunityServerManager.cs:35
Game.CommunityServerManager.Info.Type
Type Type
定义
CommunityServerManager.cs:9
Game.CommunityServerManager.Info.Clone
Info Clone()
定义
CommunityServerManager.cs:43
Game.CommunityServerManager.Info.ApiUrl
string ApiUrl
定义
CommunityServerManager.cs:11
Game.CommunityServerManager.Info.WebsiteUrl
string WebsiteUrl
定义
CommunityServerManager.cs:12
Game.CommunityServerManager.Info.Info
Info(Type type, string name, string apiUrl, string websiteUrl=null)
定义
CommunityServerManager.cs:14
Game.CommunityServerManager.Info.Equals
bool Equals(Info other)
定义
CommunityServerManager.cs:21
Game.CommunityServerManager
定义
CommunityServerManager.cs:2
Game.CommunityServerManager.GetAllInfos
static IEnumerable< Info > GetAllInfos()
定义
CommunityServerManager.cs:57
Game.CommunityServerManager.DefaultChineseInfo
static Info DefaultChineseInfo
定义
CommunityServerManager.cs:50
Game.CommunityServerManager.Type
Type
定义
CommunityServerManager.cs:3
Game.CommunityServerManager.Type.Original
@ Original
定义
CommunityServerManager.cs:4
Game.CommunityServerManager.Type.Chinese
@ Chinese
定义
CommunityServerManager.cs:5
Game.CommunityServerManager.ChangeChineseInfo
static void ChangeChineseInfo(Info info)
定义
CommunityServerManager.cs:83
Game.CommunityServerManager.ChangeOriginalInfo
static void ChangeOriginalInfo(Info info)
定义
CommunityServerManager.cs:75
Game.CommunityServerManager.CurrentChineseInfo
static Info CurrentChineseInfo
定义
CommunityServerManager.cs:55
Game.CommunityServerManager.DefaultOriginalInfo
static Info DefaultOriginalInfo
定义
CommunityServerManager.cs:49
Game.CommunityServerManager.CurrentOriginalInfo
static Info CurrentOriginalInfo
定义
CommunityServerManager.cs:54
Game.CommunityServerManager.UserInfos
static List< Info > UserInfos
定义
CommunityServerManager.cs:53
Game.ExternalContentManager
定义
ExternalContentManager.cs:5
Game.ExternalContentManager.m_providers
static List< IExternalContentProvider > m_providers
定义
ExternalContentManager.cs:6
Game.SchubExternalContentProvider
定义
SchubExternalContentProvider.cs:9
Game.SettingsManager
定义
SettingsManager.cs:11
Game.SettingsManager.CommunityContentMode
static CommunityContentMode CommunityContentMode
定义
SettingsManager.cs:281
Game.SettingsManager.OriginalCommunityContentMode
static CommunityContentMode OriginalCommunityContentMode
定义
SettingsManager.cs:283
OriginalCommunityContentManager
定义
OriginalCommunityContentManager.cs:9
OriginalCommunityContentManager.m_idToAddressMap
static Dictionary< string, string > m_idToAddressMap
定义
OriginalCommunityContentManager.cs:11
OriginalCommunityContentManager.m_feedbackCache
static Dictionary< string, bool > m_feedbackCache
定义
OriginalCommunityContentManager.cs:13
Game.IExternalContentProvider
定义
IExternalContentProvider.cs:2
Game.IExternalContentProvider.Logout
void Logout()
Game
定义
ContentFileBridge.cs:4
Game.CommunityContentMode
CommunityContentMode
定义
CommunityContentMode.cs:2
SurvivalcraftApi 1.8.2.3
Survivalcraft.Windows
ModsManager
CommunityServerManager.cs
制作者
1.16.1