Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
SettingsCompatibilityScreen.cs
浏览该文件的文档.
1using System.Xml.Linq;
2using Engine;
3#if !ANDROID
4#endif
5
6namespace Game {
8 //public ButtonWidget m_singlethreadedTerrainUpdateButton;
9
20 public const string fName = "SettingsCompatibilityScreen";
21
23 XElement node = ContentManager.Get<XElement>("Screens/SettingsCompatibilityScreen");
24 LoadContents(this, node);
25 //m_singlethreadedTerrainUpdateButton = Children.Find<ButtonWidget>("SinglethreadedTerrainUpdateButton");
26 m_viewGameLogButton = Children.Find<ButtonWidget>("ViewGameLogButton");
27 m_openGameLogButton = Children.Find<ButtonWidget>("OpenGameLogButton");
28 m_shareGameLogButton = Children.Find<ButtonWidget>("ShareGameLogButton");
29 m_shareGameLogButtonPanel = Children.Find<ContainerWidget>("ShareGameLogButtonPanel");
30 m_reportButton = Children.Find<ButtonWidget>("ReportButton");
31 m_fileAssociationEnabledButton = Children.Find<ButtonWidget>("FileAssociationEnabledButton");
32 m_manageClassSubstitutesButton = Children.Find<ButtonWidget>("ManageClassSubstitutesButton");
33 m_safeModeButton = Children.Find<ButtonWidget>("SafeModeButton");
34 m_resetDefaultsButton = Children.Find<ButtonWidget>("ResetDefaultsButton");
35 m_descriptionLabel = Children.Find<LabelWidget>("Description");
36#if !WINDOWS
37 m_fileAssociationEnabledButton.IsEnabled = false;
38#endif
39#if ANDROID
40 m_shareGameLogButtonPanel.IsVisible = true;
41#endif
43 }
44
45 public override void Enter(object[] parameters) {
46 m_descriptionLabel.Text = LanguageControl.Get(fName, "1");
47 }
48
49 public override void Update() {
50 //if (m_singlethreadedTerrainUpdateButton.IsClicked)
51 //{
52 // SettingsManager.MultithreadedTerrainUpdate = !SettingsManager.MultithreadedTerrainUpdate;
53 // m_descriptionLabel.Text = StringsManager.GetString("Settings.Compatibility.SinglethreadedTerrainUpdate.Description");
54 //}
55 if (m_viewGameLogButton.IsClicked) {
56 m_descriptionLabel.Text = LanguageControl.Get(fName, "1");
58 }
59 if (m_openGameLogButton.IsClicked) {
60#if BROWSER
62#else
63 m_descriptionLabel.Text = LanguageControl.Get(fName, "1");
64 string path = Storage.CombinePaths(ModsManager.LogPath, "Game.log");
65 if (Storage.FileExists(path)) {
66 try {
68 path,
69 LanguageControl.GetContentWidgets("SettingsCompatibilityScreen", "13"),
70 "text/plain"
71 );
72 }
73 catch (Exception e) {
75 }
76 }
77#endif
78 }
79 if (m_shareGameLogButton.IsClicked) {
80 m_descriptionLabel.Text = LanguageControl.Get(fName, "1");
81 string path = Storage.CombinePaths(ModsManager.LogPath, "Game.log");
82 if (Storage.FileExists(path)) {
83 Task.Run(async () => {
84 try {
85 await Storage.ShareFile(path, LanguageControl.GetContentWidgets("SettingsCompatibilityScreen", "15"), "text/plain");
86 }
87 catch (Exception e) {
89 }
90 }
91 );
92 }
93 }
94 if (m_reportButton.IsClicked) {
95 m_descriptionLabel.Text = LanguageControl.Get(fName, "1");
97 }
98#if WINDOWS
99 if (m_fileAssociationEnabledButton.IsClicked) {
100 m_descriptionLabel.Text = LanguageControl.Get(fName, "2");
104 }
105 else {
107 }
108 }
109#endif
110 if (m_manageClassSubstitutesButton.IsClicked) {
111 ScreensManager.SwitchScreen("ManageClassSubstitutes");
112 }
113 if (m_safeModeButton.IsClicked) {
114 m_descriptionLabel.Text = LanguageControl.Get(fName, "3");
118 null,
120 );
121 }
122 if (m_resetDefaultsButton.IsClicked) {
124 }
126 //m_singlethreadedTerrainUpdateButton.Text = "已弃用";
127 m_resetDefaultsButton.IsEnabled = !SettingsManager.MultithreadedTerrainUpdate;
128 if (Input.Back
129 || Input.Cancel
130 || Children.Find<ButtonWidget>("TopBar.Back").IsClicked) {
132 }
133 }
134 }
135}
static void Dispatch(Action action, bool waitUntilCompleted=false)
static void OpenFileWithExternalApplication(string path, string chooserTitle=null, string mimeType=null)
static bool FileExists(string path)
static string CombinePaths(params string[] paths)
static async Task ShareFile(string path, string chooserTitle=null, string mimeType=null)
readonly WidgetsList Children
static object Get(Type type, string name)
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
static string GetContentWidgets(string name, string prop)
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
static void GoBack(params object[] parameters)
static void SwitchScreen(string name, params object[] parameters)
static void LaunchBrowser(string url)
virtual void LoadContents(object eventsTarget, XElement node)
static string LogPath
static string ReportLink