From 0e763bb545a3917bd1f118f7d02f6ab00709e6bb Mon Sep 17 00:00:00 2001 From: GoogleFrog Date: Sat, 30 Jul 2016 03:00:12 +1000 Subject: [PATCH] VERSION{v0a.0.7.0} * AI list window loads game AIs. * Battle room uses Zero-K v1.4.7.1 and downloads it upon launch (really need a game config for this). * Modoption listener works correctly. Still no ability to set modoptions. --- .../chobby/components/ai_list_window.lua | 18 +++++++++++------- LuaUI/widgets/gui_battle_room_window.lua | 7 ++++++- LuaUI/widgets/gui_modoptions_panel.lua | 8 ++++++++ libs/liblobby/lobby/interface_skirmish.lua | 1 + 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/LuaUI/widgets/chobby/components/ai_list_window.lua b/LuaUI/widgets/chobby/components/ai_list_window.lua index 1d54ad2e4..18e8600d1 100644 --- a/LuaUI/widgets/chobby/components/ai_list_window.lua +++ b/LuaUI/widgets/chobby/components/ai_list_window.lua @@ -6,23 +6,27 @@ function AiListWindow:init(lobby, gameName, allyTeam) self.window:SetPos(nil, nil, 500, 700) -- Disable game-specific AIs for now since it breaks /luaui reload --- local ais = VFS.GetAvailableAIs(gameName) - local ais = VFS.GetAvailableAIs() - if Configuration.singleplayer_mode == 2 then - ais[#ais + 1] = ais[1] - ais[1] = {shortName = "CAI", version = 1} - end + local ais = VFS.GetAvailableAIs(gameName) + --local ais = VFS.GetAvailableAIs() + --if Configuration.singleplayer_mode == 2 then + -- ais[#ais + 1] = ais[1] + -- ais[1] = {shortName = "CAI", version = 1} + --end local blackList = Configuration:GetGameConfig(gameName, "aiBlacklist.lua") for i, ai in pairs(ais) do if (not blackList) or (not blackList[ai.shortName]) then + local version = " v" .. ai.version + if version == " v" then + version = "" + end local addAIButton = Button:New { x = 0, y = 0, width = "100%", height = "100%", - caption = ai.shortName .. " v" .. ai.version, + caption = ai.shortName .. version, font = Configuration:GetFont(3), OnClick = { function() diff --git a/LuaUI/widgets/gui_battle_room_window.lua b/LuaUI/widgets/gui_battle_room_window.lua index fc5cbd8b6..e1bcccb56 100644 --- a/LuaUI/widgets/gui_battle_room_window.lua +++ b/LuaUI/widgets/gui_battle_room_window.lua @@ -384,6 +384,9 @@ local function SetupInfoButtonsPanel(leftInfo, rightInfo, battle, battleID, myUs }, parent = leftInfo, } + if modoptionsHolder.children[1].visible then + modoptionsHolder.children[1]:Hide() + end downloader.lblDownload.OnHide = downloader.lblDownload.OnHide or {} downloader.lblDownload.OnHide[#downloader.lblDownload.OnHide + 1] = function () @@ -1314,7 +1317,7 @@ function BattleRoomWindow.SetSingleplayerGame(ToggleShowFunc, battleroomObj, tab if config.singleplayer_mode == 1 then WG.Chobby.GameListWindow(SetGameFail, SetGameSucess) elseif config.singleplayer_mode == 2 then - singleplayerGame = "Zero-K v1.4.7.0" + singleplayerGame = "Zero-K v1.4.7.1" ToggleShowFunc(battleroomObj, tabData) end end @@ -1348,6 +1351,8 @@ function widget:Initialize() CHOBBY_DIR = "LuaUI/widgets/chobby/" VFS.Include("LuaUI/widgets/chobby/headers/exports.lua", nil, VFS.RAW_FIRST) + MaybeDownloadArchive("Zero-K v1.4.7.1", "game") + WG.BattleRoomWindow = BattleRoomWindow end diff --git a/LuaUI/widgets/gui_modoptions_panel.lua b/LuaUI/widgets/gui_modoptions_panel.lua index 93cb449e1..9bb0c230c 100644 --- a/LuaUI/widgets/gui_modoptions_panel.lua +++ b/LuaUI/widgets/gui_modoptions_panel.lua @@ -14,6 +14,8 @@ local battleLobby local modoptionDefaults = {} local modoptionStructure = {} +local modoptionListenerLobby + -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Functions @@ -185,6 +187,7 @@ local function InitializeModoptionsDisplay() parent = mainScrollPanel, } + modoptionListenerLobby = battleLobby local function OnSetModOptions(listener, data) local modoptions = battleLobby:GetMyBattleModoptions() local text = "" @@ -211,6 +214,11 @@ local function InitializeModoptionsDisplay() local externalFunctions = {} function externalFunctions.Update() + if modoptionListenerLobby then + modoptionListenerLobby:RemoveListener("OnSetModOptions", OnSetModOptions) + end + battleLobby:AddListener("OnSetModOptions", OnSetModOptions) + OnSetModOptions() end diff --git a/libs/liblobby/lobby/interface_skirmish.lua b/libs/liblobby/lobby/interface_skirmish.lua index 5ff0918f7..32893f470 100644 --- a/libs/liblobby/lobby/interface_skirmish.lua +++ b/libs/liblobby/lobby/interface_skirmish.lua @@ -148,6 +148,7 @@ function InterfaceSkirmish:SetBattleState(myUserName, gameName, mapName, title) --(battleID, type, natType, founder, ip, port, maxPlayers, passworded, rank, mapHash, other, engineVersion, mapName, title, gameName, spectatorCount) self:_OnBattleOpened(myBattleID, nil, nil, myUserName, nil, nil, nil, nil, nil, nil, nil, nil, mapName, title, gameName, nil) self:_OnJoinedBattle(myBattleID, myUserName) + self:_OnSetModOptions({}) return self end