Merge https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Barotrauma
|
||||
// Item must be in a non-equipment slot if possible
|
||||
if (!item.AllowedSlots.All(s => equipmentSlots.Contains(s)) && IsInEquipmentSlot(item)) { return false; }
|
||||
// Item must not be contained inside an item in an equipment slot
|
||||
if (item.GetRootContainer() is Item rootContainer && IsInEquipmentSlot(rootContainer)) { return false; }
|
||||
if (item.RootContainer is Item rootContainer && IsInEquipmentSlot(rootContainer)) { return false; }
|
||||
return true;
|
||||
}, recursive: true).Distinct();
|
||||
|
||||
|
||||
@@ -376,6 +376,7 @@ namespace Barotrauma
|
||||
- (0.1f * iconRelativeWidth)
|
||||
// Spacing
|
||||
- (7 * layoutGroup.RelativeSpacing);
|
||||
nameRelativeWidth = Math.Max(nameRelativeWidth, 0.25f);
|
||||
|
||||
var font = layoutGroup.Rect.Width < 150 ? GUIStyle.SmallFont : GUIStyle.Font;
|
||||
var nameBlock = new GUITextBlock(
|
||||
|
||||
@@ -121,6 +121,23 @@ namespace Barotrauma
|
||||
{
|
||||
return AllowedToManageCampaign(ClientPermissions.ManageMoney);
|
||||
}
|
||||
protected GUIButton CreateEndRoundButton()
|
||||
{
|
||||
int buttonWidth = (int)(450 * GUI.xScale * (GUI.IsUltrawide ? 3.0f : 1.0f));
|
||||
int buttonHeight = (int)(40 * GUI.yScale);
|
||||
var rectT = HUDLayoutSettings.ToRectTransform(new Rectangle((GameMain.GraphicsWidth / 2), HUDLayoutSettings.ButtonAreaTop.Center.Y, buttonWidth, buttonHeight), GUI.Canvas);
|
||||
rectT.Pivot = Pivot.Center;
|
||||
return new GUIButton(rectT, TextManager.Get("EndRound"), textAlignment: Alignment.Center, style: "EndRoundButton")
|
||||
{
|
||||
Pulse = true,
|
||||
TextBlock =
|
||||
{
|
||||
Shadow = true,
|
||||
AutoScaleHorizontal = true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
||||
+17
-30
@@ -125,38 +125,25 @@ namespace Barotrauma
|
||||
|
||||
private void CreateButtons()
|
||||
{
|
||||
int buttonHeight = (int) (GUI.Scale * 40),
|
||||
buttonWidth = GUI.IntScale(450),
|
||||
buttonCenter = buttonHeight / 2,
|
||||
screenMiddle = GameMain.GraphicsWidth / 2;
|
||||
|
||||
endRoundButton = new GUIButton(HUDLayoutSettings.ToRectTransform(new Rectangle(screenMiddle - buttonWidth / 2, HUDLayoutSettings.ButtonAreaTop.Center.Y - buttonCenter, buttonWidth, buttonHeight), GUI.Canvas),
|
||||
TextManager.Get("EndRound"), textAlignment: Alignment.Center, style: "EndRoundButton")
|
||||
endRoundButton = CreateEndRoundButton();
|
||||
endRoundButton.OnClicked = (btn, userdata) =>
|
||||
{
|
||||
Pulse = true,
|
||||
TextBlock =
|
||||
{
|
||||
Shadow = true,
|
||||
AutoScaleHorizontal = true
|
||||
},
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => GameMain.Client.RequestStartRound(),
|
||||
onReturnToMapScreen: () =>
|
||||
{
|
||||
ShowCampaignUI = true;
|
||||
if (CampaignUI == null) { InitCampaignUI(); }
|
||||
CampaignUI.SelectTab(InteractionType.Map);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => GameMain.Client.RequestStartRound(),
|
||||
onReturnToMapScreen: () =>
|
||||
{
|
||||
ShowCampaignUI = true;
|
||||
if (CampaignUI == null) { InitCampaignUI(); }
|
||||
CampaignUI.SelectTab(InteractionType.Map);
|
||||
});
|
||||
return true;
|
||||
};
|
||||
|
||||
int readyButtonHeight = buttonHeight;
|
||||
int readyButtonWidth = (int) (GUI.Scale * 50);
|
||||
|
||||
ReadyCheckButton = new GUIButton(HUDLayoutSettings.ToRectTransform(new Rectangle(screenMiddle + (buttonWidth / 2) + GUI.IntScale(16), HUDLayoutSettings.ButtonAreaTop.Center.Y - buttonCenter, readyButtonWidth, readyButtonHeight), GUI.Canvas),
|
||||
int readyButtonWidth = (int)(GUI.Scale * 50 * (GUI.IsUltrawide ? 3.0f : 1.0f));
|
||||
int readyButtonHeight = (int)(GUI.Scale * 40);
|
||||
int readyButtonCenter = readyButtonHeight / 2,
|
||||
screenMiddle = GameMain.GraphicsWidth / 2;
|
||||
ReadyCheckButton = new GUIButton(HUDLayoutSettings.ToRectTransform(new Rectangle(screenMiddle + (endRoundButton.Rect.Width / 2) + GUI.IntScale(16), HUDLayoutSettings.ButtonAreaTop.Center.Y - readyButtonCenter, readyButtonWidth, readyButtonHeight), GUI.Canvas),
|
||||
style: "RepairBuyButton")
|
||||
{
|
||||
ToolTip = TextManager.Get("ReadyCheck.Tooltip"),
|
||||
@@ -206,7 +193,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
yield return CoroutineStatus.Failure;
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
if (GameMain.Client.LateCampaignJoin)
|
||||
|
||||
+14
-20
@@ -148,6 +148,9 @@ namespace Barotrauma
|
||||
case "stats":
|
||||
LoadStats(subElement);
|
||||
break;
|
||||
case "eventmanager":
|
||||
GameMain.GameSession.EventManager.Load(subElement);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,28 +213,14 @@ namespace Barotrauma
|
||||
{
|
||||
StartRound = () => { TryEndRound(); }
|
||||
};
|
||||
}
|
||||
|
||||
private void CreateEndRoundButton()
|
||||
{
|
||||
int buttonHeight = (int)(GUI.Scale * 40);
|
||||
int buttonWidth = GUI.IntScale(450);
|
||||
endRoundButton = new GUIButton(HUDLayoutSettings.ToRectTransform(new Rectangle((GameMain.GraphicsWidth / 2) - (buttonWidth / 2), HUDLayoutSettings.ButtonAreaTop.Center.Y - (buttonHeight / 2), buttonWidth, buttonHeight), GUI.Canvas),
|
||||
TextManager.Get("EndRound"), textAlignment: Alignment.Center, style: "EndRoundButton")
|
||||
endRoundButton = CreateEndRoundButton();
|
||||
endRoundButton.OnClicked = (btn, userdata) =>
|
||||
{
|
||||
Pulse = true,
|
||||
TextBlock =
|
||||
{
|
||||
Shadow = true,
|
||||
AutoScaleHorizontal = true
|
||||
},
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => TryEndRound(),
|
||||
onReturnToMapScreen: () => { ShowCampaignUI = true; CampaignUI.SelectTab(InteractionType.Map); });
|
||||
return true;
|
||||
}
|
||||
TryEndRoundWithFuelCheck(
|
||||
onConfirm: () => TryEndRound(),
|
||||
onReturnToMapScreen: () => { ShowCampaignUI = true; CampaignUI.SelectTab(InteractionType.Map); });
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -699,6 +688,11 @@ namespace Barotrauma
|
||||
modeElement.Add(Settings.Save());
|
||||
modeElement.Add(SaveStats());
|
||||
|
||||
if (GameMain.GameSession?.EventManager != null)
|
||||
{
|
||||
modeElement.Add(GameMain.GameSession?.EventManager.Save());
|
||||
}
|
||||
|
||||
//save and remove all items that are in someone's inventory so they don't get included in the sub file as well
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
|
||||
@@ -310,9 +310,10 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var missionDescription = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform),
|
||||
RichString.Rich(missionMessage), wrap: true);
|
||||
if (selectedMissions.Contains(displayedMission) && displayedMission.Completed)
|
||||
if (selectedMissions.Contains(displayedMission))
|
||||
{
|
||||
RichString reputationText = displayedMission.GetReputationRewardText();
|
||||
if (!reputationText.IsNullOrEmpty())
|
||||
@@ -324,7 +325,7 @@ namespace Barotrauma
|
||||
if (totalReward > 0)
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform), RichString.Rich(displayedMission.GetMissionRewardText(Submarine.MainSub)));
|
||||
if (GameMain.IsMultiplayer && Character.Controlled is { } controlled)
|
||||
if (GameMain.IsMultiplayer && Character.Controlled is { } controlled && displayedMission.Completed)
|
||||
{
|
||||
var (share, percentage, _) = Mission.GetRewardShare(controlled.Wallet.RewardDistribution, GameSession.GetSessionCrewCharacters(CharacterType.Player).Where(c => c != controlled), Option<int>.Some(totalReward));
|
||||
if (share > 0)
|
||||
|
||||
Reference in New Issue
Block a user