325 lines
9.1 KiB
Lua
325 lines
9.1 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
function UpdateMemberWindowProperties( f1_arg0, f1_arg1 )
|
|
f1_arg0.properties.memberListState = f1_arg1.memberListState
|
|
f1_arg0.properties.memberSlot = f1_arg1.memberSlot
|
|
f1_arg0.properties.team = f1_arg1.team
|
|
f1_arg0:processEvent( {
|
|
name = "refresh_member_window"
|
|
} )
|
|
end
|
|
|
|
function RefreshMemberWindow( f2_arg0, f2_arg1 )
|
|
local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 )
|
|
local f2_local1 = f2_arg0.properties
|
|
local f2_local2 = f2_local1.memberListState
|
|
local f2_local3 = f2_local1.memberSlot
|
|
local f2_local4 = f2_local1.team
|
|
if f2_local2 == Lobby.MemberListStates.None then
|
|
return
|
|
elseif f2_local0.selectedMemberUniqueId ~= GetLobbyMemberUniqueId( f2_local2, f2_local3, f2_local4 ) then
|
|
return
|
|
end
|
|
local f2_local5 = Engine.TableLookup( BackgroundsTable.File, BackgroundsTable.Cols.Ref, Lobby.GetMemberBackground and Lobby.GetMemberBackground( f2_local2, f2_local3, f2_local4 ) or 0, BackgroundsTable.Cols.Image )
|
|
if f2_local5 ~= nil then
|
|
f2_arg0:setBackground( f2_local5 )
|
|
end
|
|
local f2_local6 = {}
|
|
local f2_local7 = Lobby.GetMemberPartModelName( f2_local2, f2_local3, f2_local4, Lobby.CustomizationTypes.Head )
|
|
if f2_local7 and f2_local7 ~= "" then
|
|
if Engine.TableLookup( "mp/cac/helmets.csv", 0, f2_local7, 4 ) == "1" and string.find( f2_local7, "alt", -4 ) ~= nil then
|
|
f2_local7 = string.sub( f2_local7, 0, -4 ) .. "alt_f"
|
|
end
|
|
f2_local6.headModel = f2_local7
|
|
end
|
|
local f2_local8 = Lobby.GetMemberPartModelName( f2_local2, f2_local3, f2_local4, Lobby.CustomizationTypes.Body )
|
|
if f2_local8 and f2_local8 ~= "" then
|
|
f2_local6.bodyModel = string.sub( f2_local8, 0, -6 ) .. "elite"
|
|
end
|
|
local f2_local9 = Lobby.GetMemberPatch( f2_local2, f2_local3, f2_local4 )
|
|
if f2_local9 then
|
|
f2_local6.patch = f2_local9
|
|
end
|
|
if Engine.IsAliensMode() then
|
|
local f2_local10 = Lobby.GetMemberPerk( f2_local3, 1 )
|
|
if f2_local10 then
|
|
f2_local6.primaryWeaponName = "iw6_" .. string.sub( f2_local10, string.len( "perk_pistol_" ) + 1 ) .. "_mp"
|
|
end
|
|
else
|
|
local f2_local10 = Lobby.GetMemberWeaponSetup( f2_local2, f2_local3, f2_local4 )
|
|
local f2_local11 = 0
|
|
if f2_local10.camoName then
|
|
f2_local11 = tonumber( Cac.GetCamoWeaponIndex( f2_local10.camoName ) )
|
|
end
|
|
local f2_local12 = Cac.BuildWeaponName( f2_local10.weaponName, f2_local10.attachName1, f2_local10.attachName2, f2_local11, 0, f2_local10.attachName3 )
|
|
if f2_local12 then
|
|
f2_local6.primaryWeaponName = f2_local12
|
|
end
|
|
end
|
|
f2_arg0:updateCharacter( f2_local6 )
|
|
end
|
|
|
|
function LobbyCharacterViewUpdateSquadBotInfo( f3_arg0, f3_arg1 )
|
|
if Lobby.IsMemberAISquadMember and Lobby.IsMemberAISquadMember( f3_arg1.memberListState, f3_arg1.memberSlot, f3_arg1.team ) then
|
|
f3_arg0:animateToState( "default" )
|
|
else
|
|
f3_arg0:animateToState( "hidden" )
|
|
end
|
|
end
|
|
|
|
function LobbyCharacterViewSetSquadBotWeaponClassText( f4_arg0, f4_arg1 )
|
|
local f4_local0 = Lobby.IsMemberAISquadMember
|
|
if f4_local0 then
|
|
f4_local0 = Lobby.IsMemberAISquadMember( f4_arg1.memberListState, f4_arg1.memberSlot, f4_arg1.team )
|
|
end
|
|
if not f4_local0 or not Lobby.IsActiveMemberSlot( f4_arg1.memberIndex - 1 ) or not Lobby.GetSquadMemberWeaponName then
|
|
return
|
|
end
|
|
local f4_local1 = Lobby.GetSquadMemberWeaponName( f4_arg1.memberListState, f4_arg1.memberSlot, f4_arg1.team, f4_arg1.controller )
|
|
local f4_local2 = ""
|
|
if f4_local1 == "iw6_knifeonly" then
|
|
f4_local2 = Cac.GetWeaponName( f4_local1 )
|
|
else
|
|
f4_local2 = Cac.GetWeaponCategoryNameSingle( Cac.GetWeaponClass( f4_local1 ) )
|
|
end
|
|
if f4_local2 then
|
|
f4_arg0:setText( f4_local2 )
|
|
end
|
|
f4_arg0:animateToState( "default" )
|
|
end
|
|
|
|
function LobbyCharacterViewSetSquadBotWeaponText( f5_arg0, f5_arg1 )
|
|
local f5_local0 = Lobby.IsMemberAISquadMember
|
|
if f5_local0 then
|
|
f5_local0 = Lobby.IsMemberAISquadMember( f5_arg1.memberListState, f5_arg1.memberSlot, f5_arg1.team )
|
|
end
|
|
if not f5_local0 or not Lobby.IsActiveMemberSlot( f5_arg1.memberIndex - 1 ) or not Lobby.GetSquadMemberWeaponName then
|
|
return
|
|
end
|
|
local f5_local1 = Lobby.GetSquadMemberWeaponName( f5_arg1.memberListState, f5_arg1.memberSlot, f5_arg1.team, f5_arg1.controller )
|
|
if f5_local1 == "iw6_knifeonly" then
|
|
f5_arg0:setText( "" )
|
|
else
|
|
f5_arg0:setText( Cac.GetWeaponName( f5_local1 ) )
|
|
end
|
|
f5_arg0:animateToState( "default" )
|
|
end
|
|
|
|
function CharacterViewChildFeeder( f6_arg0 )
|
|
local f6_local0 = {
|
|
{
|
|
type = "UISquadMemberWindow",
|
|
id = "CharacterViewSquadMemberWindow",
|
|
properties = {
|
|
use_member_name = false,
|
|
use_prestige_icon = false,
|
|
use_playercard = false,
|
|
use_background = true,
|
|
default_anim = Cac.Customization.Animations.default,
|
|
uv_values = {
|
|
0,
|
|
0,
|
|
1,
|
|
1
|
|
},
|
|
character_pos = CharacterCameraPresets.Lobby.Position,
|
|
char_window_dims = {
|
|
top = 0,
|
|
bottom = 610,
|
|
left = -175,
|
|
right = 435
|
|
},
|
|
card_scale = -0.15,
|
|
squad_location = MBh.Property( "squad_location" ),
|
|
mask_pos_data = {
|
|
top = 17,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
},
|
|
memberListState = Lobby.MemberListStates.None,
|
|
memberSlot = 0,
|
|
team = Teams.free
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
leftAnchor = false,
|
|
bottomAnchor = false,
|
|
rightAnchor = true,
|
|
top = 70,
|
|
left = 0 + Cac.Layout.CacEditPanel.shift_delta,
|
|
bottom = 670,
|
|
right = 746 + Cac.Layout.CacEditPanel.shift_delta
|
|
}
|
|
},
|
|
handlers = {
|
|
menu_create = function ( f7_arg0, f7_arg1 )
|
|
f7_arg0:processEvent( {
|
|
name = "set_border_state",
|
|
border_state = "hidden"
|
|
} )
|
|
end,
|
|
lobby_detail_update = UpdateMemberWindowProperties,
|
|
refresh_member_window = RefreshMemberWindow,
|
|
menu_close = function ( f8_arg0, f8_arg1 )
|
|
LUI.UISquadMemberWindow.Shutdown( f8_arg0 )
|
|
end
|
|
}
|
|
},
|
|
{
|
|
type = "UITimer",
|
|
id = "member_window_refresh_timer",
|
|
properties = {
|
|
event = "refresh_member_window",
|
|
interval = 300,
|
|
disposable = false
|
|
}
|
|
}
|
|
}
|
|
if SvS.IsSvS() then
|
|
f6_local0[#f6_local0 + 1] = {
|
|
type = "UIVerticalList",
|
|
id = "lobby_character_view_squad_weapon_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = 20,
|
|
right = 500,
|
|
top = -200,
|
|
bottom = -250,
|
|
alpha = 1
|
|
},
|
|
hidden = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
lobby_detail_update = LobbyCharacterViewUpdateSquadBotInfo
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "lobby_character_view_squad_weapon_cat",
|
|
properties = {
|
|
text = ""
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.BigFont.Height,
|
|
font = CoD.TextSettings.BigFont.Font,
|
|
textStyle = CoD.TextStyle.ShadowedMore,
|
|
alignment = LUI.Alignment.Right,
|
|
alpha = 1,
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b
|
|
},
|
|
hidden = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
lobby_detail_update = LobbyCharacterViewSetSquadBotWeaponClassText
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "lobby_character_view_squad_weapon_name",
|
|
properties = {
|
|
text = ""
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = CoD.TextSettings.BigFont.Height,
|
|
font = CoD.TextSettings.BigFont.Font,
|
|
textStyle = CoD.TextStyle.ShadowedMore,
|
|
alignment = LUI.Alignment.Right,
|
|
alpha = 1,
|
|
red = Colors.grey_4.r,
|
|
green = Colors.grey_4.g,
|
|
blue = Colors.grey_4.b
|
|
},
|
|
hidden = {
|
|
alpha = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
lobby_detail_update = LobbyCharacterViewSetSquadBotWeaponText
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
return f6_local0
|
|
end
|
|
|
|
function lobby_character_view()
|
|
return {
|
|
type = "UIElement",
|
|
id = "lobby_character_view_id",
|
|
focusable = true,
|
|
properties = {
|
|
squad_location = "privateMatchSquadMembers"
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
leftAnchor = true,
|
|
bottomAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
left = 0,
|
|
bottom = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
handlers = {
|
|
lobby_detail_update = function ( f10_arg0, f10_arg1 )
|
|
local f10_local0 = false
|
|
if SvS.IsSvS() and (not Lobby.IsMemberAISquadMember or Lobby.IsMemberAISquadMember( f10_arg1.memberListState, f10_arg1.memberSlot, f10_arg1.team )) then
|
|
f10_local0 = true
|
|
end
|
|
if not Lobby.ShowMemberInfo( f10_arg1.memberListState, f10_arg1.memberSlot, f10_arg1.team ) then
|
|
f10_local0 = true
|
|
end
|
|
if f10_local0 then
|
|
f10_arg0:dispatchEventToParent( {
|
|
name = "page_disable",
|
|
immediate = true
|
|
} )
|
|
else
|
|
f10_arg0:dispatchEventToParent( {
|
|
name = "page_enable",
|
|
immediate = true
|
|
} )
|
|
end
|
|
end
|
|
|
|
},
|
|
childrenFeeder = CharacterViewChildFeeder
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "lobby_character_view", lobby_character_view )
|
|
LockTable( _M )
|