Zum Inhalt

content_card

Quelle: base/tealdef/gui/main/content_card.d.tl

Hinweise

Inhaltskarten: die Kästen mit Titel, aus denen Infofenster und ähnliche Panels bestehen. Eine Karte hat einen festen Teil, optional einen ausklappbaren Teil, der sich per Klick öffnet, und optional Info-Blasen (Callouts) mit Text, die beim Überfahren oder bei Fokus daneben erscheinen.

ContentCard

record global base/tealdef/gui/main/content_card.d.tl:3

global record ContentCard

Laden: local content_card = ug_require "::/gui/main/content_card.tl" as ContentCard

Hinweise

Recipes und Hilfsfunktionen für Inhaltskarten.

Beispiel

-- aus sim_person_eow.script.tl
content_card.ContentCard{
    title = _("Locations"),
    recipeAndParamPermanent = content_card.makeRecipeAndParam(
        DestinationsTable,
        { personEntityId = extensionParams.entityId }
    ),
    gameCtx = extensionParams.gameCtx,
    showOnRightSide = extensionParams.showCalloutOnRightSide,
}

Felder

Name Typ Beschreibung
InfoCalloutWrapper Recipe<CalloutWrapperParam> Umschließt Inhalt (ein Recipe und zusätzliche Kinder) und zeigt calloutText in einer Info-Blase daneben, solange der Inhalt Aufmerksamkeit hat. 1-mal im Basisspiel verwendet
ContentCard RecipeWithApi<ContentCardParam, ContentCardApi> Eine Karte mit Titel, festem Teil und optional einem ausklappbaren Teil und Info-Blasen. 98-mal im Basisspiel verwendet

Funktionen

makeRecipeAndParam<T>(recipe : Recipe<T>, param : T) : RecipeAndParamErased base/tealdef/gui/main/content_card.d.tl:53

Aufruf: content_card.makeRecipeAndParam(…)

Hinweise

Packt ein Recipe und seinen Parameter für eine Inhaltskarte in ein RecipeAndParamErased.

Rückgabe RecipeAndParamErased

Im Basisspiel verwendet: 61-mal in 16 Dateien

base/content/game_mechanics/game_mechanics/company/explorations/exploration_plane_entity_window.script.tl:48

