public override void Enter(object[] parameters) { HelpTopic helpTopic = (HelpTopic)parameters[0]; m_titleLabel.Text = helpTopic.Title; m_textLabel.Text = helpTopic.Text; m_scrollPanel.ScrollPosition = 0f; }
public void ShowTopic(HelpTopic helpTopic) { if (helpTopic.Name == "Keyboard") { DialogsManager.ShowDialog(null, new KeyboardHelpDialog()); } else if (helpTopic.Name == "Gamepad") { DialogsManager.ShowDialog(null, new GamepadHelpDialog()); } else { ScreensManager.SwitchScreen("HelpTopic", helpTopic); } }
public HelpScreen() { WidgetsManager.LoadWidgetContents(this, this, ContentManager.Get <XElement>("Screens/HelpScreen")); m_topicsList = Children.Find <ListPanelWidget>("TopicsList", true); m_recipaediaButton = Children.Find <ButtonWidget>("RecipaediaButton", true); m_bestiaryButton = Children.Find <ButtonWidget>("BestiaryButton", true); m_topicsList.ItemWidgetFactory = delegate(object item) { var helpTopic3 = (HelpTopic)item; XElement node2 = ContentManager.Get <XElement>("Widgets/HelpTopicItem"); var obj = (ContainerWidget)WidgetsManager.LoadWidget(this, node2, null); obj.Children.Find <LabelWidget>("HelpTopicItem.Title", true).Text = helpTopic3.Title; return(obj); }; m_topicsList.ItemClicked += delegate(object item) { if (item is HelpTopic helpTopic2) { ShowTopic(helpTopic2); } }; for (var i = ContentManager.CombineXml(ContentManager.Get <XElement>("Help"), ModsManager.GetEntries(".hlp"), "Title", "Name", "Topic").Elements().GetEnumerator(); i.MoveNext();) { var element = i.Current; var strArray = XmlUtils.GetAttributeValue(element, "DisabledPlatforms", string.Empty).Split(','); if (strArray.FirstOrDefault(Match) == null) { var attributeValue1 = XmlUtils.GetAttributeValue(element, "Name", string.Empty); var attributeValue2 = XmlUtils.GetAttributeValue <string>(element, "Title"); var str1 = string.Empty; strArray = element.Value.Split('\n'); for (int i1 = 0; i1 < strArray.Length; i1++) { str1 = str1 + strArray[i1].Trim() + " "; } var helpTopic = new HelpTopic { Name = attributeValue1, Title = attributeValue2, Text = str1.Replace("\r", "").Replace("’", "'").Replace("\\n", "\n") }; if (!string.IsNullOrEmpty(helpTopic.Name)) { m_topics.Add(helpTopic.Name, helpTopic); } m_topicsList.AddItem(helpTopic); } } }
public HelpScreen() { XElement node = ContentManager.Get <XElement>("Screens/HelpScreen"); LoadContents(this, node); m_topicsList = Children.Find <ListPanelWidget>("TopicsList"); m_recipaediaButton = Children.Find <ButtonWidget>("RecipaediaButton"); m_bestiaryButton = Children.Find <ButtonWidget>("BestiaryButton"); m_topicsList.ItemWidgetFactory = delegate(object item) { HelpTopic helpTopic3 = (HelpTopic)item; XElement node2 = ContentManager.Get <XElement>("Widgets/HelpTopicItem"); ContainerWidget obj = (ContainerWidget)Widget.LoadWidget(this, node2, null); obj.Children.Find <LabelWidget>("HelpTopicItem.Title").Text = helpTopic3.Title; return(obj); }; m_topicsList.ItemClicked += delegate(object item) { HelpTopic helpTopic2 = item as HelpTopic; if (helpTopic2 != null) { ShowTopic(helpTopic2); } }; foreach (KeyValuePair <string, Dictionary <string, string> > item in LanguageControl.items2["Help"]) { if (item.Value.ContainsKey("DisabledPlatforms")) { item.Value.TryGetValue("DisabledPlatforms", out string displa); if (displa.Split(new string[] { "," }, StringSplitOptions.None).FirstOrDefault((string s) => s.Trim().ToLower() == VersionsManager.Platform.ToString().ToLower()) == null) { continue; } } item.Value.TryGetValue("Title", out string Title); item.Value.TryGetValue("Name", out string Name); item.Value.TryGetValue("value", out string value); if (string.IsNullOrEmpty(Title)) { Title = string.Empty; } if (string.IsNullOrEmpty(Name)) { Name = string.Empty; } if (string.IsNullOrEmpty(value)) { value = string.Empty; } string attributeValue = Name; string attributeValue2 = Title; string text = string.Empty; string[] array = value.Split(new string[] { "\n" }, StringSplitOptions.None); foreach (string text2 in array) { text = text + text2.Trim() + " "; } text = text.Replace("\r", ""); text = text.Replace("’", "'"); text = text.Replace("\\n", "\n"); HelpTopic helpTopic = new HelpTopic { Name = attributeValue, Title = attributeValue2, Text = text }; if (!string.IsNullOrEmpty(helpTopic.Name)) { m_topics.Add(helpTopic.Name, helpTopic); } m_topicsList.AddItem(helpTopic); } }
public override void Update() { m_titleLabel.Text = $"{m_componentPlayer.PlayerData.Name}, Level {MathUtils.Floor(m_componentPlayer.PlayerData.Level)} {m_componentPlayer.PlayerData.PlayerClass.ToString()}"; m_healthValueBar.Value = m_componentPlayer.ComponentHealth.Health; m_staminaValueBar.Value = m_componentPlayer.ComponentVitalStats.Stamina; m_foodValueBar.Value = m_componentPlayer.ComponentVitalStats.Food; m_sleepValueBar.Value = m_componentPlayer.ComponentVitalStats.Sleep; m_temperatureValueBar.Value = m_componentPlayer.ComponentVitalStats.Temperature / 24f; m_wetnessValueBar.Value = m_componentPlayer.ComponentVitalStats.Wetness; m_experienceValueBar.Value = m_componentPlayer.PlayerData.Level - MathUtils.Floor(m_componentPlayer.PlayerData.Level); m_strengthLabel.Text = string.Format(CultureInfo.InvariantCulture, "x {0:0.00}", m_componentPlayer.ComponentLevel.StrengthFactor); m_resilienceLabel.Text = string.Format(CultureInfo.InvariantCulture, "x {0:0.00}", m_componentPlayer.ComponentLevel.ResilienceFactor); m_speedLabel.Text = string.Format(CultureInfo.InvariantCulture, "x {0:0.00}", m_componentPlayer.ComponentLevel.SpeedFactor); m_hungerLabel.Text = string.Format(CultureInfo.InvariantCulture, "x {0:0.00}", m_componentPlayer.ComponentLevel.HungerFactor); m_insulationLabel.Text = string.Format(CultureInfo.InvariantCulture, "{0:0.00} clo", m_componentPlayer.ComponentClothing.Insulation); if (m_healthLink.IsClicked) { HelpTopic topic = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Health"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic.Title, topic.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_staminaLink.IsClicked) { HelpTopic topic2 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Stamina"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic2.Title, topic2.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_foodLink.IsClicked) { HelpTopic topic3 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Hunger"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic3.Title, topic3.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_sleepLink.IsClicked) { HelpTopic topic4 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Sleep"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic4.Title, topic4.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_temperatureLink.IsClicked) { HelpTopic topic5 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Temperature"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic5.Title, topic5.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_wetnessLink.IsClicked) { HelpTopic topic6 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Wetness"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic6.Title, topic6.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_strengthLink.IsClicked) { List <ComponentLevel.Factor> factors = new List <ComponentLevel.Factor>(); float total = m_componentPlayer.ComponentLevel.CalculateStrengthFactor(factors); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new LevelFactorDialog("Strength", "Affects melee attack power, digging speed, throwing range, and bow range.", factors, total)); } if (m_resilienceLink.IsClicked) { List <ComponentLevel.Factor> factors2 = new List <ComponentLevel.Factor>(); float total2 = m_componentPlayer.ComponentLevel.CalculateResilienceFactor(factors2); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new LevelFactorDialog("Resilience", "Affects damage received from attacks, falls, fire, and asphyxiation.", factors2, total2)); } if (m_speedLink.IsClicked) { List <ComponentLevel.Factor> factors3 = new List <ComponentLevel.Factor>(); float total3 = m_componentPlayer.ComponentLevel.CalculateSpeedFactor(factors3); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new LevelFactorDialog("Speed", "Affects movement speed on foot, swimming speed, jump height and stamina regeneration.", factors3, total3)); } if (m_hungerLink.IsClicked) { List <ComponentLevel.Factor> factors4 = new List <ComponentLevel.Factor>(); float total4 = m_componentPlayer.ComponentLevel.CalculateHungerFactor(factors4); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new LevelFactorDialog("Hunger", "Affects how quickly eaten food is depleted.", factors4, total4)); } if (m_experienceLink.IsClicked) { HelpTopic topic7 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Levels"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic7.Title, topic7.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_insulationLink.IsClicked) { HelpTopic topic8 = ScreensManager.FindScreen <HelpScreen>("Help").GetTopic("Clothing"); DialogsManager.ShowDialog(m_componentPlayer.GuiWidget, new MessageDialog(topic8.Title, topic8.Text, LanguageControl.Get("Usual", "ok"), null, new Vector2(700f, 360f), null)); } if (m_chokeButton.IsClicked) { m_componentPlayer.ComponentHealth.Injure(0.1f, null, ignoreInvulnerability: true, "Choked"); } }