Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
MoreCommunityLinkDialog.cs
浏览该文件的文档.
1using System.Xml.Linq;
2
3namespace Game {
6
8
10
12
14
16
17 public const string fName = "MoreCommunityLinkDialog";
18
20 XElement node = ContentManager.Get<XElement>("Dialogs/MoreCommunityLinkDialog");
21 LoadContents(this, node);
22 m_userLabel = Children.Find<LabelWidget>("MoreCommunityLinkDialog.User");
23 m_changeUserButton = Children.Find<ButtonWidget>("MoreCommunityLinkDialog.ChangeUser");
24 m_userIdLabel = Children.Find<LabelWidget>("MoreCommunityLinkDialog.UserId");
25 m_copyUserIdButton = Children.Find<ButtonWidget>("MoreCommunityLinkDialog.CopyUserId");
26 m_publishButton = Children.Find<ButtonWidget>("MoreCommunityLinkDialog.Publish");
27 m_closeButton = Children.Find<ButtonWidget>("MoreCommunityLinkDialog.Close");
28 }
29
30 public override void Update() {
31 string text = UserManager.ActiveUser != null ? UserManager.ActiveUser.DisplayName : LanguageControl.Get(fName, "1");
32 if (text.Length > 15) {
33 text = $"{text.Substring(0, 15)}...";
34 }
35 m_userLabel.Text = text;
36 string text2 = UserManager.ActiveUser != null ? UserManager.ActiveUser.UniqueId : LanguageControl.Get(fName, "1");
37 if (text2.Length > 15) {
38 text2 = $"{text2.Substring(0, 15)}...";
39 }
40 m_userIdLabel.Text = text2;
41 m_publishButton.IsEnabled = UserManager.ActiveUser != null;
42 m_copyUserIdButton.IsEnabled = UserManager.ActiveUser != null;
43 if (m_changeUserButton.IsClicked) {
49 60f,
50 item => ((UserInfo)item).DisplayName,
51 delegate(object item) { UserManager.ActiveUser = (UserInfo)item; }
52 )
53 );
54 }
55 if (m_copyUserIdButton.IsClicked
56 && UserManager.ActiveUser != null) {
58 }
59 if (m_publishButton.IsClicked
60 && UserManager.ActiveUser != null) {
62 }
63 if (Input.Cancel
64 || m_closeButton.IsClicked) {
66 }
67 }
68 }
69}
readonly WidgetsList Children
static object Get(Type type, string name)
static void HideDialog(Dialog dialog)
static void ShowDialog(ContainerWidget parentWidget, Dialog dialog)
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
readonly string UniqueId
static IEnumerable< UserInfo > GetUsers()
static UserInfo ActiveUser
ContainerWidget ParentWidget
virtual void LoadContents(object eventsTarget, XElement node)