Unstable 0.1300.0.3
This commit is contained in:
@@ -473,7 +473,36 @@ namespace Barotrauma
|
||||
SelectedColor = MapGenerationParams.Instance.IndicatorColor,
|
||||
HoverColor = Color.Lerp(MapGenerationParams.Instance.IndicatorColor, Color.White, 0.5f)
|
||||
};
|
||||
missionName.Padding = new Vector4(missionName.Padding.X + icon.Rect.Width * 1.5f, missionName.Padding.Y, missionName.Padding.Z, missionName.Padding.W);
|
||||
icon.RectTransform.IsFixedSize = true;
|
||||
|
||||
GUILayoutGroup difficultyIndicatorGroup = null;
|
||||
if (mission.Difficulty.HasValue)
|
||||
{
|
||||
difficultyIndicatorGroup = new GUILayoutGroup(new RectTransform(Vector2.One * 0.9f, missionName.RectTransform, anchor: Anchor.CenterRight, scaleBasis: ScaleBasis.Smallest) { AbsoluteOffset = new Point((int)missionName.Padding.Z, 0) },
|
||||
isHorizontal: true, childAnchor: Anchor.CenterRight)
|
||||
{
|
||||
AbsoluteSpacing = 1,
|
||||
UserData = "difficulty"
|
||||
};
|
||||
var difficultyColor = mission.GetDifficultyColor();
|
||||
for (int i = 0; i < mission.Difficulty; i++)
|
||||
{
|
||||
new GUIImage(new RectTransform(Vector2.One, difficultyIndicatorGroup.RectTransform, scaleBasis: ScaleBasis.Smallest) { IsFixedSize = true }, "DifficultyIndicator", scaleToFit: true)
|
||||
{
|
||||
Color = difficultyColor * 0.5f,
|
||||
SelectedColor = difficultyColor,
|
||||
HoverColor = Color.Lerp(difficultyColor, Color.White, 0.5f)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
float extraPadding = 0.5f * icon.Rect.Width;
|
||||
float extraZPadding = difficultyIndicatorGroup != null ? mission.Difficulty.Value * (difficultyIndicatorGroup.Children.First().Rect.Width + difficultyIndicatorGroup.AbsoluteSpacing) : 0;
|
||||
missionName.Padding = new Vector4(missionName.Padding.X + icon.Rect.Width + extraPadding,
|
||||
missionName.Padding.Y,
|
||||
missionName.Padding.Z + extraZPadding + extraPadding,
|
||||
missionName.Padding.W);
|
||||
missionName.CalculateHeightFromText();
|
||||
}
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), missionTextContent.RectTransform), mission.GetMissionRewardText(), wrap: true, parseRichText: true);
|
||||
@@ -494,6 +523,10 @@ namespace Barotrauma
|
||||
missionPanel.OnAddedToGUIUpdateList = (c) =>
|
||||
{
|
||||
missionTextContent.Children.ForEach(child => child.State = c.State);
|
||||
if (missionTextContent.FindChild("difficulty", recursive: true) is GUILayoutGroup group)
|
||||
{
|
||||
group.State = c.State;
|
||||
}
|
||||
};
|
||||
|
||||
if (mission != availableMissions.Last())
|
||||
|
||||
@@ -171,10 +171,7 @@ namespace Barotrauma
|
||||
Character.Controlled.ObstructVision &&
|
||||
(Character.Controlled.ViewTarget == Character.Controlled || Character.Controlled.ViewTarget == null);
|
||||
|
||||
if (Character.Controlled != null)
|
||||
{
|
||||
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
||||
}
|
||||
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled?.CursorWorldPosition ?? Vector2.Zero);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
graphics.SetRenderTarget(renderTarget);
|
||||
@@ -334,12 +331,13 @@ namespace Barotrauma
|
||||
}
|
||||
spriteBatch.End();
|
||||
|
||||
if (GameMain.LightManager.LosEnabled && GameMain.LightManager.LosMode != LosMode.None && Character.Controlled != null)
|
||||
if (GameMain.LightManager.LosEnabled && GameMain.LightManager.LosMode != LosMode.None && Lights.LightManager.ViewTarget != null)
|
||||
{
|
||||
GameMain.LightManager.LosEffect.CurrentTechnique = GameMain.LightManager.LosEffect.Techniques["LosShader"];
|
||||
|
||||
GameMain.LightManager.LosEffect.Parameters["xTexture"].SetValue(renderTargetBackground);
|
||||
GameMain.LightManager.LosEffect.Parameters["xLosTexture"].SetValue(GameMain.LightManager.LosTexture);
|
||||
GameMain.LightManager.LosEffect.Parameters["xLosAlpha"].SetValue(GameMain.LightManager.LosAlpha);
|
||||
|
||||
Color losColor;
|
||||
if (GameMain.LightManager.LosMode == LosMode.Transparent)
|
||||
|
||||
@@ -348,6 +348,16 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("EditorDisclaimerWikiLink"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||
{
|
||||
ForceUpperCase = true,
|
||||
OnClicked = (button, userData) =>
|
||||
{
|
||||
string url = TextManager.Get("EditorDisclaimerWikiUrl", returnNull: true) ?? "https://barotraumagame.com/wiki";
|
||||
GameMain.Instance.ShowOpenUrlInWebBrowserPrompt(url, promptExtensionTag: "wikinotice");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), optionList.RectTransform), TextManager.Get("CreditsButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||
{
|
||||
ForceUpperCase = true,
|
||||
|
||||
@@ -1305,9 +1305,9 @@ namespace Barotrauma
|
||||
StartButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound) && !GameMain.Client.GameStarted && !CampaignSetupFrame.Visible && !CampaignFrame.Visible;
|
||||
ServerName.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
ServerMessage.Readonly = !GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
shuttleTickBox.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
shuttleTickBox.Enabled = GameMain.Client.HasPermission(ClientPermissions.ManageSettings);
|
||||
SubList.Enabled = !CampaignFrame.Visible && (GameMain.Client.ServerSettings.Voting.AllowSubVoting || GameMain.Client.HasPermission(ClientPermissions.SelectSub));
|
||||
shuttleList.Enabled = shuttleList.ButtonEnabled = shuttleTickBox.Enabled = !CampaignFrame.Visible && !CampaignSetupFrame.Visible && GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
shuttleList.Enabled = shuttleList.ButtonEnabled = GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
ModeList.Enabled = GameMain.Client.ServerSettings.Voting.AllowModeVoting || GameMain.Client.HasPermission(ClientPermissions.SelectMode);
|
||||
LogButtons.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
GameMain.Client.ShowLogButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
|
||||
@@ -533,20 +533,6 @@ namespace Barotrauma
|
||||
OnSelected = (GUITickBox obj) =>
|
||||
{
|
||||
lightingEnabled = obj.Selected;
|
||||
if (lightingEnabled)
|
||||
{
|
||||
//turn off lights that are inside containers
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
foreach (LightComponent lightComponent in item.GetComponents<LightComponent>())
|
||||
{
|
||||
lightComponent.Light.Color = item.Container != null || (item.body != null && !item.body.Enabled) ?
|
||||
Color.Transparent :
|
||||
lightComponent.LightColor;
|
||||
lightComponent.Light.LightSpriteEffect = lightComponent.Item.SpriteEffects;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -2704,16 +2690,6 @@ namespace Barotrauma
|
||||
cam.Position = Submarine.MainSub.Position + Submarine.MainSub.HiddenSubPosition;
|
||||
|
||||
loadFrame = null;
|
||||
|
||||
//turn off lights that are inside an inventory (cabinet for example)
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var lightComponent = item.GetComponent<LightComponent>();
|
||||
if (lightComponent != null)
|
||||
{
|
||||
lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool LoadSub(GUIButton button, object obj)
|
||||
@@ -2748,16 +2724,6 @@ namespace Barotrauma
|
||||
|
||||
loadFrame = null;
|
||||
|
||||
//turn off lights that are inside an inventory (cabinet for example)
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
var lightComponent = item.GetComponent<LightComponent>();
|
||||
if (lightComponent != null)
|
||||
{
|
||||
lightComponent.Light.Enabled = item.ParentInventory == null;
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedSub.Info.GameVersion < new Version("0.8.9.0"))
|
||||
{
|
||||
var adjustLightsPrompt = new GUIMessageBox(TextManager.Get("Warning"), TextManager.Get("AdjustLightsPrompt"),
|
||||
@@ -2857,8 +2823,8 @@ namespace Barotrauma
|
||||
|
||||
categorizedEntityList.UpdateScrollBarSize();
|
||||
categorizedEntityList.BarScroll = 0.0f;
|
||||
categorizedEntityList.Visible = true;
|
||||
allEntityList.Visible = false;
|
||||
// categorizedEntityList.Visible = true;
|
||||
// allEntityList.Visible = false;
|
||||
}
|
||||
|
||||
private void FilterEntities(string filter)
|
||||
@@ -3047,6 +3013,37 @@ namespace Barotrauma
|
||||
|
||||
public static GUIMessageBox CreatePropertyColorPicker(Color originalColor, SerializableProperty property, ISerializableEntity entity)
|
||||
{
|
||||
var entities = new List<(ISerializableEntity Entity, Color OriginalColor, SerializableProperty Property)> { (entity, originalColor, property) };
|
||||
|
||||
foreach (ISerializableEntity selectedEntity in MapEntity.SelectedList.Where(selectedEntity => selectedEntity is ISerializableEntity && entity != selectedEntity).Cast<ISerializableEntity>())
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case ItemComponent _ when selectedEntity is Item item:
|
||||
foreach (var component in item.Components)
|
||||
{
|
||||
if (component.GetType() == entity.GetType() && component != entity)
|
||||
{
|
||||
entities.Add((component, (Color) property.GetValue(component), property));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (selectedEntity.GetType() == entity.GetType())
|
||||
{
|
||||
entities.Add((selectedEntity, (Color) property.GetValue(selectedEntity), property));
|
||||
}
|
||||
else if (selectedEntity is { SerializableProperties: { } props} )
|
||||
{
|
||||
if (props.TryGetValue(property.NameToLowerInvariant, out SerializableProperty foundProp))
|
||||
{
|
||||
entities.Add((selectedEntity, (Color) foundProp.GetValue(selectedEntity), foundProp));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool setValues = true;
|
||||
object sliderMutex = new object(),
|
||||
sliderTextMutex = new object(),
|
||||
@@ -3142,9 +3139,22 @@ namespace Barotrauma
|
||||
colorPicker.DisposeTextures();
|
||||
msgBox.Close();
|
||||
|
||||
if (entity is MapEntity { Removed: true } me) { return true; }
|
||||
Color newColor = SetColor(null);
|
||||
StoreCommand(new PropertyCommand(entity, property.Name, newColor, originalColor));
|
||||
|
||||
Dictionary<object, List<ISerializableEntity>> oldProperties = new Dictionary<object, List<ISerializableEntity>>();
|
||||
|
||||
foreach (var (sEntity, color, _) in entities)
|
||||
{
|
||||
if (sEntity is MapEntity { Removed: true }) { continue; }
|
||||
if (!oldProperties.ContainsKey(color))
|
||||
{
|
||||
oldProperties.Add(color, new List<ISerializableEntity>());
|
||||
}
|
||||
oldProperties[color].Add(sEntity);
|
||||
}
|
||||
|
||||
List<ISerializableEntity> affected = entities.Select(t => t.Entity).Where(se => se is MapEntity { Removed: false }).ToList();
|
||||
StoreCommand(new PropertyCommand(affected, property.Name, newColor, oldProperties));
|
||||
|
||||
if (MapEntity.EditingHUD != null && (MapEntity.EditingHUD.UserData == entity || (!(entity is ItemComponent ic) || MapEntity.EditingHUD.UserData == ic.Item)))
|
||||
{
|
||||
@@ -3170,8 +3180,12 @@ namespace Barotrauma
|
||||
{
|
||||
colorPicker.DisposeTextures();
|
||||
msgBox.Close();
|
||||
if (entity is MapEntity { Removed: true } me) { return true; }
|
||||
property.SetValue(entity, originalColor);
|
||||
|
||||
foreach (var (e, color, prop) in entities)
|
||||
{
|
||||
if (e is MapEntity { Removed: true }) { continue; }
|
||||
prop.TrySetValue(e, color);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -3218,8 +3232,12 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Color color = ToolBox.HSVToRGB(colorPicker.SelectedHue, colorPicker.SelectedSaturation, colorPicker.SelectedValue);
|
||||
color.A = originalColor.A;
|
||||
property.TrySetValue(entity, color);
|
||||
foreach (var (e, origColor, prop) in entities)
|
||||
{
|
||||
if (e is MapEntity { Removed: true }) { continue; }
|
||||
color.A = origColor.A;
|
||||
prop.TrySetValue(e, color);
|
||||
}
|
||||
return color;
|
||||
|
||||
void SetSliders(Vector3 hsv)
|
||||
@@ -3238,9 +3256,11 @@ namespace Barotrauma
|
||||
|
||||
void SetColorPicker(Vector3 hsv)
|
||||
{
|
||||
bool hueChanged = !MathUtils.NearlyEqual(colorPicker.SelectedHue, hsv.X);
|
||||
colorPicker.SelectedHue = hsv.X;
|
||||
colorPicker.SelectedSaturation = hsv.Y;
|
||||
colorPicker.SelectedValue = hsv.Z;
|
||||
if (hueChanged) { colorPicker.RefreshHue(); }
|
||||
}
|
||||
|
||||
void SetHex(Vector3 hsv)
|
||||
@@ -3496,6 +3516,8 @@ namespace Barotrauma
|
||||
|
||||
private bool SelectPrefab(GUIComponent component, object obj)
|
||||
{
|
||||
allEntityList.Deselect();
|
||||
categorizedEntityList.Deselect();
|
||||
if (GUI.MouseOn is GUIButton || GUI.MouseOn?.Parent is GUIButton) { return false; }
|
||||
|
||||
AddPreviouslyUsed(obj as MapEntityPrefab);
|
||||
@@ -3586,7 +3608,7 @@ namespace Barotrauma
|
||||
SoundPlayer.PlayUISound(GUISoundType.PickItem);
|
||||
MapEntityPrefab.SelectPrefab(obj);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4332,6 +4354,17 @@ namespace Barotrauma
|
||||
|
||||
if (lightingEnabled)
|
||||
{
|
||||
//turn off lights that are inside containers
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
foreach (LightComponent lightComponent in item.GetComponents<LightComponent>())
|
||||
{
|
||||
lightComponent.Light.Color = item.Container != null || (item.body != null && !item.body.Enabled) ?
|
||||
Color.Transparent :
|
||||
lightComponent.LightColor;
|
||||
lightComponent.Light.LightSpriteEffect = lightComponent.Item.SpriteEffects;
|
||||
}
|
||||
}
|
||||
GameMain.LightManager?.Update((float)deltaTime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user