SendMessage(new AgentIDCardJobChangedMessage(newJob));
}
- public void OnJobIconChanged(string newJobIcon)
+ public void OnJobIconChanged(string newJobIconId)
{
- SendMessage(new AgentIDCardJobIconChangedMessage(newJobIcon));
+ SendMessage(new AgentIDCardJobIconChangedMessage(newJobIconId));
}
/// <summary>
_window.SetCurrentName(cast.CurrentName);
_window.SetCurrentJob(cast.CurrentJob);
- _window.SetAllowedIcons(cast.Icons);
+ _window.SetAllowedIcons(cast.Icons, cast.CurrentJobIconId);
}
protected override void Dispose(bool disposing)
JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text);
}
- public void SetAllowedIcons(HashSet<string> icons)
+ public void SetAllowedIcons(HashSet<string> icons, string currentJobIconId)
{
IconGrid.DisposeAllChildren();
jobIconButton.AddChild(jobIconTexture);
jobIconButton.OnPressed += _ => _bui.OnJobIconChanged(jobIcon.ID);
IconGrid.AddChild(jobIconButton);
+
+ if (jobIconId.Equals(currentJobIconId))
+ jobIconButton.Pressed = true;
+
i++;
}
}
if (!TryComp<IdCardComponent>(uid, out var idCard))
return;
- var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", component.Icons);
+ var state = new AgentIDCardBoundUserInterfaceState(idCard.FullName ?? "", idCard.JobTitle ?? "", idCard.JobIcon ?? "", component.Icons);
_uiSystem.SetUiState(uid, AgentIDCardUiKey.Key, state);
}
return;
}
- if (!_prototypeManager.TryIndex<StatusIconPrototype>(args.JobIcon, out var jobIcon))
+ if (!_prototypeManager.TryIndex<StatusIconPrototype>(args.JobIconId, out var jobIcon))
{
return;
}
public readonly HashSet<string> Icons;
public string CurrentName { get; }
public string CurrentJob { get; }
+ public string CurrentJobIconId { get; }
- public AgentIDCardBoundUserInterfaceState(string currentName, string currentJob, HashSet<string> icons)
+ public AgentIDCardBoundUserInterfaceState(string currentName, string currentJob, string currentJobIconId, HashSet<string> icons)
{
Icons = icons;
CurrentName = currentName;
CurrentJob = currentJob;
+ CurrentJobIconId = currentJobIconId;
}
}
[Serializable, NetSerializable]
public sealed class AgentIDCardJobIconChangedMessage : BoundUserInterfaceMessage
{
- public string JobIcon { get; }
+ public string JobIconId { get; }
- public AgentIDCardJobIconChangedMessage(string jobIcon)
+ public AgentIDCardJobIconChangedMessage(string jobIconId)
{
- JobIcon = jobIcon;
+ JobIconId = jobIconId;
}
}
}