added highlight effect
This commit is contained in:
parent
330cc9c25d
commit
c5e87b1e46
@ -627,7 +627,17 @@ end
|
||||
-- forwards the requested content type to the update function
|
||||
---@param player LuaPlayer Player that triggered this
|
||||
---@param contentToShow String Name of the content type to show
|
||||
function onClick_tab(player, contentToShow)
|
||||
---@param id String Id of the clicked tab
|
||||
function onClick_tab(player, contentToShow, id)
|
||||
-- sets highlight to clicked tab
|
||||
local idTable = {"tab1", "tab2","tab3","tab4","tab5"}
|
||||
for _, listId in ipairs(idTable) do
|
||||
if listId == id then
|
||||
UI.setClass(listId, 'downloadTab activeTab')
|
||||
else
|
||||
UI.setClass(listId, 'downloadTab')
|
||||
end
|
||||
end
|
||||
update_list(contentToShow)
|
||||
end
|
||||
|
||||
@ -705,11 +715,12 @@ function onMouseEnter_item(player, param)
|
||||
local item = library[contentToShow][index]
|
||||
|
||||
-- error handling
|
||||
if not item.name
|
||||
or not item.author
|
||||
or not item.description
|
||||
or not item.boxsize
|
||||
or not item.boxart then
|
||||
if not item
|
||||
or not item.name or item.name == ""
|
||||
or not item.author or item.author == ""
|
||||
or not item.description or item.description == ""
|
||||
or not item.boxsize or item.boxsize == ""
|
||||
or not item.boxart or item.boxart == "" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -10,6 +10,9 @@
|
||||
color="grey"/>
|
||||
<Button class="press"
|
||||
color="white"/>
|
||||
|
||||
<Button class="activeTab"
|
||||
color="#ffffff"/>
|
||||
</Defaults>
|
||||
|
||||
<!-- window to select downloadable content -->
|
||||
@ -46,15 +49,20 @@
|
||||
<HorizontalLayout preferredHeight="60"
|
||||
padding="5"
|
||||
spacing="5">
|
||||
<Button class="downloadTab"
|
||||
<Button class="downloadTab activeTab"
|
||||
id="tab1"
|
||||
onClick="onClick_tab(campaigns)">Official Campaigns</Button>
|
||||
<Button class="downloadTab"
|
||||
id="tab2"
|
||||
onClick="onClick_tab(scenarios)">Official Scenarios</Button>
|
||||
<Button class="downloadTab"
|
||||
id="tab3"
|
||||
onClick="onClick_tab(fanmadeCampaigns)">Fan-Made Campaigns</Button>
|
||||
<Button class="downloadTab"
|
||||
id="tab4"
|
||||
onClick="onClick_tab(fanmadeScenarios)">Fan-Made Scenarios</Button>
|
||||
<Button class="downloadTab"
|
||||
id="tab5"
|
||||
onClick="onClick_tab(fanmadePlayerCards)">Fan-Made Player Cards</Button>
|
||||
</HorizontalLayout>
|
||||
|
||||
|
@ -80,7 +80,8 @@
|
||||
<TableLayout id="optionPanel"
|
||||
class="window"
|
||||
rectAlignment="LowerRight"
|
||||
offsetXY="-50 80">
|
||||
offsetXY="-50 80"
|
||||
raycastTarget="true">
|
||||
<!-- Header: Options -->
|
||||
<Row preferredHeight="60">
|
||||
<Cell>
|
||||
|
Loading…
Reference in New Issue
Block a user