Unstable 0.1400.2.0 (a mimir edition)
This commit is contained in:
@@ -21,6 +21,7 @@ namespace Barotrauma
|
||||
private GUIComponent locationInfoPanel;
|
||||
|
||||
private GUIListBox missionList;
|
||||
private readonly List<GUITickBox> missionTickBoxes = new List<GUITickBox>();
|
||||
|
||||
private GUIButton repairHullsButton, replaceShuttlesButton, repairItemsButton;
|
||||
|
||||
@@ -320,6 +321,10 @@ namespace Barotrauma
|
||||
map.SelectLocation(-1);
|
||||
}
|
||||
map.Update(deltaTime, mapContainer);
|
||||
foreach (GUITickBox tickBox in missionTickBoxes)
|
||||
{
|
||||
tickBox.Enabled = Campaign.AllowedToManageCampaign();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
@@ -350,6 +355,7 @@ namespace Barotrauma
|
||||
|
||||
public void SelectLocation(Location location, LocationConnection connection)
|
||||
{
|
||||
missionTickBoxes.Clear();
|
||||
locationInfoPanel.ClearChildren();
|
||||
//don't select the map panel if we're looking at some other tab
|
||||
if (selectedTab == CampaignMode.InteractionType.Map)
|
||||
@@ -451,7 +457,10 @@ namespace Barotrauma
|
||||
if (GUI.MouseOn == tickBox) { return false; }
|
||||
if (tickBox != null)
|
||||
{
|
||||
tickBox.Selected = !tickBox.Selected;
|
||||
if (Campaign.AllowedToManageCampaign() && tickBox.Enabled)
|
||||
{
|
||||
tickBox.Selected = !tickBox.Selected;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -489,26 +498,28 @@ namespace Barotrauma
|
||||
};
|
||||
tickBox.RectTransform.MinSize = new Point(tickBox.Rect.Height, 0);
|
||||
tickBox.RectTransform.IsFixedSize = true;
|
||||
if (Campaign.AllowedToManageCampaign())
|
||||
tickBox.Box.DisabledColor = tickBox.Box.Color * 0.8f;
|
||||
tickBox.Enabled = Campaign.AllowedToManageCampaign();
|
||||
tickBox.OnSelected += (GUITickBox tb) =>
|
||||
{
|
||||
tickBox.OnSelected += (GUITickBox tb) =>
|
||||
if (!Campaign.AllowedToManageCampaign()) { return false; }
|
||||
|
||||
if (tb.Selected)
|
||||
{
|
||||
if (tb.Selected)
|
||||
{
|
||||
Campaign.Map.CurrentLocation.SelectMission(mission);
|
||||
}
|
||||
else
|
||||
{
|
||||
Campaign.Map.CurrentLocation.DeselectMission(mission);
|
||||
}
|
||||
if ((Campaign is MultiPlayerCampaign multiPlayerCampaign) && !multiPlayerCampaign.SuppressStateSending &&
|
||||
Campaign.AllowedToManageCampaign())
|
||||
{
|
||||
GameMain.Client?.SendCampaignState();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
Campaign.Map.CurrentLocation.SelectMission(mission);
|
||||
}
|
||||
else
|
||||
{
|
||||
Campaign.Map.CurrentLocation.DeselectMission(mission);
|
||||
}
|
||||
if ((Campaign is MultiPlayerCampaign multiPlayerCampaign) && !multiPlayerCampaign.SuppressStateSending &&
|
||||
Campaign.AllowedToManageCampaign())
|
||||
{
|
||||
GameMain.Client?.SendCampaignState();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
missionTickBoxes.Add(tickBox);
|
||||
|
||||
GUILayoutGroup difficultyIndicatorGroup = null;
|
||||
if (mission.Difficulty.HasValue)
|
||||
@@ -578,6 +589,8 @@ namespace Barotrauma
|
||||
if (prevSelectedLocation == selectedLocation)
|
||||
{
|
||||
missionList.BarScroll = prevMissionListScroll;
|
||||
missionList.UpdateDimensions();
|
||||
missionList.UpdateScrollBarSize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,6 +628,7 @@ namespace Barotrauma
|
||||
StartButton.Visible = false;
|
||||
missionList.Enabled = false;
|
||||
}
|
||||
//locationInfoPanel?.UpdateAuto(1.0f);
|
||||
}
|
||||
|
||||
public void SelectTab(CampaignMode.InteractionType tab)
|
||||
|
||||
@@ -867,9 +867,7 @@ namespace Barotrauma
|
||||
{
|
||||
int.TryParse(maxPlayersBox.Text, out int currMaxPlayers);
|
||||
currMaxPlayers = (int)MathHelper.Clamp(currMaxPlayers + (int)button.UserData, 1, NetConfig.MaxPlayers);
|
||||
|
||||
maxPlayersBox.Text = currMaxPlayers.ToString();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1322,8 +1320,18 @@ namespace Barotrauma
|
||||
};
|
||||
maxPlayersBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1.0f), buttonContainer.RectTransform), textAlignment: Alignment.Center)
|
||||
{
|
||||
Text = maxPlayers.ToString(),
|
||||
CanBeFocused = false
|
||||
Text = maxPlayers.ToString()
|
||||
};
|
||||
maxPlayersBox.OnEnterPressed += (GUITextBox sender, string text) =>
|
||||
{
|
||||
maxPlayersBox.Deselect();
|
||||
return true;
|
||||
};
|
||||
maxPlayersBox.OnDeselected += (GUITextBox sender, Microsoft.Xna.Framework.Input.Keys key) =>
|
||||
{
|
||||
int.TryParse(maxPlayersBox.Text, out int currMaxPlayers);
|
||||
currMaxPlayers = (int)MathHelper.Clamp(currMaxPlayers, 1, NetConfig.MaxPlayers);
|
||||
maxPlayersBox.Text = currMaxPlayers.ToString();
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.2f, 1.0f), buttonContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton", textAlignment: Alignment.Center)
|
||||
{
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Barotrauma
|
||||
element.Add(new XAttribute("particle", prefab.Identifier));
|
||||
}
|
||||
|
||||
SerializableProperty.SerializeProperties(emitterProperties, element, saveIfDefault: false);
|
||||
SerializableProperty.SerializeProperties(emitterProperties, element, saveIfDefault: false, ignoreEditable: true);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
|
||||
@@ -2373,10 +2373,10 @@ namespace Barotrauma
|
||||
|
||||
new GUIFrame(new RectTransform(GUI.Canvas.RelativeSize, saveFrame.RectTransform, Anchor.Center), style: "GUIBackgroundBlocker");
|
||||
|
||||
var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.25f, 0.3f), saveFrame.RectTransform, Anchor.Center) { MinSize = new Point(400, 300) });
|
||||
var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.25f, 0.35f), saveFrame.RectTransform, Anchor.Center) { MinSize = new Point(400, 350) });
|
||||
GUILayoutGroup paddedSaveFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), innerFrame.RectTransform, Anchor.Center))
|
||||
{
|
||||
AbsoluteSpacing = 5,
|
||||
AbsoluteSpacing = GUI.IntScale(5),
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
@@ -2393,15 +2393,22 @@ namespace Barotrauma
|
||||
};
|
||||
#endif
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedSaveFrame.RectTransform),
|
||||
TextManager.Get("SaveItemAssemblyDialogDescription"));
|
||||
descriptionBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.3f), paddedSaveFrame.RectTransform))
|
||||
var descriptionContainer = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.5f), paddedSaveFrame.RectTransform));
|
||||
descriptionBox = new GUITextBox(new RectTransform(Vector2.One, descriptionContainer.Content.RectTransform, Anchor.TopLeft),
|
||||
font: GUI.SmallFont, style: "GUITextBoxNoBorder", wrap: true, textAlignment: Alignment.TopLeft)
|
||||
{
|
||||
UserData = "description",
|
||||
Wrap = true,
|
||||
Text = ""
|
||||
Padding = new Vector4(10 * GUI.Scale)
|
||||
};
|
||||
|
||||
|
||||
descriptionBox.OnTextChanged += (textBox, text) =>
|
||||
{
|
||||
Vector2 textSize = textBox.Font.MeasureString(descriptionBox.WrappedText);
|
||||
textBox.RectTransform.NonScaledSize = new Point(textBox.RectTransform.NonScaledSize.X, Math.Max(descriptionContainer.Content.Rect.Height, (int)textSize.Y + 10));
|
||||
descriptionContainer.UpdateScrollBarSize();
|
||||
descriptionContainer.BarScroll = 1.0f;
|
||||
return true;
|
||||
};
|
||||
|
||||
var buttonArea = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), paddedSaveFrame.RectTransform), style: null);
|
||||
new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
||||
TextManager.Get("Cancel"))
|
||||
@@ -2417,6 +2424,7 @@ namespace Barotrauma
|
||||
{
|
||||
OnClicked = SaveAssembly
|
||||
};
|
||||
buttonArea.RectTransform.MinSize = new Point(0, buttonArea.Children.First().RectTransform.MinSize.Y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2460,7 +2468,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
bool hideInMenus = !(nameBox.Parent.GetChildByUserData("hideinmenus") is GUITickBox hideInMenusTickBox) ? false : hideInMenusTickBox.Selected;
|
||||
bool hideInMenus = nameBox.Parent.GetChildByUserData("hideinmenus") is GUITickBox hideInMenusTickBox && hideInMenusTickBox.Selected;
|
||||
#if DEBUG
|
||||
string saveFolder = ItemAssemblyPrefab.VanillaSaveFolder;
|
||||
#else
|
||||
@@ -2479,7 +2487,6 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
string filePath = Path.Combine(saveFolder, nameBox.Text + ".xml");
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("Warning"), TextManager.Get("ItemAssemblyFileExistsWarning"), new[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
@@ -2494,18 +2501,27 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
Save();
|
||||
var identifier = nameBox.Text.ToLowerInvariant().Replace(" ", "");
|
||||
var existingPrefab = MapEntityPrefab.Find(null, identifier, showErrorMessages: false);
|
||||
if (existingPrefab != null && System.IO.Path.GetDirectoryName(existingPrefab.FilePath) == ItemAssemblyPrefab.VanillaSaveFolder)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("Warning"), TextManager.Get("ItemAssemblyVanillaFileExistsWarning"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
void Save()
|
||||
{
|
||||
XDocument doc = new XDocument(ItemAssemblyPrefab.Save(MapEntity.SelectedList, nameBox.Text, descriptionBox.Text, hideInMenus));
|
||||
XDocument doc = new XDocument(ItemAssemblyPrefab.Save(MapEntity.SelectedList.ToList(), nameBox.Text, descriptionBox.Text, hideInMenus));
|
||||
#if DEBUG
|
||||
doc.Save(filePath);
|
||||
#else
|
||||
doc.SaveSafe(filePath);
|
||||
#endif
|
||||
new ItemAssemblyPrefab(filePath);
|
||||
new ItemAssemblyPrefab(filePath, allowOverwrite: true);
|
||||
UpdateEntityList();
|
||||
}
|
||||
|
||||
@@ -3002,8 +3018,11 @@ namespace Barotrauma
|
||||
new ContextMenuOption("SubEditor.PasteAssembly", isEnabled: true, () => PasteAssembly()),
|
||||
new ContextMenuOption("Editor.SelectSame", isEnabled: targets.Count > 0, onSelected: delegate
|
||||
{
|
||||
IEnumerable<MapEntity> matching = MapEntity.mapEntityList.Where(e => e.prefab != null && targets.Any(t => t.prefab?.Identifier == e.prefab.Identifier) && !MapEntity.SelectedList.Contains(e));
|
||||
MapEntity.SelectedList.AddRange(matching);
|
||||
foreach (MapEntity match in MapEntity.mapEntityList.Where(e => e.prefab != null && targets.Any(t => t.prefab?.Identifier == e.prefab.Identifier) && !MapEntity.SelectedList.Contains(e)))
|
||||
{
|
||||
if (MapEntity.SelectedList.Contains(match)) { continue; }
|
||||
MapEntity.SelectedList.Add(match);
|
||||
}
|
||||
}),
|
||||
new ContextMenuOption("SubEditor.AddImage", isEnabled: true, onSelected: ImageManager.CreateImageWizard),
|
||||
new ContextMenuOption("SubEditor.ToggleImageEditing", isEnabled: true, onSelected: delegate
|
||||
@@ -4716,9 +4735,9 @@ namespace Barotrauma
|
||||
CloseItem();
|
||||
}
|
||||
}
|
||||
else if (MapEntity.SelectedList.Count == 1 && WiringMode)
|
||||
else if (MapEntity.SelectedList.Count == 1 && WiringMode && MapEntity.SelectedList.FirstOrDefault() is Item item)
|
||||
{
|
||||
(MapEntity.SelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
||||
item.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
||||
}
|
||||
|
||||
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
|
||||
|
||||
Reference in New Issue
Block a user