(3e7222290) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -61,9 +61,89 @@ namespace Barotrauma
|
|||||||
public CrewManager(XElement element, bool isSinglePlayer)
|
public CrewManager(XElement element, bool isSinglePlayer)
|
||||||
: this(isSinglePlayer)
|
: this(isSinglePlayer)
|
||||||
{
|
{
|
||||||
foreach (XElement subElement in element.Elements())
|
guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
|
||||||
{
|
{
|
||||||
if (subElement.Name.ToString().ToLowerInvariant() != "character") continue;
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
Point scrollButtonSize = new Point((int)(200 * GUI.Scale), (int)(30 * GUI.Scale));
|
||||||
|
|
||||||
|
crewArea = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.CrewArea, guiFrame.RectTransform), "", Color.Transparent)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
toggleCrewButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform)
|
||||||
|
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
||||||
|
"", style: "UIToggleButton");
|
||||||
|
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
|
{
|
||||||
|
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
|
{
|
||||||
|
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
characterListBox = new GUIListBox(new RectTransform(new Point(100, (int)(crewArea.Rect.Height - scrollButtonSize.Y * 1.6f)), crewArea.RectTransform, Anchor.CenterLeft), false, Color.Transparent, null)
|
||||||
|
{
|
||||||
|
//Spacing = (int)(3 * GUI.Scale),
|
||||||
|
ScrollBarEnabled = false,
|
||||||
|
ScrollBarVisible = false,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
scrollButtonUp = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.TopLeft, Pivot.TopLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
||||||
|
{
|
||||||
|
Visible = false,
|
||||||
|
UserData = -1,
|
||||||
|
OnClicked = ScrollCharacterList
|
||||||
|
};
|
||||||
|
scrollButtonDown = new GUIButton(new RectTransform(scrollButtonSize, crewArea.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft), "", Alignment.Center, "GUIButtonVerticalArrow")
|
||||||
|
{
|
||||||
|
Visible = false,
|
||||||
|
UserData = 1,
|
||||||
|
OnClicked = ScrollCharacterList
|
||||||
|
};
|
||||||
|
scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
|
||||||
|
|
||||||
|
if (isSinglePlayer)
|
||||||
|
{
|
||||||
|
chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
||||||
|
{
|
||||||
|
OnEnterMessage = (textbox, text) =>
|
||||||
|
{
|
||||||
|
if (Character.Controlled?.Info == null)
|
||||||
|
{
|
||||||
|
textbox.Deselect();
|
||||||
|
textbox.Text = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(text))
|
||||||
|
{
|
||||||
|
string msgCommand = ChatMessage.GetChatMessageCommand(text, out string msg);
|
||||||
|
AddSinglePlayerChatMessage(
|
||||||
|
Character.Controlled.Info.Name,
|
||||||
|
msg,
|
||||||
|
((msgCommand == "r" || msgCommand == "radio") && ChatMessage.CanUseRadio(Character.Controlled)) ? ChatMessageType.Radio : ChatMessageType.Default,
|
||||||
|
Character.Controlled);
|
||||||
|
var headset = GetHeadset(Character.Controlled, true);
|
||||||
|
if (headset != null && headset.CanTransmit())
|
||||||
|
{
|
||||||
|
headset.TransmitSignal(stepsTaken: 0, signal: msg, source: headset.Item, sender: Character.Controlled, sendToChat: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textbox.Deselect();
|
||||||
|
textbox.Text = "";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
|
||||||
|
}
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
@@ -594,10 +674,16 @@ namespace Barotrauma
|
|||||||
float step =
|
float step =
|
||||||
(characterListBox.Content.Children.First().Rect.Height + characterListBox.Spacing) /
|
(characterListBox.Content.Children.First().Rect.Height + characterListBox.Spacing) /
|
||||||
(characterListBox.TotalSize - characterListBox.Rect.Height);
|
(characterListBox.TotalSize - characterListBox.Rect.Height);
|
||||||
characterListBox.BarScroll -= characterListBox.BarScroll % step;
|
|
||||||
characterListBox.BarScroll += dir * step;
|
characterListBox.BarScroll += dir * step;
|
||||||
|
|
||||||
return radioItem.GetComponent<WifiComponent>();
|
//round the scroll so that we're not displaying partial character frames
|
||||||
|
float roundedPos = MathUtils.RoundTowardsClosest(characterListBox.BarScroll, step);
|
||||||
|
if (Math.Abs(roundedPos - characterListBox.BarScroll) < step / 2)
|
||||||
|
{
|
||||||
|
characterListBox.BarScroll = roundedPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> KillCharacterAnim(GUIComponent component)
|
private IEnumerable<object> KillCharacterAnim(GUIComponent component)
|
||||||
@@ -610,12 +696,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
comp.Color = Color.DarkRed;
|
comp.Color = Color.DarkRed;
|
||||||
}
|
}
|
||||||
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
|
||||||
c.AIController is HumanAIController &&
|
|
||||||
!c.IsDead &&
|
|
||||||
c.SpeechImpediment <= 100.0f);
|
|
||||||
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
|
||||||
}
|
|
||||||
|
|
||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Barotrauma
|
|||||||
public static bool EditWater, EditFire;
|
public static bool EditWater, EditFire;
|
||||||
public const float OxygenDistributionSpeed = 500.0f;
|
public const float OxygenDistributionSpeed = 500.0f;
|
||||||
public const float OxygenDeteriorationSpeed = 0.3f;
|
public const float OxygenDeteriorationSpeed = 0.3f;
|
||||||
public const float OxygenConsumptionSpeed = 1000.0f;
|
public const float OxygenConsumptionSpeed = 700.0f;
|
||||||
|
|
||||||
public const int WaveWidth = 32;
|
public const int WaveWidth = 32;
|
||||||
public static float WaveStiffness = 0.02f;
|
public static float WaveStiffness = 0.02f;
|
||||||
|
|||||||
Reference in New Issue
Block a user