Skip to content

Commit 805bf09

Browse files
authored
Merge pull request #237 from Courseplay/Gui-Additions
Gui additions
2 parents 9f68584 + 1b9669a commit 805bf09

4 files changed

Lines changed: 31 additions & 20 deletions

File tree

scripts/gui/CpInGameMenu.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ function CpInGameMenu:onClickMenu()
290290
end
291291

292292
function CpInGameMenu:onPageChange(pageIndex, pageMappingIndex, element, skipTabVisualUpdate)
293-
294293
CpInGameMenu:superClass().onPageChange(self, pageIndex, pageMappingIndex, element, skipTabVisualUpdate)
295294
self:updateBackground()
295+
if self.currentPage.categoryHeaderIcon then
296+
self.currentPage.categoryHeaderIcon:setImageSlice(nil, self.pageTabs[self.currentPage].iconSliceId)
297+
end
296298
end
297299

298300
function CpInGameMenu:getPageButtonInfo(page)

scripts/gui/CustomFieldHotspot.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@ function CustomFieldHotspot:getAreaText()
7575
return g_i18n:formatArea(self.field:getAreaInSqMeters()/10000 , 2)
7676
end
7777

78+
function CustomFieldHotspot:getIsVisible()
79+
return CustomFieldHotspot:superClass().getIsVisible(self) and g_cpInGameMenu.isOpen
80+
end

scripts/gui/pages/CpCourseGeneratorFrame.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ function CpCourseGeneratorFrame:initialize(menu)
209209
self.subCategoryBox:invalidateLayout()
210210
self.subCategoryPaging:setSize(self.subCategoryBox.maxFlowSize + 140 * g_pixelSizeScaledX)
211211

212-
self.hotspotFilterCategories = table.clone(InGameMenuMapFrame.HOTSPOT_FILTER_CATEGORIES)
212+
self.hotspotFilterCategories = {}
213+
for i, v in pairs(InGameMenuMapFrame.HOTSPOT_FILTER_CATEGORIES) do
214+
self.hotspotFilterCategories[i] = table.clone(v)
215+
end
213216
table.insert(self.hotspotFilterCategories[2], {
214217
["id"] = CustomFieldHotspot.CATEGORY,
215218
["sliceId"] = CustomFieldHotspot.SLICE_ID,

scripts/gui/pages/CpHelpFrame.lua

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,31 @@ end
4646

4747
function CpHelpFrame:onFrameOpen()
4848
CpHelpFrame:superClass().onFrameOpen(self)
49-
self.customEnvironments = self.helpLineManager:getCustomEnvironmentNames()
50-
local texts = {}
51-
for _, env in ipairs(self.customEnvironments) do
52-
if string.isNilOrWhitespace(env) then
53-
--table.insert(texts, g_i18n:getText("ui_helpLine_baseGame"))
54-
else
55-
local mod = g_modManager:getModByName(env)
56-
if mod then
57-
table.insert(texts, mod.title)
49+
if not self.wasOpened then
50+
self.customEnvironments = self.helpLineManager:getCustomEnvironmentNames()
51+
local texts = {}
52+
for _, env in ipairs(self.customEnvironments) do
53+
if string.isNilOrWhitespace(env) then
54+
--table.insert(texts, g_i18n:getText("ui_helpLine_baseGame"))
5855
else
59-
table.insert(texts, "Unknown")
56+
local mod = g_modManager:getModByName(env)
57+
if mod then
58+
table.insert(texts, mod.title)
59+
else
60+
table.insert(texts, "Unknown")
61+
end
62+
end
63+
end
64+
self.helpLineSelector:setTexts(texts)
65+
for i = 1, #self.helpLineSelector.texts do
66+
local dot = self.helpLineDotTemplate:clone(self.helpLineDotBox)
67+
dot.getIsSelected = function ()
68+
return self.helpLineSelector:getState() == i
6069
end
61-
end
62-
end
63-
self.helpLineSelector:setTexts(texts)
64-
for i = 1, #self.helpLineSelector.texts do
65-
local dot = self.helpLineDotTemplate:clone(self.helpLineDotBox)
66-
dot.getIsSelected = function ()
67-
return self.helpLineSelector:getState() == i
6870
end
71+
self.helpLineDotBox:invalidateLayout()
72+
self.wasOpened = true
6973
end
70-
self.helpLineDotBox:invalidateLayout()
7174
self.helpLineList:reloadData()
7275
self:setSoundSuppressed(true)
7376
FocusManager:setFocus(self.helpLineList)

0 commit comments

Comments
 (0)