Build 0.18.13.0
This commit is contained in:
@@ -685,6 +685,7 @@ namespace Barotrauma
|
||||
causeOfDeathAffliction = AfflictionPrefab.Prefabs[afflictionName];
|
||||
}
|
||||
}
|
||||
bool containsAfflictionData = msg.ReadBoolean();
|
||||
if (!IsDead)
|
||||
{
|
||||
if (causeOfDeathType == CauseOfDeathType.Pressure || causeOfDeathAffliction == AfflictionPrefab.Pressure)
|
||||
@@ -695,6 +696,11 @@ namespace Barotrauma
|
||||
{
|
||||
Kill(causeOfDeathType, causeOfDeathAffliction?.Instantiate(1.0f), true);
|
||||
}
|
||||
}
|
||||
if (containsAfflictionData)
|
||||
{
|
||||
CharacterHealth.ClientRead(msg);
|
||||
CharacterHealth.ForceUpdateVisuals();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2011,7 +2011,6 @@ namespace Barotrauma
|
||||
|
||||
partial void UpdateSkinTint()
|
||||
{
|
||||
if (!Character.IsVisible) { return; }
|
||||
FaceTint = DefaultFaceTint;
|
||||
BodyTint = Color.TransparentBlack;
|
||||
|
||||
@@ -2029,7 +2028,6 @@ namespace Barotrauma
|
||||
|
||||
partial void UpdateLimbAfflictionOverlays()
|
||||
{
|
||||
if (!Character.IsVisible) { return; }
|
||||
foreach (Limb limb in Character.AnimController.Limbs)
|
||||
{
|
||||
if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
|
||||
|
||||
@@ -1750,9 +1750,9 @@ namespace Barotrauma
|
||||
addIfMissing($"missionfailure.{missionId}".ToIdentifier(), language);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i<missionPrefab.Messages.Length; i++)
|
||||
for (int i = 0; i < missionPrefab.Messages.Length; i++)
|
||||
{
|
||||
if (missionPrefab.Messages[i].IsNullOrWhiteSpace())
|
||||
if (missionPrefab.Messages[i].IsNullOrWhiteSpace() || (missionPrefab.Messages[i] as FallbackLString)?.GetLastFallback() is FallbackLString { PrimaryIsLoaded: false })
|
||||
{
|
||||
addIfMissing($"MissionMessage{i}.{missionId}".ToIdentifier(), language);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,9 @@ namespace Barotrauma
|
||||
CreateUI();
|
||||
UpdateLocationView(campaignUI.Campaign.Map.CurrentLocation, true);
|
||||
|
||||
campaignUI.Campaign.Map.OnLocationChanged += (prevLocation, newLocation) => UpdateLocationView(newLocation, true, prevLocation);
|
||||
campaignUI.Campaign.Map.OnLocationChanged.RegisterOverwriteExisting(
|
||||
"CrewManagement.UpdateLocationView".ToIdentifier(),
|
||||
(locationChangeInfo) => UpdateLocationView(locationChangeInfo.NewLocation, true, locationChangeInfo.PrevLocation));
|
||||
}
|
||||
|
||||
public void RefreshPermissions()
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Barotrauma
|
||||
private RectTransform currentHighestParent;
|
||||
private List<RectTransform> parentHierarchy = new List<RectTransform>();
|
||||
|
||||
private bool selectMultiple;
|
||||
private readonly bool selectMultiple;
|
||||
|
||||
public bool Dropped { get; set; }
|
||||
|
||||
@@ -129,18 +129,20 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private List<object> selectedDataMultiple = new List<object>();
|
||||
private readonly List<object> selectedDataMultiple = new List<object>();
|
||||
public IEnumerable<object> SelectedDataMultiple
|
||||
{
|
||||
get { return selectedDataMultiple; }
|
||||
}
|
||||
|
||||
private List<int> selectedIndexMultiple = new List<int>();
|
||||
private readonly List<int> selectedIndexMultiple = new List<int>();
|
||||
public IEnumerable<int> SelectedIndexMultiple
|
||||
{
|
||||
get { return selectedIndexMultiple; }
|
||||
}
|
||||
|
||||
public bool MustSelectAtLeastOne;
|
||||
|
||||
public LocalizedString Text
|
||||
{
|
||||
get { return button.Text; }
|
||||
@@ -269,6 +271,12 @@ namespace Barotrauma
|
||||
ToolTip = toolTip,
|
||||
OnSelected = (GUITickBox tb) =>
|
||||
{
|
||||
if (MustSelectAtLeastOne && selectedIndexMultiple.Count <= 1 && !tb.Selected)
|
||||
{
|
||||
tb.Selected = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
List<LocalizedString> texts = new List<LocalizedString>();
|
||||
selectedDataMultiple.Clear();
|
||||
selectedIndexMultiple.Clear();
|
||||
|
||||
@@ -188,21 +188,23 @@ namespace Barotrauma
|
||||
this.parentComponent = parentComponent;
|
||||
UpdatePermissions();
|
||||
CreateUI();
|
||||
campaignUI.Campaign.Map.OnLocationChanged += UpdateLocation;
|
||||
if (CurrentLocation?.Reputation != null)
|
||||
{
|
||||
CurrentLocation.Reputation.OnReputationValueChanged += () => { needsRefresh = true; };
|
||||
}
|
||||
campaignUI.Campaign.CargoManager.OnItemsInBuyCrateChanged += () => { needsBuyingRefresh = true; };
|
||||
campaignUI.Campaign.CargoManager.OnPurchasedItemsChanged += () => { needsRefresh = true; };
|
||||
campaignUI.Campaign.CargoManager.OnItemsInSellCrateChanged += () => { needsSellingRefresh = true; };
|
||||
campaignUI.Campaign.CargoManager.OnSoldItemsChanged += () =>
|
||||
Identifier refreshStoreId = new Identifier("RefreshStore");
|
||||
campaignUI.Campaign.Map.OnLocationChanged.RegisterOverwriteExisting(
|
||||
refreshStoreId,
|
||||
(locationChangeInfo) => UpdateLocation(locationChangeInfo.PrevLocation, locationChangeInfo.NewLocation));
|
||||
|
||||
CurrentLocation?.Reputation?.OnReputationValueChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsRefresh = true);
|
||||
CargoManager cargoManager = campaignUI.Campaign.CargoManager;
|
||||
cargoManager.OnItemsInBuyCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsBuyingRefresh = true);
|
||||
cargoManager.OnPurchasedItemsChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsRefresh = true);
|
||||
cargoManager.OnItemsInSellCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsSellingRefresh = true);
|
||||
cargoManager.OnSoldItemsChanged.RegisterOverwriteExisting(refreshStoreId, _ =>
|
||||
{
|
||||
needsItemsToSellRefresh = true;
|
||||
needsItemsToSellFromSubRefresh = true;
|
||||
needsRefresh = true;
|
||||
};
|
||||
campaignUI.Campaign.CargoManager.OnItemsInSellFromSubCrateChanged += () => { needsSellingFromSubRefresh = true; };
|
||||
});
|
||||
cargoManager.OnItemsInSellFromSubCrateChanged.RegisterOverwriteExisting(refreshStoreId, _ => needsSellingFromSubRefresh = true);
|
||||
}
|
||||
|
||||
public void SelectStore(Identifier identifier)
|
||||
@@ -713,7 +715,7 @@ namespace Barotrauma
|
||||
if (prevLocation == newLocation) { return; }
|
||||
if (prevLocation?.Reputation != null)
|
||||
{
|
||||
prevLocation.Reputation.OnReputationValueChanged -= SetNeedsRefresh;
|
||||
prevLocation.Reputation.OnReputationValueChanged.Dispose();
|
||||
}
|
||||
if (ItemPrefab.Prefabs.Any(p => p.CanBeBoughtFrom(newLocation)))
|
||||
{
|
||||
@@ -722,7 +724,7 @@ namespace Barotrauma
|
||||
ChangeStoreTab(StoreTab.Buy);
|
||||
if (newLocation?.Reputation != null)
|
||||
{
|
||||
newLocation.Reputation.OnReputationValueChanged += SetNeedsRefresh;
|
||||
CurrentLocation.Reputation.OnReputationValueChanged.RegisterOverwriteExisting("RefreshStore".ToIdentifier(), _ => { SetNeedsRefresh(); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Microsoft.Xna.Framework;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Globalization;
|
||||
using PlayerBalanceElement = Barotrauma.CampaignUI.PlayerBalanceElement;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -30,12 +29,12 @@ namespace Barotrauma
|
||||
private int selectionIndicatorThickness;
|
||||
private GUIImage listBackground;
|
||||
private GUITickBox transferItemsTickBox;
|
||||
private GUITextBlock itemTransferReminderBlock;
|
||||
private GUITextBlock itemTransferInfoBlock;
|
||||
|
||||
private readonly List<SubmarineInfo> subsToShow;
|
||||
private readonly SubmarineDisplayContent[] submarineDisplays = new SubmarineDisplayContent[submarinesPerPage];
|
||||
private SubmarineInfo selectedSubmarine = null;
|
||||
private LocalizedString purchaseAndSwitchText, purchaseOnlyText, deliveryText, currentSubText, switchText, missingPreviewText, currencyName;
|
||||
private LocalizedString purchaseAndSwitchText, purchaseOnlyText, deliveryText, selectedSubText, switchText, missingPreviewText, currencyName;
|
||||
private readonly RectTransform parent;
|
||||
private readonly Action closeAction;
|
||||
private Sprite pageIndicator;
|
||||
@@ -107,7 +106,7 @@ namespace Barotrauma
|
||||
private void Initialize()
|
||||
{
|
||||
initialized = true;
|
||||
currentSubText = TextManager.Get("currentsub");
|
||||
selectedSubText = TextManager.Get("selectedsub");
|
||||
deliveryText = TextManager.Get("requestdeliverybutton");
|
||||
switchText = TextManager.Get("switchtosubmarinebutton");
|
||||
purchaseAndSwitchText = TextManager.Get("purchaseandswitch");
|
||||
@@ -203,7 +202,7 @@ namespace Barotrauma
|
||||
OnSelected = (tb) => transferItemsOnSwitch = tb.Selected
|
||||
};
|
||||
transferItemsTickBox.RectTransform.Resize(new Point(Math.Min((int)transferItemsTickBox.ContentWidth, transferInfoFrame.Rect.Width), transferItemsTickBox.Rect.Height));
|
||||
itemTransferReminderBlock = new GUITextBlock(new RectTransform(Vector2.One, transferInfoFrame.RectTransform, Anchor.CenterRight), null)
|
||||
itemTransferInfoBlock = new GUITextBlock(new RectTransform(Vector2.One, transferInfoFrame.RectTransform, Anchor.CenterRight), null)
|
||||
{
|
||||
TextAlignment = Alignment.CenterRight,
|
||||
Visible = false
|
||||
@@ -412,7 +411,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
submarineDisplays[i].submarineFee.Text = currentSubText;
|
||||
submarineDisplays[i].submarineFee.Text = selectedSubText;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -607,35 +606,49 @@ namespace Barotrauma
|
||||
UpdateItemTransferInfoFrame();
|
||||
}
|
||||
|
||||
private bool ForceItemTransfer()
|
||||
{
|
||||
if (selectedSubmarine == null) { return false; }
|
||||
return !selectedSubmarine.IsManuallyOutfitted && !GameMain.GameSession.IsSubmarineOwned(selectedSubmarine);
|
||||
}
|
||||
|
||||
private bool IsSelectedSubCurrentSub => Submarine.MainSub?.Info?.Name == selectedSubmarine?.Name;
|
||||
|
||||
private void UpdateItemTransferInfoFrame()
|
||||
{
|
||||
if (selectedSubmarine != null)
|
||||
{
|
||||
var pendingSub = GameMain.GameSession?.Campaign?.PendingSubmarineSwitch;
|
||||
if (Submarine.MainSub?.Info?.Name == selectedSubmarine.Name && pendingSub == null)
|
||||
if (IsSelectedSubCurrentSub)
|
||||
{
|
||||
TransferItemsOnSwitch = false;
|
||||
transferItemsTickBox.Visible = false;
|
||||
itemTransferReminderBlock.Visible = false;
|
||||
itemTransferInfoBlock.Visible = confirmButton.Enabled;
|
||||
itemTransferInfoBlock.Text = TextManager.Get("switchingbacktocurrentsub");
|
||||
}
|
||||
else if (pendingSub?.Name == selectedSubmarine.Name)
|
||||
else if (ForceItemTransfer())
|
||||
{
|
||||
TransferItemsOnSwitch = true;
|
||||
transferItemsTickBox.Visible = false;
|
||||
itemTransferInfoBlock.Visible = true;
|
||||
itemTransferInfoBlock.Text = TransferItemsOnSwitch ? TextManager.Get("itemtransferenabledreminder") : TextManager.Get("itemtransferdisabledreminder");
|
||||
}
|
||||
else if (GameMain.GameSession?.Campaign?.PendingSubmarineSwitch?.Name == selectedSubmarine.Name)
|
||||
{
|
||||
transferItemsTickBox.Visible = false;
|
||||
itemTransferReminderBlock.Text = GameMain.GameSession.Campaign.TransferItemsOnSubSwitch ?
|
||||
TextManager.Get("itemtransferenabledreminder") :
|
||||
TextManager.Get("itemtransferdisabledreminder");
|
||||
itemTransferReminderBlock.Visible = true;
|
||||
itemTransferInfoBlock.Visible = true;
|
||||
itemTransferInfoBlock.Text = GameMain.GameSession.Campaign.TransferItemsOnSubSwitch ? TextManager.Get("itemtransferenabledreminder") : TextManager.Get("itemtransferdisabledreminder");
|
||||
}
|
||||
else
|
||||
{
|
||||
transferItemsTickBox.Selected = TransferItemsOnSwitch;
|
||||
transferItemsTickBox.Visible = true;
|
||||
itemTransferReminderBlock.Visible = false;
|
||||
itemTransferInfoBlock.Visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
transferItemsTickBox.Visible = false;
|
||||
itemTransferReminderBlock.Visible = false;
|
||||
itemTransferInfoBlock.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -710,6 +723,40 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
msgBox.Buttons[0].OnClicked = (applyButton, obj) =>
|
||||
{
|
||||
if (!TransferItemsOnSwitch && !IsSelectedSubCurrentSub)
|
||||
{
|
||||
if (selectedSubmarine.NoItems)
|
||||
{
|
||||
return ShowConfirmationPopup(TextManager.Get("noitemsheader"), TextManager.Get("noitemswarning"));
|
||||
}
|
||||
if (selectedSubmarine.LowFuel)
|
||||
{
|
||||
return ShowConfirmationPopup(TextManager.Get("lowfuelheader"), TextManager.Get("lowfuelwarning"));
|
||||
}
|
||||
}
|
||||
return Confirm();
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
|
||||
bool ShowConfirmationPopup(LocalizedString header, LocalizedString textBody)
|
||||
{
|
||||
msgBox.Close();
|
||||
var extraConfirmationBox = new GUIMessageBox(header, textBody, new LocalizedString[2] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||
extraConfirmationBox.Buttons[0].OnClicked = (b, o) => Confirm();
|
||||
extraConfirmationBox.Buttons[1].OnClicked = (b, o) =>
|
||||
{
|
||||
selectedSubmarine = CurrentOrPendingSubmarine();
|
||||
RefreshSubmarineDisplay(true);
|
||||
return true;
|
||||
};
|
||||
extraConfirmationBox.Buttons[0].OnClicked += extraConfirmationBox.Close;
|
||||
extraConfirmationBox.Buttons[1].OnClicked += extraConfirmationBox.Close;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Confirm()
|
||||
{
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
@@ -721,9 +768,7 @@ namespace Barotrauma
|
||||
GameMain.Client.InitiateSubmarineChange(selectedSubmarine, TransferItemsOnSwitch, Networking.VoteType.SwitchSub);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked = msgBox.Close;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowBuyPrompt(bool purchaseOnly)
|
||||
@@ -792,7 +837,16 @@ namespace Barotrauma
|
||||
|
||||
private LocalizedString GetItemTransferText()
|
||||
{
|
||||
return "\n\n" + TextManager.Get(TransferItemsOnSwitch ? "itemswillbetransferred" : "itemswontbetransferred");
|
||||
if (Submarine.MainSub?.Info?.Name == selectedSubmarine.Name)
|
||||
{
|
||||
return $"\n\n{TextManager.Get("switchingbacktocurrentsub")}";
|
||||
}
|
||||
var s = "\n\n" + TextManager.Get(TransferItemsOnSwitch ? "itemswillbetransferred" : "itemswontbetransferred");
|
||||
if (!ForceItemTransfer())
|
||||
{
|
||||
s += $" {TextManager.Get("toggleitemtransferprompt")}";
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1885,6 +1885,7 @@ namespace Barotrauma
|
||||
{
|
||||
IgnoreLayoutGroups = true
|
||||
};
|
||||
newCharacterBox.TextBlock.AutoScaleHorizontal = true;
|
||||
|
||||
newCharacterBox.OnClicked = (button, o) =>
|
||||
{
|
||||
|
||||
@@ -107,10 +107,11 @@ namespace Barotrauma
|
||||
CreateUI(upgradeFrame);
|
||||
|
||||
if (Campaign == null) { return; }
|
||||
Campaign.UpgradeManager.OnUpgradesChanged += RequestRefresh;
|
||||
Campaign.CargoManager.OnPurchasedItemsChanged += RequestRefresh;
|
||||
Campaign.CargoManager.OnSoldItemsChanged += RequestRefresh;
|
||||
Campaign.OnMoneyChanged.RegisterOverwriteExisting(nameof(UpgradeStore).ToIdentifier(), e => { RequestRefresh(); } );
|
||||
Identifier eventId = new Identifier(nameof(UpgradeStore));
|
||||
Campaign.UpgradeManager.OnUpgradesChanged?.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||
Campaign.CargoManager.OnPurchasedItemsChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||
Campaign.CargoManager.OnSoldItemsChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||
Campaign.OnMoneyChanged.RegisterOverwriteExisting(eventId, _ => RequestRefresh());
|
||||
}
|
||||
|
||||
public void RequestRefresh()
|
||||
|
||||
@@ -1109,27 +1109,6 @@ namespace Barotrauma
|
||||
GUIMessageBox.CloseAll();
|
||||
MainMenuScreen.Select();
|
||||
GameSession = null;
|
||||
|
||||
}
|
||||
|
||||
public void ShowCampaignDisclaimer(Action onContinue = null)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("CampaignDisclaimerTitle"), TextManager.Get("CampaignDisclaimerText"),
|
||||
new LocalizedString[] { TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("OK") });
|
||||
|
||||
msgBox.Buttons[0].OnClicked = (btn, userdata) =>
|
||||
{
|
||||
ShowOpenUrlInWebBrowserPrompt("https://trello.com/b/hBXI8ltN/barotrauma-roadmap-known-issues");
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += (_, __) => { onContinue?.Invoke(); return true; };
|
||||
|
||||
var config = GameSettings.CurrentConfig;
|
||||
config.CampaignDisclaimerShown = true;
|
||||
GameSettings.SetCurrentConfig(config);
|
||||
GameSettings.SaveCurrentConfig();
|
||||
}
|
||||
|
||||
public void ShowEditorDisclaimer()
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma
|
||||
{
|
||||
ItemsInBuyCrate.Add(entry.Key, entry.Value);
|
||||
}
|
||||
OnItemsInBuyCrateChanged?.Invoke();
|
||||
OnItemsInBuyCrateChanged?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SetItemsInSubSellCrate(Dictionary<Identifier, List<PurchasedItem>> items)
|
||||
@@ -62,7 +62,7 @@ namespace Barotrauma
|
||||
{
|
||||
ItemsInSellFromSubCrate.Add(entry.Key, entry.Value);
|
||||
}
|
||||
OnItemsInSellFromSubCrateChanged?.Invoke();
|
||||
OnItemsInSellFromSubCrateChanged?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SetSoldItems(Dictionary<Identifier, List<SoldItem>> items)
|
||||
@@ -97,7 +97,7 @@ namespace Barotrauma
|
||||
soldEntityMatch.Status = SoldEntity.SellStatus.Confirmed;
|
||||
}
|
||||
}
|
||||
OnSoldItemsChanged?.Invoke();
|
||||
OnSoldItemsChanged?.Invoke(this);
|
||||
|
||||
static bool Match(SoldItem soldItem, SoldEntity soldEntity, bool matchId)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace Barotrauma
|
||||
{
|
||||
GetSellCrateItems(storeIdentifier, create: true).Add(new PurchasedItem(itemPrefab, changeInQuantity));
|
||||
}
|
||||
OnItemsInSellCrateChanged?.Invoke();
|
||||
OnItemsInSellCrateChanged?.Invoke(this);
|
||||
}
|
||||
|
||||
public void SellItems(Identifier storeIdentifier, List<PurchasedItem> itemsToSell, Store.StoreTab sellingMode)
|
||||
@@ -199,7 +199,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
OnSoldItemsChanged?.Invoke();
|
||||
OnSoldItemsChanged?.Invoke(this);
|
||||
}
|
||||
|
||||
public void ClearSoldItemsProjSpecific()
|
||||
|
||||
@@ -326,6 +326,47 @@ namespace Barotrauma
|
||||
ReadyCheckButton?.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
protected void TryEndRoundWithFuelCheck(Action onConfirm, Action onReturnToMapScreen)
|
||||
{
|
||||
Submarine.MainSub.CheckFuel();
|
||||
SubmarineInfo nextSub = PendingSubmarineSwitch ?? Submarine.MainSub.Info;
|
||||
if (Level.IsLoadedFriendlyOutpost && nextSub.LowFuel && CargoManager.PurchasedItems.None(i => i.Value.Any(pi => pi.ItemPrefab.Tags.Contains("reactorfuel"))))
|
||||
{
|
||||
var extraConfirmationBox =
|
||||
new GUIMessageBox(TextManager.Get("lowfuelheader"),
|
||||
TextManager.Get("lowfuelwarning"),
|
||||
new LocalizedString[2] { TextManager.Get("ok"), TextManager.Get("cancel") });
|
||||
extraConfirmationBox.Buttons[0].OnClicked = (b, o) => { Confirm(); return true; };
|
||||
extraConfirmationBox.Buttons[0].OnClicked += extraConfirmationBox.Close;
|
||||
extraConfirmationBox.Buttons[1].OnClicked = extraConfirmationBox.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
Confirm();
|
||||
}
|
||||
|
||||
void Confirm()
|
||||
{
|
||||
var availableTransition = GetAvailableTransition(out _, out _);
|
||||
if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
||||
{
|
||||
onConfirm();
|
||||
}
|
||||
else if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ProgressToNextLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
||||
{
|
||||
onConfirm();
|
||||
}
|
||||
else
|
||||
{
|
||||
onReturnToMapScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
base.Update(deltaTime);
|
||||
|
||||
+8
-19
@@ -137,25 +137,14 @@ namespace Barotrauma
|
||||
},
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
var availableTransition = GetAvailableTransition(out _, out _);
|
||||
if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
||||
{
|
||||
GameMain.Client.RequestStartRound();
|
||||
}
|
||||
else if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ProgressToNextLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
||||
{
|
||||
GameMain.Client.RequestStartRound();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCampaignUI = true;
|
||||
if (CampaignUI == null) { InitCampaignUI(); }
|
||||
CampaignUI.SelectTab(InteractionType.Map);
|
||||
}
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => GameMain.Client.RequestStartRound(),
|
||||
onReturnToMapScreen: () =>
|
||||
{
|
||||
ShowCampaignUI = true;
|
||||
if (CampaignUI == null) { InitCampaignUI(); }
|
||||
CampaignUI.SelectTab(InteractionType.Map);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
+3
-18
@@ -184,24 +184,9 @@ namespace Barotrauma
|
||||
},
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
var availableTransition = GetAvailableTransition(out _, out _);
|
||||
if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ReturnToPreviousLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.StartOutpost)
|
||||
{
|
||||
TryEndRound();
|
||||
}
|
||||
else if (Character.Controlled != null &&
|
||||
availableTransition == TransitionType.ProgressToNextLocation &&
|
||||
Character.Controlled?.Submarine == Level.Loaded?.EndOutpost)
|
||||
{
|
||||
TryEndRound();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowCampaignUI = true;
|
||||
CampaignUI.SelectTab(InteractionType.Map);
|
||||
}
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => TryEndRound(),
|
||||
onReturnToMapScreen: () => { ShowCampaignUI = true; CampaignUI.SelectTab(InteractionType.Map); });
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -251,7 +251,7 @@ namespace Barotrauma.Tutorials
|
||||
yield return new WaitForSeconds(2.0f);
|
||||
}*/
|
||||
|
||||
TriggerTutorialSegment(0, GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Select), GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Deselect)); // Medical supplies objective
|
||||
TriggerTutorialSegment(0, GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Select), GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Deselect), "None"); // Medical supplies objective
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
@@ -405,13 +405,13 @@ namespace Barotrauma.Items.Components
|
||||
float newVolume;
|
||||
try
|
||||
{
|
||||
newVolume = Math.Min(property.GetFloatValue(this), 1.0f);
|
||||
newVolume = property.GetFloatValue(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
newVolume *= sound.VolumeMultiplier;
|
||||
newVolume = Math.Min(newVolume * sound.VolumeMultiplier, 1.0f);
|
||||
|
||||
if (!MathUtils.IsValid(newVolume))
|
||||
{
|
||||
|
||||
@@ -89,7 +89,8 @@ namespace Barotrauma.Items.Components
|
||||
if (Light?.LightSprite != null && item.Prefab.CanSpriteFlipX && item.body == null)
|
||||
{
|
||||
Light.LightSpriteEffect = Light.LightSpriteEffect == SpriteEffects.None ?
|
||||
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
SetLightSourceTransformProjSpecific();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -985,7 +985,8 @@ namespace Barotrauma.Items.Components
|
||||
missionIndex++;
|
||||
}
|
||||
|
||||
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null)
|
||||
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null &&
|
||||
(item.CurrentHull == null || !DetectSubmarineWalls))
|
||||
{
|
||||
foreach (var c in MineralClusters)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
|
||||
@@ -10,22 +10,18 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
int roundedValue = (int)Math.Round((1 - damageModifier.DamageMultiplier * damageModifier.ProbabilityMultiplier) * 100);
|
||||
if (roundedValue == 0) { return; }
|
||||
string colorStr = XMLExtensions.ColorToString(GUIStyle.Green);
|
||||
string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
|
||||
|
||||
LocalizedString afflictionName =
|
||||
AfflictionPrefab.List.FirstOrDefault(ap => ap.Identifier == afflictionIdentifier)?.Name ??
|
||||
TextManager.Get($"afflictiontype.{afflictionIdentifier}").Fallback(afflictionIdentifier.Value);
|
||||
|
||||
description += $"\n ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {afflictionName}";
|
||||
if (!description.IsNullOrWhiteSpace()) { description += '\n'; }
|
||||
description += $" ‖color:{colorStr}‖{roundedValue.ToString("-0;+#")}%‖color:end‖ {afflictionName}";
|
||||
}
|
||||
|
||||
public override void AddTooltipInfo(ref LocalizedString name, ref LocalizedString description)
|
||||
{
|
||||
if (damageModifiers.Any(d => !MathUtils.NearlyEqual(d.DamageMultiplier, 1f) || !MathUtils.NearlyEqual(d.ProbabilityMultiplier, 1f)) || SkillModifiers.Any())
|
||||
{
|
||||
description += "\n";
|
||||
}
|
||||
|
||||
if (damageModifiers.Any())
|
||||
{
|
||||
foreach (DamageModifier damageModifier in damageModifiers)
|
||||
@@ -49,10 +45,11 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
foreach (var skillModifier in SkillModifiers)
|
||||
{
|
||||
string colorStr = XMLExtensions.ColorToString(GUIStyle.Green);
|
||||
string colorStr = XMLExtensions.ToStringHex(GUIStyle.Green);
|
||||
int roundedValue = (int)Math.Round(skillModifier.Value);
|
||||
if (roundedValue == 0) { continue; }
|
||||
description += $"\n ‖color:{colorStr}‖{roundedValue.ToString("+0;-#")}‖color:end‖ {TextManager.Get($"SkillName.{skillModifier.Key}").Fallback(skillModifier.Key.Value)}";
|
||||
if (!description.IsNullOrWhiteSpace()) { description += '\n'; }
|
||||
description += $" ‖color:{colorStr}‖{roundedValue.ToString("+0;-#")}‖color:end‖ {TextManager.Get($"SkillName.{skillModifier.Key}").Fallback(skillModifier.Key.Value)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,9 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
description = TextManager.GetWithVariables("IDCardNameJob", ("[name]", idName, FormatCapitals.No), ("[job]", idJob, FormatCapitals.Yes));
|
||||
description = TextManager.GetWithVariables("IDCardNameJob",
|
||||
("[name]", idName, FormatCapitals.No),
|
||||
("[job]", TextManager.Get("jobname." + idJob).Fallback(idJob), FormatCapitals.Yes));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.Description))
|
||||
{
|
||||
@@ -1582,7 +1584,7 @@ namespace Barotrauma
|
||||
DrawItemStateIndicator(spriteBatch, inventory, indicatorSprite, emptyIndicatorSprite, conditionIndicatorArea, item.Condition / item.MaxCondition);
|
||||
}
|
||||
|
||||
if (itemContainer != null && itemContainer.ShowContainedStateIndicator)
|
||||
if (itemContainer != null && itemContainer.ShowContainedStateIndicator && itemContainer.Capacity > 0)
|
||||
{
|
||||
float containedState = 0.0f;
|
||||
if (itemContainer.ShowConditionInContainedStateIndicator)
|
||||
|
||||
@@ -149,51 +149,18 @@ namespace Barotrauma
|
||||
pos.X += Math.Sign(flowForce.X);
|
||||
pos.Y = MathHelper.Clamp(Rand.Range(higherSurface, lowerSurface), rect.Y - rect.Height, rect.Y);
|
||||
}
|
||||
else
|
||||
if (flowTargetHull != null)
|
||||
{
|
||||
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
|
||||
pos.X = MathHelper.Clamp(pos.X, flowTargetHull.Rect.X + 1, flowTargetHull.Rect.Right - 1);
|
||||
pos.Y = MathHelper.Clamp(pos.Y, flowTargetHull.Rect.Y - flowTargetHull.Rect.Height + 1, flowTargetHull.Rect.Y - 1);
|
||||
}
|
||||
|
||||
//spawn less particles when there's already a large number of them
|
||||
float particleAmountMultiplier = 1.0f - GameMain.ParticleManager.ParticleCount / (float)GameMain.ParticleManager.MaxParticles;
|
||||
particleAmountMultiplier *= particleAmountMultiplier;
|
||||
|
||||
//light dripping
|
||||
if (open < 0.2f && LerpedFlowForce.LengthSquared() > 100.0f)
|
||||
{
|
||||
particleTimer += deltaTime;
|
||||
float particlesPerSec = open * 100.0f * particleAmountMultiplier;
|
||||
float emitInterval = 1.0f / particlesPerSec;
|
||||
while (particleTimer > emitInterval)
|
||||
{
|
||||
Vector2 velocity = flowForce;
|
||||
if (!IsHorizontal)
|
||||
{
|
||||
velocity.X = Rand.Range(-500.0f, 500.0f) * open;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X *= Rand.Range(1.0f, 3.0f);
|
||||
}
|
||||
|
||||
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle(
|
||||
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
||||
(Submarine == null ? pos : pos + Submarine.Position),
|
||||
velocity, 0, flowTargetHull);
|
||||
}
|
||||
|
||||
GameMain.ParticleManager.CreateParticle(
|
||||
"bubbles",
|
||||
(Submarine == null ? pos : pos + Submarine.Position),
|
||||
velocity, 0, flowTargetHull);
|
||||
|
||||
particleTimer -= emitInterval;
|
||||
}
|
||||
}
|
||||
//heavy flow -> strong waterfall type of particles
|
||||
else if (LerpedFlowForce.LengthSquared() > 20000.0f)
|
||||
if (LerpedFlowForce.LengthSquared() > 20000.0f)
|
||||
{
|
||||
particleTimer += deltaTime;
|
||||
if (IsHorizontal)
|
||||
@@ -218,6 +185,10 @@ namespace Barotrauma
|
||||
if (particle.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(particle); }
|
||||
particle.Size *= Math.Min(Math.Abs(flowForce.X / 500.0f), 5.0f);
|
||||
}
|
||||
if (GapSize() <= Structure.WallSectionSize || !IsRoomToRoom)
|
||||
{
|
||||
CreateWaterSpatter();
|
||||
}
|
||||
}
|
||||
|
||||
if (Math.Abs(flowForce.X) > 300.0f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
||||
@@ -245,7 +216,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) { return; }
|
||||
|
||||
float particlesPerSec = Math.Max(open * rect.Width * 0.3f * particleAmountMultiplier, 20.0f);
|
||||
float particlesPerSec = Math.Max(open * rect.Width * 0.5f * particleAmountMultiplier, 10.0f);
|
||||
float emitInterval = 1.0f / particlesPerSec;
|
||||
while (particleTimer > emitInterval)
|
||||
{
|
||||
@@ -263,7 +234,11 @@ namespace Barotrauma
|
||||
if (splash != null)
|
||||
{
|
||||
if (splash.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(splash); }
|
||||
splash.Size *= MathHelper.Clamp(rect.Width / 50.0f, 1.5f, 4.0f);
|
||||
splash.Size *= MathHelper.Clamp(rect.Width / 50.0f, 1.5f, 4.0f);
|
||||
}
|
||||
if (GapSize() <= Structure.WallSectionSize || !IsRoomToRoom)
|
||||
{
|
||||
CreateWaterSpatter();
|
||||
}
|
||||
}
|
||||
if (Math.Abs(flowForce.Y) > 190.0f && Rand.Range(0.0f, 1.0f) < 0.3f && flowTargetHull.WaterVolume > flowTargetHull.Volume * 0.1f)
|
||||
@@ -277,10 +252,77 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
//light dripping
|
||||
else if (LerpedFlowForce.LengthSquared() > 100.0f &&
|
||||
/*no dripping from large gaps between rooms (looks bad)*/
|
||||
((GapSize() <= Structure.WallSectionSize) || !IsRoomToRoom))
|
||||
{
|
||||
particleTimer += deltaTime;
|
||||
float particlesPerSec = open * 100.0f * particleAmountMultiplier;
|
||||
float emitInterval = 1.0f / particlesPerSec;
|
||||
while (particleTimer > emitInterval)
|
||||
{
|
||||
Vector2 velocity = flowForce;
|
||||
if (!IsHorizontal)
|
||||
{
|
||||
velocity.X = Rand.Range(-100.0f, 100.0f) * open;
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X *= Rand.Range(1.0f, 3.0f);
|
||||
}
|
||||
|
||||
if (flowTargetHull.WaterVolume < flowTargetHull.Volume)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle(
|
||||
Rand.Range(0.0f, open) < 0.05f ? "waterdrop" : "watersplash",
|
||||
Submarine == null ? pos : pos + Submarine.Position,
|
||||
velocity, 0, flowTargetHull);
|
||||
CreateWaterSpatter();
|
||||
}
|
||||
|
||||
GameMain.ParticleManager.CreateParticle(
|
||||
"bubbles",
|
||||
(Submarine == null ? pos : pos + Submarine.Position),
|
||||
velocity, 0, flowTargetHull);
|
||||
|
||||
particleTimer -= emitInterval;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
particleTimer = 0.0f;
|
||||
}
|
||||
|
||||
void CreateWaterSpatter()
|
||||
{
|
||||
Vector2 spatterPos = pos;
|
||||
float rotation;
|
||||
if (IsHorizontal)
|
||||
{
|
||||
rotation = LerpedFlowForce.X > 0 ? 0 : MathHelper.Pi;
|
||||
spatterPos.Y = rect.Y - rect.Height / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation = LerpedFlowForce.Y > 0 ? -MathHelper.PiOver2 : MathHelper.PiOver2;
|
||||
spatterPos.X = rect.Center.X;
|
||||
}
|
||||
var spatter = GameMain.ParticleManager.CreateParticle(
|
||||
"waterspatter",
|
||||
Submarine == null ? spatterPos : spatterPos + Submarine.Position,
|
||||
Vector2.Zero, rotation, flowTargetHull);
|
||||
if (spatter != null)
|
||||
{
|
||||
if (spatter.CurrentHull == null) { GameMain.ParticleManager.RemoveParticle(spatter); }
|
||||
spatter.Size *= MathHelper.Clamp(LerpedFlowForce.Length() / 200.0f, 0.5f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
float GapSize()
|
||||
{
|
||||
return IsHorizontal ? rect.Height : rect.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
|
||||
//remove some lights with a light volume if there's too many of them
|
||||
if (activeLightsWithLightVolume.Count > GameSettings.CurrentConfig.Graphics.VisibleLightLimit)
|
||||
if (activeLightsWithLightVolume.Count > GameSettings.CurrentConfig.Graphics.VisibleLightLimit && Screen.Selected is { IsEditor: false })
|
||||
{
|
||||
for (int i = GameSettings.CurrentConfig.Graphics.VisibleLightLimit; i < activeLightsWithLightVolume.Count; i++)
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Barotrauma.Lights
|
||||
[Serialize(0f, IsPropertySaveable.Yes), Editable(MinValueFloat = -360, MaxValueFloat = 360, ValueStep = 1, DecimalCount = 0)]
|
||||
public float Rotation { get; set; }
|
||||
|
||||
public Vector2 GetOffset() => Vector2.Transform(Offset, Matrix.CreateRotationZ(Rotation));
|
||||
public Vector2 GetOffset() => Vector2.Transform(Offset, Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)));
|
||||
|
||||
private float flicker;
|
||||
[Editable, Serialize(0.0f, IsPropertySaveable.No, description: "How heavily the light flickers. 0 = no flickering, 1 = the light will alternate between completely dark and full brightness.")]
|
||||
|
||||
@@ -110,7 +110,9 @@ namespace Barotrauma
|
||||
{
|
||||
noiseOverlay ??= new Sprite("Content/UI/noise.png", Vector2.Zero);
|
||||
|
||||
OnLocationChanged = LocationChanged;
|
||||
OnLocationChanged.RegisterOverwriteExisting(
|
||||
"Map.InitProjSpecific".ToIdentifier(),
|
||||
(locationChangeInfo) => LocationChanged(locationChangeInfo.PrevLocation, locationChangeInfo.NewLocation));
|
||||
|
||||
borders = new Rectangle(
|
||||
(int)Locations.Min(l => l.MapPosition.X),
|
||||
@@ -447,7 +449,7 @@ namespace Barotrauma
|
||||
Level.Loaded.DebugSetEndLocation(null);
|
||||
|
||||
CurrentLocation.Discover();
|
||||
OnLocationChanged?.Invoke(prevLocation, CurrentLocation);
|
||||
OnLocationChanged?.Invoke(new LocationChangeInfo(prevLocation, CurrentLocation));
|
||||
SelectLocation(-1);
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
|
||||
@@ -88,6 +88,11 @@ namespace Barotrauma
|
||||
prevCullTime = 0;
|
||||
}
|
||||
|
||||
public static void ForceRemoveFromVisibleEntities(MapEntity entity)
|
||||
{
|
||||
visibleEntities?.Remove(entity);
|
||||
}
|
||||
|
||||
public static void Draw(SpriteBatch spriteBatch, bool editing = false)
|
||||
{
|
||||
var entitiesToRender = !editing && visibleEntities != null ? visibleEntities : MapEntity.mapEntityList;
|
||||
|
||||
@@ -1845,8 +1845,11 @@ namespace Barotrauma.Networking
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
// TODO: Re-enable the server message once it's been edited and translated
|
||||
//AddChatMessage($"ServerMessage.HowToCommunicate~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Chat)}~[radiobutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.RadioChat)}", ChatMessageType.Server);
|
||||
string message = "ServerMessage.HowToCommunicate" +
|
||||
$"~[chatbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.ActiveChat)}" +
|
||||
$"~[pttbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.Voice)}" +
|
||||
$"~[switchbutton]={GameSettings.CurrentConfig.KeyMap.KeyBindText(InputType.ToggleChatMode)}";
|
||||
AddChatMessage(message, ChatMessageType.Server);
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace Barotrauma
|
||||
{
|
||||
GUILayoutGroup inputContainer = CreateSettingBase(parent, description, tooltip, horizontalSize: 0.55f, verticalSize: verticalSize);
|
||||
|
||||
GUIButton minusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton", textAlignment: Alignment.Center) { UserData = -1 };
|
||||
GUIButton minusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIButtonToggleLeft", textAlignment: Alignment.Center) { UserData = -1 };
|
||||
GUIFrame inputFrame = new GUIFrame(new RectTransform(Vector2.One, inputContainer.RectTransform), style: null);
|
||||
GUINumberInput numberInput = new GUINumberInput(new RectTransform(Vector2.One, inputFrame.RectTransform, Anchor.Center), NumberType.Int, textAlignment: Alignment.Center, style: "GUITextBox", hidePlusMinusButtons: true)
|
||||
{
|
||||
@@ -290,7 +290,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
GUIButton plusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton", textAlignment: Alignment.Center) { UserData = 1 };
|
||||
GUIButton plusButton = new GUIButton(new RectTransform(Vector2.One, inputContainer.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIButtonToggleRight", textAlignment: Alignment.Center) { UserData = 1 };
|
||||
|
||||
minusButton.OnClicked = plusButton.OnClicked = ChangeValue;
|
||||
|
||||
|
||||
-7
@@ -235,13 +235,6 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
var disclaimerBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.8f), rightColumn.RectTransform, Anchor.TopRight) { AbsoluteOffset = new Point(5) }, style: "GUINotificationButton")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = (btn, userdata) => { GameMain.Instance.ShowCampaignDisclaimer(); return true; }
|
||||
};
|
||||
disclaimerBtn.RectTransform.MaxSize = new Point((int)(30 * GUI.Scale));
|
||||
|
||||
columnContainer.Recalculate();
|
||||
leftColumn.Recalculate();
|
||||
rightColumn.Recalculate();
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace Barotrauma
|
||||
|
||||
CreateUI(container);
|
||||
|
||||
campaign.Map.OnLocationSelected += SelectLocation;
|
||||
campaign.Map.OnMissionsSelected += (connection, missions) =>
|
||||
campaign.Map.OnLocationSelected = SelectLocation;
|
||||
campaign.Map.OnMissionsSelected = (connection, missions) =>
|
||||
{
|
||||
if (missionList?.Content != null)
|
||||
{
|
||||
|
||||
@@ -534,12 +534,6 @@ namespace Barotrauma
|
||||
ShowTutorialSkipWarning(Tab.NewGame);
|
||||
return true;
|
||||
}
|
||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = Tab.Empty;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.NewGame); });
|
||||
return true;
|
||||
}
|
||||
campaignSetupUI.RandomizeCrew();
|
||||
campaignSetupUI.SetPage(0);
|
||||
campaignSetupUI.CreateDefaultSaveName();
|
||||
@@ -559,12 +553,6 @@ namespace Barotrauma
|
||||
ShowTutorialSkipWarning(Tab.JoinServer);
|
||||
return true;
|
||||
}
|
||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = Tab.Empty;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.JoinServer); });
|
||||
return true;
|
||||
}
|
||||
GameMain.ServerListScreen.Select();
|
||||
break;
|
||||
case Tab.HostServer:
|
||||
@@ -574,13 +562,6 @@ namespace Barotrauma
|
||||
ShowTutorialSkipWarning(tab);
|
||||
return true;
|
||||
}
|
||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = Tab.Empty;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.HostServer); });
|
||||
return true;
|
||||
}
|
||||
|
||||
serverExecutableDropdown.ListBox.Content.Children.ToArray()
|
||||
.Where(c => c.UserData is ServerExecutableFile f && !ContentPackageManager.EnabledPackages.All.Contains(f.ContentPackage))
|
||||
.ForEach(serverExecutableDropdown.ListBox.RemoveChild);
|
||||
@@ -611,12 +592,6 @@ namespace Barotrauma
|
||||
}
|
||||
break;
|
||||
case Tab.Tutorials:
|
||||
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
|
||||
{
|
||||
selectedTab = Tab.Empty;
|
||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.Tutorials); });
|
||||
return true;
|
||||
}
|
||||
UpdateTutorialList();
|
||||
break;
|
||||
case Tab.CharacterEditor:
|
||||
|
||||
@@ -1814,7 +1814,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (Submarine.GetLightCount() > MaxLights)
|
||||
{
|
||||
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.lightcounterror", "[max]", MaxShadowCastingLights.ToString()));
|
||||
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("subeditor.lightcounterror", "[max]", MaxLights.ToString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2522,6 +2522,27 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
var outFittingArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), subSettingsContainer.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||
{
|
||||
Stretch = true,
|
||||
AbsoluteSpacing = 5
|
||||
};
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), outFittingArea.RectTransform),
|
||||
TextManager.Get("ManuallyOutfitted"), textAlignment: Alignment.CenterLeft, wrap: true, font: GUIStyle.SmallFont)
|
||||
{
|
||||
ToolTip = TextManager.Get("manuallyoutfittedtooltip")
|
||||
};
|
||||
new GUITickBox(new RectTransform((0.4f, 1.0f), outFittingArea.RectTransform), "")
|
||||
{
|
||||
ToolTip = TextManager.Get("manuallyoutfittedtooltip"),
|
||||
Selected = MainSub.Info.IsManuallyOutfitted,
|
||||
OnSelected = box =>
|
||||
{
|
||||
MainSub.Info.IsManuallyOutfitted = box.Selected;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
if (MainSub != null)
|
||||
{
|
||||
int min = MainSub.Info.RecommendedCrewSizeMin;
|
||||
@@ -2824,7 +2845,7 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
var saveButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonArea.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("SaveSubButton"))
|
||||
TextManager.Get("SaveSubButton").Fallback(TextManager.Get("save")))
|
||||
{
|
||||
OnClicked = (button, o) => SaveSub(packageToSaveInList.SelectedData as ContentPackage)
|
||||
};
|
||||
@@ -3502,8 +3523,11 @@ namespace Barotrauma
|
||||
modProject.RemoveFile(modProject.Files.First(f => ContentPath.FromRaw(subPackage, f.Path) == sub.FilePath));
|
||||
modProject.Save(subPackage.Path);
|
||||
ReloadModifiedPackage(subPackage);
|
||||
}
|
||||
|
||||
if (MainSub?.Info != null && MainSub.Info.FilePath == sub.FilePath)
|
||||
{
|
||||
MainSub.Info.FilePath = null;
|
||||
}
|
||||
}
|
||||
sub.Dispose();
|
||||
CreateLoadScreen();
|
||||
}
|
||||
@@ -5036,8 +5060,8 @@ namespace Barotrauma
|
||||
|
||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||
hullVolumeFrame.RectTransform.AbsoluteOffset = new Point(Math.Max(showEntitiesPanel.Rect.Right, previouslyUsedPanel.Rect.Right), 0);
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
snapToGridFrame.Visible = MapEntity.SelectedList.Count > 0;
|
||||
saveAssemblyFrame.Visible = MapEntity.SelectedList.Count > 0 && !WiringMode;
|
||||
snapToGridFrame.Visible = MapEntity.SelectedList.Count > 0 && !WiringMode;
|
||||
|
||||
var offset = cam.WorldView.Top - cam.ScreenToWorld(new Vector2(0, GameMain.GraphicsHeight - EntityMenu.Rect.Top)).Y;
|
||||
|
||||
|
||||
@@ -629,16 +629,18 @@ namespace Barotrauma
|
||||
|
||||
bool isFlagsAttribute = value.GetType().IsDefined(typeof(FlagsAttribute), false);
|
||||
|
||||
bool hasNoneOption = false;
|
||||
foreach (object enumValue in Enum.GetValues(value.GetType()))
|
||||
{
|
||||
if (isFlagsAttribute && !MathHelper.IsPowerOfTwo((int)enumValue)) { continue; }
|
||||
|
||||
hasNoneOption |= (int)enumValue == 0;
|
||||
enumDropDown.AddItem(enumValue.ToString(), enumValue);
|
||||
if (((int)enumValue != 0 || (int)value == 0) && ((Enum)value).HasFlag((Enum)enumValue))
|
||||
{
|
||||
enumDropDown.SelectItem(enumValue);
|
||||
}
|
||||
}
|
||||
enumDropDown.MustSelectAtLeastOne = !hasNoneOption;
|
||||
enumDropDown.OnSelected += (selected, val) =>
|
||||
{
|
||||
if (SetPropertyValue(property, entity, string.Join(", ", enumDropDown.SelectedDataMultiple.Select(d => d.ToString()))))
|
||||
@@ -1441,7 +1443,21 @@ namespace Barotrauma
|
||||
if (component.GetType() == parentObject.GetType() && component != parentObject)
|
||||
{
|
||||
SafeAdd(component, property);
|
||||
property.PropertyInfo.SetValue(component, value);
|
||||
if (value is string stringValue && Enum.TryParse(property.PropertyType, stringValue, out var enumValue))
|
||||
{
|
||||
property.PropertyInfo.SetValue(component, enumValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
property.PropertyInfo.SetValue(component, value);
|
||||
}
|
||||
catch (ArgumentException e)
|
||||
{
|
||||
DebugConsole.ThrowError($"Failed to set the value of the property \"{property.Name}\" to {value?.ToString() ?? "null"}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -45,6 +45,20 @@ namespace Barotrauma
|
||||
Instance = new SettingsMenu(mainParent);
|
||||
return Instance;
|
||||
}
|
||||
|
||||
public void Recreate()
|
||||
{
|
||||
if (GUI.SettingsMenuOpen)
|
||||
{
|
||||
GUI.SettingsMenuOpen = false;
|
||||
GUI.SettingsMenuOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Create(mainFrame.Parent.RectTransform);
|
||||
Instance?.SelectTab(Tab.Controls);
|
||||
}
|
||||
}
|
||||
|
||||
private SettingsMenu(RectTransform mainParent)
|
||||
{
|
||||
@@ -653,7 +667,7 @@ namespace Barotrauma
|
||||
{
|
||||
unsavedConfig.InventoryKeyMap = GameSettings.Config.InventoryKeyMapping.GetDefault();
|
||||
unsavedConfig.KeyMap = GameSettings.Config.KeyMapping.GetDefault();
|
||||
Create(mainFrame.Parent.RectTransform);
|
||||
Recreate();
|
||||
Instance?.SelectTab(Tab.Controls);
|
||||
return true;
|
||||
}
|
||||
@@ -761,7 +775,7 @@ namespace Barotrauma
|
||||
private void CreateBottomButtons()
|
||||
{
|
||||
GUIButton cancelButton =
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: "Cancel")
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: TextManager.Get("Cancel"))
|
||||
{
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
@@ -770,7 +784,7 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
GUIButton applyButton =
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: "Apply")
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), bottom.RectTransform), text: TextManager.Get("applysettingsbutton"))
|
||||
{
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
|
||||
@@ -253,12 +253,12 @@ namespace Barotrauma
|
||||
if (flipHorizontal)
|
||||
{
|
||||
float diff = targetSize.X % (sourceRect.Width * scale.X);
|
||||
flippedDrawOffset.X = (int)MathF.Round((sourceRect.Width * scale.X - diff) / scale.X);
|
||||
flippedDrawOffset.X = (int)((sourceRect.Width * scale.X - diff) / scale.X);
|
||||
}
|
||||
if (flipVertical)
|
||||
{
|
||||
float diff = targetSize.Y % (sourceRect.Height * scale.Y);
|
||||
flippedDrawOffset.Y = (int)MathF.Round((sourceRect.Height * scale.Y - diff) / scale.Y);
|
||||
flippedDrawOffset.Y = (int)((sourceRect.Height * scale.Y - diff) / scale.Y);
|
||||
}
|
||||
drawOffset += flippedDrawOffset;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user