[feat] New Interface (#10)

This commit is contained in:
rhailrake
2023-05-01 16:36:41 +06:00
committed by Aviu00
parent c14cabae3a
commit 0deda77a06
71 changed files with 1855 additions and 136 deletions

View File

@@ -1,4 +1,3 @@
using System.Globalization;
using System.Linq;
using System.Numerics;
using Content.Client.Administration.Managers;
@@ -19,6 +18,8 @@ using Content.Shared.Damage.ForceSay;
using Content.Shared.Examine;
using Content.Shared.Input;
using Content.Shared.Radio;
using Content.Shared.White;
using Content.Shared.White.Utils;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Player;
@@ -235,19 +236,28 @@ public sealed class ChatUIController : UIController
}
ChatBox chatBox;
string? chatSizeRaw;
//White modification start
string chatSizeRaw;
Vector2 chatSize;
//End
switch (UIManager.ActiveScreen)
{
case DefaultGameScreen defaultScreen:
chatBox = defaultScreen.ChatBox;
chatSizeRaw = _config.GetCVar(CCVars.DefaultScreenChatSize);
SetChatSizing(chatSizeRaw, defaultScreen, setting);
//White modification start
chatSizeRaw = _config.GetCVar(WhiteCVars.DefaultChatSize);
chatSize = Vector2Utils.ParseVector2FromString(chatSizeRaw, ';');
//End
SetChatSizing(chatSize, defaultScreen, setting);
break;
case SeparatedChatGameScreen separatedScreen:
chatBox = separatedScreen.ChatBox;
chatSizeRaw = _config.GetCVar(CCVars.SeparatedScreenChatSize);
SetChatSizing(chatSizeRaw, separatedScreen, setting);
//White modification start
chatSizeRaw = _config.GetCVar(WhiteCVars.SeparatedChatSize);
chatSize = Vector2Utils.ParseVector2FromString(chatSizeRaw, ';');
//End
SetChatSizing(chatSize, separatedScreen, setting);
break;
default:
// this could be better?
@@ -261,7 +271,7 @@ public sealed class ChatUIController : UIController
chatBox.Main = setting;
}
private void SetChatSizing(string sizing, InGameScreen screen, bool setting)
private void SetChatSizing(Vector2 sizing, InGameScreen screen, bool setting)
{
if (!setting)
{
@@ -271,19 +281,9 @@ public sealed class ChatUIController : UIController
screen.OnChatResized += StoreChatSize;
if (string.IsNullOrEmpty(sizing))
{
return;
}
var split = sizing.Split(",");
var chatSize = new Vector2(
float.Parse(split[0], CultureInfo.InvariantCulture),
float.Parse(split[1], CultureInfo.InvariantCulture));
screen.SetChatSize(chatSize);
//White modification start
screen.SetChatSize(sizing);
//End
}
private void StoreChatSize(Vector2 size)
@@ -293,15 +293,17 @@ public sealed class ChatUIController : UIController
throw new Exception("Cannot get active screen!");
}
var stringSize =
$"{size.X.ToString(CultureInfo.InvariantCulture)},{size.Y.ToString(CultureInfo.InvariantCulture)}";
switch (UIManager.ActiveScreen)
{
case DefaultGameScreen _:
_config.SetCVar(CCVars.DefaultScreenChatSize, stringSize);
//White modification start
_config.SetCVar(WhiteCVars.DefaultChatSize, size.ConvertToString(';'));
//End
break;
case SeparatedChatGameScreen _:
_config.SetCVar(CCVars.SeparatedScreenChatSize, stringSize);
//White modification start
_config.SetCVar(WhiteCVars.SeparatedChatSize, size.ConvertToString(';'));
//End
break;
default:
// do nothing

View File

@@ -7,13 +7,13 @@
HorizontalExpand="True"
VerticalExpand="True"
MinSize="465 225">
<PanelContainer HorizontalExpand="True" VerticalExpand="True">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#25252AAA" />
</PanelContainer.PanelOverride>
<PanelContainer HorizontalExpand="True" VerticalExpand="True" StyleClasses="FuckyWuckyBackground" >
<BoxContainer Orientation="Vertical" SeparationOverride="4" HorizontalExpand="True" VerticalExpand="True">
<OutputPanel Name="Contents" HorizontalExpand="True" VerticalExpand="True" Margin="8 8 8 4" />
<OutputPanel Name="Contents" HorizontalExpand="True" VerticalExpand="True" Margin="2 2 2 2" >
<OutputPanel.StyleBoxOverride>
<graphics:StyleBoxFlat PaddingRight="16" />
</OutputPanel.StyleBoxOverride>
</OutputPanel>
<controls:ChatInputBox HorizontalExpand="True" Name="ChatInput" Access="Public" Margin="2"/>
</BoxContainer>
</PanelContainer>