Skip to content

Commit

Permalink
Lobby 2.5b
Browse files Browse the repository at this point in the history
- Disable Windowed options if the game is already set windowed
- Add color for the default options in Game Options window
- Add Tooltip for the Mod in Mod Manager with Little View
- Fix people can change color of other people
- Remove debug message

Conflicts:
	lua/ui/lobby/changelog.lua
  • Loading branch information
Xinnony authored and Sheeo committed Dec 12, 2014
1 parent 6f89e32 commit b5ad333
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 32 deletions.
28 changes: 19 additions & 9 deletions lua/ui/controls/combo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ local defaultBitmaps = {

---------------------------------------------------------------------------------------------------------------------------------------- COMBO
Combo = Class(Group) {
__init = function(self, parent, pointSize, maxVisibleItems, staticTitle, bitmaps, rolloverCue, clickCue, itemCue, debugName)
__init = function(self, parent, pointSize, maxVisibleItems, staticTitle, bitmaps, rolloverCue, clickCue, itemCue, debugName, EnableColor)
Group.__init(self, parent)
self:SetName(debugName or "Combo")
self.mRolloverCue = rolloverCue
self.mClickCue = clickCue
self.mItemCue = itemCue or "UI_Tab_Click_01"
self.EnableColor = EnableColor or true

bitmaps = bitmaps or defaultBitmaps

Expand Down Expand Up @@ -211,7 +212,7 @@ Combo = Class(Group) {
self._btnLeft:SetTexture(bitmaps.button.left.over)
self._btnRight:SetTexture(bitmaps.button.right.over)
self._btnMid:SetTexture(bitmaps.button.mid.over)
self._text:SetColor(self._titleColor or UIUtil.fontColor)
if not self.EnableColor then self._text:SetColor(self._titleColor or UIUtil.fontColor) end
if self.mRolloverCue then
local sound = Sound({Cue = self.mRolloverCue, Bank = "Interface",})
PlaySound(sound)
Expand All @@ -223,7 +224,7 @@ Combo = Class(Group) {
self._btnLeft:SetTexture(bitmaps.button.left.up)
self._btnRight:SetTexture(bitmaps.button.right.up)
self._btnMid:SetTexture(bitmaps.button.mid.up)
self._text:SetColor(self._titleColor or UIUtil.fontColor)
if not self.EnableColor then self._text:SetColor(self._titleColor or UIUtil.fontColor) end
end
self:OnMouseExit()
eventHandled = true
Expand All @@ -245,15 +246,15 @@ Combo = Class(Group) {
self._btnLeft:SetTexture(bitmaps.button.left.dis)
self._btnRight:SetTexture(bitmaps.button.right.dis)
self._btnMid:SetTexture(bitmaps.button.mid.dis)
self._text:SetColor(self._titleColor or UIUtil.fontColor)
if not self.EnableColor then self._text:SetColor(self._titleColor or UIUtil.fontColor) end
self._dropdown:Hide()
end

self.OnEnable = function(self)
self._btnLeft:SetTexture(bitmaps.button.left.up)
self._btnRight:SetTexture(bitmaps.button.right.up)
self._btnMid:SetTexture(bitmaps.button.mid.up)
self._text:SetColor(self._titleColor or UIUtil.fontColor)
if not self.EnableColor then self._text:SetColor(self._titleColor or UIUtil.fontColor) end
end

-- set up selection logic
Expand Down Expand Up @@ -306,9 +307,10 @@ Combo = Class(Group) {
-- remove old items and replace with a table of strings, also set the visible size
-- defaultItemIndex is 1 based
AddItems = function(self, textArray, defaultItemIndex, realDefValue)
defaultItemIndex = defaultItemIndex or 1
local numItems = table.getn(textArray)
self._visibleItems:Set(math.min(numItems, self._maxVisibleItems))
local defaultItemIndex = defaultItemIndex or 1

self._visibleItems:Set(math.min(numItems, self._maxVisibleItems))

if self._scrollbar then
self._scrollbar:Destroy()
Expand All @@ -317,13 +319,19 @@ Combo = Class(Group) {
self._scrollbar = UIUtil.CreateVertScrollbarFor(self._list)
end

for i, text in ipairs(textArray) do
local realDefFinded = false
for i, text in ipairs(textArray) do
if realDefValue and i == realDefValue then
if i == defaultItemIndex then realDefFinded = true end
self._list:AddItem(LOC(text)..' (default)')
else
elseif i != realDefValue then
self._list:AddItem(LOC(text))
end
end

if self.EnableColor and realDefFinded then
self._text:SetColor('DBDBBA') -- Yellow
end

self:SetItem(defaultItemIndex)
end,
Expand All @@ -332,6 +340,7 @@ Combo = Class(Group) {
self._visibleItems:Set(0)
self._list:DeleteAllItems()
self._text:SetText("")
self._text:SetColor(UIUtil.fontColor) -- Gris
if self._scrollbar then
self._scrollbar:Destroy()
self._scrollbar = nil
Expand Down Expand Up @@ -365,6 +374,7 @@ Combo = Class(Group) {

-- overload to get clicks
OnClick = function(self, index, text)
--if line.combo.EnableColor then line.combo:SetTitleTextColor('BADBBA') end -- Green
end,

OnEvent = function(self)
Expand Down
3 changes: 2 additions & 1 deletion lua/ui/dialogs/mapselect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,11 @@ function SetupOptionsPanel(parent, singlePlayer, curOptions)
--
--if data.type == 'option1' or data.type == 'option2' or data.type == 'option3' then -- For enable label (default) just or global/team/ai options
if data.data.default then realDefValue = data.data.default end
line.combo:AddItems(itemArray, defValue, realDefValue) -- For all (true for enable (default) label)
line.combo:AddItems(itemArray, defValue, realDefValue, true) -- For all (true for enable (default) label)
line.combo.OnClick = function(self, index, text)
--LOG('>> OnClick > '..index..' > '..text)
changedOptions[data.data.key] = {value = data.data.values[index].key, pref = data.data.pref, index = index}
if line.combo.EnableColor then line.combo._text:SetColor('DBBADB') end
--LOG('>> changedOptions > '..changedOptions[data.data.key].value..' > '..changedOptions[data.data.key].pref..' > '..changedOptions[data.data.key].index)
end
line.HandleEvent = Group.HandleEvent
Expand Down
4 changes: 4 additions & 0 deletions lua/ui/lobby/ModsManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -806,5 +806,9 @@ function CreateListElementtt(parent, modInfo, Pos, little)
end
--group.type:SetDropShadow(true)
--
if little then
Tooltip.AddControlTooltip(group.bg, {text=modInfo.name, body=modInfo.description})
end
--
return group
end
14 changes: 8 additions & 6 deletions lua/ui/lobby/changelog.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
last_version = 1
last_version = 4
changelog = {
{
version = 1,
version = 3,
name = "Lobby 2.5 (3636 patch)",
description = {
"- Add Changelog dialog",
Expand All @@ -11,7 +11,12 @@ changelog = {
"- Add 'Player Swapped' message",
"- Add 'Connected with xxx (with FAF Proxy)' message see if is connected with FAFproxy",
"- Add 1250 and 1500 Units Caps",
"- Fix Preset not loaded correctly (exemple FinalRushPro)",
"- Add Windowed options for launch Lobby windowed until launch [by Crotalus]",
"- Add Autobalance the teams when spawn is random [by Crotalus]",
"- Add new restrictions (NoEngineeringStation+EnhancementDrone), (NoEyeofRhianneandSoothsayer)",
"- Add translation for Unit Restrictions and re-order [by Xinnony, Navax's, aeoncleanse]",
"- Fix the Mod UI not activated directly [by Crotalus]",
"- Fix Preset not loaded correctly (exemple FinalRushPro, but need recreate preset)",
"- Fix ModManager crash sometime",
"- Fix a bug in Game Options, the new value is reset if you scroll the list",
"- Fix sometime a PresetLobby not loaded (caused by map not available)",
Expand All @@ -28,10 +33,7 @@ changelog = {
"- Typo 'x mods UI' to 'x UI mods' (KRAMP idea)",
"- Now you can see and select only the color available",
"- Transparent color the ACU in Minimap (just the grey color, not the black border)",
"- Add new restrictions (NoEngineeringStation+EnhancementDrone), (NoEyeofRhianneandSoothsayer)",
"- Typos in PresetLobby",
"- Add Windowed options for launch Lobby windowed until launch [by Crotalus]",
"- Autobalance the teams when spawn is random [by Crotalus]",
}
},
{
Expand Down
33 changes: 17 additions & 16 deletions lua/ui/lobby/lobby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
--* Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
--*****************************************************************************

LOBBYversion = 'v2.5'
LOBBYversion = 'v2.5b'

local UIUtil = import('/lua/ui/uiutil.lua')
local MenuCommon = import('/lua/ui/menus/menucommon.lua')
Expand Down Expand Up @@ -855,11 +855,7 @@ function SetSlotInfo(slot, playerInfo)
GUI.slots[slot].faction:SetItem(playerInfo.Faction)

GUI.slots[slot].color:Show()
--AddChatText('------------------------')
--AddChatText('=> SetSlotInfo START, index: '..playerInfo.PlayerColor..' = '..BASE_ALL_Color[playerInfo.PlayerColor]..' (slot:'..slot..'|'..gameInfo.PlayerOptions[slot].PlayerName..')')
Check_Availaible_Color(GUI.slots[slot].color, slot)
--AddChatText('=> SetSlotInfo FINISH, index: '..playerInfo.PlayerColor..' = '..BASE_ALL_Color[playerInfo.PlayerColor]..' (slot:'..slot..'|'..gameInfo.PlayerOptions[slot].PlayerName..')')
--AddChatText('------------------------')
--GUI.slots[slot].color:SetItem(playerInfo.PlayerColor)

GUI.slots[slot].team:Show()
Expand Down Expand Up @@ -3454,7 +3450,6 @@ function CreateUI(maxPlayers)
GUI.slots[i].color.Width:Set(slotColumnSizes.color.width)
GUI.slots[i].color.row = i
GUI.slots[i].color.OnClick = function(self, index)
AddChatText('> OnClick (i:'..index..')')
Get_IndexColor_by_CompleteTable(index, i)
Tooltip.DestroyMouseoverDisplay()
if not lobbyComm:IsHost() then
Expand Down Expand Up @@ -4730,7 +4725,6 @@ function InitLobbyComm(protocol, localPort, desiredPlayerName, localPlayerUID, n
HostConvertObserverToPlayerWithoutSlot(data.SenderID, data.RequestedName, data.ObserverSlot,
data.requestedFaction, data.requestedPL, data.requestedRC, data.requestedNG)
elseif data.Type == 'RequestColor' then
AddChatText('<>')
data.Color = Get_IndexColor_by_CompleteTable(data.Color)
if IsColorFree(data.Color) then
-- Color is available, let everyone else know
Expand Down Expand Up @@ -6719,6 +6713,12 @@ function CreateOptionLobbyDialog()
--
local WindowedLobby = Prefs.GetFromCurrentProfile('WindowedLobby') or 'true'
cbox_WindowedLobby:SetCheck(WindowedLobby == 'true', true)
if defaultMode == 'windowed' then
-- Already set Windowed in Game
cbox_WindowedLobby:Disable()
cbox_WindowedLobby_TEXT:Disable()
cbox_WindowedLobby_TEXT:SetColor('5C5F5C')
end
--
local XinnoSkin = Prefs.GetFromCurrentProfile('XinnoSkin') or 'Dark'
if XinnoSkin == 'Dark' then
Expand Down Expand Up @@ -7446,16 +7446,7 @@ end

-- Create the Available Color Table and Recreate the ComboBox --
function Check_Availaible_Color(self, slot)
local Checkbox = import('/lua/maui/checkbox.lua').Checkbox
local Text = import('/lua/maui/text.lua').Text
local MapPreview = import('/lua/ui/controls/mappreview.lua').MapPreview
local MultiLineText = import('/lua/maui/multilinetext.lua').MultiLineText
local Combo = import('/lua/ui/controls/combo.lua').Combo2
local StatusBar = import('/lua/maui/statusbar.lua').StatusBar
local BitmapCombo = import('/lua/ui/controls/combo.lua').BitmapCombo2
local EffectHelpers = import('/lua/maui/effecthelpers.lua')
local ItemList = import('/lua/maui/itemlist.lua').ItemList
local Prefs = import('/lua/user/prefs.lua')
--
Avail_Color[slot] = {}
num = 0
Expand Down Expand Up @@ -7516,6 +7507,16 @@ function Check_Availaible_Color(self, slot)
GUI.slots[slot].color.OnEvent = GUI.slots[slot].name.OnEvent
Tooltip.AddControlTooltip(GUI.slots[slot].color, 'lob_color')
GUI.slots[slot].color.row = slot
--
if IsLocallyOwned(slot) then
if gameInfo.PlayerOptions[slot]['Ready'] then
GUI.slots[slot].color:Disable()
else
GUI.slots[slot].color:Enable()
end
else
GUI.slots[slot].color:Disable()
end
end

#
Expand Down

0 comments on commit b5ad333

Please sign in to comment.