Unstable 0.17.0.0
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Barotrauma
|
||||
if (state != value)
|
||||
{
|
||||
base.State = value;
|
||||
if (state == HostagesKilledState && !string.IsNullOrEmpty(hostagesKilledMessage))
|
||||
if (state == HostagesKilledState && !hostagesKilledMessage.IsNullOrEmpty())
|
||||
{
|
||||
CreateMessageBox(string.Empty, hostagesKilledMessage);
|
||||
}
|
||||
|
||||
@@ -8,23 +8,29 @@ namespace Barotrauma
|
||||
public override bool DisplayAsCompleted => false;
|
||||
public override bool DisplayAsFailed => false;
|
||||
|
||||
public override string GetMissionRewardText(Submarine sub)
|
||||
public override RichString GetMissionRewardText(Submarine sub)
|
||||
{
|
||||
string rewardText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", GetReward(sub)));
|
||||
LocalizedString rewardText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", GetReward(sub)));
|
||||
|
||||
LocalizedString retVal;
|
||||
if (rewardPerCrate.HasValue)
|
||||
{
|
||||
string rewardPerCrateText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", rewardPerCrate.Value));
|
||||
return TextManager.GetWithVariables("missionrewardcargopercrate",
|
||||
new string[] { "[rewardpercrate]", "[itemcount]", "[maxitemcount]", "[totalreward]" },
|
||||
new string[] { rewardPerCrateText, itemsToSpawn.Count.ToString(), maxItemCount.ToString(), $"‖color:gui.orange‖{rewardText}‖end‖" });
|
||||
LocalizedString rewardPerCrateText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", rewardPerCrate.Value));
|
||||
retVal = TextManager.GetWithVariables("missionrewardcargopercrate",
|
||||
("[rewardpercrate]", rewardPerCrateText),
|
||||
("[itemcount]", itemsToSpawn.Count.ToString()),
|
||||
("[maxitemcount]", maxItemCount.ToString()),
|
||||
("[totalreward]", $"‖color:gui.orange‖{rewardText}‖end‖"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return TextManager.GetWithVariables("missionrewardcargo",
|
||||
new string[] { "[totalreward]", "[itemcount]", "[maxitemcount]" },
|
||||
new string[] { $"‖color:gui.orange‖{rewardText}‖end‖", itemsToSpawn.Count.ToString(), maxItemCount.ToString() });
|
||||
retVal = TextManager.GetWithVariables("missionrewardcargo",
|
||||
("[totalreward]", $"‖color:gui.orange‖{rewardText}‖end‖"),
|
||||
("[itemcount]", itemsToSpawn.Count.ToString()),
|
||||
("[maxitemcount]", maxItemCount.ToString()));
|
||||
}
|
||||
|
||||
return RichString.Rich(retVal);
|
||||
}
|
||||
public override void ClientReadInitial(IReadMessage msg)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Barotrauma
|
||||
{
|
||||
partial class CombatMission : Mission
|
||||
{
|
||||
public override string Description
|
||||
public override LocalizedString Description
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Barotrauma
|
||||
|
||||
for(int i = 0; i < resourceClusters.Count; i++)
|
||||
{
|
||||
var identifier = msg.ReadString();
|
||||
var identifier = msg.ReadIdentifier();
|
||||
var count = msg.ReadByte();
|
||||
var resources = new Item[count];
|
||||
for (int j = 0; j < count; j++)
|
||||
|
||||
@@ -9,11 +9,8 @@ namespace Barotrauma
|
||||
{
|
||||
abstract partial class Mission
|
||||
{
|
||||
private readonly List<string> shownMessages = new List<string>();
|
||||
public IEnumerable<string> ShownMessages
|
||||
{
|
||||
get { return shownMessages; }
|
||||
}
|
||||
private readonly List<LocalizedString> shownMessages = new List<LocalizedString>();
|
||||
public IEnumerable<LocalizedString> ShownMessages => shownMessages;
|
||||
|
||||
public bool DisplayTargetHudIcons => Prefab.DisplayTargetHudIcons;
|
||||
|
||||
@@ -32,29 +29,29 @@ namespace Barotrauma
|
||||
{
|
||||
int v = Difficulty ?? MissionPrefab.MinDifficulty;
|
||||
float t = MathUtils.InverseLerp(MissionPrefab.MinDifficulty, MissionPrefab.MaxDifficulty, v);
|
||||
return ToolBox.GradientLerp(t, GUI.Style.Green, GUI.Style.Orange, GUI.Style.Red);
|
||||
return ToolBox.GradientLerp(t, GUIStyle.Green, GUIStyle.Orange, GUIStyle.Red);
|
||||
}
|
||||
|
||||
public virtual string GetMissionRewardText(Submarine sub)
|
||||
public virtual RichString GetMissionRewardText(Submarine sub)
|
||||
{
|
||||
string rewardText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", GetReward(sub)));
|
||||
return TextManager.GetWithVariable("missionreward", "[reward]", $"‖color:gui.orange‖{rewardText}‖end‖");
|
||||
LocalizedString rewardText = TextManager.GetWithVariable("currencyformat", "[credits]", string.Format(CultureInfo.InvariantCulture, "{0:N0}", GetReward(sub)));
|
||||
return RichString.Rich(TextManager.GetWithVariable("missionreward", "[reward]", "‖color:gui.orange‖"+rewardText+"‖end‖"));
|
||||
}
|
||||
|
||||
public string GetReputationRewardText(Location currLocation)
|
||||
public RichString GetReputationRewardText(Location currLocation)
|
||||
{
|
||||
List<string> reputationRewardTexts = new List<string>();
|
||||
List<LocalizedString> reputationRewardTexts = new List<LocalizedString>();
|
||||
foreach (var reputationReward in ReputationRewards)
|
||||
{
|
||||
string name = "";
|
||||
LocalizedString name = "";
|
||||
|
||||
if (reputationReward.Key.Equals("location", StringComparison.OrdinalIgnoreCase))
|
||||
if (reputationReward.Key == "location")
|
||||
{
|
||||
name = $"‖color:gui.orange‖{currLocation.Name}‖end‖";
|
||||
}
|
||||
else
|
||||
{
|
||||
var faction = FactionPrefab.Prefabs.Find(f => f.Identifier.Equals(reputationReward.Key, StringComparison.OrdinalIgnoreCase));
|
||||
var faction = FactionPrefab.Prefabs.Find(f => f.Identifier == reputationReward.Key);
|
||||
if (faction != null)
|
||||
{
|
||||
name = $"‖color:{XMLExtensions.ColorToString(faction.IconColor)}‖{faction.Name}‖end‖";
|
||||
@@ -66,28 +63,28 @@ namespace Barotrauma
|
||||
}
|
||||
float normalizedValue = MathUtils.InverseLerp(-100.0f, 100.0f, reputationReward.Value);
|
||||
string formattedValue = ((int)reputationReward.Value).ToString("+#;-#;0"); //force plus sign for positive numbers
|
||||
string rewardText = TextManager.GetWithVariables(
|
||||
LocalizedString rewardText = TextManager.GetWithVariables(
|
||||
"reputationformat",
|
||||
new string[] { "[reputationname]", "[reputationvalue]" },
|
||||
new string[] { name, $"‖color:{XMLExtensions.ColorToString(Reputation.GetReputationColor(normalizedValue))}‖{formattedValue}‖end‖" });
|
||||
reputationRewardTexts.Add(rewardText);
|
||||
("[reputationname]", name),
|
||||
("[reputationvalue]", $"‖color:{XMLExtensions.ColorToString(Reputation.GetReputationColor(normalizedValue))}‖{formattedValue}‖end‖" ));
|
||||
reputationRewardTexts.Add(rewardText.Value);
|
||||
}
|
||||
return TextManager.AddPunctuation(':', TextManager.Get("reputation"), string.Join(", ", reputationRewardTexts));
|
||||
return RichString.Rich(TextManager.AddPunctuation(':', TextManager.Get("reputation"), LocalizedString.Join(", ", reputationRewardTexts)));
|
||||
}
|
||||
|
||||
partial void ShowMessageProjSpecific(int missionState)
|
||||
{
|
||||
int messageIndex = missionState - 1;
|
||||
if (messageIndex >= Headers.Count && messageIndex >= Messages.Count) { return; }
|
||||
if (messageIndex >= Headers.Length && messageIndex >= Messages.Length) { return; }
|
||||
if (messageIndex < 0) { return; }
|
||||
|
||||
string header = messageIndex < Headers.Count ? Headers[messageIndex] : "";
|
||||
string message = messageIndex < Messages.Count ? Messages[messageIndex] : "";
|
||||
LocalizedString header = messageIndex < Headers.Length ? Headers[messageIndex] : "";
|
||||
LocalizedString message = messageIndex < Messages.Length ? Messages[messageIndex] : "";
|
||||
|
||||
CoroutineManager.StartCoroutine(ShowMessageBoxAfterRoundSummary(header, message));
|
||||
}
|
||||
|
||||
private IEnumerable<CoroutineStatus> ShowMessageBoxAfterRoundSummary(string header, string message)
|
||||
private IEnumerable<CoroutineStatus> ShowMessageBoxAfterRoundSummary(LocalizedString header, LocalizedString message)
|
||||
{
|
||||
while (GUIMessageBox.VisibleBox?.UserData is RoundSummary)
|
||||
{
|
||||
@@ -97,10 +94,10 @@ namespace Barotrauma
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
protected void CreateMessageBox(string header, string message)
|
||||
protected void CreateMessageBox(LocalizedString header, LocalizedString message)
|
||||
{
|
||||
shownMessages.Add(message);
|
||||
new GUIMessageBox(header, message, buttons: new string[0], type: GUIMessageBox.Type.InGame, icon: Prefab.Icon, parseRichText: true)
|
||||
new GUIMessageBox(RichString.Rich(header), RichString.Rich(message), buttons: Array.Empty<LocalizedString>(), type: GUIMessageBox.Type.InGame, icon: Prefab.Icon)
|
||||
{
|
||||
IconColor = Prefab.IconColor
|
||||
};
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace Barotrauma
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
abstract partial class MissionMode : GameMode
|
||||
{
|
||||
@@ -6,7 +8,7 @@
|
||||
{
|
||||
foreach (Mission mission in missions)
|
||||
{
|
||||
new GUIMessageBox(mission.Name, mission.Description, new string[0], type: GUIMessageBox.Type.InGame, icon: mission.Prefab.Icon, parseRichText: true)
|
||||
new GUIMessageBox(RichString.Rich(mission.Name), RichString.Rich(mission.Description), Array.Empty<LocalizedString>(), type: GUIMessageBox.Type.InGame, icon: mission.Prefab.Icon)
|
||||
{
|
||||
IconColor = mission.Prefab.IconColor,
|
||||
UserData = "missionstartmessage"
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class MissionPrefab
|
||||
partial class MissionPrefab : PrefabWithUintIdentifier
|
||||
{
|
||||
public Sprite Icon
|
||||
{
|
||||
@@ -49,11 +49,11 @@ namespace Barotrauma
|
||||
private Sprite hudIcon;
|
||||
private Color? hudIconColor;
|
||||
|
||||
partial void InitProjSpecific(XElement element)
|
||||
partial void InitProjSpecific(ContentXElement element)
|
||||
{
|
||||
DisplayTargetHudIcons = element.GetAttributeBool("displaytargethudicons", false);
|
||||
HudIconMaxDistance = element.GetAttributeFloat("hudiconmaxdistance", 1000.0f);
|
||||
foreach (XElement subElement in element.Elements())
|
||||
foreach (var subElement in element.Elements())
|
||||
{
|
||||
string name = subElement.Name.ToString();
|
||||
if (name.Equals("icon", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -68,5 +68,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partial void DisposeProjectSpecific()
|
||||
{
|
||||
Icon?.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user