Sub editor: zooming not allowed if the cursor is on a GUIComponent, disabled music, limiting item names in the "previously used" listbox
This commit is contained in:
@@ -165,7 +165,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveCamera(float deltaTime)
|
public void MoveCamera(float deltaTime, bool allowMove = true, bool allowZoom = true)
|
||||||
{
|
{
|
||||||
prevPosition = position;
|
prevPosition = position;
|
||||||
prevZoom = zoom;
|
prevZoom = zoom;
|
||||||
@@ -175,7 +175,7 @@ namespace Barotrauma
|
|||||||
Vector2 moveCam = Vector2.Zero;
|
Vector2 moveCam = Vector2.Zero;
|
||||||
if (targetPos == Vector2.Zero)
|
if (targetPos == Vector2.Zero)
|
||||||
{
|
{
|
||||||
if (GUIComponent.KeyboardDispatcher.Subscriber == null)
|
if (allowMove && GUIComponent.KeyboardDispatcher.Subscriber == null)
|
||||||
{
|
{
|
||||||
if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f;
|
if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f;
|
||||||
if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f;
|
if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f;
|
||||||
@@ -197,11 +197,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
moveCam = moveCam * deltaTime * 60.0f;
|
moveCam = moveCam * deltaTime * 60.0f;
|
||||||
|
|
||||||
Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition);
|
if (allowZoom)
|
||||||
Vector2 diffViewCenter;
|
{
|
||||||
diffViewCenter = ((mouseInWorld - Position) * Zoom);
|
Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition);
|
||||||
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f);
|
Vector2 diffViewCenter;
|
||||||
if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom);
|
diffViewCenter = ((mouseInWorld - Position) * Zoom);
|
||||||
|
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f);
|
||||||
|
if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -304,19 +304,15 @@ namespace Barotrauma
|
|||||||
if (Submarine.MainSub != null)
|
if (Submarine.MainSub != null)
|
||||||
{
|
{
|
||||||
cam.Position = Submarine.MainSub.Position + Submarine.MainSub.HiddenSubPosition;
|
cam.Position = Submarine.MainSub.Position + Submarine.MainSub.HiddenSubPosition;
|
||||||
//nameBox.Text = Submarine.MainSub.Name;
|
|
||||||
//descriptionBox.Text = ToolBox.LimitString(Submarine.MainSub.Description, 15);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cam.Position = Submarine.HiddenSubStartPosition;
|
cam.Position = Submarine.HiddenSubStartPosition;
|
||||||
//if (nameBox != null) nameBox.Text = "";
|
|
||||||
//descriptionBox.Text = "";
|
|
||||||
|
|
||||||
Submarine.MainSub = new Submarine(Path.Combine(Submarine.SavePath, "Unnamed.sub"), "", false);
|
Submarine.MainSub = new Submarine(Path.Combine(Submarine.SavePath, "Unnamed.sub"), "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//nameBox.Deselect();
|
SoundPlayer.OverrideMusicType = "none";
|
||||||
|
|
||||||
cam.UpdateTransform();
|
cam.UpdateTransform();
|
||||||
}
|
}
|
||||||
@@ -335,6 +331,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (wiringMode) ToggleWiringMode();
|
if (wiringMode) ToggleWiringMode();
|
||||||
|
|
||||||
|
SoundPlayer.OverrideMusicType = null;
|
||||||
|
|
||||||
if (dummyCharacter != null)
|
if (dummyCharacter != null)
|
||||||
{
|
{
|
||||||
dummyCharacter.Remove();
|
dummyCharacter.Remove();
|
||||||
@@ -843,7 +841,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
string name = ToolBox.LimitString(mapEntityPrefab.Name,15);
|
string name = ToolBox.LimitString(mapEntityPrefab.Name,15);
|
||||||
|
|
||||||
var textBlock = new GUITextBlock(new Rectangle(0,0,0,15), name, GUI.Style, previouslyUsedList);
|
var textBlock = new GUITextBlock(
|
||||||
|
new Rectangle(0,0,0,10),
|
||||||
|
ToolBox.LimitString(name, GUI.SmallFont, previouslyUsedList.Rect.Width),
|
||||||
|
GUI.Style, previouslyUsedList, GUI.SmallFont);
|
||||||
|
|
||||||
textBlock.UserData = mapEntityPrefab;
|
textBlock.UserData = mapEntityPrefab;
|
||||||
|
|
||||||
previouslyUsedList.RemoveChild(textBlock);
|
previouslyUsedList.RemoveChild(textBlock);
|
||||||
@@ -903,7 +905,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull);
|
||||||
|
|
||||||
cam.MoveCamera((float)deltaTime);
|
cam.MoveCamera((float)deltaTime, true, GUIComponent.MouseOn == null);
|
||||||
|
|
||||||
if (characterMode || wiringMode)
|
if (characterMode || wiringMode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -247,7 +247,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
List<BackgroundMusic> suitableMusic = GetSuitableMusicClips();
|
List<BackgroundMusic> suitableMusic = GetSuitableMusicClips();
|
||||||
|
|
||||||
if (suitableMusic.Count > 0 && !suitableMusic.Contains(currentMusic))
|
if (suitableMusic.Count == 0)
|
||||||
|
{
|
||||||
|
targetMusic = null;
|
||||||
|
}
|
||||||
|
else if (!suitableMusic.Contains(currentMusic))
|
||||||
{
|
{
|
||||||
int index = Rand.Int(suitableMusic.Count);
|
int index = Rand.Int(suitableMusic.Count);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user