(6912a70c7) Removed: Unused, old code. Fixed: Formatting
This commit is contained in:
@@ -327,8 +327,6 @@ namespace Barotrauma
|
||||
debugInteractablesAtCursor.Clear();
|
||||
debugInteractablesNearCursor.Clear();
|
||||
|
||||
bool draggingItemToWorld = CharacterInventory.DraggingItemToWorld;
|
||||
|
||||
//reduce the amount of aim assist if an item has been selected
|
||||
//= can't switch selection to another item without deselecting the current one first UNLESS the cursor is directly on the item
|
||||
//otherwise it would be too easy to accidentally switch the selected item when rewiring items
|
||||
@@ -350,15 +348,6 @@ namespace Barotrauma
|
||||
if (item.body != null && !item.body.Enabled) continue;
|
||||
if (item.ParentInventory != null) continue;
|
||||
if (ignoredItems != null && ignoredItems.Contains(item)) continue;
|
||||
|
||||
if (draggingItemToWorld)
|
||||
{
|
||||
if (item.OwnInventory == null ||
|
||||
!item.OwnInventory.CanBePut(CharacterInventory.draggingItem))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
float distanceToItem = float.PositiveInfinity;
|
||||
if (item.IsInsideTrigger(displayPosition, out Rectangle transformedTrigger))
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace Barotrauma
|
||||
scale: scale);
|
||||
}
|
||||
|
||||
if (!GUI.DisableItemHighlights && !Inventory.DraggingItemToWorld)
|
||||
if (!GUI.DisableItemHighlights)
|
||||
{
|
||||
var hudTexts = focusedItem.GetHUDTexts(character);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.Media;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
@@ -13,6 +12,7 @@ namespace Barotrauma
|
||||
{
|
||||
private Video currentVideo;
|
||||
private string filePath;
|
||||
private bool isPlaying;
|
||||
|
||||
private GUIFrame background, videoFrame, textFrame;
|
||||
private GUITextBlock title, textContent, objectiveTitle, objectiveText;
|
||||
@@ -21,13 +21,6 @@ namespace Barotrauma
|
||||
private Color backgroundColor = new Color(0f, 0f, 0f, 1f);
|
||||
private Action callbackOnStop;
|
||||
|
||||
private bool isPlaying;
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
private Point scaledResolution;
|
||||
private readonly int borderSize = 20;
|
||||
private readonly Point buttonSize = new Point(160, 50);
|
||||
@@ -57,7 +50,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public VideoPlayer()
|
||||
public VideoPlayer() // GUI elements with size set to Point.Zero are resized based on content
|
||||
{
|
||||
int screenWidth = (int)(GameMain.GraphicsWidth * 0.55f);
|
||||
scaledResolution = new Point(screenWidth, (int)(screenWidth / 16f * 9f));
|
||||
@@ -66,21 +59,19 @@ namespace Barotrauma
|
||||
int height = scaledResolution.Y;
|
||||
|
||||
background = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center), "InnerFrame", backgroundColor);
|
||||
videoFrame = new GUIFrame(new RectTransform(new Point(width + borderSize, height + borderSize), background.RectTransform, Anchor.Center, Pivot.Center) { AbsoluteOffset = new Point((int)(-100 / (GUI.Scale * 0.6f)), 0) }, "SonarFrame");
|
||||
//videoFrame.RectTransform.AbsoluteOffset = new Point(-borderSize, 0);
|
||||
videoFrame = new GUIFrame(new RectTransform(Point.Zero, background.RectTransform, Anchor.Center, Pivot.Center) { AbsoluteOffset = new Point((int)(-100 / (GUI.Scale * 0.6f)), 0) }, "SonarFrame");
|
||||
|
||||
textFrame = new GUIFrame(new RectTransform(new Point(width + borderSize, height + borderSize * 2), videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame");
|
||||
textFrame.RectTransform.AbsoluteOffset = new Point(borderSize + videoFrame.Rect.Width, 0);
|
||||
textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame");
|
||||
textFrame.RectTransform.AbsoluteOffset = new Point(width + borderSize * 2, 0);
|
||||
|
||||
videoView = new GUICustomComponent(new RectTransform(new Point(width, height), videoFrame.RectTransform, Anchor.Center),
|
||||
(spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
||||
videoView = new GUICustomComponent(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.Center), (spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
||||
title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(5, 10) }, string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left);
|
||||
|
||||
textContent = new GUITextBlock(new RectTransform(new Vector2(1f, .8f), textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(0, borderSize + titleHeight) }, string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
||||
textContent = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(0, borderSize + titleHeight) }, string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
||||
|
||||
objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight, textColor: Color.White);
|
||||
objectiveTitle.Text = TextManager.Get("NewObjective");
|
||||
objectiveText = new GUITextBlock(new RectTransform(new Point(textFrame.Rect.Width, textHeight), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight);
|
||||
objectiveText = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight);
|
||||
|
||||
objectiveTitle.Visible = objectiveText.Visible = false;
|
||||
}
|
||||
@@ -124,7 +115,7 @@ namespace Barotrauma
|
||||
|
||||
public void AddToGUIUpdateList(bool ignoreChildren = false, int order = 0)
|
||||
{
|
||||
if (!IsPlaying()) return;
|
||||
if (!isPlaying) return;
|
||||
background.AddToGUIUpdateList(ignoreChildren, order);
|
||||
}
|
||||
|
||||
@@ -161,7 +152,7 @@ namespace Barotrauma
|
||||
textSettings.Text = ToolBox.WrapText(textSettings.Text, textSettings.Width, GUI.Font);
|
||||
int wrappedHeight = textSettings.Text.Split('\n').Length * textHeight;
|
||||
textFrame.RectTransform.NonScaledSize += new Point(textSettings.Width + borderSize, wrappedHeight + borderSize + buttonSize.Y + titleHeight);
|
||||
textContent.RectTransform.NonScaledSize = new Point(textSettings.Width, wrappedHeight);
|
||||
textContent.RectTransform.NonScaledSize += new Point(textSettings.Width, wrappedHeight);
|
||||
}
|
||||
|
||||
textContent.Text = textSettings.Text;
|
||||
@@ -209,7 +200,6 @@ namespace Barotrauma
|
||||
|
||||
try
|
||||
{
|
||||
//video = new Video(GameMain.Instance.GraphicsDevice, GameMain.SoundManager, "Content/splashscreen.mp4", 1280, 720);
|
||||
video = new Video(GameMain.Instance.GraphicsDevice, GameMain.SoundManager, filePath, (uint)resolution.X, (uint)resolution.Y);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -5,7 +5,6 @@ using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Items.Components;
|
||||
using System.Linq;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Windows;
|
||||
|
||||
namespace Barotrauma.Tutorials
|
||||
{
|
||||
@@ -42,12 +41,8 @@ namespace Barotrauma.Tutorials
|
||||
private bool disableTutorialOnDeficiencyFound = true;
|
||||
|
||||
private GUIFrame holderFrame, objectiveFrame;
|
||||
//private GUIButton toggleButton;
|
||||
//private bool objectivesOpen = false;
|
||||
//private float openState = 0f;
|
||||
private List<TutorialSegment> activeObjectives = new List<TutorialSegment>();
|
||||
private string objectiveTranslated;
|
||||
//private Point objectiveBaseOffset = Point.Zero;
|
||||
|
||||
private float floodTutorialTimer = 0.0f;
|
||||
private const float floodTutorialDelay = 2.0f;
|
||||
@@ -113,7 +108,6 @@ namespace Barotrauma.Tutorials
|
||||
base.Initialize();
|
||||
videoPlayer = new VideoPlayer();
|
||||
characterTimeOnSonar = new List<Pair<Character, float>>();
|
||||
//objectivesOpen = true;
|
||||
}
|
||||
|
||||
public void LoadPartiallyComplete(XElement element)
|
||||
@@ -137,15 +131,6 @@ namespace Barotrauma.Tutorials
|
||||
}
|
||||
}
|
||||
|
||||
private void PreloadVideoContent() // Have to see if needed with videos
|
||||
{
|
||||
/*for (int i = 0; i < segments.Count; i++)
|
||||
{
|
||||
if (segments[i].ContentType != ContentTypes.Video || segments[i].IsTriggered) continue;
|
||||
spriteSheetPlayer.PreloadContent(playableContentPath, "tutorial", segments[i].Id, segments[i].VideoContent);
|
||||
}*/
|
||||
}
|
||||
|
||||
public void SavePartiallyComplete(XElement element)
|
||||
{
|
||||
XElement tutorialElement = new XElement("contextualtutorial");
|
||||
@@ -177,10 +162,7 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
if (!Initialized) return;
|
||||
|
||||
PreloadVideoContent();
|
||||
|
||||
base.Start();
|
||||
|
||||
injuredMember = null;
|
||||
activeObjectives.Clear();
|
||||
objectiveTranslated = TextManager.Get("Objective");
|
||||
@@ -249,21 +231,6 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center));
|
||||
objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null);
|
||||
|
||||
/*int toggleButtonWidth = (int)(30 * GUI.Scale);
|
||||
int toggleButtonHeight = (int)(40 * GUI.Scale);
|
||||
toggleButton = new GUIButton(new RectTransform(new Point(toggleButtonWidth, toggleButtonHeight), objectiveFrame.RectTransform, Anchor.CenterRight) { AbsoluteOffset = new Point(0, 20) }, style: "UIToggleButton");
|
||||
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
objectivesOpen = !objectivesOpen;
|
||||
foreach (GUIComponent child in btn.Children)
|
||||
{
|
||||
child.SpriteEffects = objectivesOpen ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
objectiveBaseOffset = new Point((int)(-2.5f * toggleButton.Rect.Width), 0);*/
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
@@ -311,36 +278,6 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
CheckActiveObjectives(activeObjectives[i], deltaTime);
|
||||
}
|
||||
|
||||
/*if (activeObjectives.Count > 0)
|
||||
{
|
||||
if (objectivesOpen)
|
||||
{
|
||||
openState -= deltaTime * 5.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
openState += deltaTime * 5.0f;
|
||||
}
|
||||
|
||||
openState = MathHelper.Clamp(openState, 0.0f, 1.0f);
|
||||
|
||||
float widestObjective = 0f;
|
||||
for (int i = 0; i < activeObjectives.Count; i++)
|
||||
{
|
||||
if (activeObjectives[i].ReplayButton.Rect.Width > widestObjective)
|
||||
{
|
||||
widestObjective = activeObjectives[i].ReplayButton.Rect.Width;
|
||||
}
|
||||
}
|
||||
|
||||
float objectivesHiddenOffset = widestObjective + toggleButton.Rect.Width + 100f;
|
||||
|
||||
for (int i = 0; i < activeObjectives.Count; i++)
|
||||
{
|
||||
activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = objectiveBaseOffset + new Point((int)MathHelper.SmoothStep(0, objectivesHiddenOffset, openState), 0);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void ClosePreTextAndTriggerVideoCallback()
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace Barotrauma
|
||||
protected virtual void ControlInput(Camera cam)
|
||||
{
|
||||
// Note that these targets are static. Therefore the outcome is the same if this method is called multiple times or only once.
|
||||
if (selectedSlot != null && !DraggingItemToWorld)
|
||||
if (selectedSlot != null || draggingItem != null)
|
||||
{
|
||||
cam.Freeze = true;
|
||||
}
|
||||
@@ -609,17 +609,8 @@ namespace Barotrauma
|
||||
|
||||
if (selectedSlot == null)
|
||||
{
|
||||
if (DraggingItemToWorld &&
|
||||
Character.Controlled.FocusedItem?.OwnInventory != null &&
|
||||
Character.Controlled.FocusedItem.OwnInventory.TryPutItem(draggingItem, Character.Controlled))
|
||||
{
|
||||
GUI.PlayUISound(GUISoundType.PickItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.PlayUISound(GUISoundType.DropItem);
|
||||
draggingItem.Drop(Character.Controlled);
|
||||
}
|
||||
draggingItem.Drop(Character.Controlled);
|
||||
GUI.PlayUISound(GUISoundType.DropItem);
|
||||
}
|
||||
else if (selectedSlot.ParentInventory.Items[selectedSlot.SlotIndex] != draggingItem)
|
||||
{
|
||||
@@ -711,27 +702,10 @@ namespace Barotrauma
|
||||
int iconSize = (int)(64 * GUI.Scale);
|
||||
float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f);
|
||||
Vector2 itemPos = PlayerInput.MousePosition;
|
||||
|
||||
if (GUI.MouseOn == null && selectedSlot == null)
|
||||
{
|
||||
var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0];
|
||||
string toolTip = Character.Controlled.FocusedItem != null ?
|
||||
TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) :
|
||||
TextManager.Get("DropItem");
|
||||
int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X);
|
||||
int textSpacing = (int)(15 * GUI.Scale);
|
||||
Point shadowBorders = (new Point(40, 10)).Multiply(GUI.Scale);
|
||||
shadowSprite.Draw(spriteBatch,
|
||||
new Rectangle(itemPos.ToPoint() - new Point(iconSize / 2) - shadowBorders, new Point(iconSize + textWidth + textSpacing, iconSize) + shadowBorders.Multiply(2)), Color.Black * 0.8f);
|
||||
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y - iconSize / 2), draggingItem.Name, Color.White);
|
||||
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y), toolTip,
|
||||
color: Character.Controlled.FocusedItem == null ? Color.Red : Color.LightGreen,
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
sprite.Draw(spriteBatch, itemPos + Vector2.One * 2, Color.Black, scale: scale);
|
||||
sprite.Draw(spriteBatch,
|
||||
itemPos,
|
||||
sprite == draggingItem.Sprite ? draggingItem.GetSpriteColor() : draggingItem.GetInventoryIconColor(),
|
||||
sprite.Draw(spriteBatch,
|
||||
itemPos,
|
||||
sprite == draggingItem.Sprite ? draggingItem.GetSpriteColor() : draggingItem.GetInventoryIconColor(),
|
||||
scale: scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1652,8 +1652,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
if (GUI.MouseOn == null &&
|
||||
(!CharacterInventory.IsMouseOnInventory() || CharacterInventory.DraggingItemToWorld))
|
||||
if (GUI.MouseOn == null && !CharacterInventory.IsMouseOnInventory())
|
||||
{
|
||||
if (findFocusedTimer <= 0.0f || Screen.Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
|
||||
@@ -818,6 +818,39 @@ namespace Barotrauma
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
if (sprite == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
|
||||
#if SERVER
|
||||
sprite = new Sprite("", Vector2.Zero);
|
||||
sprite.SourceRect = new Rectangle(0, 0, 32, 32);
|
||||
#else
|
||||
sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
|
||||
{
|
||||
Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
|
||||
};
|
||||
#endif
|
||||
size = sprite.size;
|
||||
sprite.EntityID = identifier;
|
||||
}
|
||||
|
||||
if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
|
||||
if (existingPrefab != null)
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
|
||||
}
|
||||
}
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
List.Add(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user