8 protected Widget m_Widget;
10 protected ref map<SCR_EntitiesEditorUIRule, SCR_BaseEditableEntityUIComponent> m_EntityWidgets =
new map<SCR_EntitiesEditorUIRule, SCR_BaseEditableEntityUIComponent>();
17 return m_EntityWidgets.IsEmpty();
35 ResourceName
layout = rule.GetLayout(info.GetEntityType());
37 entityUI.Init(info,
this);
38 return entityUI.GetWidget();
49 ResourceName
layout = rule.GetLayout(entity.GetEntityType());
51 return CreateWidgetForEntity(entity, rule,
layout);
62 return CreateWidgetForEntity(entity,
null,
layout);
69 if (m_EntityWidgets.Contains(rule))
76 entityUI.Init(entity,
this);
77 m_EntityWidgets.Insert(rule, entityUI);
79 return entityUI.GetWidget();
85 Widget entityWidget =
GetGame().GetWorkspace().CreateWidgets(
layout, m_Widget);
88 Debug.Error2(Type().ToString(),
string.Format(
"Unable to create widget '%1'!\n",
layout));
96 Debug.Error2(Type().ToString(),
string.Format(
"SCR_BaseEditableEntityUIComponent component is missing in the root widget of '%1'!\n",
layout));
98 entityWidget.RemoveFromHierarchy();
111 if (!m_EntityWidgets.Find(rule, entityUI))
115 m_EntityWidgets.Remove(rule);
119 protected void SetFactionColor()
123 GetWidget().SetColor(
UIColors.EDITOR_ICON_COLOR_NEUTRAL);
129 GetWidget().SetColor(faction.GetFactionColor());
131 GetWidget().SetColor(
UIColors.EDITOR_ICON_COLOR_DESTROYED);
133 GetWidget().SetColor(
UIColors.EDITOR_ICON_COLOR_NEUTRAL);
137 protected void RefreshSlot()
141 entityUI.OnRefresh(
this);
144 GetGame().GetCallqueue().CallLater(SetFactionColor);
148 protected void ResetSlot()
156 GetGame().GetCallqueue().CallLater(SetFactionColor);
166 vector UpdateSlot(
int screenW,
int screenH, vector posCenter, vector posCam)
176 if (!entity || !entity.GetOwner())
185 if (entity.GetOnUIRefresh())
186 entity.GetOnUIRefresh().Insert(RefreshSlot);
188 if (entity.GetOnUIReset())
189 entity.GetOnUIReset().Insert(ResetSlot);
198 m_Widget.RemoveFromHierarchy();
205 m_Entity.GetOnUIRefresh().Remove(RefreshSlot);
208 m_Entity.GetOnUIReset().Remove(ResetSlot);
228 override void HandlerAttached(Widget w)