Skip to content

Commit 0a76d3a

Browse files
committed
Map bug fix and diff controller / focus improvements
1 parent fe7af35 commit 0a76d3a

8 files changed

Lines changed: 66 additions & 138 deletions

File tree

Courseplay.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function Courseplay:init()
2323

2424
g_overlayManager:addTextureConfigFile(Utils.getFilename("img/iconSprite.xml", self.BASE_DIRECTORY), "cpIconSprite")
2525
g_overlayManager:addTextureConfigFile(Utils.getFilename("img/ui_courseplay.xml", self.BASE_DIRECTORY), "cpUi")
26+
g_gui:loadProfiles(Utils.getFilename("config/gui/GUIProfiles.xml", self.BASE_DIRECTORY))
2627
end
2728

2829
function Courseplay:registerXmlSchema()

config/gui/GUIProfiles.xml

Lines changed: 2 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<GUIProfiles>
3-
<Presets>
4-
<Preset name="colorTransparent" value="0 0 0 0" />
5-
6-
<Preset name="colorGlass" value="0.018 0.016 0.015 0.6" />
7-
<Preset name="colorGlass_50" value="0.018 0.016 0.015 0.25" />
8-
9-
<Preset name="colorGlassVeryLight" value="0.718 0.716 0.715 0.04" />
10-
<Preset name="colorGlassExtremelyLight" value="0.918 0.916 0.915 0.15" />
11-
<Preset name="colorGlassMedium" value="0.118 0.116 0.115 0.20" />
12-
<Preset name="colorGlassDark" value="0.018 0.016 0.015 0.65" />
13-
<Preset name="colorGlassLight" value="0.718 0.716 0.715 0.25" />
14-
<Preset name="colorGlassLight_50" value="0.718 0.716 0.715 0.0625" />
15-
<Preset name="colorGlassLight_75" value="0.718 0.716 0.715 0.09375" />
16-
17-
<Preset name="colorMainUI" value="0.0227 0.5346 0.8519 1.0"/>
18-
<Preset name="colorMainUI_80" value="0.0227 0.5346 0.8519 0.8"/>
19-
<Preset name="colorMainUI_70" value="0.0227 0.5346 0.8519 0.7"/>
20-
<Preset name="colorMainUI_60" value="0.0227 0.5346 0.8519 0.6"/>
21-
<Preset name="colorMainUI_50" value="0.0227 0.5346 0.8519 0.5"/>
22-
<Preset name="colorMainUI_40" value="0.0227 0.5346 0.8519 0.4"/>
23-
<Preset name="colorMainUI_30" value="0.0227 0.5346 0.8519 0.3"/>
24-
<Preset name="colorMainUI_20" value="0.0227 0.5346 0.8519 0.2"/>
25-
<Preset name="colorMainUI_10" value="0.0227 0.5346 0.8519 0.1"/>
26-
<Preset name="colorMainUI_6" value="0.0227 0.5346 0.8519 0.06"/>
27-
<Preset name="colorMainUIAlt" value="0.9900 0.4640 0.0010 1" />
28-
<Preset name="colorDisabled" value="0.4 0.4 0.4 1" />
29-
30-
<Preset name="colorWhite" value="1 1 1 1" />
31-
<Preset name="colorWhite_50" value="1 1 1 0.5" />
32-
<Preset name="colorWhite_25" value="1 1 1 0.25" />
33-
<Preset name="colorRed" value="0.8069 0.0097 0.0097 1" />
34-
<Preset name="colorDarkRed" value="0.2832 0.0091 0.0091 1" />
35-
<Preset name="colorBlue" value="0.0742 0.4341 0.6939 1" />
36-
<Preset name="colorGreen" value="0.0781 0.2233 0.0478 1" />
37-
<Preset name="colorGreen2" value="0.2122 0.5271 0.0307 1" />
38-
39-
<Preset name="colorBlack" value="0 0 0 1" />
40-
<Preset name="colorBlack2" value="0.0075 0.0075 0.0075 1" />
41-
<Preset name="colorBlack3" value="0.013 0.013 0.013 1" />
42-
<Preset name="colorBlack3_97" value="0.013 0.013 0.013 0.97" />
43-
<Preset name="colorBlack3_70" value="0.013 0.013 0.013 0.7" />
44-
<Preset name="colorBlack3_0" value="0.013 0.013 0.013 0" />
45-
46-
<Preset name="colorDarkGrey" value="0.0284 0.0284 0.0284 1" />
47-
<Preset name="colorDarkGrey_0" value="0.0284 0.0284 0.0284 0" />
48-
<Preset name="colorDarkGrey2" value="0.0630 0.0630 0.0630 1" />
49-
<Preset name="colorDarkGrey2_50" value="0.0630 0.0630 0.0630 0.5" />
50-
<Preset name="colorDarkGrey2_70" value="0.0630 0.0630 0.0630 0.7" />
51-
<Preset name="colorDarkGrey3" value="0.0194 0.0194 0.0194 1" />
52-
<Preset name="colorDarkGrey4" value="0.0723 0.0723 0.0723 1" />
53-
<Preset name="colorDarkGrey5" value="0.1356 0.1356 0.1356 1" />
54-
<Preset name="colorDarkGrey6" value="0.03 0.03 0.03 1" />
55-
<Preset name="colorDarkGrey7" value="0.0212 0.0212 0.0212 1" />
56-
57-
<Preset name="colorListRowBackground" value="$preset_colorGlassLight_50" />
58-
59-
<Preset name="colorLightGrey" value="0.0482 0.0482 0.0482 1" />
60-
<Preset name="colorDescriptionText" value="0.2918 0.2918 0.2918 1" />
61-
<Preset name="colorDescriptionText2" value="0.6 0.6 0.6 1" />
62-
<Preset name="colorDescriptionText3" value="0.1845 0.1845 0.1845 1" />
63-
<Preset name="colorDescriptionText4" value="0.6307 0.6307 0.6307 1" />
64-
<!-- UVs -->
65-
<Preset name="colorUVs" value="10px 1010px 4px 4px" />
66-
</Presets>
67-
68-
<Traits>
69-
<Trait name="debugging">
70-
<Value name="debugEnabled" value="true" />
71-
</Trait>
72-
<Trait name="anchorTopLeft">
73-
<Value name="anchors" value="0 0 1 1" />
74-
</Trait>
75-
<Trait name="anchorTopCenter">
76-
<Value name="anchors" value="0.5 0.5 1 1" />
77-
</Trait>
78-
<Trait name="anchorMiddleCenter">
79-
<Value name="anchors" value="0.5 0.5 0.5 0.5" />
80-
<!--
81-
82-
<Value name="screenAlign" value="middleCenter" />
83-
<Value name="positionOrigin" value="middleCenter" />
84-
-->
85-
</Trait>
86-
</Traits>
87-
88-
<Profile name="cpCourseGeneratorBackground" extends="emptyFullPanel" with="anchorTopLeft">
89-
<Value name="size" value="1220px 840px"/>
90-
<Value name="imageColor" value="0.0111 0.0276 0.0377 0.95"/>
3+
<Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
4+
<position value="-500px 0px" />
915
</Profile>
92-
93-
<Profile name="cpIngameMenuSettingsBox" extends="ingameMenuSettingsBox">
94-
<Value name="size" value="1200px 756px"/>
95-
</Profile>
96-
97-
<Profile name="cpIngameMenuSettingsLayout" extends="ingameMenuSettingsLayout">
98-
<Value name="size" value="1200px 756px"/>
99-
</Profile>
100-
101-
<Profile name="cpMultiTextOptionSettingsTooltip" extends="multiTextOptionSettingsTooltip">
102-
<Value name="textMaxWidth" value="332px" />
103-
</Profile>
104-
105-
<Profile name="cpControllerGuiLayout" extends="ingameMenuAICreateLayout">
106-
<Value name="position" value="-40px 0px" />
107-
</Profile>
108-
109-
<Profile name="cpDrawingCustomFieldHeader" extends="ingameMenuFrameHeaderText" with="anchorTopCenter">
110-
<Value name="position" value="0px -40px" />
111-
</Profile>
112-
<Profile name="cpDrawingCustomFieldSubHeader" extends="ingameMenuFrameHeaderText" with="anchorTopCenter">
113-
<Value name="position" value="0px -70px" />
114-
</Profile>
115-
116-
<Profile name="cpMultiTextOptionText" extends="multiTextOptionText">
117-
<Value name="imageColor" value="0 0 0 0"/>
118-
</Profile>
119-
120-
<Profile name="cpMultiTextOptionSettingsText" extends="multiTextOptionSettingsText">
121-
<Value name="size" value="210px 48px"/>
122-
<Value name="imageColor" value="0 0 0 0"/>
123-
</Profile>
124-
125-
1266
</GUIProfiles>

