public void UpdateList() { m_directoryList.ClearItems(); if (m_externalContentProvider != null && m_externalContentProvider.IsLoggedIn) { CancellableBusyDialog busyDialog = new CancellableBusyDialog(LanguageControl.Get(fName, 9), autoHideOnCancel: false); DialogsManager.ShowDialog(null, busyDialog); m_externalContentProvider.List(m_path, busyDialog.Progress, delegate(ExternalContentEntry entry) { DialogsManager.HideDialog(busyDialog); List <ExternalContentEntry> list = new List <ExternalContentEntry>(entry.ChildEntries.Where((ExternalContentEntry e) => EntryFilter(e)).Take(1000)); m_directoryList.ClearItems(); list.Sort(delegate(ExternalContentEntry e1, ExternalContentEntry e2) { if (e1.Type == ExternalContentType.Directory && e2.Type != ExternalContentType.Directory) { return(-1); } return((e1.Type != ExternalContentType.Directory && e2.Type == ExternalContentType.Directory) ? 1 : string.Compare(e1.Path, e2.Path)); }); foreach (ExternalContentEntry item in list) { m_directoryList.AddItem(item); } }, delegate(Exception error) { DialogsManager.HideDialog(busyDialog); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); } }
public override IEnumerable <CraftingRecipe> GetProceduralCraftingRecipes() { int color = 0; while (color < 8) { CraftingRecipe craftingRecipe = new CraftingRecipe { ResultCount = 4, ResultValue = Terrain.MakeBlockValue(182, 0, SetColor(0, color)), RemainsCount = 1, RemainsValue = Terrain.MakeBlockValue(90), RequiredHeatLevel = 0f, Description = LanguageControl.Get(GetType().Name, 1) }; craftingRecipe.Ingredients[0] = "glass"; craftingRecipe.Ingredients[1] = "glass"; craftingRecipe.Ingredients[2] = "glass"; craftingRecipe.Ingredients[4] = "paintbucket:" + color.ToString(CultureInfo.InvariantCulture); craftingRecipe.Ingredients[6] = "copperingot"; craftingRecipe.Ingredients[7] = "copperingot"; craftingRecipe.Ingredients[8] = "copperingot"; yield return(craftingRecipe); int num = color + 1; color = num; } }
public override void Update() { if (m_windowModeButton.IsClicked) { SettingsManager.WindowMode = (WindowMode)((int)(SettingsManager.WindowMode + 1) % EnumUtils.GetEnumValues(typeof(WindowMode)).Count); } if (m_languageButton.IsClicked) { DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), LanguageControl.Get(fName, 2), LanguageControl.Get("Usual", "yes"), LanguageControl.Get("Usual", "no"), delegate(MessageDialogButton button) { if (button == MessageDialogButton.Button1) { ModsManager.modSettings.languageType = (LanguageControl.LanguageType)((int)(ModsManager.modSettings.languageType + 1) % EnumUtils.GetEnumValues(typeof(LanguageControl.LanguageType)).Count); ModsManager.SaveSettings(); System.Environment.Exit(0); } })); } if (m_uiSizeButton.IsClicked) { SettingsManager.GuiSize = (GuiSize)((int)(SettingsManager.GuiSize + 1) % EnumUtils.GetEnumValues(typeof(GuiSize)).Count); } if (m_upsideDownButton.IsClicked) { SettingsManager.UpsideDownLayout = !SettingsManager.UpsideDownLayout; } if (m_hideMoveLookPadsButton.IsClicked) { SettingsManager.HideMoveLookPads = !SettingsManager.HideMoveLookPads; } if (m_showGuiInScreenshotsButton.IsClicked) { SettingsManager.ShowGuiInScreenshots = !SettingsManager.ShowGuiInScreenshots; } if (m_showLogoInScreenshotsButton.IsClicked) { SettingsManager.ShowLogoInScreenshots = !SettingsManager.ShowLogoInScreenshots; } if (m_screenshotSizeButton.IsClicked) { SettingsManager.ScreenshotSize = (ScreenshotSize)((int)(SettingsManager.ScreenshotSize + 1) % EnumUtils.GetEnumValues(typeof(ScreenshotSize)).Count); } if (m_communityContentModeButton.IsClicked) { SettingsManager.CommunityContentMode = (CommunityContentMode)((int)(SettingsManager.CommunityContentMode + 1) % EnumUtils.GetEnumValues(typeof(CommunityContentMode)).Count); } m_windowModeButton.Text = LanguageControl.Get("WindowMode", SettingsManager.WindowMode.ToString()); m_uiSizeButton.Text = LanguageControl.Get("GuiSize", SettingsManager.GuiSize.ToString()); m_languageButton.Text = LanguageControl.LName(); m_upsideDownButton.Text = (SettingsManager.UpsideDownLayout ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_hideMoveLookPadsButton.Text = (SettingsManager.HideMoveLookPads ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_showGuiInScreenshotsButton.Text = (SettingsManager.ShowGuiInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_showLogoInScreenshotsButton.Text = (SettingsManager.ShowLogoInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no")); m_screenshotSizeButton.Text = LanguageControl.Get("ScreenshotSize", SettingsManager.ScreenshotSize.ToString()); m_communityContentModeButton.Text = LanguageControl.Get("CommunityContentMode", SettingsManager.CommunityContentMode.ToString()); if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked) { ScreensManager.SwitchScreen(ScreensManager.PreviousScreen); } }
public void Update(float dt) { if (IsSleeping && m_componentPlayer.ComponentHealth.Health > 0f) { m_sleepFactor = MathUtils.Min(m_sleepFactor + 0.33f * Time.FrameDuration, 1f); m_minWetness = MathUtils.Min(m_minWetness, m_componentPlayer.ComponentVitalStats.Wetness); m_componentPlayer.PlayerStats.TimeSlept += m_subsystemGameInfo.TotalElapsedGameTimeDelta; if ((m_componentPlayer.ComponentVitalStats.Sleep >= 1f || m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative) && m_subsystemTimeOfDay.TimeOfDay > 0.3f && m_subsystemTimeOfDay.TimeOfDay < 0.599999964f && m_sleepStartTime.HasValue && m_subsystemGameInfo.TotalElapsedGameTime > m_sleepStartTime + 180.0) { WakeUp(); } if (m_componentPlayer.ComponentHealth.HealthChange < 0f && (m_componentPlayer.ComponentHealth.Health < 0.5f || m_componentPlayer.ComponentVitalStats.Sleep > 0.5f)) { WakeUp(); } if (m_componentPlayer.ComponentVitalStats.Wetness > m_minWetness + 0.05f && m_componentPlayer.ComponentVitalStats.Sleep > 0.2f) { WakeUp(); m_subsystemTime.QueueGameTimeDelayedExecution(m_subsystemTime.GameTime + 1.0, delegate { m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 6), Color.White, blinking: true, playNotificationSound: true); }); } if (m_sleepStartTime.HasValue) { float num = (float)(m_subsystemGameInfo.TotalElapsedGameTime - m_sleepStartTime.Value); if (m_allowManualWakeUp && num > 10f) { if (m_componentPlayer.GameWidget.Input.Any && !DialogsManager.HasDialogs(m_componentPlayer.GameWidget)) { m_componentPlayer.GameWidget.Input.Clear(); WakeUp(); m_subsystemTime.QueueGameTimeDelayedExecution(m_subsystemTime.GameTime + 2.0, delegate { m_componentPlayer.ComponentGui.DisplaySmallMessage(LanguageControl.Get(fName, 7), Color.White, blinking: true, playNotificationSound: false); }); } m_messageFactor = MathUtils.Min(m_messageFactor + 0.5f * Time.FrameDuration, 1f); m_componentPlayer.ComponentScreenOverlays.Message = LanguageControl.Get(fName, 8); m_componentPlayer.ComponentScreenOverlays.MessageFactor = m_messageFactor; } if (!m_allowManualWakeUp && num > 5f) { m_messageFactor = MathUtils.Min(m_messageFactor + 1f * Time.FrameDuration, 1f); m_componentPlayer.ComponentScreenOverlays.Message = LanguageControl.Get(fName, 9); m_componentPlayer.ComponentScreenOverlays.MessageFactor = m_messageFactor; } } } else { m_sleepFactor = MathUtils.Max(m_sleepFactor - 1f * Time.FrameDuration, 0f); } m_componentPlayer.ComponentScreenOverlays.BlackoutFactor = MathUtils.Max(m_componentPlayer.ComponentScreenOverlays.BlackoutFactor, m_sleepFactor); if (m_sleepFactor > 0.01f) { m_componentPlayer.ComponentScreenOverlays.FloatingMessage = LanguageControl.Get(fName, 10); m_componentPlayer.ComponentScreenOverlays.FloatingMessageFactor = MathUtils.Saturate(10f * (m_sleepFactor - 0.9f)); } }
public bool Use(Ray3 ray) { if (Use1 != null) { return(Use1(ray)); } int num = Terrain.ExtractContents(ActiveBlockValue); Block block = BlocksManager.Blocks[num]; if (!CanUseTool(ActiveBlockValue)) { ComponentPlayer?.ComponentGui.DisplaySmallMessage(string.Format(LanguageControl.Get(fName, 1), block.PlayerLevelRequired, block.GetDisplayName(m_subsystemTerrain, ActiveBlockValue)), Color.White, blinking: true, playNotificationSound: true); Poke(forceRestart: false); return(false); } SubsystemBlockBehavior[] blockBehaviors = m_subsystemBlockBehaviors.GetBlockBehaviors(num); for (int i = 0; i < blockBehaviors.Length; i++) { if (blockBehaviors[i].OnUse(ray, this)) { Poke(forceRestart: false); return(true); } } return(false); }
public static string GetDeviceDisplayName(WidgetInputDevice device) { switch (device) { case WidgetInputDevice.Keyboard | WidgetInputDevice.Mouse: return(LanguageControl.Get(fName, 4)); case WidgetInputDevice.GamePad1: return(LanguageControl.Get(fName, 5) + (GamePad.IsConnected(0) ? "" : LanguageControl.Get(fName, 9))); case WidgetInputDevice.GamePad2: return(LanguageControl.Get(fName, 6) + (GamePad.IsConnected(1) ? "" : LanguageControl.Get(fName, 9))); case WidgetInputDevice.GamePad3: return(LanguageControl.Get(fName, 7) + (GamePad.IsConnected(2) ? "" : LanguageControl.Get(fName, 9))); case WidgetInputDevice.GamePad4: return(LanguageControl.Get(fName, 8) + (GamePad.IsConnected(3) ? "" : LanguageControl.Get(fName, 9))); case WidgetInputDevice.VrControllers: return(LanguageControl.Get(fName, 11) + (VrManager.IsVrAvailable ? "" : LanguageControl.Get(fName, 9))); default: return(LanguageControl.Get(fName, 10)); } }
public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) { ComponentBody = base.Entity.FindComponent <ComponentBody>(throwOnError: true); ComponentHealth = base.Entity.FindComponent <ComponentHealth>(throwOnError: true); ComponentSpawn = base.Entity.FindComponent <ComponentSpawn>(throwOnError: true); ComponentCreatureSounds = base.Entity.FindComponent <ComponentCreatureSounds>(throwOnError: true); ComponentCreatureModel = base.Entity.FindComponent <ComponentCreatureModel>(throwOnError: true); ComponentLocomotion = base.Entity.FindComponent <ComponentLocomotion>(throwOnError: true); m_subsystemPlayerStats = base.Project.FindSubsystem <SubsystemPlayerStats>(throwOnError: true); ConstantSpawn = valuesDictionary.GetValue <bool>("ConstantSpawn"); Category = valuesDictionary.GetValue <CreatureCategory>("Category"); DisplayName = valuesDictionary.GetValue <string>("DisplayName"); if (DisplayName.StartsWith("[") && DisplayName.EndsWith("]")) { string[] lp = DisplayName.Substring(1, DisplayName.Length - 2).Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries); DisplayName = LanguageControl.GetDatabase("DisplayName", lp[1]); } m_killVerbs = HumanReadableConverter.ValuesListFromString <string>(',', valuesDictionary.GetValue <string>("KillVerbs")); if (m_killVerbs.Length == 0) { throw new InvalidOperationException("Must have at least one KillVerb"); } if (!MathUtils.IsPowerOf2((long)Category)) { throw new InvalidOperationException("A single category must be assigned for creature."); } }
public override void Enter(object[] parameters) { BusyDialog dialog = new BusyDialog(LanguageControl.GetContentWidgets(fName, 5), null); DialogsManager.ShowDialog(null, dialog); Task.Run(delegate { WorldInfo selectedItem = (WorldInfo)m_worldsListWidget.SelectedItem; WorldsManager.UpdateWorldsList(); List <WorldInfo> worldInfos = new List <WorldInfo>(WorldsManager.WorldInfos); worldInfos.Sort((WorldInfo w1, WorldInfo w2) => DateTime.Compare(w2.LastSaveTime, w1.LastSaveTime)); Dispatcher.Dispatch(delegate { m_worldsListWidget.ClearItems(); foreach (WorldInfo item in worldInfos) { m_worldsListWidget.AddItem(item); } if (selectedItem != null) { m_worldsListWidget.SelectedItem = worldInfos.FirstOrDefault((WorldInfo wi) => wi.DirectoryName == selectedItem.DirectoryName); } DialogsManager.HideDialog(dialog); }); }); }
public virtual void Initialize() { if (Durability < -1 || Durability > 65535) { throw new InvalidOperationException(string.Format(LanguageControl.Get(fName, 1), DefaultDisplayName)); } }
public CreativeInventoryWidget(Entity entity) { m_componentCreativeInventory = entity.FindComponent <ComponentCreativeInventory>(throwOnError: true); XElement node = ContentManager.Get <XElement>("Widgets/CreativeInventoryWidget"); LoadContents(this, node); m_categoryLeftButton = Children.Find <ButtonWidget>("CategoryLeftButton"); m_categoryRightButton = Children.Find <ButtonWidget>("CategoryRightButton"); m_categoryButton = Children.Find <ButtonWidget>("CategoryButton"); m_pageUpButton = Children.Find <ButtonWidget>("PageUpButton"); m_pageDownButton = Children.Find <ButtonWidget>("PageDownButton"); m_pageLabel = Children.Find <LabelWidget>("PageLabel"); m_panelContainer = Children.Find <ContainerWidget>("PanelContainer"); CreativeInventoryPanel creativeInventoryPanel = new CreativeInventoryPanel(this) { IsVisible = false }; m_panelContainer.Children.Add(creativeInventoryPanel); FurnitureInventoryPanel furnitureInventoryPanel = new FurnitureInventoryPanel(this) { IsVisible = false }; m_panelContainer.Children.Add(furnitureInventoryPanel); foreach (string category in BlocksManager.Categories) { m_categories.Add(new Category { Name = category, Panel = creativeInventoryPanel }); } m_categories.Add(new Category { Name = LanguageControl.Get(fName, 1), Panel = furnitureInventoryPanel }); m_categories.Add(new Category { Name = LanguageControl.Get(fName, 2), Panel = creativeInventoryPanel }); for (int i = 0; i < m_categories.Count; i++) { if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Electrics")) { m_categories[i].Color = new Color(128, 140, 255); } if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Plants")) { m_categories[i].Color = new Color(64, 160, 64); } if (m_categories[i].Name == LanguageControl.Get("BlocksManager", "Weapons")) { m_categories[i].Color = new Color(255, 128, 112); } } }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { int data = Terrain.ExtractData(value); int color = GetColor(data); return(LanguageControl.Get("LedBlock", color) + LanguageControl.GetBlock(string.Format("{0}:{1}", GetType().Name, data.ToString()), "DisplayName")); }
public BuildFurnitureDialog(FurnitureDesign design, FurnitureDesign sourceDesign, Action <bool> handler) { XElement node = ContentManager.Get <XElement>("Dialogs/BuildFurnitureDialog"); LoadContents(this, node); m_nameLabel = Children.Find <LabelWidget>("BuildFurnitureDialog.Name"); m_statusLabel = Children.Find <LabelWidget>("BuildFurnitureDialog.Status"); m_designWidget2d = Children.Find <FurnitureDesignWidget>("BuildFurnitureDialog.Design2d"); m_designWidget3d = Children.Find <FurnitureDesignWidget>("BuildFurnitureDialog.Design3d"); m_nameButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.NameButton"); m_axisButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.AxisButton"); m_leftButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.LeftButton"); m_rightButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.RightButton"); m_upButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.UpButton"); m_downButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.DownButton"); m_mirrorButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.MirrorButton"); m_turnRightButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.TurnRightButton"); m_increaseResolutionButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.IncreaseResolutionButton"); m_decreaseResolutionButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.DecreaseResolutionButton"); m_resolutionLabel = Children.Find <LabelWidget>("BuildFurnitureDialog.ResolutionLabel"); m_cancelButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.CancelButton"); m_buildButton = Children.Find <ButtonWidget>("BuildFurnitureDialog.BuildButton"); m_handler = handler; m_design = design; m_sourceDesign = sourceDesign; m_axis = 1; int num = 0; num += m_design.Geometry.SubsetOpaqueByFace.Sum((BlockMesh b) => (b != null) ? (b.Indices.Count / 3) : 0); num += m_design.Geometry.SubsetAlphaTestByFace.Sum((BlockMesh b) => (b != null) ? (b.Indices.Count / 3) : 0); m_isValid = (num <= 65535); m_statusLabel.Text = string.Format(LanguageControl.Get(fName, 1), num, 65535, m_isValid ? LanguageControl.Get(fName, 2) : LanguageControl.Get(fName, 3)); m_designWidget2d.Design = m_design; m_designWidget3d.Design = m_design; }
public static string FormatOffset(float value) { if (value != 0f) { return(((value >= 0f) ? "+" : "") + value.ToString()); } return(LanguageControl.Get(fName, 6)); }
public override string GetCategory(int value) { if (GetClothingColor(Terrain.ExtractData(value)) == 0) { return(base.GetCategory(value)); } return(LanguageControl.Get("BlocksManager", "Dyed")); }
public override string GetCategory(int value) { if (!GetColor(Terrain.ExtractData(value)).HasValue) { return(base.GetCategory(value)); } return(LanguageControl.Get("BlocksManager", "Painted")); }
public void ShipView_Enter() { ComponentBody componentBody = m_componentPlayer.Entity.FindComponent <ComponentBody>(throwOnError: true); Vector2 vector = FindOceanDirection(m_subsystemTerrain.TerrainContentsGenerator, componentBody.Position.XZ); Vector2 vector2 = componentBody.Position.XZ + 25f * vector; bool isPlayerMounted = m_componentPlayer.ComponentRider.Mount != null; Vector2 vector3 = vector2; float num = float.MinValue; for (int i = Terrain.ToCell(vector2.Y) - 15; i < Terrain.ToCell(vector2.Y) + 15; i++) { for (int j = Terrain.ToCell(vector2.X) - 15; j < Terrain.ToCell(vector2.X) + 15; j++) { float num2 = ScoreShipPosition(componentBody.Position.XZ, j, i); if (num2 > num) { num = num2; vector3 = new Vector2(j, i); } } } DatabaseObject databaseObject = base.Project.GameDatabase.Database.FindDatabaseObject("IntroShip", base.Project.GameDatabase.EntityTemplateType, throwIfNotFound: true); ValuesDictionary valuesDictionary = new ValuesDictionary(); valuesDictionary.PopulateFromDatabaseObject(databaseObject); Entity entity = base.Project.CreateEntity(valuesDictionary); Vector3 vector4 = new Vector3(vector3.X, (float)m_subsystemTerrain.TerrainContentsGenerator.OceanLevel + 0.5f, vector3.Y); entity.FindComponent <ComponentFrame>(throwOnError: true).Position = vector4; entity.FindComponent <ComponentIntroShip>(throwOnError: true).Heading = Vector2.Angle(vector, -Vector2.UnitY); base.Project.AddEntity(entity); m_subsystemTime.QueueGameTimeDelayedExecution(2.0, delegate { m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 1), 5f, 0f); }); m_subsystemTime.QueueGameTimeDelayedExecution(7.0, delegate { if (isPlayerMounted) { m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 2), 5f, 0f); } else { m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 3), 5f, 0f); } }); m_subsystemTime.QueueGameTimeDelayedExecution(12.0, delegate { m_componentPlayer.ComponentGui.DisplayLargeMessage(null, LanguageControl.Get(fName, 4), 5f, 0f); }); IntroCamera introCamera = m_componentPlayer.GameWidget.FindCamera <IntroCamera>(); m_componentPlayer.GameWidget.ActiveCamera = introCamera; introCamera.CameraPosition = vector4 + new Vector3(12f * vector.X, 8f, 12f * vector.Y) + new Vector3(-5f * vector.Y, 0f, 5f * vector.X); introCamera.TargetPosition = m_componentPlayer.ComponentCreatureModel.EyePosition + 2.5f * new Vector3(vector.X, 0f, vector.Y); introCamera.Speed = 0f; introCamera.TargetCameraPosition = m_componentPlayer.ComponentCreatureModel.EyePosition; }
public void PopulateList(string cursor) { string text = string.Empty; if (SettingsManager.CommunityContentMode == CommunityContentMode.Strict) { text = "1"; } if (SettingsManager.CommunityContentMode == CommunityContentMode.Normal) { text = "0"; } string text2 = (m_filter is string) ? ((string)m_filter) : string.Empty; string text3 = (m_filter is ExternalContentType) ? LanguageControl.Get(fName, m_filter.ToString()) : string.Empty; string text4 = LanguageControl.Get(fName, m_order.ToString()); string cacheKey = text2 + "\n" + text3 + "\n" + text4 + "\n" + text; m_moreLink = null; if (string.IsNullOrEmpty(cursor)) { m_listPanel.ClearItems(); m_listPanel.ScrollPosition = 0f; if (m_contentExpiryTime != 0.0 && Time.RealTime < m_contentExpiryTime && m_itemsCache.TryGetValue(cacheKey, out IEnumerable <object> value)) { foreach (object item in value) { m_listPanel.AddItem(item); } return; } } CancellableBusyDialog busyDialog = new CancellableBusyDialog(LanguageControl.Get(fName, 2), autoHideOnCancel: false); DialogsManager.ShowDialog(null, busyDialog); CommunityContentManager.List(cursor, text2, text3, text, text4, busyDialog.Progress, delegate(List <CommunityContentEntry> list, string nextCursor) { DialogsManager.HideDialog(busyDialog); m_contentExpiryTime = Time.RealTime + 300.0; while (m_listPanel.Items.Count > 0 && !(m_listPanel.Items[m_listPanel.Items.Count - 1] is CommunityContentEntry)) { m_listPanel.RemoveItemAt(m_listPanel.Items.Count - 1); } foreach (CommunityContentEntry item2 in list) { m_listPanel.AddItem(item2); } if (list.Count > 0 && !string.IsNullOrEmpty(nextCursor)) { m_listPanel.AddItem(nextCursor); } m_itemsCache[cacheKey] = new List <object>(m_listPanel.Items); }, delegate(Exception error) { DialogsManager.HideDialog(busyDialog); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); }
public override string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { int data = Terrain.ExtractData(value); int color = GetColor(data); Shape shape = GetShape(data); int altitude = GetAltitude(data); bool flickering = GetFlickering(data); return(string.Format(LanguageControl.GetFireworks("Other", "1"), LanguageControl.GetFireworks("FireworksColorDisplayNames", color.ToString()), flickering ? LanguageControl.GetFireworks("Other", "2") : null, LanguageControl.GetFireworks("ShapeDisplayNames", ((int)shape).ToString()), (altitude == 0) ? LanguageControl.GetFireworks("Other", "3") : LanguageControl.GetFireworks("Other", "4"))); }
public static Block FindBlockByTypeName(string typeName, bool throwIfNotFound) { Block block = Blocks.FirstOrDefault((Block b) => b.GetType().Name == typeName); if (block == null && throwIfNotFound) { throw new InvalidOperationException(string.Format(LanguageControl.Get("BlocksManager", 1), typeName)); } return(block); }
public override void Update() { for (int j = 0; j < 16; j++) { m_labels[j].Text = m_tmpPalette.Names[j]; m_rectangles[j].CenterColor = m_tmpPalette.Colors[j]; m_resetButtons[j].IsEnabled = (m_tmpPalette.Colors[j] != WorldPalette.DefaultColors[j] || m_tmpPalette.Names[j] != LanguageControl.Get("WorldPalette", j)); } for (int k = 0; k < 16; k++) { int i = k; if (m_labels[k].IsClicked) { DialogsManager.ShowDialog(this, new TextBoxDialog("Edit Color Name", m_labels[k].Text, 16, delegate(string s) { if (s != null) { if (WorldPalette.VerifyColorName(s)) { m_tmpPalette.Names[i] = s; } else { DialogsManager.ShowDialog(this, new MessageDialog("Invalid name", null, "OK", null, null)); } } })); } if (m_rectangles[k].IsClicked) { DialogsManager.ShowDialog(this, new EditColorDialog(m_tmpPalette.Colors[k], delegate(Color? color) { if (color.HasValue) { m_tmpPalette.Colors[i] = color.Value; } })); } if (m_resetButtons[k].IsClicked) { m_tmpPalette.Colors[k] = WorldPalette.DefaultColors[k]; m_tmpPalette.Names[k] = LanguageControl.Get("WorldPalette", k); } } if (m_okButton.IsClicked) { m_tmpPalette.CopyTo(m_palette); Dismiss(); } if (base.Input.Cancel || m_cancelButton.IsClicked) { Dismiss(); } }
public override void Update() { try { m_stateMachine.Update(); } catch (Exception e) { ScreensManager.SwitchScreen(ScreensManager.PreviousScreen); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), ExceptionManager.MakeFullErrorMessage(e), LanguageControl.Get("Usual", "ok"), null, null)); } }
public override string GetDescription(int value) { int data = Terrain.ExtractData(value); ClothingData clothingData = GetClothingData(data); string desc = LanguageControl.GetBlock(string.Format("{0}:{1}", GetType().Name, data), "Description"); if (string.IsNullOrEmpty(desc)) { desc = clothingData.Description; } return(desc); }
public static string GetName(SubsystemTerrain subsystemTerrain, int?index, string suffix) { if (index.HasValue) { string text = LanguageControl.Get("WorldPalette", index.Value); if (!string.IsNullOrEmpty(suffix)) { return(text + " " + suffix); } return(text); } return(suffix ?? string.Empty); }
public bool VerifyName() { if (m_nameWasInvalid) { return(false); } if (PlayerData.VerifyName(m_nameTextBox.Text.Trim())) { return(true); } DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), LanguageControl.Get(fName, 12), LanguageControl.Get("Usual", "ok"), null, null)); return(false); }
public float CalculateHungerFactor(ICollection <Factor> factors) { float num = (m_componentPlayer.PlayerData.PlayerClass == PlayerClass.Female) ? 0.7f : 1f; float num2 = 1f * num; Factor item; if (factors != null) { item = new Factor { Value = num, Description = m_componentPlayer.PlayerData.PlayerClass.ToString() }; factors.Add(item); } float level = m_componentPlayer.PlayerData.Level; float num3 = 1f - 0.01f * MathUtils.Floor(MathUtils.Clamp(level, 1f, 21f) - 1f); float num4 = num2 * num3; if (factors != null) { item = new Factor { Value = num3, Description = string.Format(LanguageControl.Get(fName, 2), MathUtils.Floor(level).ToString()) }; factors.Add(item); } float num5 = 1f; if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Harmless) { num5 = 0.66f; } if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative) { num5 = 0f; } float result = num4 * num5; if (factors != null) { item = new Factor { Value = num5, Description = string.Format(LanguageControl.Get(fName, 12), m_subsystemGameInfo.WorldSettings.GameMode.ToString()) }; factors.Add(item); } return(result); }
public override void Update() { if (m_listCategoryIndex != m_categoryIndex) { PopulateBlocksList(); } string arg = m_categories[m_categoryIndex] ?? LanguageControl.Get("BlocksManager", "All Blocks"); m_categoryLabel.Text = $"{arg} ({m_blocksList.Items.Count})"; m_prevCategoryButton.IsEnabled = (m_categoryIndex > 0); m_nextCategoryButton.IsEnabled = (m_categoryIndex < m_categories.Count - 1); int?value = null; int num = 0; if (m_blocksList.SelectedItem is int) { value = (int)m_blocksList.SelectedItem; num = CraftingRecipesManager.Recipes.Count((CraftingRecipe r) => r.ResultValue == value); } if (num > 0) { m_recipesButton.Text = string.Format("{0} {1}", num, (num == 1) ? LanguageControl.Get(fName, 1) : LanguageControl.Get(fName, 2)); m_recipesButton.IsEnabled = true; } else { m_recipesButton.Text = LanguageControl.Get(fName, 3); m_recipesButton.IsEnabled = false; } m_detailsButton.IsEnabled = value.HasValue; if (m_prevCategoryButton.IsClicked || base.Input.Left) { m_categoryIndex = MathUtils.Max(m_categoryIndex - 1, 0); } if (m_nextCategoryButton.IsClicked || base.Input.Right) { m_categoryIndex = MathUtils.Min(m_categoryIndex + 1, m_categories.Count - 1); } if (value.HasValue && m_detailsButton.IsClicked) { ScreensManager.SwitchScreen("RecipaediaDescription", value.Value, m_blocksList.Items.Cast <int>().ToList()); } if (value.HasValue && m_recipesButton.IsClicked) { ScreensManager.SwitchScreen("RecipaediaRecipes", value.Value); } if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked) { ScreensManager.SwitchScreen(m_previousScreen); } }
public static string GetOrderDisplayName(Order order) { switch (order) { case Order.ByRank: return(LanguageControl.Get(fName, 11)); case Order.ByTime: return(LanguageControl.Get(fName, 12)); default: throw new InvalidOperationException(LanguageControl.Get(fName, 13)); } }
public virtual string GetDescription(int value) { int data = Terrain.ExtractData(value); string bn = string.Format("{0}:{1}", GetType().Name, data); string nm = LanguageControl.GetBlock(bn, "Description"); if (string.IsNullOrEmpty(nm)) { return(DefaultDescription); } else { return(nm); } }
public virtual string GetDisplayName(SubsystemTerrain subsystemTerrain, int value) { int data = Terrain.ExtractData(value); string bn = string.Format("{0}:{1}", GetType().Name, data); string nm = LanguageControl.GetBlock(bn, "DisplayName"); if (string.IsNullOrEmpty(nm)) { return(DefaultDisplayName); } else { return(nm); } }
public void DownloadEntry(CommunityContentEntry entry) { string userId = (UserManager.ActiveUser != null) ? UserManager.ActiveUser.UniqueId : string.Empty; CancellableBusyDialog busyDialog = new CancellableBusyDialog(string.Format(LanguageControl.Get(fName, 1), entry.Name), autoHideOnCancel: false); DialogsManager.ShowDialog(null, busyDialog); CommunityContentManager.Download(entry.Address, entry.Name, entry.Type, userId, busyDialog.Progress, delegate { DialogsManager.HideDialog(busyDialog); }, delegate(Exception error) { DialogsManager.HideDialog(busyDialog); DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get("Usual", "error"), error.Message, LanguageControl.Get("Usual", "ok"), null, null)); }); }