mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 15:22:27 +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
100 lines
2.3 KiB
C#
100 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Robust.Client.Graphics.Drawing;
|
|
using Robust.Client.Interfaces.GameObjects.Components;
|
|
using Robust.Shared.Log;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Robust.Client.UserInterface.Controls
|
|
{
|
|
[ControlWrap(typeof(GodotGlue.SpriteView), "res://Engine/Scenes/SpriteMirror/SpriteView.tscn")]
|
|
public class SpriteView : Control
|
|
{
|
|
ISpriteProxy Mirror;
|
|
ISpriteComponent _sprite;
|
|
|
|
public ISpriteComponent Sprite
|
|
{
|
|
get => _sprite;
|
|
set
|
|
{
|
|
_sprite = value;
|
|
if (Mirror != null)
|
|
{
|
|
Mirror.Dispose();
|
|
Mirror = null;
|
|
}
|
|
|
|
if (value != null)
|
|
{
|
|
Mirror = value.CreateProxy();
|
|
Mirror.AttachToControl(this);
|
|
UpdateMirrorPosition();
|
|
}
|
|
}
|
|
}
|
|
|
|
public SpriteView() : base()
|
|
{
|
|
}
|
|
|
|
public SpriteView(string name) : base(name)
|
|
{
|
|
}
|
|
|
|
public SpriteView(Godot.Control control) : base(control)
|
|
{
|
|
}
|
|
|
|
protected override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
RectClipContent = true;
|
|
}
|
|
|
|
protected override void Resized()
|
|
{
|
|
base.Resized();
|
|
UpdateMirrorPosition();
|
|
}
|
|
|
|
void UpdateMirrorPosition()
|
|
{
|
|
if (Mirror == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Mirror.Offset = Size / 2;
|
|
}
|
|
|
|
protected override Vector2 CalculateMinimumSize()
|
|
{
|
|
// TODO: make this not hardcoded.
|
|
// It'll break on larger things.
|
|
return new Vector2(32, 32);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
Mirror?.Dispose();
|
|
}
|
|
|
|
protected internal override void Draw(DrawingHandleScreen handle)
|
|
{
|
|
if (GameController.OnGodot || _sprite == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
handle.DrawEntity(_sprite.Owner, GlobalPosition + Size / 2);
|
|
}
|
|
}
|
|
}
|