(3a5d98b) v0.9.6.0
This commit is contained in:
@@ -319,6 +319,14 @@ namespace Barotrauma
|
||||
RelativeSpacing = panelSpacing
|
||||
};
|
||||
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
if (innerFrame != null)
|
||||
{
|
||||
innerFrame.RectTransform.MaxSize = new Point(int.MaxValue, GameMain.GraphicsHeight - 50);
|
||||
}
|
||||
};
|
||||
|
||||
var panelContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), innerFrame.RectTransform, Anchor.Center), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
@@ -440,6 +448,14 @@ namespace Barotrauma
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
if (panelContainer != null && sideBar != null)
|
||||
{
|
||||
sideBar.RectTransform.MaxSize = new Point(650, panelContainer.RectTransform.Rect.Height);
|
||||
}
|
||||
};
|
||||
|
||||
//player info panel ------------------------------------------------------------
|
||||
|
||||
myCharacterFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.5f), sideBar.RectTransform));
|
||||
@@ -1781,24 +1797,23 @@ namespace Barotrauma
|
||||
RelativeSpacing = 0.03f
|
||||
};
|
||||
|
||||
var headerContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedPlayerFrame.RectTransform), isHorizontal: true)
|
||||
var headerContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), paddedPlayerFrame.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft)
|
||||
{
|
||||
Stretch = true
|
||||
};
|
||||
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(0.75f, 1.0f), headerContainer.RectTransform),
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), headerContainer.RectTransform),
|
||||
text: selectedClient.Name, font: GUI.LargeFont);
|
||||
nameText.Text = ToolBox.LimitString(nameText.Text, nameText.Font, nameText.Rect.Width);
|
||||
|
||||
if (selectedClient.SteamID != 0 && Steam.SteamManager.IsInitialized)
|
||||
{
|
||||
var viewSteamProfileButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), headerContainer.RectTransform, Anchor.TopCenter),
|
||||
var viewSteamProfileButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), headerContainer.RectTransform, Anchor.TopCenter) { MaxSize = new Point(int.MaxValue, (int)(40 * GUI.Scale)) },
|
||||
TextManager.Get("ViewSteamProfile"))
|
||||
{
|
||||
UserData = selectedClient
|
||||
};
|
||||
|
||||
GUITextBlock.AutoScaleAndNormalize(nameText, viewSteamProfileButton.TextBlock);
|
||||
|
||||
viewSteamProfileButton.TextBlock.AutoScale = true;
|
||||
viewSteamProfileButton.OnClicked = (bt, userdata) =>
|
||||
{
|
||||
Steam.SteamManager.Instance.Overlay.OpenUrl("https://steamcommunity.com/profiles/" + selectedClient.SteamID.ToString());
|
||||
@@ -2054,7 +2069,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
var closeButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonAreaLower.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("Close"))
|
||||
TextManager.Get("Close"), style: "GUIButtonLarge")
|
||||
{
|
||||
IgnoreLayoutGroups = true,
|
||||
OnClicked = ClosePlayerFrame
|
||||
@@ -2409,6 +2424,13 @@ namespace Barotrauma
|
||||
AbsoluteOffset = new Point(characterInfoFrame.Rect.Right - characterInfoFrame.Rect.Width, button.Rect.Bottom)
|
||||
});
|
||||
|
||||
characterInfoFrame.RectTransform.SizeChanged += () =>
|
||||
{
|
||||
if (characterInfoFrame == null || HeadSelectionList?.RectTransform == null || button == null) { return; }
|
||||
HeadSelectionList.RectTransform.Resize(new Point(characterInfoFrame.Rect.Width, (characterInfoFrame.Rect.Bottom - button.Rect.Bottom) + characterInfoFrame.Rect.Height * 2));
|
||||
HeadSelectionList.RectTransform.AbsoluteOffset = new Point(characterInfoFrame.Rect.Right - characterInfoFrame.Rect.Width, button.Rect.Bottom);
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), HeadSelectionList.RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black)
|
||||
{
|
||||
UserData = "outerglow",
|
||||
@@ -2446,7 +2468,7 @@ namespace Barotrauma
|
||||
headSprite.SourceRect = new Rectangle(CharacterInfo.CalculateOffset(headSprite, head.Value.ToPoint()), headSprite.SourceRect.Size);
|
||||
characterSprites.Add(headSprite);
|
||||
|
||||
if (row == null || itemsInRow >= 4)
|
||||
if (itemsInRow >= 4 || row == null || gender != (Gender)row.UserData)
|
||||
{
|
||||
row = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.333f), HeadSelectionList.Content.RectTransform), true)
|
||||
{
|
||||
@@ -2536,6 +2558,14 @@ namespace Barotrauma
|
||||
JobSelectionFrame = new GUIFrame(new RectTransform(frameSize, GUI.Canvas, Anchor.TopLeft)
|
||||
{ AbsoluteOffset = new Point(characterInfoFrame.Rect.Right - frameSize.X, characterInfoFrame.Rect.Bottom) }, "GUIFrameListBox");
|
||||
|
||||
characterInfoFrame.RectTransform.SizeChanged += () =>
|
||||
{
|
||||
if (characterInfoFrame == null || JobSelectionFrame?.RectTransform == null) { return; }
|
||||
Point size = new Point(characterInfoFrame.Rect.Width, characterInfoFrame.Rect.Height * 2);
|
||||
JobSelectionFrame.RectTransform.Resize(size);
|
||||
JobSelectionFrame.RectTransform.AbsoluteOffset = new Point(characterInfoFrame.Rect.Right - size.X, characterInfoFrame.Rect.Bottom);
|
||||
};
|
||||
|
||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), JobSelectionFrame.RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black)
|
||||
{
|
||||
UserData = "outerglow",
|
||||
@@ -2600,32 +2630,24 @@ namespace Barotrauma
|
||||
image.Visible = currVisible == (variantIndex + 1);
|
||||
}
|
||||
|
||||
var variantButton = new GUIButton(new RectTransform(new Vector2(0.15f), jobButton.RectTransform, scaleBasis: ScaleBasis.BothWidth) { RelativeOffset = new Vector2(0.05f, 0.05f + 0.2f * variantIndex) }, (variantIndex + 1).ToString(), style: null)
|
||||
var variantButton = CreateJobVariantButton(jobPrefab, variantIndex, images.Length, jobButton);
|
||||
variantButton.OnClicked = (btn, obj) =>
|
||||
{
|
||||
Color = new Color(50, 50, 50, 200),
|
||||
HoverColor = Color.Gray * 0.75f,
|
||||
PressedColor = Color.Black * 0.75f,
|
||||
SelectedColor = new Color(45, 70, 100, 200),
|
||||
UserData = new Pair<JobPrefab, int>(jobPrefab.First, variantIndex+1),
|
||||
OnClicked = (btn, obj) =>
|
||||
currSelected.Selected = false;
|
||||
int k = ((Pair<JobPrefab, int>)obj).Second;
|
||||
btn.Parent.UserData = obj;
|
||||
for (int j = 0; j < images.Length; j++)
|
||||
{
|
||||
currSelected.Selected = false;
|
||||
int k = ((Pair<JobPrefab, int>)obj).Second;
|
||||
btn.Parent.UserData = obj;
|
||||
for (int j = 0; j < images.Length; j++)
|
||||
foreach (GUIImage image in images[j])
|
||||
{
|
||||
foreach (GUIImage image in images[j])
|
||||
{
|
||||
image.Visible = k == (j + 1);
|
||||
}
|
||||
image.Visible = k == (j + 1);
|
||||
}
|
||||
currSelected = btn;
|
||||
currSelected.Selected = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
currSelected = btn;
|
||||
currSelected.Selected = true;
|
||||
|
||||
return false;
|
||||
};
|
||||
if (currVisible == (variantIndex + 1))
|
||||
{
|
||||
currSelected = variantButton;
|
||||
@@ -2818,7 +2840,7 @@ namespace Barotrauma
|
||||
|
||||
subList.Enabled = !enabled && AllowSubSelection;
|
||||
shuttleList.Enabled = !enabled && GameMain.Client.HasPermission(ClientPermissions.SelectSub);
|
||||
StartButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound) && GameMain.Client.GameStarted && !enabled;
|
||||
StartButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound) && !GameMain.Client.GameStarted && !enabled;
|
||||
|
||||
if (campaignViewButton != null) { campaignViewButton.Visible = enabled; }
|
||||
|
||||
@@ -2943,34 +2965,28 @@ namespace Barotrauma
|
||||
}
|
||||
if (images.Length > 1)
|
||||
{
|
||||
var variantButton = new GUIButton(new RectTransform(new Vector2(0.15f), slot.RectTransform, scaleBasis: ScaleBasis.BothWidth) { RelativeOffset = new Vector2(0.05f, 0.25f + 0.2f * variantIndex) }, (variantIndex + 1).ToString(), style: null)
|
||||
var variantButton = CreateJobVariantButton(jobPrefab, variantIndex, images.Length, slot);
|
||||
variantButton.OnClicked = (btn, obj) =>
|
||||
{
|
||||
Color = new Color(50, 50, 50, 200),
|
||||
HoverColor = Color.Gray * 0.75f,
|
||||
PressedColor = Color.Black * 0.75f,
|
||||
SelectedColor = new Color(45, 70, 100, 200),
|
||||
Selected = jobPrefab.Second == (variantIndex + 1),
|
||||
UserData = new Pair<JobPrefab, int>(jobPrefab.First, variantIndex + 1),
|
||||
OnClicked = (btn, obj) =>
|
||||
{
|
||||
int k = ((Pair<JobPrefab, int>)obj).Second;
|
||||
btn.Parent.UserData = obj;
|
||||
UpdateJobPreferences(listBox);
|
||||
return false;
|
||||
}
|
||||
int k = ((Pair<JobPrefab, int>)obj).Second;
|
||||
btn.Parent.UserData = obj;
|
||||
UpdateJobPreferences(listBox);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//info button
|
||||
new GUIButton(new RectTransform(new Vector2(0.15f), slot.RectTransform, Anchor.TopLeft, scaleBasis: ScaleBasis.BothWidth) { RelativeOffset = new Vector2(0.05f) }, style: "GUIButtonInfo")
|
||||
new GUIButton(new RectTransform(new Vector2(0.2f), slot.RectTransform, Anchor.TopLeft, scaleBasis: ScaleBasis.BothHeight)
|
||||
{ RelativeOffset = new Vector2(0.05f) },
|
||||
style: "GUIButtonInfo")
|
||||
{
|
||||
UserData = jobPrefab.First,
|
||||
OnClicked = ViewJobInfo
|
||||
};
|
||||
|
||||
//remove button
|
||||
new GUIButton(new RectTransform(new Vector2(0.15f), slot.RectTransform, Anchor.TopRight, scaleBasis: ScaleBasis.BothWidth) { RelativeOffset = new Vector2(0.05f) }, style: "GUICancelButton")
|
||||
new GUIButton(new RectTransform(new Vector2(0.2f), slot.RectTransform, Anchor.TopRight, scaleBasis: ScaleBasis.BothHeight) { RelativeOffset = new Vector2(0.05f) }, style: "GUICancelButton")
|
||||
{
|
||||
UserData = i,
|
||||
OnClicked = (btn, obj) =>
|
||||
@@ -3013,6 +3029,24 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private GUIButton CreateJobVariantButton(Pair<JobPrefab, int> jobPrefab, int variantIndex, int variantCount, GUIComponent slot)
|
||||
{
|
||||
float relativeHeight = Math.Min(0.7f / variantCount, 0.2f);
|
||||
|
||||
var btn = new GUIButton(new RectTransform(new Vector2(relativeHeight), slot.RectTransform, scaleBasis: ScaleBasis.BothHeight)
|
||||
{ RelativeOffset = new Vector2(0.05f, 0.25f + relativeHeight * 1.05f * variantIndex) },
|
||||
(variantIndex + 1).ToString(), style: null)
|
||||
{
|
||||
Color = new Color(50, 50, 50, 200),
|
||||
HoverColor = Color.Gray * 0.75f,
|
||||
PressedColor = Color.Black * 0.75f,
|
||||
SelectedColor = new Color(45, 70, 100, 200),
|
||||
Selected = jobPrefab.Second == (variantIndex + 1),
|
||||
UserData = new Pair<JobPrefab, int>(jobPrefab.First, variantIndex + 1),
|
||||
};
|
||||
return btn;
|
||||
}
|
||||
|
||||
public Pair<string, string> FailedSelectedSub;
|
||||
public Pair<string, string> FailedSelectedShuttle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user