8 private string m_sEntityNameWidgetName;
14 private string m_sEnityImageWidgetName;
65 private ref
Color m_DisabledColor;
70 [
Attribute(
"",
UIWidgets.EditBox,
"Name of frame widget which holds Content meant for Horizontal scrolling")]
82 private Widget m_wAssetCardName
95 private ref SCR_HorizontalScrollAnimationComponent m_HorizontalScrollComponent;
113 if (!entityBudgetCost)
119 if (budgetCostTextWidget)
120 budgetCostTextWidget.SetText(entityBudgetCost.GetBudgetValue().ToString());
127 void UpdateBlockingBudget(SCR_UIInfo blockingBudgetInfo = null)
132 bool canPlace = blockingBudgetInfo == null;
138 if (blockingBudgetInfo)
139 blockingBudgetInfo.SetIconTo(exceedBudgetIcon);
148 void InitCard(
int prefabID, SCR_UIInfo info, ResourceName prefab, SCR_UIInfo blockingBudgetInfo = null, SCR_ContentBrowserEditorComponent contentBrowser = null)
155 TextWidget entityNameWidget = TextWidget.Cast(m_wWidget.FindAnyWidget(m_sEntityNameWidgetName));
162 info.SetNameTo(entityNameWidget);
164 SCR_EditableEntityUIInfo infoCard = SCR_EditableEntityUIInfo.Cast(info);
167 SCR_EditableEntityUIInfoColored colorOverwriteInfo = SCR_EditableEntityUIInfoColored.Cast(infoCard);
170 if (!colorOverwriteInfo)
176 Color color = Color.FromInt(faction.GetFactionColor().PackToInt());
182 factionColor = m_wWidget.FindAnyWidget(factionColorName);
184 factionColor.SetColor(color);
190 Widget colorOverlay = m_wWidget.FindAnyWidget(
"ColorOverlay");
200 SCR_EditableEntityBaseSlotUIComponent iconSlot = SCR_EditableEntityBaseSlotUIComponent.Cast(iconSlotWidget.FindHandler(SCR_EditableEntityBaseSlotUIComponent));
203 SCR_EditableEntityUIConfig entityUIConfig = SCR_EditableEntityUIConfig.GetConfig();
206 array<ref SCR_EntitiesEditorUIRule> entityRules = entityUIConfig.
GetRules();
207 foreach (SCR_EntitiesEditorUIRule rule: entityRules)
223 ImageWidget imageOverlayWidget = ImageWidget.Cast(m_wWidget.FindAnyWidget(
m_sImageOverlayName));
234 UpdateBlockingBudget(blockingBudgetInfo);
239 ImageWidget traitIcon;
243 contentBrowser = SCR_ContentBrowserEditorComponent.Cast(SCR_ContentBrowserEditorComponent.GetInstance(SCR_ContentBrowserEditorComponent,
false,
true));
245 if (!contentBrowser || contentBrowser.AreFactionsShownOnContentCards())
249 traitWidget.SetVisible(
true);
250 traitIcon.LoadImageTexture(0, faction.GetUIInfo().GetIconPath());
259 SCR_EditorModeEntity modeEntity = editorManager.GetCurrentModeEntity();
261 editorMode = modeEntity.GetModeType();
265 SCR_EditableEntityCore core = SCR_EditableEntityCore.Cast(SCR_EditableEntityCore.GetInstance(SCR_EditableEntityCore));
269 array<EEditableEntityLabel> labels = {};
270 SCR_UIInfo labelInfo;
273 if (!core.GetLabelUIInfoIfValid(labels[i], editorMode, labelInfo))
280 traitWidget.SetVisible(
true);
283 SCR_LinkTooltipTargetEditorUIComponent tooltip = SCR_LinkTooltipTargetEditorUIComponent.Cast(traitWidget.FindHandler(SCR_LinkTooltipTargetEditorUIComponent));
299 Widget areaWidget = m_wWidget.FindAnyWidget(
m_sAreaName);
307 if (entityNameWidget && prefab)
309 string path = prefab.GetPath();
310 array<string> pathNames = {};
311 path.Split(
"/", pathNames,
true);
312 entityNameWidget.SetText(pathNames[pathNames.Count() - 1]);
319 if (m_wAssetCardName)
321 m_HorizontalScrollComponent = SCR_HorizontalScrollAnimationComponent.Cast(m_wAssetCardName.FindHandler(SCR_HorizontalScrollAnimationComponent));
322 if (m_HorizontalScrollComponent)
330 m_HorizontalScrollComponent.AnimationStop();
331 m_HorizontalScrollComponent.ResetPosition();
339 array<string> modList = SCR_AddonTool.GetResourceAddons(prefab,
true);
341 modIndicator.SetVisible(modList.Count() > 0);
343 modIndicator.SetVisible(
false);
352 set<SCR_EditableEntityComponent> FactionRecipients()
356 SCR_EditableEntityUIInfo infoCard = SCR_EditableEntityUIInfo.Cast(m_Info);
363 SCR_EditableFactionComponent factionDelegate;
365 SCR_DelegateFactionManagerComponent delegateFactionManager = SCR_DelegateFactionManagerComponent.GetInstance();
366 if (delegateFactionManager)
369 set<SCR_EditableEntityComponent> factionRecipients =
new set<SCR_EditableEntityComponent>();
371 factionRecipients.Insert(factionDelegate);
373 return factionRecipients;
381 traitWidget = m_wWidget.FindAnyWidget(
m_sTraitNames[outIndex]);
384 traitIcon =
ImageWidget.Cast(traitWidget.FindAnyWidget(
"Trait"));
404 m_wAssetCardName.Update();
405 m_wAssetCardName.GetScreenSize(width, height);
408 if (hoverEntered && !m_HorizontalScrollComponent.GetContentFitX() && width > 0)
410 m_HorizontalScrollComponent.AnimationStart();
412 else if (!hoverEntered || m_HorizontalScrollComponent.GetContentFitX() || width <= 0)
414 m_HorizontalScrollComponent.AnimationStop();
415 m_HorizontalScrollComponent.ResetPosition();
434 if (imageName.IsEmpty())
453 if (imageName.IsEmpty())
472 if (imageName.IsEmpty())
489 TextWidget entityNameWidget =
TextWidget.Cast(m_wWidget.FindAnyWidget(m_sEntityNameWidgetName));
490 if (entityNameWidget)
492 if (newText.IsEmpty())
494 entityNameWidget.SetVisible(
false);
498 entityNameWidget.SetVisible(
true);
499 entityNameWidget.SetText(newText);
627 if (m_HorizontalScrollComponent)