@@ -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 )
284310end
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()
435463end
436464
437465function 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-
13611389end
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 )
14971535end
14981536
14991537function 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
16371688end
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