* Move submodule to Godot * Update submodule AGAIN. * Update project files. * Remove WearableAnimatedSprite from prototypes. * Remove content repo resource copier. * Update submodule. * Fix resource handling. * Content.Client compiles by commenting out hands GUI. * Update submodule. * Fix prototype textures and update submodule. * Update Submodule. * Update submodule SOME MORE! * Random WiP shit I guess * Make omnisharp not choke on buildchecker. * Update submodule. * Highly WiP broken HandsGui code. * Ok maybe let's not insult omnisharp. * Fix annoying Omnisharp warning. * Update submodule. * Update submodule. * Hey I forgot to push this but it didn't conflict! * Fix hands GUI on godot. * Update submodule. * Obligatory submodule update. * Work on exports. * Work on exports. * Update submodule. * Update submodule. * Fix dumb case mismatch between content and engine * work pls. * This maybe. * Now! * Update submodule. * update submodule. * Some WiP work on exporting aaah. * OK READY FOR THE BUILDS SERVER. * Probably should've made those commits in a different order. * DO THE THING * update submodule. * Updates for effects system. * Update submodule. * Make file/line numbers show up on Windows Godot. * Set submodule to master.
62 lines
1.8 KiB
C#
62 lines
1.8 KiB
C#
using Content.Client.Interfaces.GameObjects;
|
|
using Content.Client.UserInterface;
|
|
using Content.Shared.GameObjects;
|
|
using SS14.Client.Interfaces.UserInterface;
|
|
using SS14.Shared.GameObjects;
|
|
using SS14.Shared.Interfaces.GameObjects;
|
|
using SS14.Shared.IoC;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Content.Client.GameObjects
|
|
{
|
|
public class HandsComponent : SharedHandsComponent, IHandsComponent
|
|
{
|
|
private readonly Dictionary<string, IEntity> hands = new Dictionary<string, IEntity>();
|
|
public string ActiveIndex { get; private set; }
|
|
|
|
public IEntity GetEntity(string index)
|
|
{
|
|
if (hands.TryGetValue(index, out var entity))
|
|
{
|
|
return entity;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public override void HandleComponentState(ComponentState state)
|
|
{
|
|
var cast = (HandsComponentState)state;
|
|
hands.Clear();
|
|
foreach (var hand in cast.Hands)
|
|
{
|
|
IEntity entity = null;
|
|
try
|
|
{
|
|
entity = Owner.EntityManager.GetEntity(hand.Value);
|
|
}
|
|
catch
|
|
{
|
|
// Nothing.
|
|
}
|
|
hands[hand.Key] = entity;
|
|
}
|
|
|
|
ActiveIndex = cast.ActiveIndex;
|
|
// Tell UI to update.
|
|
var uiMgr = IoCManager.Resolve<IUserInterfaceManager>();
|
|
if (!uiMgr.StateRoot.TryGetChild<HandsGui>("HandsGui", out var control))
|
|
{
|
|
control = new HandsGui();
|
|
uiMgr.StateRoot.AddChild(control);
|
|
}
|
|
control.UpdateHandIcons();
|
|
}
|
|
|
|
public void SendChangeHand(string index)
|
|
{
|
|
SendNetworkMessage(new ClientChangedHandMsg(index));
|
|
}
|
|
}
|
|
}
|