(7d2df62c0) fixed ID card tags

This commit is contained in:
Joonas Rikkonen
2019-06-04 16:41:39 +03:00
parent aadb0ffa80
commit fd8fe59688
6 changed files with 26 additions and 96 deletions

View File

@@ -63,17 +63,11 @@ namespace Barotrauma
frame = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.45f), GUI.Canvas) { MinSize = new Point(400, 300), AbsoluteOffset = new Point(10, 10) },
color: new Color(0.4f, 0.4f, 0.4f, 0.8f));
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), frame.RectTransform, Anchor.Center)) { RelativeSpacing = 0.01f };
var paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.9f), frame.RectTransform, Anchor.Center), style: null);
var toggleText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedFrame.RectTransform, Anchor.TopLeft), TextManager.Get("DebugConsoleHelpText"), Color.GreenYellow, GUI.SmallFont, Alignment.CenterLeft, style: null);
var toggleText = new GUITextBlock(new RectTransform(new Point(paddedFrame.Rect.Width-30, 20), paddedFrame.RectTransform, Anchor.TopLeft), TextManager.Get("DebugConsoleHelpText"), new Color(150,150,200,255), GUI.SmallFont, Alignment.CenterLeft, style: null);
var closeButton = new GUIButton(new RectTransform(new Vector2(0.025f, 1.0f), toggleText.RectTransform, Anchor.TopRight), "X", style: null)
{
Color = Color.DarkRed,
HoverColor = Color.Red,
TextColor = Color.White,
OutlineColor = Color.Red
};
var closeButton = new GUIButton(new RectTransform(new Point(20, 20), paddedFrame.RectTransform, Anchor.TopRight), "X", color: Color.Red);
closeButton.OnClicked += (btn, userdata) =>
{
isOpen = false;
@@ -82,12 +76,12 @@ namespace Barotrauma
return true;
};
listBox = new GUIListBox(new RectTransform(new Point(paddedFrame.Rect.Width, paddedFrame.Rect.Height - 60), paddedFrame.RectTransform, Anchor.Center)
listBox = new GUIListBox(new RectTransform(new Point(paddedFrame.Rect.Width, paddedFrame.Rect.Height - 50), paddedFrame.RectTransform, Anchor.Center)
{
IsFixedSize = false
}, color: Color.Black * 0.9f) { ScrollBarVisible = true };
}, color: Color.Black * 0.9f);
textBox = new GUITextBox(new RectTransform(new Point(paddedFrame.Rect.Width, 30), paddedFrame.RectTransform, Anchor.BottomLeft)
textBox = new GUITextBox(new RectTransform(new Point(paddedFrame.Rect.Width, 20), paddedFrame.RectTransform, Anchor.BottomLeft)
{
IsFixedSize = false
});

View File

@@ -15,20 +15,7 @@ namespace Barotrauma
{
radioButtons = new Dictionary<Enum, GUITickBox>();
}
public override bool Enabled
{
get => base.Enabled;
set
{
base.Enabled = value;
foreach(KeyValuePair<Enum, GUITickBox> rbPair in radioButtons)
{
rbPair.Value.Enabled = value;
}
}
}
public void AddRadioButton(Enum key, GUITickBox radioButton)
{
if (selected == key) radioButton.Selected = true;

View File

@@ -472,75 +472,49 @@ namespace Barotrauma
UnsavedSettings = true;
return true;
};
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice) || !(deviceNames?.Contains(VoiceCaptureDevice) ?? false))
{
VoiceCaptureDevice = deviceNames?.Count > 0 ? deviceNames[0] : null;
}
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice))
{
VoiceSetting = VoiceMode.Disabled;
}
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
#if (!OSX)
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TrimAudioDeviceName(VoiceCaptureDevice), deviceNames.Count);
if (deviceNames?.Count > 0)
foreach (string name in deviceNames)
{
foreach (string name in deviceNames)
{
deviceList.AddItem(TrimAudioDeviceName(name), name);
}
deviceList.OnSelected = (GUIComponent selected, object obj) =>
{
string name = obj as string;
if (VoiceCaptureDevice == name) { return true; }
VoipCapture.ChangeCaptureDevice(name);
return true;
};
deviceList.AddItem(TrimAudioDeviceName(name), name);
}
else
deviceList.OnSelected = (GUIComponent selected, object obj) =>
{
deviceList.AddItem(TextManager.Get("VoipNoDevices") ?? "N/A", null);
deviceList.ButtonEnabled = false;
deviceList.Select(0);
}
string name = obj as string;
if (VoiceCaptureDevice == name) { return true; }
VoipCapture.ChangeCaptureDevice(name);
return true;
};
#else
var defaultDeviceGroup = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.1f), audioSliders.RectTransform), true, Anchor.CenterLeft);
var currentDeviceTextBlock = new GUITextBlock(new RectTransform(new Vector2(.7f, 0.75f), null),
TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TrimAudioDeviceName(VoiceCaptureDevice)))
var suavemente = new GUITextBlock(new RectTransform(new Vector2(.7f, 0.75f), null),
TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice)))
{
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
TextAlignment = Alignment.CenterLeft
};
string refreshText = ToolBox.WrapText(TextManager.Get("RefreshDefaultDevice"), defaultDeviceGroup.RectTransform.Rect.Width * 0.3f, GUI.Font);
var currentDeviceButton = new GUIButton(new RectTransform(new Vector2(.3f, 0.75f), defaultDeviceGroup.RectTransform), refreshText)
new GUIButton(new RectTransform(new Vector2(.3f, 0.75f), defaultDeviceGroup.RectTransform), refreshText)
{
ToolTip = TextManager.Get("RefreshDefaultDeviceToolTip"),
OnClicked = (bt, userdata) =>
{
deviceNames = Alc.GetStringList((IntPtr)null, Alc.CaptureDeviceSpecifier);
if (deviceNames?.Count > 0)
{
if (VoiceCaptureDevice == deviceNames[0]) return true;
if (VoiceCaptureDevice == deviceNames[0]) return true;
VoipCapture.ChangeCaptureDevice(deviceNames[0]);
currentDeviceTextBlock.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TrimAudioDeviceName(VoiceCaptureDevice));
currentDeviceTextBlock.Flash(Color.Blue);
}
else
{
currentDeviceTextBlock.Text = TextManager.Get("VoipNoDevices") ?? "N/A";
currentDeviceTextBlock.Flash(Color.Red);
}
VoipCapture.ChangeCaptureDevice(deviceNames[0]);
suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TrimAudioDeviceName(VoiceCaptureDevice));
suavemente.Flash(Color.Blue);
return true;
}
};
currentDeviceButton.OnClicked(currentDeviceButton, null);
currentDeviceTextBlock.RectTransform.Parent = defaultDeviceGroup.RectTransform;
suavemente.RectTransform.Parent = defaultDeviceGroup.RectTransform;
#endif
//var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.12f), audioSliders.RectTransform));
@@ -656,10 +630,6 @@ namespace Barotrauma
}
};
voiceMode.Selected = VoiceSetting;
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice))
{
voiceMode.Enabled = false;
}
/// Controls tab -------------------------------------------------------------
var controlsLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), tabs[(int)Tab.Controls].RectTransform, Anchor.TopCenter)
@@ -813,7 +783,6 @@ namespace Barotrauma
private string TrimAudioDeviceName(string name)
{
if (string.IsNullOrWhiteSpace(name)) { return string.Empty; }
string[] prefixes = { "OpenAL Soft on " };
foreach (string prefix in prefixes)
{

View File

@@ -150,23 +150,7 @@ namespace Barotrauma
bool run = objectiveManager.CurrentObjective.ForceRun || objectiveManager.GetCurrentPriority() > AIObjectiveManager.RunPriority;
if (ObjectiveManager.CurrentObjective is AIObjectiveGoTo goTo && goTo.Target != null)
{
if (Character.CurrentHull == null)
{
run = Vector2.DistanceSquared(Character.WorldPosition, goTo.Target.WorldPosition) > 300 * 300;
}
else
{
float yDiff = goTo.Target.WorldPosition.Y - Character.WorldPosition.Y;
if (Math.Abs(yDiff) > 100)
{
run = true;
}
else
{
float xDiff = goTo.Target.WorldPosition.X - Character.WorldPosition.X;
run = Math.Abs(xDiff) > 300;
}
}
run = Vector2.DistanceSquared(Character.WorldPosition, goTo.Target.WorldPosition) > 300 * 300;
}
if (run)
{

View File

@@ -179,10 +179,6 @@ namespace Barotrauma
bool closeEnough = Vector2.DistanceSquared(Target.WorldPosition, character.WorldPosition) < CloseEnough * CloseEnough;
if (repeat)
{
if (closeEnough)
{
closeEnough = !(Target is Character) || Target is Character c && c.CurrentHull == character.CurrentHull;
}
if (closeEnough)
{
OnCompleted();