This commit is contained in:
Applevangelist 2023-07-23 12:41:46 +02:00
parent 02fadaf17e
commit 1fbadd02f9
2 changed files with 25 additions and 5 deletions

View File

@ -381,7 +381,7 @@ end
CLIENTMENUMANAGER = {
ClassName = "CLIENTMENUMANAGER",
lid = "",
version = "0.1.0",
version = "0.1.1",
name = nil,
clientset = nil,
menutree = {},
@ -670,7 +670,7 @@ end
--- Remove the entry and all entries below the given entry from the client's F10 menus.
-- @param #CLIENTMENUMANAGER self
-- @param #CLIENTMENU Entry The entry to remove
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client. In this case the generic structure will not be touched.
-- @param Wrapper.Client#CLIENT Client (optional) If given, make this change only for this client.
-- @return #CLIENTMENUMANAGER self
function CLIENTMENUMANAGER:DeleteF10Entry(Entry,Client)
self:T(self.lid.."DeleteF10Entry")

View File

@ -98,7 +98,7 @@ PLAYERTASK = {
--- PLAYERTASK class version.
-- @field #string version
PLAYERTASK.version="0.1.17"
PLAYERTASK.version="0.1.18"
--- Generic task condition.
-- @type PLAYERTASK.Condition
@ -1008,6 +1008,7 @@ do
-- @field Core.ClientMenu#CLIENTMENUMANAGER ActiveTaskMenuTemplate
-- @field Core.ClientMenu#CLIENTMENU ActiveTopMenu
-- @field Core.ClientMenu#CLIENTMENU ActiveInfoMenu
-- @field Core.ClientMenu#CLIENTMENU MenuNoTask
-- @extends Core.Fsm#FSM
---
@ -1336,6 +1337,7 @@ PLAYERTASKCONTROLLER = {
InfoHasCoordinate = false,
UseTypeNames = false,
Scoring = nil,
MenuNoTask = nil,
}
---
@ -3469,6 +3471,19 @@ function PLAYERTASKCONTROLLER:_UpdateJoinMenuTemplate()
local actinfomenu = self.ActiveInfoMenu
--local entrynumbers = {}
--local existingentries = {}
if self.TaskQueue:Count() == 0 and self.MenuNoTask == nil then
local menunotasks = self.gettext:GetEntry("MENUNOTASKS",self.locale)
self.MenuNoTask = controller:NewEntry(menunotasks,self.JoinMenu)
controller:AddEntry(self.MenuNoTask)
end
if self.TaskQueue:Count() > 0 and self.MenuNoTask ~= nil then
controller:DeleteGenericEntry(self.MenuNoTask)
controller:DeleteF10Entry(self.MenuNoTask)
self.MenuNoTask = nil
end
local maxn = self.menuitemlimit
-- Generate task type menu items
for _type,_ in pairs(taskpertype) do
@ -3641,8 +3656,13 @@ function PLAYERTASKCONTROLLER:_CreateJoinMenuTemplate()
self.JoinInfoMenu = JoinTaskMenuTemplate:NewEntry(menutaskinfo,self.JoinTopMenu)
end
if self.TaskQueue:Count() == 0 then
JoinTaskMenuTemplate:NewEntry(menunotasks,self.JoinMenu)
if self.TaskQueue:Count() == 0 and self.MenuNoTask == nil then
self.MenuNoTask = JoinTaskMenuTemplate:NewEntry(menunotasks,self.JoinMenu)
end
if self.TaskQueue:Count() > 0 and self.MenuNoTask ~= nil then
JoinTaskMenuTemplate:DeleteGenericEntry(self.MenuNoTask)
self.MenuNoTask = nil
end
self.JoinTaskMenuTemplate = JoinTaskMenuTemplate