Faction Test v1.0.1.0
This commit is contained in:
@@ -193,7 +193,7 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
|
||||
var reports = OrderPrefab.Prefabs.Where(o => o.IsReport && o.SymbolSprite != null && !o.Hidden).ToArray();
|
||||
var reports = OrderPrefab.Prefabs.Where(o => o.IsReport && o.SymbolSprite != null && !o.Hidden).OrderBy(o => o.Identifier).ToArray();
|
||||
if (reports.None())
|
||||
{
|
||||
DebugConsole.ThrowError("No valid orders for report buttons found! Cannot create report buttons. The orders for the report buttons must have 'targetallcharacters' attribute enabled and a valid 'symbolsprite' defined.");
|
||||
@@ -787,7 +787,6 @@ namespace Barotrauma
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ws != null)
|
||||
{
|
||||
hull = Hull.FindHull(ws.WorldPosition);
|
||||
@@ -801,7 +800,6 @@ namespace Barotrauma
|
||||
hull = Hull.FindHull(se.WorldPosition);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
order.OrderGiver?.Speak(order.GetChatMessage("", hull?.DisplayName?.Value, givingOrderToSelf: character == order.OrderGiver, isNewOrder: isNewOrder), ChatMessageType.Order);
|
||||
@@ -816,13 +814,13 @@ namespace Barotrauma
|
||||
{
|
||||
//can't issue an order if no characters are available
|
||||
if (character == null) { return; }
|
||||
|
||||
var orderGiver = order?.OrderGiver;
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
character.SetOrder(order, isNewOrder, speak: orderGiver != character);
|
||||
string message = order?.GetChatMessage(character.Name, orderGiver?.CurrentHull?.DisplayName?.Value, givingOrderToSelf: character == orderGiver, orderOption: order?.Option ?? Identifier.Empty, isNewOrder: isNewOrder);
|
||||
orderGiver?.Speak(message);
|
||||
bool isGivingOrderToSelf = orderGiver == character;
|
||||
character.SetOrder(order, isNewOrder, speak: !isGivingOrderToSelf);
|
||||
string message = order?.GetChatMessage(character.Name, orderGiver?.CurrentHull?.DisplayName?.Value, isGivingOrderToSelf, orderOption: order?.Option ?? Identifier.Empty, isNewOrder: isNewOrder);
|
||||
orderGiver?.Speak(message);
|
||||
}
|
||||
else if (orderGiver != null)
|
||||
{
|
||||
@@ -1404,8 +1402,7 @@ namespace Barotrauma
|
||||
bool hitDeselect = PlayerInput.KeyHit(InputType.Deselect) &&
|
||||
(!PlayerInput.SecondaryMouseButtonClicked() || (!isMouseOnOptionNode && !isMouseOnShortcutNode));
|
||||
|
||||
bool isBoundToPrimaryMouse = GameSettings.CurrentConfig.KeyMap.Bindings[InputType.Command].MouseButton is MouseButton mouseButton &&
|
||||
(mouseButton == MouseButton.PrimaryMouse || mouseButton == (PlayerInput.MouseButtonsSwapped() ? MouseButton.RightMouse : MouseButton.LeftMouse));
|
||||
bool isBoundToPrimaryMouse = GameSettings.CurrentConfig.KeyMap.Bindings[InputType.Command].MouseButton == MouseButton.PrimaryMouse;
|
||||
bool canToggleInterface = !isBoundToPrimaryMouse ||
|
||||
(!isMouseOnOptionNode && !isMouseOnShortcutNode && extraOptionNodes.None(n => GUI.IsMouseOn(n)) && !GUI.IsMouseOn(returnNode));
|
||||
|
||||
@@ -2797,8 +2794,8 @@ namespace Barotrauma
|
||||
var orderName = GetOrderNameBasedOnContextuality(order);
|
||||
var icon = CreateNodeIcon(Vector2.One, node.RectTransform, order.SymbolSprite, order.Color,
|
||||
tooltip: !showAssignmentTooltip ? orderName : orderName +
|
||||
"\n" + (!PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.leftmouse") : TextManager.Get("input.rightmouse")) + ": " + TextManager.Get("commandui.quickassigntooltip") +
|
||||
"\n" + (!PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.rightmouse") : TextManager.Get("input.leftmouse")) + ": " + TextManager.Get("commandui.manualassigntooltip"));
|
||||
"\n" + PlayerInput.PrimaryMouseLabel + ": " + TextManager.Get("commandui.quickassigntooltip") +
|
||||
"\n" + PlayerInput.SecondaryMouseLabel + ": " + TextManager.Get("commandui.manualassigntooltip"));
|
||||
|
||||
if (disableNode)
|
||||
{
|
||||
@@ -3000,8 +2997,8 @@ namespace Barotrauma
|
||||
var showAssignmentTooltip = characterContext == null && !order.MustManuallyAssign && !order.TargetAllCharacters;
|
||||
icon = CreateNodeIcon(Vector2.One, node.RectTransform, sprite, order.Color,
|
||||
tooltip: characterContext != null ? optionName : optionName +
|
||||
"\n" + (!PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.leftmouse") : TextManager.Get("input.rightmouse")) + ": " + TextManager.Get("commandui.quickassigntooltip") +
|
||||
"\n" + (!PlayerInput.MouseButtonsSwapped() ? TextManager.Get("input.rightmouse") : TextManager.Get("input.leftmouse")) + ": " + TextManager.Get("commandui.manualassigntooltip"));
|
||||
"\n" + PlayerInput.PrimaryMouseLabel + ": " + TextManager.Get("commandui.quickassigntooltip") +
|
||||
"\n" + PlayerInput.SecondaryMouseLabel + ": " + TextManager.Get("commandui.manualassigntooltip"));
|
||||
}
|
||||
if (!CanCharacterBeHeard())
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Barotrauma
|
||||
|
||||
partial void SettingsChanged(Option<int> balanceChanged, Option<int> rewardChanged)
|
||||
{
|
||||
if (Owner is Some<Character> { Value: var character })
|
||||
if (Owner.TryUnwrap(out var character))
|
||||
{
|
||||
if (!character.IsPlayer) { return; }
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Barotrauma
|
||||
protected set;
|
||||
}
|
||||
|
||||
public static CancellationTokenSource StartRoundCancellationToken { get; private set; }
|
||||
private CancellationTokenSource startRoundCancellationToken;
|
||||
|
||||
public bool ForceMapUI
|
||||
{
|
||||
@@ -62,10 +62,19 @@ namespace Barotrauma
|
||||
{
|
||||
chatBox.ToggleOpen = wasChatBoxOpen;
|
||||
}
|
||||
if (!value && CampaignUI?.SelectedTab == InteractionType.PurchaseSub)
|
||||
if (!value)
|
||||
{
|
||||
SubmarinePreview.Close();
|
||||
switch (CampaignUI?.SelectedTab)
|
||||
{
|
||||
case InteractionType.PurchaseSub:
|
||||
SubmarinePreview.Close();
|
||||
break;
|
||||
case InteractionType.MedicalClinic:
|
||||
CampaignUI.MedicalClinic?.OnDeselected();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
showCampaignUI = value;
|
||||
}
|
||||
}
|
||||
@@ -110,12 +119,7 @@ namespace Barotrauma
|
||||
|
||||
public static bool AllowedToManageWallets()
|
||||
{
|
||||
if (GameMain.Client == null) { return true; }
|
||||
|
||||
return
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageMoney) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign) ||
|
||||
GameMain.Client.IsServerOwner;
|
||||
return AllowedToManageCampaign(ClientPermissions.ManageMoney);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
@@ -247,11 +251,11 @@ namespace Barotrauma
|
||||
|
||||
GUI.ClearCursorWait();
|
||||
|
||||
StartRoundCancellationToken = new CancellationTokenSource();
|
||||
startRoundCancellationToken = new CancellationTokenSource();
|
||||
var loadTask = Task.Run(async () =>
|
||||
{
|
||||
await Task.Yield();
|
||||
Rand.ThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
Rand.ThreadId = Environment.CurrentManagedThreadId;
|
||||
try
|
||||
{
|
||||
GameMain.GameSession.StartRound(newLevel, mirrorLevel: mirror, startOutpost: GetPredefinedStartOutpost());
|
||||
@@ -261,7 +265,8 @@ namespace Barotrauma
|
||||
roundSummaryScreen.LoadException = e;
|
||||
}
|
||||
Rand.ThreadId = 0;
|
||||
}, StartRoundCancellationToken.Token);
|
||||
startRoundCancellationToken = null;
|
||||
}, startRoundCancellationToken.Token);
|
||||
TaskPool.Add("AsyncCampaignStartRound", loadTask, (t) =>
|
||||
{
|
||||
overlayColor = Color.Transparent;
|
||||
@@ -271,6 +276,21 @@ namespace Barotrauma
|
||||
return loadTask;
|
||||
}
|
||||
|
||||
public void CancelStartRound()
|
||||
{
|
||||
startRoundCancellationToken?.Cancel();
|
||||
}
|
||||
|
||||
public void ThrowIfStartRoundCancellationRequested()
|
||||
{
|
||||
if (startRoundCancellationToken != null &&
|
||||
startRoundCancellationToken.Token.IsCancellationRequested)
|
||||
{
|
||||
startRoundCancellationToken.Token.ThrowIfCancellationRequested();
|
||||
startRoundCancellationToken = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected SubmarineInfo GetPredefinedStartOutpost()
|
||||
{
|
||||
if (Map?.CurrentLocation?.Type?.GetForcedOutpostGenerationParams() is OutpostGenerationParams parameters && !parameters.OutpostFilePath.IsNullOrEmpty())
|
||||
@@ -304,7 +324,7 @@ namespace Barotrauma
|
||||
goto default;
|
||||
default:
|
||||
ShowCampaignUI = true;
|
||||
CampaignUI.SelectTab(npc.CampaignInteractionType, storeIdentifier: npc.MerchantIdentifier);
|
||||
CampaignUI.SelectTab(npc.CampaignInteractionType, npc);
|
||||
CampaignUI.UpgradeStore?.RequestRefresh();
|
||||
break;
|
||||
}
|
||||
|
||||
+13
-18
@@ -962,25 +962,20 @@ namespace Barotrauma
|
||||
foreach (NetWalletTransaction transaction in update.Transactions)
|
||||
{
|
||||
WalletInfo info = transaction.Info;
|
||||
switch (transaction.CharacterID)
|
||||
if (transaction.CharacterID.TryUnwrap(out var charID))
|
||||
{
|
||||
case Some<ushort> { Value: var charID }:
|
||||
{
|
||||
Character targetCharacter = Character.CharacterList?.FirstOrDefault(c => c.ID == charID);
|
||||
if (targetCharacter is null) { break; }
|
||||
Wallet wallet = targetCharacter.Wallet;
|
||||
Character targetCharacter = Character.CharacterList?.FirstOrDefault(c => c.ID == charID);
|
||||
if (targetCharacter is null) { break; }
|
||||
Wallet wallet = targetCharacter.Wallet;
|
||||
|
||||
wallet.Balance = info.Balance;
|
||||
wallet.RewardDistribution = info.RewardDistribution;
|
||||
TryInvokeEvent(wallet, transaction.ChangedData, info);
|
||||
break;
|
||||
}
|
||||
case None<ushort> _:
|
||||
{
|
||||
Bank.Balance = info.Balance;
|
||||
TryInvokeEvent(Bank, transaction.ChangedData, info);
|
||||
break;
|
||||
}
|
||||
wallet.Balance = info.Balance;
|
||||
wallet.RewardDistribution = info.RewardDistribution;
|
||||
TryInvokeEvent(wallet, transaction.ChangedData, info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Bank.Balance = info.Balance;
|
||||
TryInvokeEvent(Bank, transaction.ChangedData, info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,7 +990,7 @@ namespace Barotrauma
|
||||
|
||||
public override bool TryPurchase(Client client, int price)
|
||||
{
|
||||
if (!AllowedToManageCampaign(ClientPermissions.ManageCampaign))
|
||||
if (!AllowedToManageCampaign(ClientPermissions.ManageMoney))
|
||||
{
|
||||
return PersonalWallet.TryDeduct(price);
|
||||
}
|
||||
|
||||
+4
-3
@@ -421,6 +421,7 @@ namespace Barotrauma
|
||||
TotalPassedLevels++;
|
||||
break;
|
||||
case TransitionType.ProgressToNextEmptyLocation:
|
||||
Map.Visit(Map.CurrentLocation);
|
||||
TotalPassedLevels++;
|
||||
break;
|
||||
case TransitionType.End:
|
||||
@@ -437,9 +438,9 @@ namespace Barotrauma
|
||||
if (transitionType != TransitionType.End)
|
||||
{
|
||||
var endTransition = new CameraTransition(Submarine.MainSub, GameMain.GameScreen.Cam, null,
|
||||
transitionType == TransitionType.LeaveLocation ? Alignment.BottomCenter : Alignment.Center,
|
||||
fadeOut: false,
|
||||
panDuration: EndTransitionDuration);
|
||||
transitionType == TransitionType.LeaveLocation ? Alignment.BottomCenter : Alignment.Center,
|
||||
fadeOut: false,
|
||||
panDuration: EndTransitionDuration);
|
||||
|
||||
Location portraitLocation = Map.SelectedLocation ?? Map.CurrentLocation;
|
||||
overlaySprite = portraitLocation.Type.GetPortrait(portraitLocation.PortraitId);
|
||||
|
||||
@@ -585,7 +585,7 @@ namespace Barotrauma
|
||||
if (!gap.IsRoomToRoom)
|
||||
{
|
||||
if (!IsWearingDivingSuit()) { continue; }
|
||||
if (Character.Controlled.IsProtectedFromPressure()) { continue; }
|
||||
if (Character.Controlled.IsProtectedFromPressure) { continue; }
|
||||
if (DisplayHint("divingsuitwarning".ToIdentifier(), extendTextTag: false)) { return; }
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Barotrauma
|
||||
{
|
||||
internal sealed partial class MedicalClinic
|
||||
{
|
||||
private MedicalClinicUI? ui => campaign?.CampaignUI?.MedicalClinic;
|
||||
|
||||
public enum RequestResult
|
||||
{
|
||||
Undecided,
|
||||
@@ -303,6 +305,12 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private void AfflictionUpdateReceived(IReadMessage inc)
|
||||
{
|
||||
NetCrewMember crewMember = INetSerializableStruct.Read<NetCrewMember>(inc);
|
||||
ui?.UpdateAfflictions(crewMember);
|
||||
}
|
||||
|
||||
private void PendingRequestReceived(IReadMessage inc)
|
||||
{
|
||||
var pendingCrew = INetSerializableStruct.Read<NetCollection<NetCrewMember>>(inc);
|
||||
@@ -312,6 +320,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendUnsubscribeRequest() => ClientSend(null,
|
||||
header: NetworkHeader.UNSUBSCRIBE_ME,
|
||||
deliveryMethod: DeliveryMethod.Reliable);
|
||||
|
||||
private static IWriteMessage StartSending()
|
||||
{
|
||||
IWriteMessage writeMessage = new WriteOnlyMessage();
|
||||
@@ -337,6 +349,9 @@ namespace Barotrauma
|
||||
case NetworkHeader.REQUEST_AFFLICTIONS:
|
||||
AfflictionRequestReceived(inc);
|
||||
break;
|
||||
case NetworkHeader.AFFLICTION_UPDATE:
|
||||
AfflictionUpdateReceived(inc);
|
||||
break;
|
||||
case NetworkHeader.REQUEST_PENDING:
|
||||
PendingRequestReceived(inc);
|
||||
break;
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Barotrauma
|
||||
|
||||
private void CreateMessageBox(string author)
|
||||
{
|
||||
Vector2 relativeSize = new Vector2(GUI.IsFourByThree() ? 0.3f : 0.2f, 0.15f);
|
||||
Vector2 relativeSize = new Vector2(0.3f * GUI.AspectRatioAdjustment, 0.15f);
|
||||
Point minSize = new Point(300, 200);
|
||||
msgBox = new GUIMessageBox(readyCheckHeader, readyCheckBody(author), new[] { yesButton, noButton }, relativeSize, minSize, type: GUIMessageBox.Type.Vote) { UserData = PromptData, Draggable = true };
|
||||
|
||||
|
||||
@@ -311,7 +311,6 @@ namespace Barotrauma
|
||||
}
|
||||
var missionDescription = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform),
|
||||
RichString.Rich(missionMessage), wrap: true);
|
||||
int reward = displayedMission.GetReward(Submarine.MainSub);
|
||||
if (selectedMissions.Contains(displayedMission) && displayedMission.Completed)
|
||||
{
|
||||
RichString reputationText = displayedMission.GetReputationRewardText();
|
||||
@@ -320,12 +319,13 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform), reputationText);
|
||||
}
|
||||
|
||||
if (reward > 0)
|
||||
int totalReward = displayedMission.GetFinalReward(Submarine.MainSub);
|
||||
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)
|
||||
{
|
||||
var (share, percentage, _) = Mission.GetRewardShare(controlled.Wallet.RewardDistribution, GameSession.GetSessionCrewCharacters(CharacterType.Player).Where(c => c != controlled), Option<int>.Some(reward));
|
||||
var (share, percentage, _) = Mission.GetRewardShare(controlled.Wallet.RewardDistribution, GameSession.GetSessionCrewCharacters(CharacterType.Player).Where(c => c != controlled), Option<int>.Some(totalReward));
|
||||
if (share > 0)
|
||||
{
|
||||
string shareFormatted = string.Format(CultureInfo.InvariantCulture, "{0:N0}", share);
|
||||
@@ -419,7 +419,7 @@ namespace Barotrauma
|
||||
var factionFrame = CreateReputationElement(
|
||||
reputationList.Content,
|
||||
faction.Prefab.Name,
|
||||
faction.Reputation.Value, faction.Reputation.NormalizedValue, initialReputation,
|
||||
faction.Reputation, initialReputation,
|
||||
faction.Prefab.ShortDescription, faction.Prefab.Description,
|
||||
faction.Prefab.Icon, faction.Prefab.BackgroundPortrait, faction.Prefab.IconColor);
|
||||
CreatePathUnlockElement(factionFrame, faction, null);
|
||||
@@ -685,7 +685,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private GUIFrame CreateReputationElement(GUIComponent parent,
|
||||
LocalizedString name, float reputation, float normalizedReputation, float initialReputation,
|
||||
LocalizedString name, Reputation reputation, float initialReputation,
|
||||
LocalizedString shortDescription, LocalizedString fullDescription, Sprite icon, Sprite backgroundPortrait, Color iconColor)
|
||||
{
|
||||
var factionFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), parent.RectTransform), style: null);
|
||||
@@ -703,21 +703,22 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
|
||||
var factionInfoHorizontal = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), factionFrame.RectTransform, Anchor.Center), childAnchor: Anchor.CenterLeft, isHorizontal: true)
|
||||
var factionInfoHorizontal = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), factionFrame.RectTransform, Anchor.Center), childAnchor: Anchor.CenterRight, isHorizontal: true)
|
||||
{
|
||||
AbsoluteSpacing = GUI.IntScale(5),
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
var factionIcon = new GUIImage(new RectTransform(Vector2.One * 0.7f, factionInfoHorizontal.RectTransform, scaleBasis: ScaleBasis.Smallest), icon, scaleToFit: true)
|
||||
{
|
||||
Color = iconColor
|
||||
};
|
||||
var factionTextContent = new GUILayoutGroup(new RectTransform(Vector2.One, factionInfoHorizontal.RectTransform))
|
||||
{
|
||||
AbsoluteSpacing = GUI.IntScale(10),
|
||||
Stretch = true
|
||||
};
|
||||
var factionIcon = new GUIImage(new RectTransform(Vector2.One * 0.7f, factionInfoHorizontal.RectTransform, scaleBasis: ScaleBasis.Smallest), icon, scaleToFit: true)
|
||||
{
|
||||
Color = iconColor
|
||||
};
|
||||
|
||||
factionInfoHorizontal.Recalculate();
|
||||
|
||||
var header = new GUITextBlock(new RectTransform(new Point(factionTextContent.Rect.Width, GUI.IntScale(40)), factionTextContent.RectTransform),
|
||||
@@ -738,24 +739,30 @@ namespace Barotrauma
|
||||
factionTextContent.Recalculate();
|
||||
|
||||
new GUICustomComponent(new RectTransform(new Vector2(0.8f, 1.0f), sliderHolder.RectTransform),
|
||||
onDraw: (sb, customComponent) => DrawReputationBar(sb, customComponent.Rect, normalizedReputation));
|
||||
onDraw: (sb, customComponent) => DrawReputationBar(sb, customComponent.Rect, reputation.NormalizedValue));
|
||||
|
||||
var reputationText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), sliderHolder.RectTransform),
|
||||
string.Empty, textAlignment: Alignment.CenterLeft, font: GUIStyle.SubHeadingFont);
|
||||
SetReputationText(reputationText);
|
||||
reputation?.OnReputationValueChanged.RegisterOverwriteExisting("RefreshRoundSummary".ToIdentifier(), _ =>
|
||||
{
|
||||
SetReputationText(reputationText);
|
||||
});
|
||||
|
||||
LocalizedString reputationText = Reputation.GetFormattedReputationText(normalizedReputation, reputation, addColorTags: true);
|
||||
int reputationChange = (int)Math.Round(reputation - initialReputation);
|
||||
if (Math.Abs(reputationChange) > 0)
|
||||
void SetReputationText(GUITextBlock textBlock)
|
||||
{
|
||||
string changeText = $"{(reputationChange > 0 ? "+" : "") + reputationChange}";
|
||||
string colorStr = XMLExtensions.ToStringHex(reputationChange > 0 ? GUIStyle.Green : GUIStyle.Red);
|
||||
var richText = RichString.Rich($"{reputationText} (‖color:{colorStr}‖{changeText}‖color:end‖)");
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), sliderHolder.RectTransform),
|
||||
richText,
|
||||
textAlignment: Alignment.CenterLeft, font: GUIStyle.SubHeadingFont);
|
||||
}
|
||||
else
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), sliderHolder.RectTransform),
|
||||
RichString.Rich(reputationText),
|
||||
textAlignment: Alignment.CenterLeft, font: GUIStyle.SubHeadingFont);
|
||||
LocalizedString reputationText = Reputation.GetFormattedReputationText(reputation.NormalizedValue, reputation.Value, addColorTags: true);
|
||||
int reputationChange = (int)Math.Round(reputation.Value - initialReputation);
|
||||
if (Math.Abs(reputationChange) > 0)
|
||||
{
|
||||
string changeText = $"{(reputationChange > 0 ? "+" : "") + reputationChange}";
|
||||
string colorStr = XMLExtensions.ToStringHex(reputationChange > 0 ? GUIStyle.Green : GUIStyle.Red);
|
||||
textBlock.Text = RichString.Rich($"{reputationText} (‖color:{colorStr}‖{changeText}‖color:end‖)");
|
||||
}
|
||||
else
|
||||
{
|
||||
textBlock.Text = RichString.Rich(reputationText);
|
||||
}
|
||||
}
|
||||
|
||||
//spacing
|
||||
|
||||
Reference in New Issue
Block a user