mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-03 10:37:05 +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
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Robust.Client.GameObjects.EntitySystems
|
|
{
|
|
sealed class AppearanceSystem : EntitySystem
|
|
{
|
|
public AppearanceSystem()
|
|
{
|
|
EntityQuery = new TypeEntityQuery(typeof(AppearanceComponent));
|
|
}
|
|
|
|
public override void FrameUpdate(float frameTime)
|
|
{
|
|
foreach (var entity in RelevantEntities)
|
|
{
|
|
var component = entity.GetComponent<AppearanceComponent>();
|
|
if (component.AppearanceDirty)
|
|
{
|
|
UpdateComponent(component);
|
|
component.AppearanceDirty = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void UpdateComponent(AppearanceComponent component)
|
|
{
|
|
foreach (var visualizer in component.Visualizers)
|
|
{
|
|
switch (visualizer)
|
|
{
|
|
case AppearanceComponent.SpriteLayerToggle spriteLayerToggle:
|
|
UpdateSpriteLayerToggle(component, spriteLayerToggle);
|
|
break;
|
|
|
|
default:
|
|
visualizer.OnChangeData(component);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void UpdateSpriteLayerToggle(AppearanceComponent component, AppearanceComponent.SpriteLayerToggle toggle)
|
|
{
|
|
component.TryGetData(toggle.Key, out bool visible);
|
|
var sprite = component.Owner.GetComponent<SpriteComponent>();
|
|
sprite.LayerSetVisible(toggle.SpriteLayer, visible);
|
|
}
|
|
}
|
|
}
|