config/gui/pages/ConstructionFrame.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,8 @@
167167
</ThreePartBitmap>
168168
</ThreePartBitmap> -->
169169
<GUIProfiles>
170-
<Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
171-
<position value="-500px 0px" />
172-
</Profile>
173170
<Profile name="cpHelpDisplay" with="anchorStretchingYLeft">
174171
<position value="700px -230px" />
175172
</Profile>
176-
177173
</GUIProfiles>
178174
</GUI>

config/gui/pages/CourseGeneratorFrame.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@
281281
</ThreePartBitmap>
282282
</ThreePartBitmap>
283283
<GUIProfiles>
284-
<Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
284+
<!-- <Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
285285
<position value="-500px 0px" />
286-
</Profile>
286+
</Profile> -->
287287
<Profile name="cpLeftSideBackground" extends="fs25_fullScreenBackground" with="pivotMiddleLeft">
288288
<height value="100%"/>
289289
<width value="250px" />

config/gui/pages/GlobalSettingsFrame.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
</ThreePartBitmap>
5252
</ThreePartBitmap>
5353
<GUIProfiles>
54-
<Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
54+
<!-- <Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
5555
<position value="-500px 0px" />
56-
</Profile>
56+
</Profile> -->
5757
</GUIProfiles>
5858
</GUI>

