4 protected ref array<ref SCR_BaseEntitiesEditorUIEffect> m_aEffects;
7 protected ref array<ref SCR_EditableEntityUISlotSize> m_aSlotSizes;
10 protected ResourceName m_SlotPrefab;
13 protected ref map<EEditableEntityState, SCR_BaseEntitiesEditorUIEffect> m_aEffectsMap =
new map<EEditableEntityState, SCR_BaseEntitiesEditorUIEffect>();
14 protected WorkspaceWidget m_Workspace;
15 protected InputManager m_InputManager;
30 if (slot || !createIfNull)
45 slotWidget.RemoveFromHierarchy();
47 slotWidget =
GetGame().GetWorkspace().CreateWidget(WidgetType.FrameWidgetTypeID, WidgetFlags.VISIBLE,
new Color(1, 1, 1, 1), 0,
GetWidget());
49 slotWidget.AddHandler(sceneSlot);
56 foreach (SCR_EditableEntityUISlotSize slotSizeStruct:
m_aSlotSizes)
58 if (slotSizeStruct.GetType() == entityType)
60 slotSize = slotSizeStruct.GetSize();
65 slotSize = slotSizeStruct.GetSize();
70 FrameSlot.SetSize(slotWidget, slotSize, slotSize);
72 InsertSlot(entity, slot);
73 ApplyAutoEffect(entity, sceneSlot);
78 if (ruleTracker.GetRule().IsDependent())
79 ruleTracker.AddEntity(entity);
88 bool deleted = super.DeleteSlot(entity, forced);
100 override bool OnMouseEnter(Widget w,
int x,
int y)
110 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
120 protected void OnInputDeviceIsGamepad(
bool isGamepad)
127 protected void OnEffect(
EEditableEntityState state, set<SCR_EditableEntityComponent> entitiesInsert, set<SCR_EditableEntityComponent> entitiesRemove)
134 if (!m_mEntitySlots.Find(entity, slot))
137 ApplyAutoEffect(entity, slot);
150 if (!m_mEntitySlots.Find(entity, slot))
153 effect.ApplyOn(slot.GetWidget());
166 if (entity.HasEntityState(effectState))
168 effect.ApplyOn(slot.GetWidget());
180 void OnMenuUpdate(
float tDelta)
192 vector posCenter = Vector(screenW / 2, screenH / 2, 0);
194 vector transformCam[4];
195 GetGame().GetWorld().GetCurrentCamera(transformCam);
196 vector posCam = transformCam[3];
198 if (!m_bInteractive || !m_CursorComponent || (m_InputManager &&
m_InputManager.IsUsingMouseAndKeyboard()))
203 entitySlot.UpdateSlot(screenW, screenH, posCenter, posCam);
215 dis = vector.DistanceSq(cursorPos, entitySlot.UpdateSlot(screenW, screenH, posCenter, posCam));
216 if (dis < nearestDis && !entitySlot.IsPreview())
219 nearestSlot = entitySlot;
233 protected void OnMenuFocusLost()
236 GetGame().GetCallqueue().CallLater(OnMenuUpdate, 10,
true, 0);
240 protected void OnMenuFocusGained()
242 GetGame().GetCallqueue().Remove(OnMenuUpdate);
250 override void HandlerAttachedScripted(Widget w)
263 menu.GetOnMenuUpdate().Insert(OnMenuUpdate);
264 menu.GetOnMenuFocusLost().Insert(OnMenuFocusLost);
265 menu.GetOnMenuFocusGained().Insert(OnMenuFocusGained);
267 if (!menu.IsFocused())
277 GetGame().OnInputDeviceIsGamepadInvoker().Insert(OnInputDeviceIsGamepad);
297 stateManager.GetOnChanged().Insert(OnEffect);
303 super.HandlerAttachedScripted(w);
307 override void HandlerDeattached(Widget w)
309 super.HandlerDeattached(w);
316 menu.GetOnMenuUpdate().Remove(OnMenuUpdate);
317 menu.GetOnMenuFocusLost().Remove(OnMenuFocusLost);
318 menu.GetOnMenuFocusGained().Remove(OnMenuFocusGained);
321 GetGame().OnInputDeviceIsGamepadInvoker().Remove(OnInputDeviceIsGamepad);
328 if (m_RuleTrackers.Find(rule, ruleTracker))
345 if (stateManager && stateManager.GetOnChanged())
346 stateManager.GetOnChanged().Remove(OnEffect);
353 class SCR_EditableEntityUISlotSize