mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
RobustToolbox projects should be named Robust.* This PR changes the RobustToolbox projects from SS14.* to Robust.* Updates SS14.* prefixes/namespaces to Robust.* Updates SpaceStation14.sln to RobustToolbox.sln Updates MSBUILD/SS14.* to MSBUILD/Robust.* Updates CSProject and MSBuild references for the above Updates git_helper.py Removes Runserver and Runclient as they are unusable
76 lines
2.9 KiB
C#
76 lines
2.9 KiB
C#
using Robust.Client.Interfaces.ResourceManagement;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.ViewVariables.Editors;
|
|
using Robust.Client.ViewVariables.Instances;
|
|
using Robust.Shared.Utility;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Robust.Client.ViewVariables.Traits
|
|
{
|
|
internal class ViewVariablesTraitMembers : ViewVariablesTrait
|
|
{
|
|
private readonly IViewVariablesManagerInternal _vvm;
|
|
private readonly IResourceCache _resourceCache;
|
|
|
|
private VBoxContainer _memberList;
|
|
|
|
public override void Initialize(ViewVariablesInstanceObject instance)
|
|
{
|
|
base.Initialize(instance);
|
|
_memberList = new VBoxContainer {SeparationOverride = 0};
|
|
instance.AddTab("Members", _memberList);
|
|
}
|
|
|
|
public ViewVariablesTraitMembers(IViewVariablesManagerInternal vvm, IResourceCache resourceCache)
|
|
{
|
|
_resourceCache = resourceCache;
|
|
_vvm = vvm;
|
|
}
|
|
|
|
public override async void Refresh()
|
|
{
|
|
_memberList.DisposeAllChildren();
|
|
|
|
if (Instance.Object != null)
|
|
{
|
|
foreach (var control in ViewVariablesInstance.LocalPropertyList(Instance.Object,
|
|
Instance.ViewVariablesManager, _resourceCache))
|
|
{
|
|
_memberList.AddChild(control);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DebugTools.Assert(Instance.Session != null);
|
|
|
|
var blob = await Instance.ViewVariablesManager.RequestData<ViewVariablesBlobMembers>(
|
|
Instance.Session, new ViewVariablesRequestMembers());
|
|
|
|
var otherStyle = false;
|
|
foreach (var propertyData in blob.Members)
|
|
{
|
|
var propertyEdit = new ViewVariablesPropertyControl(_vvm, _resourceCache);
|
|
propertyEdit.SetStyle(otherStyle = !otherStyle);
|
|
var editor = propertyEdit.SetProperty(propertyData);
|
|
// TODO: should this maybe not be hardcoded?
|
|
if (editor is ViewVariablesPropertyEditorReference refEditor)
|
|
{
|
|
refEditor.OnPressed += () =>
|
|
Instance.ViewVariablesManager.OpenVV(
|
|
new ViewVariablesSessionRelativeSelector(Instance.Session.SessionId,
|
|
new object[] {new ViewVariablesMemberSelector(propertyData.PropertyIndex)}));
|
|
}
|
|
|
|
editor.OnValueChanged += o =>
|
|
{
|
|
Instance.ViewVariablesManager.ModifyRemote(Instance.Session,
|
|
new object[] {new ViewVariablesMemberSelector(propertyData.PropertyIndex)}, o);
|
|
};
|
|
|
|
_memberList.AddChild(propertyEdit);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|