config/gui/pages/VehicleSettingsFrame.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
</ThreePartBitmap>
5252
</ThreePartBitmap>
5353
<GUIProfiles>
54-
<Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
54+
<!-- <Profile name="cpSettingsMultiOptionTitle" extends="fs25_settingsMultiTextOptionTitle">
5555
<position value="-500px 0px" />
56-
</Profile>
56+
</Profile> -->
5757
</GUIProfiles>
5858
</GUI>

scripts/gui/CpInGameMenu.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function CpInGameMenu.new(target, customMt, messageCenter, l10n, inputManager, c
1818
g_gui:showGui("CpInGameMenu")
1919
self:changeScreen(CpInGameMenu)
2020
self:updatePages()
21-
-- local index = self.pagingElement:getPageMappingIndexByElement(self.page)
22-
-- self.pageSelector:setState(pageAIIndex, true)
21+
local index = self.pagingElement:getPageMappingIndexByElement(self.pageCourseGenerator)
22+
self.pageSelector:setState(index, true)
2323
end, self)
2424
self.messageCenter:subscribe(MessageType.GUI_CP_INGAME_OPEN_GLOBAL_SETTINGS, function (menu)
2525
g_gui:showGui("CpInGameMenu")

scripts/gui/pages/CpCourseGeneratorFrame.lua

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,32 @@ function CpCourseGeneratorFrame:update(dt)
280280
if hasChanged then
281281
self:updateStatusMessages()
282282
end
283+
local inputMode = g_inputBinding:getInputHelpMode()
284+
if inputMode ~= self.lastInputHelpMode then
285+
self.lastInputHelpMode = inputMode
286+
-- p102.buttonSelectIngame:setVisible(v104 == GS_INPUT_HELP_MODE_GAMEPAD)
287+
-- p102:updateContextInputBarVisibility()
288+
g_inputBinding:setShowMouseCursor(inputMode ~= GS_INPUT_HELP_MODE_GAMEPAD)
289+
-- self:updateInputGlyphs()
290+
end
291+
if inputMode == GS_INPUT_HELP_MODE_GAMEPAD then
292+
local x, y = self.ingameMap:getLocalPointerTarget()
293+
if self.isPickingLocation then
294+
local dx, dz = self.ingameMap:localToWorldPos(x, y)
295+
self.aiTargetMapHotspot:setWorldPosition(dx, dz)
296+
elseif self.isPickingRotation then
297+
local dx, dz = self.ingameMap:localToWorldPos(x, y)
298+
local nx = dx - self.pickingRotationOrigin[1]
299+
local nz = dz - self.pickingRotationOrigin[2]
300+
local rotY = math.atan2(nx, nz) + math.pi
301+
if self.pickingRotationSnapAngle > 0 then
302+
rotY = MathUtil.round(rotY / self.pickingRotationSnapAngle, 0) *
303+
self.pickingRotationSnapAngle
304+
end
305+
self.aiTargetMapHotspot:setWorldRotation(rotY)
306+
end
307+
end
308+
283309
CpCourseGeneratorFrame:superClass().update(self, dt)
284310
end
285311

@@ -341,6 +367,7 @@ function CpCourseGeneratorFrame:onFrameOpen()
341367
end
342368
end
343369
end
370+
self.activeWorkerList:reloadData()
344371
end, self)
345372
g_messageCenter:subscribe(MessageType.AI_JOB_REMOVED, function(self, jobId)
346373
table.removeElement(self.playerFarmActiveJobs, jobId)
@@ -432,6 +459,7 @@ function CpCourseGeneratorFrame:onFrameOpen()
432459
self:setMapSelectionItem(nil)
433460
end
434461
g_customFieldManager:refresh()
462+
-- self:updateInputGlyphs()
435463
end
436464

437465
function CpCourseGeneratorFrame:saveHotspotFilter()
@@ -1071,6 +1099,7 @@ function CpCourseGeneratorFrame:onStartedJob(args, state, jobTypeIndex)
10711099
g_messageCenter:unsubscribe(AIJobStartRequestEvent, self)
10721100
if state == AIJob.START_SUCCESS then
10731101
self.mapOverviewSelector:setState(self.MAP_SELECTOR_ACTIVE_JOBS, true)
1102+
FocusManager:setFocus(self.activeWorkerList)
10741103
else
10751104
local jobType = g_currentMission.aiJobTypeManager:getJobTypeByIndex(jobTypeIndex)
10761105
local text = jobType.classObject.getIsStartErrorText(state)
@@ -1357,7 +1386,6 @@ function CpCourseGeneratorFrame:updateInputGlyphs()
13571386
}, nil, nil, self)
13581387
self.mapMoveGlyphText:setText(moveText)
13591388
self.mapZoomGlyphText:setText(self.zoomText)
1360-
13611389
end
13621390

