You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
switch (Movie.Stack.GetCurrentClass())
{
case class'UIFacility_Academy':
StaffSlots.AddItem(Spawn(class'UIFacility_AcademySlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
break;
case class'UIFacility_AdvancedWarfareCenter':
if (StaffSlot.IsSoldierSlot())
StaffSlots.AddItem(Spawn(class'UIFacility_AdvancedWarfareCenterSlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
else
StaffSlots.AddItem(Spawn(class'UIFacility_StaffSlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
break;
case class'UIFacility_PsiLab':
if (StaffSlot.IsSoldierSlot())
StaffSlots.AddItem(Spawn(class'UIFacility_PsiLabSlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
else
StaffSlots.AddItem(Spawn(class'UIFacility_StaffSlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
break;
default:
StaffSlots.AddItem(Spawn(class'UIFacility_StaffSlot', self).InitStaffSlot(self, LocationRef, i, onStaffUpdatedDelegate));
break;
}
which is bad because it doesn't allow new Staff Slot types without major hackery using UIScreenListeners and also doesn't allow overrides of UIFacility classes.
A mechanism would be needed to expand this behavior to allow custom UIFacility_StaffSlot classes.
The text was updated successfully, but these errors were encountered:
My idea would be adding a property + getter to X2StaffSlotTemplate that returns the UI class for the staff slot. That way, we can break up this whole switch statement and replace it with something more sensible.
Considerations: Adding a delegate / member to X2StaffSlotTemplate is a change in data layout, which is fine at the moment.
However, if it were to be made a native class in the future (not that I expect it to), this approach would break, in addition to mods that were to use it.
A safer option would be making it a function that reads from a config map, but can be overridden by subclasses.
Currently,
UIFacilityStaffContainer
does this:which is bad because it doesn't allow new Staff Slot types without major hackery using UIScreenListeners and also doesn't allow overrides of
UIFacility
classes.A mechanism would be needed to expand this behavior to allow custom
UIFacility_StaffSlot
classes.The text was updated successfully, but these errors were encountered: