Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
LoadingFailedScreen.cs
浏览该文件的文档.
1using Engine;
3
4namespace Game {
5 public class LoadingFailedScreen : Screen {
7 public LoadingFailedScreen(string title, IEnumerable<string> details, IEnumerable<string> solveMethods) {
8 Children.Clear();
9 Children.Add(
10 new RectangleWidget {
11 Size = new Vector2(float.PositiveInfinity), FillColor = Color.Black, OutlineColor = Color.Black, OutlineThickness = 0
12 }
13 );
14 ScrollPanelWidget scrollPanelWidget = new() { HorizontalAlignment = WidgetAlignment.Center, Direction = LayoutDirection.Vertical };
15 StackPanelWidget widget = new() { Direction = LayoutDirection.Vertical, HorizontalAlignment = WidgetAlignment.Center, Margin = new Vector2(20f)};
16 scrollPanelWidget.Children.Add(widget);
17 {
18 widget.Children.Add(
19 new LabelWidget { Text = title, FontScale = 2, Color = Color.Red, HorizontalAlignment = WidgetAlignment.Center, WordWrap = true }
20 );
21 widget.Children.Add(new RectangleWidget { ColorTransform = Color.Transparent, Size = new Vector2(float.PositiveInfinity, 40f) });
22 foreach (string detail in details) {
23 widget.Children.Add(new LabelWidget { Text = detail, WordWrap = true });
24 }
25 widget.Children.Add(new RectangleWidget { ColorTransform = Color.Transparent, Size = new Vector2(float.PositiveInfinity, 20f) });
26 widget.Children.Add(
27 new LabelWidget {
28 Text = "For solving this problem, please try: \n要解决此问题,请尝试:",
30 WordWrap = true,
31 Margin = new Vector2(0f, 8f)
32 }
33 );
34 foreach (string method in solveMethods) {
35 widget.Children.Add(new LabelWidget { Text = method, WordWrap = true, Margin = new Vector2(0f, 4f)});
36 }
37 m_enableSafeModeButton = new BevelledButtonWidget { Text = "Safe Mode 安全模式", Size = new Vector2(310f, 60f), HorizontalAlignment = WidgetAlignment.Center, Margin = new Vector2(0f, 10f)};
39 }
40 Children.Add(scrollPanelWidget);
41 }
42
43 public override void Update() {
44 if (m_enableSafeModeButton.IsClicked) {
46 DialogsManager.ShowDialog(null, new MessageDialog("Need Restarting 需要重启", null, "OK", null, null));
47 }
48 }
49 }
50}
readonly WidgetsList Children
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
LoadingFailedScreen(string title, IEnumerable< string > details, IEnumerable< string > solveMethods)
Color ColorTransform
virtual Vector2 Margin
virtual WidgetAlignment HorizontalAlignment
void Add(Widget widget)
static Color Transparent
定义 Color.cs:5
static Color Red
static Color Green
static Color Black
定义 Color.cs:7