13631391
-- Lines 992-1005
@@ -1494,20 +1522,30 @@ function CpCourseGeneratorFrame:initializeContextActions()
14941522
actionOnly = true
14951523
}
14961524
}
1525+
FocusManager:linkElements(self.contextButtonList, FocusManager.TOP, nil)
1526+
FocusManager:linkElements(self.contextButtonList, FocusManager.BOTTOM, nil)
1527+
FocusManager:linkElements(self.contextButtonList, FocusManager.LEFT, nil)
1528+
FocusManager:linkElements(self.contextButtonList, FocusManager.RIGHT, nil)
1529+
FocusManager:linkElements(self.filterList, FocusManager.LEFT, nil)
1530+
FocusManager:linkElements(self.filterList, FocusManager.RIGHT, nil)
1531+
FocusManager:linkElements(self.filterList, FocusManager.BOTTOM, nil)
1532+
FocusManager:linkElements(self.customFieldList, FocusManager.LEFT, nil)
1533+
FocusManager:linkElements(self.customFieldList, FocusManager.RIGHT, nil)
1534+
FocusManager:linkElements(self.customFieldList, FocusManager.BOTTOM, nil)
14971535
end
14981536

14991537
function CpCourseGeneratorFrame:updateContextActions()
15001538
local vehicle = self.cpMenu:getCurrentVehicle()
15011539
self.contextActions[self.CONTEXT_ACTIONS.ENTER_VEHICLE].isActive = vehicle and vehicle:getIsEnterableFromMenu() and self.mode ~= self.AI_MODE_CREATE
1540+
self.canCancel = vehicle and vehicle.spec_aiJobVehicle and vehicle:getIsAIActive()
15021541
self.canCreateJob = false
1503-
if vehicle and not self.currentJobVehicle then
1542+
if vehicle and not self.currentJobVehicle and not self.canCancel then
15041543
for _, job in pairs(self.jobTypeInstances) do
15051544
if job:getIsAvailableForVehicle(vehicle, true) then
15061545
self.canCreateJob = true
15071546
end
15081547
end
15091548
end
1510-
self.canCancel = vehicle and vehicle.spec_aiJobVehicle and vehicle:getIsAIActive()
15111549
self.contextActions[self.CONTEXT_ACTIONS.CREATE_JOB].isActive = self.canCreateJob and self.mode ~= self.AI_MODE_CREATE
15121550
self.contextActions[self.CONTEXT_ACTIONS.START_JOB].isActive = self:getCanStartJob()
15131551
self.contextActions[self.CONTEXT_ACTIONS.STOP_JOB].isActive = self:getCanCancelJob() and self.mode ~= self.AI_MODE_CREATE
@@ -1631,8 +1669,21 @@ function CpCourseGeneratorFrame:setMapSelectionItem(hotspot)
16311669
InGameMenuMapUtil.hideContextBox(self.contextBoxCustomField)
16321670
InGameMenuMapUtil.showContextBox(self.currentContextBox, hotspot, name, imageFilename, uvs, farmId, playerName, false, true, false)
16331671
self:updateContextActions()
1672+
FocusManager:setFocus(self.contextButtonList)
16341673
else
1674+
local state = self.mapOverviewSelector:getState()
1675+
local hasFocus = not self.currentContextBox:getIsVisible()
1676+
if state == self.AI_MODE_WORKER_LIST then
1677+
hasFocus = FocusManager:setFocus(self.activeWorkerList) or FocusManager:getFocusedElement() == self.activeWorkerList
1678+
elseif state == self.CUSTOM_FIELD_HOTSPOTS then
1679+
hasFocus = FocusManager:setFocus(self.customFieldList) or FocusManager:getFocusedElement() == self.customFieldList
1680+
else
1681+
hasFocus = FocusManager:setFocus(self.jobMenuLayout) or FocusManager:getFocusedElement() == self.jobMenuLayout
1682+
end
16351683
InGameMenuMapUtil.hideContextBox(self.currentContextBox)
1684+
if not hasFocus then
1685+
FocusManager:setFocus(self.mapOverviewSelector)
1686+
end
16361687
end
16371688
end
16381689

@@ -1694,7 +1745,7 @@ function CpCourseGeneratorFrame:setJobMenuVisible(isVisible)
16941745
self.currentJob = nil
16951746
self.currentJobVehicle = nil
16961747
self:updateCourseGenerator(false)
1697-
FocusManager:setFocus(self.mapOverviewSelector)
1748+
-- FocusManager:setFocus(self.mapOverviewSelector)
16981749
self.mapOverviewSelector:setState(self.MAP_SELECTOR_ACTIVE_JOBS, true)
16991750
else
17001751
self.mapOverviewSelector:setState(self.MAP_SELECTOR_CREATE_JOB, true)

0 commit comments

Comments
 (0)