(c445db0f5) Lazy load item & structure sprites (loaded automatically when switching to the sub editor or instantiating an item/structure, so should not cause any mid-game freezes).
This commit is contained in:
@@ -70,7 +70,6 @@ namespace Barotrauma
|
|||||||
private GUIImage(RectTransform rectT, Sprite sprite, Rectangle? sourceRect, bool scaleToFit, string style) : base(style, rectT)
|
private GUIImage(RectTransform rectT, Sprite sprite, Rectangle? sourceRect, bool scaleToFit, string style) : base(style, rectT)
|
||||||
{
|
{
|
||||||
this.scaleToFit = scaleToFit;
|
this.scaleToFit = scaleToFit;
|
||||||
sprite?.EnsureLazyLoaded();
|
|
||||||
Sprite = sprite;
|
Sprite = sprite;
|
||||||
if (sourceRect.HasValue)
|
if (sourceRect.HasValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (ScrollBar.IsHorizontal)
|
if (ScrollBar.IsHorizontal)
|
||||||
{
|
{
|
||||||
if (pos + child.Rect.Height + spacing > Content.Rect.Height)
|
if (pos + child.Rect.Height + spacing > Content.Rect.Height || child == children.Last())
|
||||||
{
|
{
|
||||||
pos = 0;
|
pos = 0;
|
||||||
totalSize += child.Rect.Width + spacing;
|
totalSize += child.Rect.Width + spacing;
|
||||||
@@ -515,14 +515,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
pos += child.Rect.Height + spacing;
|
pos += child.Rect.Height + spacing;
|
||||||
}
|
}
|
||||||
if (child == children.Last())
|
|
||||||
{
|
|
||||||
totalSize += child.Rect.Width + spacing;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pos + child.Rect.Width + spacing > Content.Rect.Width)
|
if (pos + child.Rect.Width + spacing > Content.Rect.Width || child == children.Last())
|
||||||
{
|
{
|
||||||
pos = 0;
|
pos = 0;
|
||||||
totalSize += child.Rect.Height + spacing;
|
totalSize += child.Rect.Height + spacing;
|
||||||
@@ -531,11 +527,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
pos += child.Rect.Width + spacing;
|
pos += child.Rect.Width + spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child == children.Last())
|
|
||||||
{
|
|
||||||
totalSize += child.Rect.Height + spacing;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -476,13 +476,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
//var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.12f), audioSliders.RectTransform));
|
var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.12f), audioSliders.RectTransform));
|
||||||
|
|
||||||
GUIRadioButtonGroup voiceMode = new GUIRadioButtonGroup();
|
GUIRadioButtonGroup voiceMode = new GUIRadioButtonGroup();
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
string langStr = "VoiceMode." + ((VoiceMode)i).ToString();
|
string langStr = "VoiceMode." + ((VoiceMode)i).ToString();
|
||||||
var tick = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get(langStr))
|
var tick = new GUITickBox(new RectTransform(new Point(32, 32), radioButtonFrame.RectTransform), TextManager.Get(langStr))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get(langStr + "ToolTip")
|
ToolTip = TextManager.Get(langStr + "ToolTip")
|
||||||
};
|
};
|
||||||
@@ -508,12 +508,9 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
||||||
|
|
||||||
|
var voiceInputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), audioSliders.RectTransform, Anchor.BottomCenter));
|
||||||
var extraVoiceSettingsContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.2f), audioSliders.RectTransform, Anchor.BottomCenter), style: null);
|
new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.05f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice") + ": ");
|
||||||
|
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 0.05f), voiceInputContainer.RectTransform, Anchor.TopRight),
|
||||||
var voiceInputContainer = new GUILayoutGroup(new RectTransform(Vector2.One, extraVoiceSettingsContainer.RectTransform, Anchor.BottomCenter));
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 0.25f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice") + ": ");
|
|
||||||
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 0.25f), voiceInputContainer.RectTransform, Anchor.TopRight),
|
|
||||||
text: keyMapping[(int)InputType.Voice].ToString())
|
text: keyMapping[(int)InputType.Voice].ToString())
|
||||||
{
|
{
|
||||||
UserData = InputType.Voice
|
UserData = InputType.Voice
|
||||||
@@ -521,22 +518,22 @@ namespace Barotrauma
|
|||||||
voiceKeyBox.OnSelected += KeyBoxSelected;
|
voiceKeyBox.OnSelected += KeyBoxSelected;
|
||||||
voiceKeyBox.SelectedColor = Color.Gold * 0.3f;
|
voiceKeyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
|
|
||||||
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(Vector2.One, extraVoiceSettingsContainer.RectTransform));
|
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), audioSliders.RectTransform));
|
||||||
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.25f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"))
|
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"))
|
||||||
{
|
{
|
||||||
TextGetter = () =>
|
TextGetter = () =>
|
||||||
{
|
{
|
||||||
return TextManager.Get("NoiseGateThreshold") + " " + ((int)NoiseGateThreshold).ToString() + " dB";
|
return TextManager.Get("NoiseGateThreshold") + " " + ((int)NoiseGateThreshold).ToString() + " dB";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var dbMeter = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.25f), voiceActivityGroup.RectTransform), 0.0f, Color.Lime);
|
var dbMeter = new GUIProgressBar(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), 0.0f, Color.Lime);
|
||||||
dbMeter.ProgressGetter = () =>
|
dbMeter.ProgressGetter = () =>
|
||||||
{
|
{
|
||||||
if (VoipCapture.Instance == null) return 0.0f;
|
if (VoipCapture.Instance == null) return 0.0f;
|
||||||
dbMeter.Color = VoipCapture.Instance.LastdB > NoiseGateThreshold ? Color.Lime : Color.Orange; //TODO: i'm a filthy hack
|
dbMeter.Color = VoipCapture.Instance.LastdB > NoiseGateThreshold ? Color.Lime : Color.Orange; //TODO: i'm a filthy hack
|
||||||
return ((float)VoipCapture.Instance.LastdB + 100.0f) / 100.0f;
|
return ((float)VoipCapture.Instance.LastdB + 100.0f) / 100.0f;
|
||||||
};
|
};
|
||||||
var noiseGateSlider = new GUIScrollBar(new RectTransform(Vector2.One, dbMeter.RectTransform, Anchor.Center), color: Color.White, barSize: 0.03f);
|
var noiseGateSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 1.0f), dbMeter.RectTransform, Anchor.Center), color: Color.White, barSize: 0.03f);
|
||||||
noiseGateSlider.Frame.Visible = false;
|
noiseGateSlider.Frame.Visible = false;
|
||||||
noiseGateSlider.Step = 0.01f;
|
noiseGateSlider.Step = 0.01f;
|
||||||
noiseGateSlider.Range = new Vector2(-100.0f, 0.0f);
|
noiseGateSlider.Range = new Vector2(-100.0f, 0.0f);
|
||||||
@@ -634,7 +631,7 @@ namespace Barotrauma
|
|||||||
var inputNames = Enum.GetValues(typeof(InputType));
|
var inputNames = Enum.GetValues(typeof(InputType));
|
||||||
for (int i = 0; i < inputNames.Length; i++)
|
for (int i = 0; i < inputNames.Length; i++)
|
||||||
{
|
{
|
||||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f), inputFrame.RectTransform)) { Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) };
|
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f), inputFrame.RectTransform)) { Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = Color.DarkGray * 0.25f };
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
||||||
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
||||||
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform),
|
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform),
|
||||||
@@ -646,7 +643,7 @@ namespace Barotrauma
|
|||||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
|
|
||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), inputFrame.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.005f), inputFrame.RectTransform), style: null);
|
||||||
}
|
}
|
||||||
GUITextBlock aimAssistText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("AimAssist"));
|
GUITextBlock aimAssistText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform), TextManager.Get("AimAssist"));
|
||||||
GUIScrollBar aimAssistSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform),
|
GUIScrollBar aimAssistSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.05f), controlsLayoutGroup.RectTransform),
|
||||||
@@ -702,6 +699,25 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//spacing
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
|
new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomLeft),
|
||||||
|
TextManager.Get("Cancel"), style: "GUIButtonLarge")
|
||||||
|
{
|
||||||
|
IgnoreLayoutGroups = true,
|
||||||
|
OnClicked = (x, y) =>
|
||||||
|
{
|
||||||
|
if (UnsavedSettings)
|
||||||
|
{
|
||||||
|
LoadPlayerConfig();
|
||||||
|
}
|
||||||
|
if (Screen.Selected == GameMain.MainMenuScreen) GameMain.MainMenuScreen.ReturnToMainMenu(null, null);
|
||||||
|
GUI.SettingsMenuOpen = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
applyButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
|
applyButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
|
||||||
TextManager.Get("ApplySettingsButton"), style: "GUIButtonLarge")
|
TextManager.Get("ApplySettingsButton"), style: "GUIButtonLarge")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private GUIButton activateButton;
|
private GUIButton activateButton;
|
||||||
|
|
||||||
private GUITextBox itemFilterBox;
|
|
||||||
|
|
||||||
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
||||||
private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay;
|
private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay;
|
||||||
|
|
||||||
@@ -30,25 +28,12 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
partial void InitProjSpecific()
|
partial void InitProjSpecific()
|
||||||
{
|
{
|
||||||
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), GuiFrame.RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
|
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), GuiFrame.RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
|
||||||
{
|
{
|
||||||
Stretch = true,
|
Stretch = true,
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
var filterArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f), paddedFrame.RectTransform), isHorizontal: true)
|
|
||||||
{
|
|
||||||
Stretch = true,
|
|
||||||
UserData = "filterarea"
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.25f, 1.0f), filterArea.RectTransform), TextManager.Get("FilterMapEntities"), font: GUI.Font);
|
|
||||||
itemFilterBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1.0f), filterArea.RectTransform), font: GUI.Font);
|
|
||||||
itemFilterBox.OnTextChanged += (textBox, text) => { FilterEntities(text); return true; };
|
|
||||||
var clearButton = new GUIButton(new RectTransform(new Vector2(0.1f, 1.0f), filterArea.RectTransform), "x")
|
|
||||||
{
|
|
||||||
OnClicked = (btn, userdata) => { ClearFilter(); itemFilterBox.Flash(Color.White); return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
itemList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.5f), paddedFrame.RectTransform))
|
itemList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.5f), paddedFrame.RectTransform))
|
||||||
{
|
{
|
||||||
OnSelected = (GUIComponent component, object userdata) =>
|
OnSelected = (GUIComponent component, object userdata) =>
|
||||||
@@ -65,7 +50,7 @@ namespace Barotrauma.Items.Components
|
|||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
var outputArea = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.25f), paddedFrame.RectTransform), isHorizontal: true);
|
var outputArea = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.3f), paddedFrame.RectTransform), isHorizontal: true);
|
||||||
|
|
||||||
selectedItemFrame = new GUIFrame(new RectTransform(new Vector2(0.75f, 1.0f), outputArea.RectTransform), style: "InnerFrame");
|
selectedItemFrame = new GUIFrame(new RectTransform(new Vector2(0.75f, 1.0f), outputArea.RectTransform), style: "InnerFrame");
|
||||||
outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.25f, 1.0f), outputArea.RectTransform), style: null);
|
outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(0.25f, 1.0f), outputArea.RectTransform), style: null);
|
||||||
@@ -76,7 +61,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
foreach (FabricationRecipe fi in fabricationRecipes)
|
foreach (FabricationRecipe fi in fabricationRecipes)
|
||||||
{
|
{
|
||||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null)
|
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 50), itemList.Content.RectTransform), style: null)
|
||||||
{
|
{
|
||||||
UserData = fi,
|
UserData = fi,
|
||||||
HoverColor = Color.Gold * 0.2f,
|
HoverColor = Color.Gold * 0.2f,
|
||||||
@@ -93,7 +78,7 @@ namespace Barotrauma.Items.Components
|
|||||||
var itemIcon = fi.TargetItem.InventoryIcon ?? fi.TargetItem.sprite;
|
var itemIcon = fi.TargetItem.InventoryIcon ?? fi.TargetItem.sprite;
|
||||||
if (itemIcon != null)
|
if (itemIcon != null)
|
||||||
{
|
{
|
||||||
GUIImage img = new GUIImage(new RectTransform(new Point(30, 30), frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(3, 0) },
|
GUIImage img = new GUIImage(new RectTransform(new Point(40, 40), frame.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(3, 0) },
|
||||||
itemIcon, scaleToFit: true)
|
itemIcon, scaleToFit: true)
|
||||||
{
|
{
|
||||||
Color = fi.TargetItem.InventoryIconColor,
|
Color = fi.TargetItem.InventoryIconColor,
|
||||||
@@ -103,7 +88,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
||||||
TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge")
|
TextManager.Get("FabricatorCreate"))
|
||||||
{
|
{
|
||||||
OnClicked = StartButtonClicked,
|
OnClicked = StartButtonClicked,
|
||||||
UserData = selectedItem,
|
UserData = selectedItem,
|
||||||
@@ -272,36 +257,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FilterEntities(string filter)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(filter))
|
|
||||||
{
|
|
||||||
itemList.Content.Children.ForEach(c => c.Visible = true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
filter = filter.ToLower();
|
|
||||||
foreach (GUIComponent child in itemList.Content.Children)
|
|
||||||
{
|
|
||||||
FabricationRecipe recipe = child.UserData as FabricationRecipe;
|
|
||||||
if (recipe?.DisplayName == null) { continue; }
|
|
||||||
child.Visible = recipe.DisplayName.ToLower().Contains(filter);
|
|
||||||
}
|
|
||||||
itemList.UpdateScrollBarSize();
|
|
||||||
itemList.BarScroll = 0.0f;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ClearFilter()
|
|
||||||
{
|
|
||||||
FilterEntities("");
|
|
||||||
itemList.UpdateScrollBarSize();
|
|
||||||
itemList.BarScroll = 0.0f;
|
|
||||||
itemFilterBox.Text = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool SelectItem(Character user, FabricationRecipe selectedItem)
|
private bool SelectItem(Character user, FabricationRecipe selectedItem)
|
||||||
{
|
{
|
||||||
selectedItemFrame.ClearChildren();
|
selectedItemFrame.ClearChildren();
|
||||||
@@ -391,9 +346,6 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
activateButton.Enabled = false;
|
activateButton.Enabled = false;
|
||||||
|
|||||||
@@ -123,8 +123,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial void InitProjSpecific()
|
partial void InitProjSpecific()
|
||||||
{
|
{
|
||||||
|
Prefab.sprite?.EnsureLazyLoaded();
|
||||||
|
Prefab.InventoryIcon?.EnsureLazyLoaded();
|
||||||
|
foreach (BrokenItemSprite brokenSprite in Prefab.BrokenSprites)
|
||||||
|
{
|
||||||
|
brokenSprite.Sprite.EnsureLazyLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var decorativeSprite in ((ItemPrefab)prefab).DecorativeSprites)
|
foreach (var decorativeSprite in ((ItemPrefab)prefab).DecorativeSprites)
|
||||||
{
|
{
|
||||||
|
decorativeSprite.Sprite.EnsureLazyLoaded();
|
||||||
spriteAnimState.Add(decorativeSprite, new SpriteState());
|
spriteAnimState.Add(decorativeSprite, new SpriteState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,9 +615,6 @@ namespace Barotrauma
|
|||||||
if (GameMain.GameSession?.CrewManager != null)
|
if (GameMain.GameSession?.CrewManager != null)
|
||||||
{
|
{
|
||||||
disallowedAreas.Add(GameMain.GameSession.CrewManager.GetCharacterListArea());
|
disallowedAreas.Add(GameMain.GameSession.CrewManager.GetCharacterListArea());
|
||||||
disallowedAreas.Add(new Rectangle(
|
|
||||||
HUDLayoutSettings.ChatBoxArea.X - 50, HUDLayoutSettings.ChatBoxArea.Y,
|
|
||||||
HUDLayoutSettings.ChatBoxArea.Width + 50, HUDLayoutSettings.ChatBoxArea.Height));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.PreventElementOverlap(elementsToMove, disallowedAreas,
|
GUI.PreventElementOverlap(elementsToMove, disallowedAreas,
|
||||||
|
|||||||
@@ -28,12 +28,11 @@ namespace Barotrauma
|
|||||||
public readonly string[] AllowedContainerIdentifiers;
|
public readonly string[] AllowedContainerIdentifiers;
|
||||||
public readonly string[] AllowedContainerTags;
|
public readonly string[] AllowedContainerTags;
|
||||||
|
|
||||||
public ContainedItemSprite(XElement element, string path = "")
|
public ContainedItemSprite(XElement element, string path = "", bool lazyLoad = false)
|
||||||
{
|
{
|
||||||
Sprite = new Sprite(element, path);
|
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
|
||||||
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
|
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
|
||||||
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
|
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MatchesContainer(Item container)
|
public bool MatchesContainer(Item container)
|
||||||
@@ -101,9 +100,9 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public List<PropertyConditional> AnimationConditionals { get; private set; } = new List<PropertyConditional>();
|
public List<PropertyConditional> AnimationConditionals { get; private set; } = new List<PropertyConditional>();
|
||||||
|
|
||||||
public DecorativeSprite(XElement element, string path = "")
|
public DecorativeSprite(XElement element, string path = "", bool lazyLoad = false)
|
||||||
{
|
{
|
||||||
Sprite = new Sprite(element, path);
|
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
|
||||||
SerializableProperty.DeserializeProperties(this, element);
|
SerializableProperty.DeserializeProperties(this, element);
|
||||||
|
|
||||||
foreach (XElement subElement in element.Elements())
|
foreach (XElement subElement in element.Elements())
|
||||||
|
|||||||
@@ -55,7 +55,13 @@ namespace Barotrauma
|
|||||||
get { return textureOffset; }
|
get { return textureOffset; }
|
||||||
set { textureOffset = value; }
|
set { textureOffset = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void InitProjSpecific()
|
||||||
|
{
|
||||||
|
Prefab.sprite?.EnsureLazyLoaded();
|
||||||
|
Prefab.BackgroundSprite?.EnsureLazyLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
partial void CreateConvexHull(Vector2 position, Vector2 size, float rotation)
|
partial void CreateConvexHull(Vector2 position, Vector2 size, float rotation)
|
||||||
{
|
{
|
||||||
if (!CastShadow) { return; }
|
if (!CastShadow) { return; }
|
||||||
|
|||||||
@@ -219,9 +219,9 @@ namespace Barotrauma
|
|||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.0f), optionHolder.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(0.01f, 0.0f), optionHolder.RectTransform), style: null);
|
||||||
|
|
||||||
var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) });
|
var optionButtons = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 1.0f), parent: optionHolder.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.15f) });
|
||||||
|
|
||||||
var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.3f), parent: optionButtons.RectTransform))
|
var optionList = new GUILayoutGroup(new RectTransform(new Vector2(0.8f, 0.15f), parent: optionButtons.RectTransform))
|
||||||
{
|
{
|
||||||
Stretch = false,
|
Stretch = false,
|
||||||
RelativeSpacing = 0.035f
|
RelativeSpacing = 0.035f
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private readonly string containerDeleteTag = "containerdelete";
|
private readonly string containerDeleteTag = "containerdelete";
|
||||||
|
|
||||||
private Color primaryColor = new Color(12, 14, 15, 190);
|
|
||||||
private Color secondaryColor = new Color(12, 14, 15, 215);
|
|
||||||
|
|
||||||
public override Camera Cam
|
public override Camera Cam
|
||||||
{
|
{
|
||||||
get { return cam; }
|
get { return cam; }
|
||||||
@@ -192,17 +189,16 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
LeftPanel = new GUIFrame(new RectTransform(new Vector2(0.08f, 1.0f), GUI.Canvas) { MinSize = new Point(170, 0) }, style: null) { Color = primaryColor };
|
LeftPanel = new GUIFrame(new RectTransform(new Vector2(0.08f, 1.0f), GUI.Canvas) { MinSize = new Point(170, 0) }, "GUIFrameLeft");
|
||||||
|
GUILayoutGroup paddedLeftPanel = new GUILayoutGroup(new RectTransform(
|
||||||
GUILayoutGroup paddedLeftPanel = new GUILayoutGroup(new RectTransform(new Point((int)(LeftPanel.Rect.Width), (int)(GameMain.GraphicsHeight - TopPanel.Rect.Height * 0.95f)),
|
new Point((int)(LeftPanel.Rect.Width * 0.8f), (int)(GameMain.GraphicsHeight - TopPanel.Rect.Height * 0.95f)),
|
||||||
LeftPanel.RectTransform, Anchor.Center))
|
LeftPanel.RectTransform, Anchor.Center)
|
||||||
|
{ AbsoluteOffset = new Point(0, TopPanel.Rect.Height) })
|
||||||
{
|
{
|
||||||
|
RelativeSpacing = 0.01f,
|
||||||
Stretch = true
|
Stretch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
//empty guiframe as a separator
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), paddedLeftPanel.RectTransform) { AbsoluteOffset = new Point(0, TopPanel.Rect.Height) }, style: null);
|
|
||||||
|
|
||||||
GUITextBlock itemCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedLeftPanel.RectTransform), "ItemCount")
|
GUITextBlock itemCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedLeftPanel.RectTransform), "ItemCount")
|
||||||
{
|
{
|
||||||
TextGetter = GetItemCount
|
TextGetter = GetItemCount
|
||||||
@@ -244,9 +240,10 @@ namespace Barotrauma
|
|||||||
//Entity menu
|
//Entity menu
|
||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
|
|
||||||
EntityMenu = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth - LeftPanel.Rect.Width, (int)(359 * GUI.Scale)), GUI.Canvas, Anchor.BottomRight), style: null) { Color = primaryColor };
|
EntityMenu = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth - LeftPanel.Rect.Width + 20, (int)(300 * GUI.Scale)), GUI.Canvas, Anchor.BottomRight),
|
||||||
|
style: "GUIFrameBottom");
|
||||||
|
|
||||||
toggleEntityMenuButton = new GUIButton(new RectTransform(new Vector2(0.15f, 0.1f), EntityMenu.RectTransform, Anchor.TopCenter, Pivot.BottomCenter) { RelativeOffset = new Vector2(0.0f, -0.05f) },
|
toggleEntityMenuButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.1f), EntityMenu.RectTransform, Anchor.TopCenter, Pivot.BottomCenter) { RelativeOffset = new Vector2(0.0f, -0.12f) },
|
||||||
style: "GUIButtonVerticalArrow")
|
style: "GUIButtonVerticalArrow")
|
||||||
{
|
{
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
@@ -262,25 +259,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var paddedTab = new GUIFrame(new RectTransform(new Vector2(1.0f, 1.0f), EntityMenu.RectTransform, Anchor.Center), style: null);
|
var tabButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.1f), EntityMenu.RectTransform, Anchor.TopRight, Pivot.BottomRight),
|
||||||
|
|
||||||
var filterArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedTab.RectTransform), isHorizontal: true)
|
|
||||||
{
|
|
||||||
Color = secondaryColor,
|
|
||||||
Stretch = true,
|
|
||||||
UserData = "filterarea"
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.05f, 1.0f), filterArea.RectTransform), TextManager.Get("FilterMapEntities"), font: GUI.Font);
|
|
||||||
entityFilterBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1.0f), filterArea.RectTransform), font: GUI.Font);
|
|
||||||
entityFilterBox.OnTextChanged += (textBox, text) => { FilterEntities(text); return true; };
|
|
||||||
var clearButton = new GUIButton(new RectTransform(new Vector2(0.02f, 1.0f), filterArea.RectTransform), "x")
|
|
||||||
{
|
|
||||||
OnClicked = (btn, userdata) => { ClearFilter(); entityFilterBox.Flash(Color.White); return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
var entityListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.85f), paddedTab.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.05f) });
|
|
||||||
|
|
||||||
var tabButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.1f), entityListHolder.RectTransform, Anchor.TopRight, Pivot.BottomRight),
|
|
||||||
isHorizontal: true)
|
isHorizontal: true)
|
||||||
{
|
{
|
||||||
RelativeSpacing = 0.01f,
|
RelativeSpacing = 0.01f,
|
||||||
@@ -301,7 +280,21 @@ namespace Barotrauma
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
var paddedTab = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.8f), EntityMenu.RectTransform, Anchor.Center), style: null);
|
||||||
|
var filterArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), paddedTab.RectTransform), isHorizontal: true)
|
||||||
|
{
|
||||||
|
AbsoluteSpacing = 5,
|
||||||
|
Stretch = true,
|
||||||
|
UserData = "filterarea"
|
||||||
|
};
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.15f, 1.0f), filterArea.RectTransform), TextManager.Get("FilterMapEntities"), font: GUI.SmallFont);
|
||||||
|
entityFilterBox = new GUITextBox(new RectTransform(new Vector2(0.8f, 1.0f), filterArea.RectTransform), font: GUI.SmallFont);
|
||||||
|
entityFilterBox.OnTextChanged += (textBox, text) => { FilterEntities(text); return true; };
|
||||||
|
var clearButton = new GUIButton(new RectTransform(new Vector2(0.05f, 1.0f), filterArea.RectTransform), "x")
|
||||||
|
{
|
||||||
|
OnClicked = (btn, userdata) => { ClearFilter(); entityFilterBox.Flash(Color.White); return true; }
|
||||||
|
};
|
||||||
|
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.85f), paddedTab.RectTransform, Anchor.BottomCenter))
|
||||||
{
|
{
|
||||||
OnSelected = SelectPrefab,
|
OnSelected = SelectPrefab,
|
||||||
UseGridLayout = true,
|
UseGridLayout = true,
|
||||||
@@ -312,10 +305,7 @@ namespace Barotrauma
|
|||||||
//empty guiframe as a separator
|
//empty guiframe as a separator
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), paddedLeftPanel.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), paddedLeftPanel.RectTransform), style: null);
|
||||||
|
|
||||||
var characterModeTickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.01f), paddedLeftPanel.RectTransform) { MinSize = new Point(0, 32) })
|
characterModeTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform), TextManager.Get("CharacterModeButton"))
|
||||||
{ Color = secondaryColor };
|
|
||||||
|
|
||||||
characterModeTickBox = new GUITickBox(new RectTransform(new Point(32, 32), characterModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("CharacterModeButton"))
|
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("CharacterModeToolTip"),
|
ToolTip = TextManager.Get("CharacterModeToolTip"),
|
||||||
OnSelected = (GUITickBox tBox) =>
|
OnSelected = (GUITickBox tBox) =>
|
||||||
@@ -324,11 +314,7 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
wiringModeTickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform), TextManager.Get("WiringModeButton"))
|
||||||
var wiringModeTickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.01f), paddedLeftPanel.RectTransform) { MinSize = new Point(0, 32) })
|
|
||||||
{ Color = secondaryColor };
|
|
||||||
|
|
||||||
wiringModeTickBox = new GUITickBox(new RectTransform(new Point(32, 32), wiringModeTickBoxHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("WiringModeButton"))
|
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("WiringModeToolTip"),
|
ToolTip = TextManager.Get("WiringModeToolTip"),
|
||||||
OnSelected = (GUITickBox tBox) =>
|
OnSelected = (GUITickBox tBox) =>
|
||||||
@@ -347,13 +333,9 @@ namespace Barotrauma
|
|||||||
OnClicked = GenerateWaypoints
|
OnClicked = GenerateWaypoints
|
||||||
};
|
};
|
||||||
|
|
||||||
// empty guiframe as a separator
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowEntitiesLabel"));
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), paddedLeftPanel.RectTransform), style: null);
|
|
||||||
|
|
||||||
var showEntitiesHolder = new GUILayoutGroup(new RectTransform(new Vector2(paddedLeftPanel.RectTransform.RelativeSize.X, 0.3f), paddedLeftPanel.RectTransform))
|
var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowLighting"))
|
||||||
{ Color = secondaryColor, Stretch = true, RelativeSpacing = 0.05f };
|
|
||||||
|
|
||||||
var tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLighting"))
|
|
||||||
{
|
{
|
||||||
Selected = lightingEnabled,
|
Selected = lightingEnabled,
|
||||||
OnSelected = (GUITickBox obj) =>
|
OnSelected = (GUITickBox obj) =>
|
||||||
@@ -375,49 +357,52 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWalls"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowWalls"))
|
||||||
{
|
{
|
||||||
Selected = Structure.ShowWalls,
|
Selected = Structure.ShowWalls,
|
||||||
OnSelected = (GUITickBox obj) => { Structure.ShowWalls = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { Structure.ShowWalls = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowStructures"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowStructures"))
|
||||||
{
|
{
|
||||||
Selected = Structure.ShowStructures,
|
Selected = Structure.ShowStructures,
|
||||||
OnSelected = (GUITickBox obj) => { Structure.ShowStructures = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { Structure.ShowStructures = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowItems"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowItems"))
|
||||||
{
|
{
|
||||||
Selected = Item.ShowItems,
|
Selected = Item.ShowItems,
|
||||||
OnSelected = (GUITickBox obj) => { Item.ShowItems = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { Item.ShowItems = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowWaypoints"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowWaypoints"))
|
||||||
{
|
{
|
||||||
Selected = WayPoint.ShowWayPoints,
|
Selected = WayPoint.ShowWayPoints,
|
||||||
OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowSpawnpoints"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowSpawnpoints"))
|
||||||
{
|
{
|
||||||
Selected = WayPoint.ShowSpawnPoints,
|
Selected = WayPoint.ShowSpawnPoints,
|
||||||
OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowLinks"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowLinks"))
|
||||||
{
|
{
|
||||||
Selected = Item.ShowLinks,
|
Selected = Item.ShowLinks,
|
||||||
OnSelected = (GUITickBox obj) => { Item.ShowLinks = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { Item.ShowLinks = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowHulls"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowHulls"))
|
||||||
{
|
{
|
||||||
Selected = Hull.ShowHulls,
|
Selected = Hull.ShowHulls,
|
||||||
OnSelected = (GUITickBox obj) => { Hull.ShowHulls = obj.Selected; return true; }
|
OnSelected = (GUITickBox obj) => { Hull.ShowHulls = obj.Selected; return true; }
|
||||||
};
|
};
|
||||||
tickBox = new GUITickBox(new RectTransform(new Point(32, 32), showEntitiesHolder.RectTransform) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("ShowGaps"))
|
tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.03f), paddedLeftPanel.RectTransform), TextManager.Get("ShowGaps"))
|
||||||
{
|
{
|
||||||
Selected = Gap.ShowGaps,
|
Selected = Gap.ShowGaps,
|
||||||
OnSelected = (GUITickBox obj) => { Gap.ShowGaps = obj.Selected; return true; },
|
OnSelected = (GUITickBox obj) => { Gap.ShowGaps = obj.Selected; return true; },
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(10, 0) }, TextManager.Get("PreviouslyUsedLabel"));
|
//empty guiframe as a separator
|
||||||
previouslyUsedList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), paddedLeftPanel.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(10, 0) })
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform), style: null);
|
||||||
|
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.025f), paddedLeftPanel.RectTransform), TextManager.Get("PreviouslyUsedLabel"));
|
||||||
|
previouslyUsedList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.25f), paddedLeftPanel.RectTransform))
|
||||||
{
|
{
|
||||||
OnSelected = SelectPrefab
|
OnSelected = SelectPrefab
|
||||||
};
|
};
|
||||||
@@ -552,6 +537,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
|
|
||||||
|
foreach (MapEntityPrefab prefab in MapEntityPrefab.List)
|
||||||
|
{
|
||||||
|
prefab.sprite?.EnsureLazyLoaded();
|
||||||
|
if (prefab is ItemPrefab itemPrefab)
|
||||||
|
{
|
||||||
|
itemPrefab.InventoryIcon?.EnsureLazyLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
editorSelectedTime = DateTime.Now;
|
editorSelectedTime = DateTime.Now;
|
||||||
|
|
||||||
GUI.ForceMouseOn(null);
|
GUI.ForceMouseOn(null);
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
tempBuffer.Write(IsRagdolled);
|
tempBuffer.Write(IsRagdolled);
|
||||||
|
|
||||||
tempBuffer.Write(AnimController.Dir > 0.0f);
|
tempBuffer.Write(AnimController.TargetDir == Direction.Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedCharacter != null || SelectedConstruction != null)
|
if (SelectedCharacter != null || SelectedConstruction != null)
|
||||||
|
|||||||
@@ -530,8 +530,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater &&
|
if (Math.Abs(Character.AnimController.movement.X) > 0.1f && !Character.AnimController.InWater)
|
||||||
(GameMain.NetworkMember == null || GameMain.NetworkMember.IsServer || Character.Controlled == Character))
|
|
||||||
{
|
{
|
||||||
Character.AnimController.TargetDir = Character.WorldPosition.X < attackWorldPos.X ? Direction.Right : Direction.Left;
|
Character.AnimController.TargetDir = Character.WorldPosition.X < attackWorldPos.X ? Direction.Right : Direction.Left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -411,6 +411,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V);
|
keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V);
|
||||||
|
|
||||||
|
keyMapping[(int)InputType.SelectNextCharacter] = new KeyOrMouse(Keys.Tab);
|
||||||
|
keyMapping[(int)InputType.SelectPreviousCharacter] = new KeyOrMouse(Keys.Q);
|
||||||
|
|
||||||
|
keyMapping[(int)InputType.Voice] = new KeyOrMouse(Keys.V);
|
||||||
|
|
||||||
keyMapping[(int)InputType.Use] = new KeyOrMouse(0);
|
keyMapping[(int)InputType.Use] = new KeyOrMouse(0);
|
||||||
keyMapping[(int)InputType.Aim] = new KeyOrMouse(1);
|
keyMapping[(int)InputType.Aim] = new KeyOrMouse(1);
|
||||||
|
|
||||||
@@ -913,371 +918,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Save PlayerConfig
|
|
||||||
public void SaveNewPlayerConfig()
|
|
||||||
{
|
|
||||||
XDocument doc = new XDocument();
|
|
||||||
UnsavedSettings = false;
|
|
||||||
|
|
||||||
if (doc.Root == null)
|
|
||||||
{
|
|
||||||
doc.Add(new XElement("config"));
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.Root.Add(
|
|
||||||
new XAttribute("language", TextManager.Language),
|
|
||||||
new XAttribute("masterserverurl", MasterServerUrl),
|
|
||||||
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
|
||||||
new XAttribute("musicvolume", musicVolume),
|
|
||||||
new XAttribute("soundvolume", soundVolume),
|
|
||||||
new XAttribute("verboselogging", VerboseLogging),
|
|
||||||
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
|
||||||
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
|
||||||
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
|
|
||||||
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
|
||||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
|
||||||
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
|
||||||
new XAttribute("aimassistamount", aimAssistAmount),
|
|
||||||
new XAttribute("enablemouselook", EnableMouseLook));
|
|
||||||
|
|
||||||
if (!ShowUserStatisticsPrompt)
|
|
||||||
{
|
|
||||||
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
|
|
||||||
}
|
|
||||||
|
|
||||||
XElement gMode = doc.Root.Element("graphicsmode");
|
|
||||||
if (gMode == null)
|
|
||||||
{
|
|
||||||
gMode = new XElement("graphicsmode");
|
|
||||||
doc.Root.Add(gMode);
|
|
||||||
}
|
|
||||||
if (GraphicsWidth == 0 || GraphicsHeight == 0)
|
|
||||||
{
|
|
||||||
gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gMode.ReplaceAttributes(
|
|
||||||
new XAttribute("width", GraphicsWidth),
|
|
||||||
new XAttribute("height", GraphicsHeight),
|
|
||||||
new XAttribute("vsync", VSyncEnabled),
|
|
||||||
new XAttribute("displaymode", windowMode));
|
|
||||||
}
|
|
||||||
|
|
||||||
XElement gSettings = doc.Root.Element("graphicssettings");
|
|
||||||
if (gSettings == null)
|
|
||||||
{
|
|
||||||
gSettings = new XElement("graphicssettings");
|
|
||||||
doc.Root.Add(gSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
gSettings.ReplaceAttributes(
|
|
||||||
new XAttribute("particlelimit", ParticleLimit),
|
|
||||||
new XAttribute("lightmapscale", LightMapScale),
|
|
||||||
new XAttribute("specularity", SpecularityEnabled),
|
|
||||||
new XAttribute("chromaticaberration", ChromaticAberrationEnabled),
|
|
||||||
new XAttribute("losmode", LosMode),
|
|
||||||
new XAttribute("hudscale", HUDScale),
|
|
||||||
new XAttribute("inventoryscale", InventoryScale));
|
|
||||||
|
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
|
||||||
{
|
|
||||||
if (contentPackage.Path.Contains(vanillaContentPackagePath))
|
|
||||||
{
|
|
||||||
doc.Root.Add(new XElement("contentpackage", new XAttribute("path", contentPackage.Path)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var keyMappingElement = new XElement("keymapping");
|
|
||||||
doc.Root.Add(keyMappingElement);
|
|
||||||
for (int i = 0; i < keyMapping.Length; i++)
|
|
||||||
{
|
|
||||||
if (keyMapping[i].MouseButton == null)
|
|
||||||
{
|
|
||||||
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].Key));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
keyMappingElement.Add(new XAttribute(((InputType)i).ToString(), keyMapping[i].MouseButton));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var gameplay = new XElement("gameplay");
|
|
||||||
var jobPreferences = new XElement("jobpreferences");
|
|
||||||
foreach (string jobName in JobPreferences)
|
|
||||||
{
|
|
||||||
jobPreferences.Add(new XElement("job", new XAttribute("identifier", jobName)));
|
|
||||||
}
|
|
||||||
gameplay.Add(jobPreferences);
|
|
||||||
doc.Root.Add(gameplay);
|
|
||||||
|
|
||||||
var playerElement = new XElement("player",
|
|
||||||
new XAttribute("name", defaultPlayerName ?? ""),
|
|
||||||
new XAttribute("headindex", CharacterHeadIndex),
|
|
||||||
new XAttribute("gender", CharacterGender),
|
|
||||||
new XAttribute("race", CharacterRace),
|
|
||||||
new XAttribute("hairindex", CharacterHairIndex),
|
|
||||||
new XAttribute("beardindex", CharacterBeardIndex),
|
|
||||||
new XAttribute("moustacheindex", CharacterMoustacheIndex),
|
|
||||||
new XAttribute("faceattachmentindex", CharacterFaceAttachmentIndex));
|
|
||||||
doc.Root.Add(playerElement);
|
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings
|
|
||||||
{
|
|
||||||
Indent = true,
|
|
||||||
OmitXmlDeclaration = true,
|
|
||||||
NewLineOnAttributes = true
|
|
||||||
};
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
using (var writer = XmlWriter.Create(savePath, settings))
|
|
||||||
{
|
|
||||||
doc.WriteTo(writer);
|
|
||||||
writer.Flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Saving game settings failed.", e);
|
|
||||||
GameAnalyticsManager.AddErrorEventOnce("GameSettings.Save:SaveFailed", GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
|
||||||
"Saving game settings failed.\n" + e.Message + "\n" + e.StackTrace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Load PlayerConfig
|
|
||||||
// TODO: DRY
|
|
||||||
public void LoadPlayerConfig()
|
|
||||||
{
|
|
||||||
XDocument doc = XMLExtensions.LoadXml(playerSavePath);
|
|
||||||
|
|
||||||
if (doc == null || doc.Root == null)
|
|
||||||
{
|
|
||||||
ShowUserStatisticsPrompt = true;
|
|
||||||
SaveNewPlayerConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Language = doc.Root.GetAttributeString("language", Language);
|
|
||||||
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", AutoCheckUpdates);
|
|
||||||
sendUserStatistics = doc.Root.GetAttributeBool("senduserstatistics", true);
|
|
||||||
|
|
||||||
XElement graphicsMode = doc.Root.Element("graphicsmode");
|
|
||||||
GraphicsWidth = graphicsMode.GetAttributeInt("width", GraphicsWidth);
|
|
||||||
GraphicsHeight = graphicsMode.GetAttributeInt("height", GraphicsHeight);
|
|
||||||
VSyncEnabled = graphicsMode.GetAttributeBool("vsync", VSyncEnabled);
|
|
||||||
|
|
||||||
XElement graphicsSettings = doc.Root.Element("graphicssettings");
|
|
||||||
ParticleLimit = graphicsSettings.GetAttributeInt("particlelimit", ParticleLimit);
|
|
||||||
LightMapScale = MathHelper.Clamp(graphicsSettings.GetAttributeFloat("lightmapscale", LightMapScale), 0.1f, 1.0f);
|
|
||||||
SpecularityEnabled = graphicsSettings.GetAttributeBool("specularity", SpecularityEnabled);
|
|
||||||
ChromaticAberrationEnabled = graphicsSettings.GetAttributeBool("chromaticaberration", ChromaticAberrationEnabled);
|
|
||||||
HUDScale = graphicsSettings.GetAttributeFloat("hudscale", HUDScale);
|
|
||||||
InventoryScale = graphicsSettings.GetAttributeFloat("inventoryscale", InventoryScale);
|
|
||||||
var losModeStr = graphicsSettings.GetAttributeString("losmode", "Transparent");
|
|
||||||
if (!Enum.TryParse(losModeStr, out losMode))
|
|
||||||
{
|
|
||||||
losMode = LosMode.Transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CLIENT
|
|
||||||
if (GraphicsWidth == 0 || GraphicsHeight == 0)
|
|
||||||
{
|
|
||||||
GraphicsWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
|
|
||||||
GraphicsHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
var windowModeStr = graphicsMode.GetAttributeString("displaymode", "Fullscreen");
|
|
||||||
if (!Enum.TryParse(windowModeStr, out windowMode))
|
|
||||||
{
|
|
||||||
windowMode = WindowMode.Fullscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
XElement audioSettings = doc.Root.Element("audio");
|
|
||||||
if (audioSettings != null)
|
|
||||||
{
|
|
||||||
SoundVolume = audioSettings.GetAttributeFloat("soundvolume", SoundVolume);
|
|
||||||
MusicVolume = audioSettings.GetAttributeFloat("musicvolume", MusicVolume);
|
|
||||||
VoiceChatVolume = audioSettings.GetAttributeFloat("voicechatvolume", VoiceChatVolume);
|
|
||||||
string voiceSettingStr = audioSettings.GetAttributeString("voicesetting", "Disabled");
|
|
||||||
VoiceCaptureDevice = audioSettings.GetAttributeString("voicecapturedevice", "");
|
|
||||||
NoiseGateThreshold = audioSettings.GetAttributeFloat("noisegatethreshold", -45);
|
|
||||||
var voiceSetting = VoiceMode.Disabled;
|
|
||||||
if (Enum.TryParse(voiceSettingStr, out voiceSetting))
|
|
||||||
{
|
|
||||||
VoiceSetting = voiceSetting;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
|
||||||
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
|
||||||
|
|
||||||
EnableSplashScreen = doc.Root.GetAttributeBool("enablesplashscreen", EnableSplashScreen);
|
|
||||||
|
|
||||||
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
|
||||||
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
|
||||||
{
|
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "keymapping":
|
|
||||||
foreach (XAttribute attribute in subElement.Attributes())
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(attribute.Name.ToString(), true, out InputType inputType))
|
|
||||||
{
|
|
||||||
if (int.TryParse(attribute.Value.ToString(), out int mouseButton))
|
|
||||||
{
|
|
||||||
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(attribute.Value.ToString(), true, out Keys key))
|
|
||||||
{
|
|
||||||
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "gameplay":
|
|
||||||
jobPreferences = new List<string>();
|
|
||||||
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
|
|
||||||
{
|
|
||||||
string jobIdentifier = ele.GetAttributeString("identifier", "");
|
|
||||||
if (string.IsNullOrEmpty(jobIdentifier)) continue;
|
|
||||||
jobPreferences.Add(jobIdentifier);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "player":
|
|
||||||
defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName);
|
|
||||||
CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex);
|
|
||||||
if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g))
|
|
||||||
{
|
|
||||||
CharacterGender = g;
|
|
||||||
}
|
|
||||||
if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r))
|
|
||||||
{
|
|
||||||
CharacterRace = r;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CharacterRace = Race.White;
|
|
||||||
}
|
|
||||||
CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex);
|
|
||||||
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex);
|
|
||||||
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex);
|
|
||||||
CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex);
|
|
||||||
break;
|
|
||||||
case "tutorials":
|
|
||||||
foreach (XElement tutorialElement in subElement.Elements())
|
|
||||||
{
|
|
||||||
CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", ""));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
|
||||||
{
|
|
||||||
if (keyMapping[(int)inputType] == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!");
|
|
||||||
keyMapping[(int)inputType] = new KeyOrMouse(Keys.D1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UnsavedSettings = false;
|
|
||||||
|
|
||||||
selectedContentPackagePaths = new HashSet<string>();
|
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
|
||||||
{
|
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "contentpackage":
|
|
||||||
string path = System.IO.Path.GetFullPath(subElement.GetAttributeString("path", ""));
|
|
||||||
selectedContentPackagePaths.Add(path);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadContentPackages(selectedContentPackagePaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReloadContentPackages()
|
|
||||||
{
|
|
||||||
LoadContentPackages(selectedContentPackagePaths);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadContentPackages(IEnumerable<string> contentPackagePaths)
|
|
||||||
{
|
|
||||||
var missingPackagePaths = new List<string>();
|
|
||||||
var incompatiblePackages = new List<ContentPackage>();
|
|
||||||
SelectedContentPackages.Clear();
|
|
||||||
foreach (string path in contentPackagePaths)
|
|
||||||
{
|
|
||||||
var matchingContentPackage = ContentPackage.List.Find(cp => System.IO.Path.GetFullPath(cp.Path) == path);
|
|
||||||
|
|
||||||
if (matchingContentPackage == null)
|
|
||||||
{
|
|
||||||
missingPackagePaths.Add(path);
|
|
||||||
}
|
|
||||||
else if (!matchingContentPackage.IsCompatible())
|
|
||||||
{
|
|
||||||
incompatiblePackages.Add(matchingContentPackage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SelectedContentPackages.Add(matchingContentPackage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextManager.LoadTextPacks(SelectedContentPackages);
|
|
||||||
|
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
|
||||||
{
|
|
||||||
foreach (ContentFile file in contentPackage.Files)
|
|
||||||
{
|
|
||||||
if (!System.IO.File.Exists(file.Path))
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ToolBox.IsProperFilenameCase(file.Path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!SelectedContentPackages.Any())
|
|
||||||
{
|
|
||||||
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
|
|
||||||
if (availablePackage != null)
|
|
||||||
{
|
|
||||||
SelectedContentPackages.Add(availablePackage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//save to get rid of the invalid selected packages in the config file
|
|
||||||
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
|
|
||||||
|
|
||||||
//display error messages after all content packages have been loaded
|
|
||||||
//to make sure the package that contains text files has been loaded before we attempt to use TextManager
|
|
||||||
foreach (string missingPackagePath in missingPackagePaths)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError(TextManager.Get("ContentPackageNotFound").Replace("[packagepath]", missingPackagePath));
|
|
||||||
}
|
|
||||||
foreach (ContentPackage incompatiblePackage in incompatiblePackages)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError(TextManager.Get(incompatiblePackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage")
|
|
||||||
.Replace("[packagename]", incompatiblePackage.Name)
|
|
||||||
.Replace("[packageversion]", incompatiblePackage.GameVersion.ToString())
|
|
||||||
.Replace("[gameversion]", GameMain.Version.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Save PlayerConfig
|
#region Save PlayerConfig
|
||||||
public void SaveNewPlayerConfig()
|
public void SaveNewPlayerConfig()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private float blinkTimer;
|
private float blinkTimer;
|
||||||
|
|
||||||
|
private bool itemLoaded;
|
||||||
|
|
||||||
|
private float blinkTimer;
|
||||||
|
|
||||||
public PhysicsBody ParentBody;
|
public PhysicsBody ParentBody;
|
||||||
|
|
||||||
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
[Editable(MinValueFloat = 0.0f, MaxValueFloat = 2048.0f), Serialize(100.0f, true)]
|
||||||
|
|||||||
@@ -1613,8 +1613,6 @@ namespace Barotrauma
|
|||||||
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
|
GameMain.NetworkMember != null && (GameMain.NetworkMember.IsServer || Character.Controlled == dropper))
|
||||||
{
|
{
|
||||||
parentInventory.CreateNetworkEvent();
|
parentInventory.CreateNetworkEvent();
|
||||||
//send frequent updates after the item has been dropped
|
|
||||||
PositionUpdateInterval = 0.0f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ namespace Barotrauma
|
|||||||
canSpriteFlipX = subElement.GetAttributeBool("canflipx", true);
|
canSpriteFlipX = subElement.GetAttributeBool("canflipx", true);
|
||||||
canSpriteFlipY = subElement.GetAttributeBool("canflipy", true);
|
canSpriteFlipY = subElement.GetAttributeBool("canflipy", true);
|
||||||
|
|
||||||
sprite = new Sprite(subElement, spriteFolder);
|
sprite = new Sprite(subElement, spriteFolder, lazyLoad: true);
|
||||||
if (subElement.Attribute("sourcerect") == null)
|
if (subElement.Attribute("sourcerect") == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for item \"" + Name + "\"!");
|
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for item \"" + Name + "\"!");
|
||||||
@@ -505,7 +505,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
iconFolder = Path.GetDirectoryName(filePath);
|
iconFolder = Path.GetDirectoryName(filePath);
|
||||||
}
|
}
|
||||||
InventoryIcon = new Sprite(subElement, iconFolder);
|
InventoryIcon = new Sprite(subElement, iconFolder, lazyLoad: true);
|
||||||
break;
|
break;
|
||||||
case "brokensprite":
|
case "brokensprite":
|
||||||
string brokenSpriteFolder = "";
|
string brokenSpriteFolder = "";
|
||||||
@@ -515,7 +515,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
var brokenSprite = new BrokenItemSprite(
|
var brokenSprite = new BrokenItemSprite(
|
||||||
new Sprite(subElement, brokenSpriteFolder),
|
new Sprite(subElement, brokenSpriteFolder, lazyLoad: true),
|
||||||
subElement.GetAttributeFloat("maxcondition", 0.0f),
|
subElement.GetAttributeFloat("maxcondition", 0.0f),
|
||||||
subElement.GetAttributeBool("fadein", false));
|
subElement.GetAttributeBool("fadein", false));
|
||||||
|
|
||||||
@@ -541,7 +541,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
decorativeSprite = new DecorativeSprite(subElement, decorativeSpriteFolder);
|
decorativeSprite = new DecorativeSprite(subElement, decorativeSpriteFolder, lazyLoad: true);
|
||||||
DecorativeSprites.Add(decorativeSprite);
|
DecorativeSprites.Add(decorativeSprite);
|
||||||
groupID = decorativeSprite.RandomGroupID;
|
groupID = decorativeSprite.RandomGroupID;
|
||||||
}
|
}
|
||||||
@@ -558,7 +558,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
containedSpriteFolder = Path.GetDirectoryName(filePath);
|
containedSpriteFolder = Path.GetDirectoryName(filePath);
|
||||||
}
|
}
|
||||||
var containedSprite = new ContainedItemSprite(subElement, containedSpriteFolder);
|
var containedSprite = new ContainedItemSprite(subElement, containedSpriteFolder, lazyLoad: true);
|
||||||
if (containedSprite.Sprite != null)
|
if (containedSprite.Sprite != null)
|
||||||
{
|
{
|
||||||
ContainedSprites.Add(containedSprite);
|
ContainedSprites.Add(containedSprite);
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
SerializableProperty.DeserializeProperties(this, configElement);
|
SerializableProperty.DeserializeProperties(this, configElement);
|
||||||
|
|
||||||
name = TextManager.Get("EntityName." + identifier, returnNull: true) ?? name;
|
|
||||||
Description = TextManager.Get("EntityDescription." + identifier, returnNull: true) ?? Description;
|
|
||||||
|
|
||||||
int minX = int.MaxValue, minY = int.MaxValue;
|
int minX = int.MaxValue, minY = int.MaxValue;
|
||||||
int maxX = int.MinValue, maxY = int.MinValue;
|
int maxX = int.MinValue, maxY = int.MinValue;
|
||||||
DisplayEntities = new List<Pair<MapEntityPrefab, Rectangle>>();
|
DisplayEntities = new List<Pair<MapEntityPrefab, Rectangle>>();
|
||||||
|
|||||||
@@ -276,9 +276,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
StairDirection = Prefab.StairDirection;
|
StairDirection = Prefab.StairDirection;
|
||||||
|
|
||||||
SerializableProperties = SerializableProperty.GetProperties(this);
|
SerializableProperties = SerializableProperty.GetProperties(this);
|
||||||
|
|
||||||
|
InitProjSpecific();
|
||||||
|
|
||||||
if (Prefab.Body)
|
if (Prefab.Body)
|
||||||
{
|
{
|
||||||
Bodies = new List<Body>();
|
Bodies = new List<Body>();
|
||||||
@@ -307,6 +308,8 @@ namespace Barotrauma
|
|||||||
InsertToList();
|
InsertToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void InitProjSpecific();
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return Name;
|
return Name;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ namespace Barotrauma
|
|||||||
switch (subElement.Name.ToString())
|
switch (subElement.Name.ToString())
|
||||||
{
|
{
|
||||||
case "sprite":
|
case "sprite":
|
||||||
sp.sprite = new Sprite(subElement);
|
sp.sprite = new Sprite(subElement, lazyLoad: true);
|
||||||
if (subElement.Attribute("sourcerect") == null)
|
if (subElement.Attribute("sourcerect") == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for structure \"" + sp.name + "\"!");
|
DebugConsole.ThrowError("Warning - sprite sourcerect not configured for structure \"" + sp.name + "\"!");
|
||||||
@@ -193,7 +193,7 @@ namespace Barotrauma
|
|||||||
sp.sprite.EntityID = sp.identifier;
|
sp.sprite.EntityID = sp.identifier;
|
||||||
break;
|
break;
|
||||||
case "backgroundsprite":
|
case "backgroundsprite":
|
||||||
sp.BackgroundSprite = new Sprite(subElement);
|
sp.BackgroundSprite = new Sprite(subElement, lazyLoad: true);
|
||||||
|
|
||||||
if (subElement.GetAttributeBool("fliphorizontal", false))
|
if (subElement.GetAttributeBool("fliphorizontal", false))
|
||||||
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
|
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ namespace Barotrauma
|
|||||||
public readonly HashSet<Character> ReactorMeltdown = new HashSet<Character>();
|
public readonly HashSet<Character> ReactorMeltdown = new HashSet<Character>();
|
||||||
|
|
||||||
public readonly HashSet<Character> Casualties = new HashSet<Character>();
|
public readonly HashSet<Character> Casualties = new HashSet<Character>();
|
||||||
|
|
||||||
public bool SubWasDamaged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RoundData roundData;
|
private static RoundData roundData;
|
||||||
@@ -112,47 +110,7 @@ namespace Barotrauma
|
|||||||
UnlockAchievement("subdeep", true, c => c != null && c.Submarine == sub && !c.IsDead && !c.IsUnconscious);
|
UnlockAchievement("subdeep", true, c => c != null && c.Submarine == sub && !c.IsDead && !c.IsUnconscious);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!roundData.SubWasDamaged)
|
|
||||||
{
|
|
||||||
roundData.SubWasDamaged = SubWallsDamaged(Submarine.MainSub);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameMain.GameSession != null && Character.Controlled != null)
|
|
||||||
{
|
|
||||||
if (Character.Controlled.HasEquippedItem("clownmask") &&
|
|
||||||
Character.Controlled.HasEquippedItem("clowncostume"))
|
|
||||||
{
|
|
||||||
UnlockAchievement(Character.Controlled, "clowncostume");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Submarine.MainSub != null && Character.Controlled.Submarine == null)
|
|
||||||
{
|
|
||||||
float dist = 500 / Physics.DisplayToRealWorldRatio;
|
|
||||||
if (Vector2.DistanceSquared(Character.Controlled.WorldPosition, Submarine.MainSub.WorldPosition) >
|
|
||||||
dist * dist)
|
|
||||||
{
|
|
||||||
UnlockAchievement(Character.Controlled, "crewaway");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool SubWallsDamaged(Submarine sub)
|
|
||||||
{
|
|
||||||
foreach (Structure structure in Structure.WallList)
|
|
||||||
{
|
|
||||||
if (structure.Submarine != sub || structure.HasBody) { continue; }
|
|
||||||
for (int i = 0; i < structure.SectionCount; i++)
|
|
||||||
{
|
|
||||||
if (structure.SectionIsLeaking(i))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnBiomeDiscovered(Biome biome)
|
public static void OnBiomeDiscovered(Biome biome)
|
||||||
@@ -316,21 +274,14 @@ namespace Barotrauma
|
|||||||
//made it to the destination
|
//made it to the destination
|
||||||
if (gameSession.Submarine.AtEndPosition)
|
if (gameSession.Submarine.AtEndPosition)
|
||||||
{
|
{
|
||||||
bool noDamageRun = !roundData.SubWasDamaged && !roundData.Casualties.Any(c => !(c.AIController is EnemyAIController));
|
|
||||||
|
|
||||||
#if SERVER
|
#if SERVER
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
//in MP all characters that were inside the sub during reactor meltdown and still alive at the end of the round get an achievement
|
//in MP all characters that were inside the sub during reactor meltdown and still alive at the end of the round get an achievement
|
||||||
UnlockAchievement("survivereactormeltdown", true, c => c != null && !c.IsDead && roundData.ReactorMeltdown.Contains(c));
|
UnlockAchievement("survivereactormeltdown", true, c => c != null && !c.IsDead && roundData.ReactorMeltdown.Contains(c));
|
||||||
if (noDamageRun)
|
|
||||||
{
|
|
||||||
UnlockAchievement("nodamagerun", true, c => c != null && !c.IsDead);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (noDamageRun) { UnlockAchievement("nodamagerun"); }
|
|
||||||
if (roundData.ReactorMeltdown.Any()) //in SP getting to the destination after a meltdown is enough
|
if (roundData.ReactorMeltdown.Any()) //in SP getting to the destination after a meltdown is enough
|
||||||
{
|
{
|
||||||
UnlockAchievement("survivereactormeltdown");
|
UnlockAchievement("survivereactormeltdown");
|
||||||
@@ -351,11 +302,6 @@ namespace Barotrauma
|
|||||||
UnlockAchievement(charactersInSub[0], "lonesailor");
|
UnlockAchievement(charactersInSub[0], "lonesailor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (Character character in charactersInSub)
|
|
||||||
{
|
|
||||||
if (character.Info.Job == null) { continue; }
|
|
||||||
UnlockAchievement(character, character.Info.Job.Prefab.Identifier + "round");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user