Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
BulletinDialog.cs
浏览该文件的文档.
1using System.Xml.Linq;
2using Engine;
3
4namespace Game {
5 public class BulletinDialog : Dialog {
7
9
11
13
15
17
19
21
22 public float m_areaLength = 0;
23
24 public Action Action;
25
27
29
30 public BulletinDialog(string title,
31 string content,
32 string time,
33 Action action,
36 XElement node = ContentManager.Get<XElement>("Dialogs/BulletinDialog");
37 LoadContents(this, node);
38 m_okButton = Children.Find<ButtonWidget>("OkButton");
39 m_editButton = Children.Find<ButtonWidget>("EditButton");
40 m_updateButton = Children.Find<ButtonWidget>("UpdateButton");
41 m_titleLabel = Children.Find<LabelWidget>("Title");
42 m_contentLabel = Children.Find<LabelWidget>("Content");
43 m_timeLabel = Children.Find<LabelWidget>("Time");
44 m_buttonLabel = Children.Find<LabelWidget>("ButtonLabel");
45 m_scrollPanel = Children.Find<ScrollPanelWidget>("ScrollPanel");
46 m_buttonLabel.Text = LanguageControl.Ok;
47 m_okButton.IsVisible = false;
48 m_titleLabel.Text = title;
49 m_contentLabel.Text = content;
50 m_timeLabel.Text = time;
51 Action = action;
52 Action2 = action2;
53 Action3 = action3;
54 m_editButton.IsVisible = false;
55 m_updateButton.IsVisible = false;
56 }
57
58 public override void Update() {
59 float length = MathUtils.Max(m_scrollPanel.m_scrollAreaLength - m_scrollPanel.ActualSize.Y, 0f);
60 if (m_scrollPanel.ScrollPosition >= length * 0.8f
61 && m_scrollPanel.m_scrollAreaLength != 0) {
62 m_okButton.IsVisible = true;
63 }
64 if (m_okButton.IsClicked) {
65 Action?.Invoke();
67 }
68 if (m_editButton.IsClicked) {
70 }
71 if (m_updateButton.IsClicked) {
74 }
75 }
76 }
77}
static int Max(int x1, int x2)
Action< LabelWidget, LabelWidget > Action3
Action< LabelWidget, LabelWidget > Action2
BulletinDialog(string title, string content, string time, Action action, Action< LabelWidget, LabelWidget > action2, Action< LabelWidget, LabelWidget > action3)
ScrollPanelWidget m_scrollPanel
readonly WidgetsList Children
static object Get(Type type, string name)
static void HideDialog(Dialog dialog)
virtual void LoadContents(object eventsTarget, XElement node)