recipeAndParamPermanent = content_card.makeRecipeAndParam(
base/content/gui/gui/entity_window/animal/animal_eow.script.tl:48
recipeAndParamPermanent = content_card.makeRecipeAndParam(
base/content/gui/gui/entity_window/entity_window_util.tl:770
recipeAndParamPermanent = content_card.makeRecipeAndParam(
base/content/gui/gui/entity_window/fun_elements/fun_elements_eow.script.tl:132
recipeAndParamPermanent = content_card.makeRecipeAndParam(
base/content/gui/gui/entity_window/industry/industry_eow.script.tl:644
recipeAndParamCollapsible = param.showWorkplaces and content_card.makeRecipeAndParam(
base/content/gui/gui/entity_window/line/line_eow.script.tl:548
recipeAndParamPermanent = content_card.makeRecipeAndParam(
… und 10 weitere Dateien.

makeRecipe0(recipe : Recipe0) : RecipeAndParamErased base/tealdef/gui/main/content_card.d.tl:54

Aufruf: content_card.makeRecipe0(…)

Hinweise

Packt ein Recipe ohne Parameter in ein RecipeAndParamErased (mit leerer Parametertabelle).

Rückgabe RecipeAndParamErased

Im Basisspiel verwendet: 5-mal in 1 Datei

base/content/gui/gui/game_bar/game_bar_widgets.tl:783

recipeAndParamPermanent = content_card.makeRecipe0(CalendarWeatherControl),

makeContentCardsCollapsibleFunctions(collapsibleCardsState : ReactStateT<{string : boolean}>, onlyOneExpandable : boolean) : function(string, boolean), function(string) base/tealdef/gui/main/content_card.d.tl:55

Aufruf: content_card.makeContentCardsCollapsibleFunctions(…)

Hinweise

Erzeugt die Funktionen zum Auf- und Zuklappen für mehrere Inhaltskarten, die sich eine Zustandstabelle mit der Karte als Schlüssel teilen.

Parameter Typ Beschreibung
collapsibleCardsState ReactStateT<{string : boolean}> React-State mit dem Aufklapp-Flag je Kartenschlüssel.
onlyOneExpandable boolean Bei true klappt das Aufklappen einer Karte alle anderen zu.

Rückgabe function(string, boolean), function(string): setExpanded(key, expanded) und isExpanded(key).

Beispiel

-- aus sim_person.tl
local collapsibleCardsState = react.useState({})
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
-- je Karte:
--   setCollapsibleExpanded = function(v) updateCollapsibleState(cardKey, v) end,
--   collapsibleExpanded = isExpanded(cardKey),
Im Basisspiel verwendet: 14-mal in 14 Dateien

base/content/gui/gui/entity_window/animal/animal.tl:32

local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
base/content/gui/gui/entity_window/empty_construction/empty_construction.tl:26
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
base/content/gui/gui/entity_window/fun_elements/fun_elements.tl:32
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
base/content/gui/gui/entity_window/industry/industry.tl:283
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
base/content/gui/gui/entity_window/line/line.tl:120
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:48
local updateCollapsibleState, isExpanded = content_card.makeContentCardsCollapsibleFunctions(collapsibleCardsState, true)
… und 8 weitere Dateien.

useShowCalloutOnRight(refWindow : ReactRefWrap) : boolean base/tealdef/gui/main/content_card.d.tl:56

Aufruf: content_card.useShowCalloutOnRight(…)

Hinweise

Hook, der true liefert, solange das angegebene Fenster in der linken Bildschirmhälfte liegt. Dann sollen sich Info-Blasen rechts davon öffnen.

Rückgabe boolean

Im Basisspiel verwendet: 15-mal in 15 Dateien

base/content/gui/gui/entity_window/animal/animal.tl:29

local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
base/content/gui/gui/entity_window/empty_construction/empty_construction.tl:23
local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
base/content/gui/gui/entity_window/fun_elements/fun_elements.tl:29
local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
base/content/gui/gui/entity_window/industry/industry.tl:272
local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
base/content/gui/gui/entity_window/line/line.tl:100
local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
base/content/gui/gui/entity_window/maintenance_station/maintenance_station.tl:45
local showOnRightSide = content_card.useShowCalloutOnRight(refSelf)
… und 9 weitere Dateien.

makeInfoHint(hint : string, addIcon : boolean) : TreeNodeId base/tealdef/gui/main/content_card.d.tl:58

Aufruf: content_card.makeInfoHint(…)

Hinweise

Erzeugt einen kleinen Hinweistext, auf Wunsch mit einem Info-Symbol davor.

Rückgabe TreeNodeId

Im Basisspiel verwendet: 6-mal in 4 Dateien

base/content/game_mechanics/game_mechanics/finance/finances_cargo_lifetime.tl:339

content_card.makeInfoHint(
base/content/gui/gui/entity_window/entity_window_util.tl:1568
content_card.makeInfoHint(noPersonText, true),
base/content/gui/gui/entity_window/industry/industry_eow.script.tl:357
content_card.makeInfoHint(
base/content/gui/gui/entity_window/town/town.tl:754
content_card.makeInfoHint(params.hint, true),

ContentCard.CalloutWrapperParam

record base/tealdef/gui/main/content_card.d.tl:4

record CalloutWrapperParam is IRecipeParamWithMeta

Hinweise

Parameter von InfoCalloutWrapper.

Im Basisspiel verwendet: 1-mal in 1 Datei

base/content/gui/gui/main/content_card.tl:64

content_card.InfoCalloutWrapper = react.RegisterRecipe("InfoCalloutWrapper", function(param : ContentCard.CalloutWrapperParam) : TreeNodeId

Felder

Name Typ Beschreibung
recipeAndParam ContentCard.RecipeAndParamErased Hauptinhalt, gebaut aus einem Recipe und seinem Parameter.
extraChildren {TreeNodeId} Note: only use these for elements that are always visible
separatorBetweenExtraChildren boolean Bei true steht zwischen den extraChildren ein Trenner.
calloutText string Text der Info-Blase (Callout), die erscheint, solange der Inhalt Aufmerksamkeit hat (Hover oder Fokus); ein leerer Text heißt keine Info-Blase.
gameCtx GameContext Spielkontext; über seinen calloutContainerRef öffnet sich die Info-Blase.
showOnRightSide boolean Bei true öffnet sich die Info-Blase rechts vom Inhalt, sonst links.
isPermanent boolean Kennzeichnet den festen Teil einer Karte (gibt ihm Rahmen und Formatierung der Karte und macht ihn fokussierbar).
isCollapsibleButton boolean Kennzeichnet Inhalt, der zugleich die Schaltfläche zum Auf- und Zuklappen der Karte ist (Style-Klasse is-button).
hovering boolean Fügt die Style-Klasse hovering hinzu.

ContentCard.RecipeAndParamErased

record base/tealdef/gui/main/content_card.d.tl:20

record RecipeAndParamErased

Hinweise

Ein Recipe samt Parameter, gespeichert ohne den Parametertyp; du erzeugst es mit makeRecipeAndParam oder makeRecipe0.

Im Basisspiel verwendet: 5-mal in 2 Dateien

base/content/gui/gui/entity_window/perk/perk_eow.script.tl:218

local recipeAndParamCollapsible : ContentCard.RecipeAndParamErased
base/content/gui/gui/main/content_card.tl:191
content_card.makeRecipeAndParam = function<T>(recipe : Recipe<T>, param : T) : ContentCard.RecipeAndParamErased

Felder

Name Typ Beschreibung
recipe Recipe<any> Das aufzurufende Recipe.
param any Der Parameter, der an das Recipe geht.

ContentCard.ContentCardParam

record base/tealdef/gui/main/content_card.d.tl:25

record ContentCardParam

Hinweise

Parameter von ContentCard.

Im Basisspiel verwendet: 2-mal in 1 Datei

base/content/gui/gui/main/content_card.tl:207

content_card.ContentCard = react.RegisterRecipe("ContentCard", function(param : ContentCard.ContentCardParam) : TreeNodeId

Felder

Name Typ Beschreibung
title string Titel der Karte, erscheint als Überschrift über der Karte; nil für keinen Titel.
initialCalloutTextPermanent string Anfänglicher Text der Info-Blase (Callout) am festen Teil; später änderst du ihn mit ContentCardApi.setPermanentCalloutText.
recipeAndParamPermanent RecipeAndParamErased Inhalt des festen (immer sichtbaren) Teils.
extraChildrenPermanent {TreeNodeId} Zusätzliche Knoten, die an den festen Teil angehängt werden.
separatorBetweenExtraChildren boolean Bei true steht zwischen den extraChildrenPermanent ein Trenner.
hasPermanentFocusables boolean Auf true setzen, wenn der feste Teil fokussierbare Elemente enthält. Dann bleiben sie fokussierbar, obwohl der Teil die Schaltfläche zum Zuklappen ist.
initialCalloutTextCollapsible string Anfänglicher Text der Info-Blase (Callout) am ausklappbaren Teil; später änderst du ihn mit ContentCardApi.setCollapsibleCalloutText.
recipeAndParamCollapsible RecipeAndParamErased Inhalt des ausklappbaren Teils, nur sichtbar, solange collapsibleExpanded true ist.
collapsibleExpanded boolean Ob der ausklappbare Teil gerade aufgeklappt ist; die Karte selbst speichert diesen Zustand nicht.
gameCtx GameContext Spielkontext, über den sich die Info-Blasen öffnen.
showOnRightSide boolean Bei true öffnen sich die Info-Blasen rechts von der Karte (siehe useShowCalloutOnRight).

Funktionen

titleOnHoverFocus(isSelected : boolean) base/tealdef/gui/main/content_card.d.tl:27

Hinweise

Wird mit true oder false aufgerufen, wenn der Titel Aufmerksamkeit (Hover oder Fokus) bekommt oder verliert.

setCollapsibleExpanded(boolean) base/tealdef/gui/main/content_card.d.tl:39

Hinweise

Wird mit dem neuen Zustand aufgerufen, wenn der Spieler die Karte auf- oder zuklappt (Klick oder IA_MENU_BACK im aufgeklappten Zustand).

ContentCard.ContentCardApi

record base/tealdef/gui/main/content_card.d.tl:46

record ContentCardApi

Hinweise

API eines ContentCard-Knotens, erreichbar über seine Node-Ref.

Im Basisspiel verwendet: 2-mal in 2 Dateien

base/content/gui/gui/entity_window/town/town.tl:923

local contentCardApi : ContentCard.ContentCardApi = contentCardRef:getApi()
base/content/gui/gui/main/content_card.tl:455
end) as RecipeWithApi<ContentCard.ContentCardParam, ContentCard.ContentCardApi>

Funktionen

setPermanentCalloutText(string) base/tealdef/gui/main/content_card.d.tl:47

Hinweise

Ersetzt den Text der Info-Blase am festen Teil (nil wird ignoriert).

setCollapsibleCalloutText(string) base/tealdef/gui/main/content_card.d.tl:48

Hinweise

Ersetzt den Text der Info-Blase am ausklappbaren Teil (nil wird ignoriert).