924 lines
31 KiB
Lua
924 lines
31 KiB
Lua
LUI.UISquadMemberWindow = InheritFrom( LUI.UIElement )
|
|
LUI.UISquadMemberWindow.build = function ( f1_arg0, f1_arg1 )
|
|
return LUI.UISquadMemberWindow.new( f1_arg1 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.new = function ( f2_arg0 )
|
|
local self = LUI.UIElement.new()
|
|
self.id = "UISquadMemberWindow"
|
|
self.setDisplayName = LUI.UISquadMemberWindow.SetDisplayName
|
|
self.setPrestigeIcon = LUI.UISquadMemberWindow.SetPrestigeIcon
|
|
self.moveTo = LUI.UISquadMemberWindow.MoveTo
|
|
self.setCharacterAnim = LUI.UISquadMemberWindow.SetAnimation
|
|
self.setBackground = LUI.UISquadMemberWindow.SetBackground
|
|
self.updateSquadMember = LUI.UISquadMemberWindow.UpdateSavedCharacterWindow
|
|
self.updateCharacter = LUI.UISquadMemberWindow.UpdateCharacterWindow
|
|
assert( f2_arg0, "UISquadMemberWindow requires a properties table. At the very least, you must specify char_window_dims, uv_values, and character_pos" )
|
|
if not f2_arg0 then
|
|
f2_arg0 = {
|
|
char_window_dims = {
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
}
|
|
end
|
|
self.squadMemberIndex = f2_arg0.squad_member_index
|
|
self.loadoutSlot = f2_arg0.loadout_slot
|
|
local f2_local1 = f2_arg0.squad_location
|
|
if not f2_local1 then
|
|
DebugPrint( "WARNING: Using UISquadMemberWindow without specifying squad_location. Defaulting to privateMatchSquadMembers" )
|
|
f2_local1 = "privateMatchSquadMembers"
|
|
end
|
|
self.squadLocation = f2_local1
|
|
local f2_local2 = f2_arg0.controller
|
|
if not f2_local2 then
|
|
DebugPrint( "WARNING: Using UISquadMemberWindow without specifying controller. Defaulting to first active controller" )
|
|
f2_local2 = Engine.GetFirstActiveController()
|
|
end
|
|
self.controller = f2_local2
|
|
if f2_arg0.use_background then
|
|
local charWindow = f2_arg0.mask_pos_data
|
|
if not charWindow then
|
|
charWindow = {
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
bottom = 0
|
|
}
|
|
end
|
|
local f2_local4 = f2_arg0.mask_dims_data
|
|
if not f2_local4 then
|
|
f2_local4 = {
|
|
width = 512,
|
|
height = 512
|
|
}
|
|
end
|
|
self.background_mask = LUI.UIImage.new( {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = charWindow.top,
|
|
left = charWindow.left,
|
|
width = f2_local4.width,
|
|
height = f2_local4.height,
|
|
material = RegisterMaterial( "img_bg_alpha_stencil" ),
|
|
alpha = 1
|
|
} )
|
|
self.background_mask:setUseStencil( true )
|
|
self.background_mask.id = "member_window_background_mask_id"
|
|
self:addElement( self.background_mask )
|
|
local f2_local5 = f2_arg0.bg_anchor_data
|
|
if not f2_local5 then
|
|
f2_local5 = {
|
|
left = true,
|
|
top = true,
|
|
right = true,
|
|
bottom = true
|
|
}
|
|
end
|
|
local f2_local6 = f2_arg0.bg_pos_data
|
|
if not f2_local6 then
|
|
f2_local6 = {
|
|
left = 1,
|
|
top = 1,
|
|
right = -1,
|
|
bottom = -1
|
|
}
|
|
end
|
|
self.background = LUI.UIImage.new( {
|
|
left = f2_local6.left,
|
|
top = f2_local6.top,
|
|
right = f2_local6.right,
|
|
bottom = f2_local6.bottom,
|
|
leftAnchor = f2_local5.left,
|
|
topAnchor = f2_local5.top,
|
|
rightAnchor = f2_local5.right,
|
|
bottomAnchor = f2_local5.bottom,
|
|
alpha = 1
|
|
} )
|
|
self.background.id = "member_window_background_id"
|
|
self.background:registerAnimationState( "hidden", {
|
|
alpha = 0
|
|
} )
|
|
self.background:animateToState( "hidden", 0 )
|
|
self.background:registerEventHandler( "update_character_bg", function ( element, event )
|
|
if event.material then
|
|
element:setImage( event.material )
|
|
element:animateToState( "default", 0 )
|
|
end
|
|
end )
|
|
self.background_mask:addElement( self.background )
|
|
end
|
|
if f2_arg0.use_border then
|
|
local f2_local4 = LUI.MenuBuilder.buildItems( {
|
|
type = "generic_border",
|
|
id = "member_window_bg_border_id",
|
|
properties = {
|
|
thickness = 1,
|
|
border_red = 1,
|
|
border_green = 1,
|
|
border_blue = 1,
|
|
border_alpha = 0.5
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0,
|
|
alpha = 0.2
|
|
}
|
|
}
|
|
}, f2_arg0, self )
|
|
f2_local4:registerAnimationState( "focused", {
|
|
alpha = 0.4
|
|
} )
|
|
f2_local4:registerAnimationState( "hidden", {
|
|
alpha = 0
|
|
} )
|
|
f2_local4:registerEventHandler( "set_border_state", function ( element, event )
|
|
element:animateToState( event.border_state )
|
|
end )
|
|
self:addElement( f2_local4 )
|
|
end
|
|
if f2_arg0.use_3d_model and f2_arg0.use_2d_character_image then
|
|
DebugPrint( "ERROR: Both use_3d_model and use_2d_character_image are set to true! Defaulting to using the 2d model." )
|
|
f2_arg0.use_3d_model = false
|
|
end
|
|
if f2_arg0.use_3d_model ~= false then
|
|
local charWindow = LUI.UICharacterWindow.new()
|
|
charWindow.id = "member_window_character_id"
|
|
charWindow:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = f2_arg0.char_window_dims.top,
|
|
bottom = f2_arg0.char_window_dims.bottom,
|
|
left = f2_arg0.char_window_dims.left,
|
|
right = f2_arg0.char_window_dims.right,
|
|
red = 1,
|
|
green = 1,
|
|
blue = 1,
|
|
alpha = 1
|
|
} )
|
|
charWindow:registerAnimationState( "silhouette", {
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alpha = 1
|
|
} )
|
|
charWindow:registerAnimationState( "hidden", {
|
|
red = 0,
|
|
green = 0,
|
|
blue = 0,
|
|
alpha = 0
|
|
} )
|
|
charWindow:animateToState( "default" )
|
|
charWindow:registerEventHandler( "make_scene", LUI.UISquadMemberWindow.InitCharacterWindow )
|
|
charWindow:registerEventHandler( "set_silhouette", function ( element, event )
|
|
element:animateToState( "silhouette", event.anim_length or 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "set_normal", function ( element, event )
|
|
element:animateToState( "default", event.anim_length or 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "hide_character", function ( element, event )
|
|
element:animateToState( "hidden", event.anim_length or 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "animLooped", LUI.UISquadMemberWindow.ChangeAnimOnLoopedEnd )
|
|
charWindow:registerEventHandler( "animEnded", LUI.UISquadMemberWindow.ChangeAnimOnEnd )
|
|
charWindow:registerEventHandler( "weapon_changed", LUI.UISquadMemberWindow.WeaponChangeAnim )
|
|
charWindow:registerEventHandler( "weapon_changed_stowed", LUI.UISquadMemberWindow.WeaponChangeStowed )
|
|
charWindow:registerEventHandler( "idle_changed", LUI.UISquadMemberWindow.IdleChangeAnim )
|
|
charWindow:registerEventHandler( "gamepad_sticks", LUI.UISquadMemberWindow.RightStickSpin )
|
|
charWindow:registerEventHandler( "leftmousedown", function ( element, event )
|
|
|
|
end )
|
|
charWindow:registerEventHandler( "leftmouseup", function ( element, event )
|
|
local f9_local0 = element:getParent()
|
|
CharacterScene.SetSpin( f9_local0.handle, 0, 0, 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "mousemove", LUI.UISquadMemberWindow.PCSpin )
|
|
charWindow:setHandleMouseButton( true )
|
|
local f2_local4 = LUI.UITimer.new( 50, "make_scene" )
|
|
f2_local4.id = "createSceneTimer"
|
|
charWindow:addElement( f2_local4 )
|
|
self:addElement( charWindow )
|
|
self.charWindow = charWindow
|
|
|
|
LUI.UISquadMemberWindow.AddLoadingWidget( self, f2_arg0 )
|
|
end
|
|
if f2_arg0.use_2d_character_image == true then
|
|
local charWindow = LUI.UIImage.new()
|
|
charWindow.id = "member_window_character_id"
|
|
charWindow:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = f2_arg0.char_window_dims.top,
|
|
bottom = f2_arg0.char_window_dims.bottom,
|
|
left = f2_arg0.char_window_dims.left,
|
|
right = f2_arg0.char_window_dims.right,
|
|
material = RegisterMaterial( "img_char_cas" ),
|
|
red = 0.6,
|
|
green = 0.6,
|
|
blue = 0.6,
|
|
alpha = 0.25
|
|
} )
|
|
charWindow:registerAnimationState( "hidden", {
|
|
alpha = 0
|
|
} )
|
|
charWindow:animateToState( "default" )
|
|
charWindow:registerEventHandler( "set_normal", function ( element, event )
|
|
element:animateToState( "default", event.anim_length or 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "set_silhouette", function ( element, event )
|
|
element:animateToState( "default", event.anim_length or 0 )
|
|
end )
|
|
charWindow:registerEventHandler( "hide_character", function ( element, event )
|
|
element:animateToState( "hidden", event.anim_length or 0 )
|
|
end )
|
|
self:addElement( charWindow )
|
|
self.charImage = charWindow
|
|
end
|
|
if f2_arg0.use_member_name then
|
|
LUI.UISquadMemberWindow.AddMemberName( self )
|
|
end
|
|
if f2_arg0.use_prestige_icon then
|
|
self.prestigeIcon = LUI.UIImage.new()
|
|
self.prestigeIcon.id = "member_window_prestige_icon_id"
|
|
self.prestigeIcon:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 30,
|
|
top = 100,
|
|
right = 94,
|
|
bottom = 164,
|
|
material = RegisterMaterial( "white" ),
|
|
alpha = 1
|
|
} )
|
|
self.prestigeIcon:registerAnimationState( "shown", {
|
|
alpha = 1
|
|
} )
|
|
self.prestigeIcon:registerAnimationState( "hidden", {
|
|
alpha = 0
|
|
} )
|
|
self.prestigeIcon:animateToState( "default" )
|
|
self.prestigeIcon:registerEventHandler( "show_prestige_icon", function ( element, event )
|
|
element:animateToState( "shown", event.anim_length or 0 )
|
|
end )
|
|
self.prestigeIcon:registerEventHandler( "hide_prestige_icon", function ( element, event )
|
|
element:animateToState( "hidden", event.anim_length or 0 )
|
|
end )
|
|
self:addElement( self.prestigeIcon )
|
|
end
|
|
if f2_arg0.use_playercard then
|
|
local charWindow = LUI.Playercard.new( nil, f2_arg0.card_props or {}, childNum )
|
|
charWindow.id = "playercard_id"
|
|
local f2_local4 = f2_arg0.card_dims
|
|
if not f2_local4 then
|
|
f2_local4 = {
|
|
top = -15,
|
|
bottom = 35,
|
|
left = -50,
|
|
right = 6
|
|
}
|
|
end
|
|
charWindow:registerAnimationState( "default", {
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = f2_local4.top,
|
|
bottom = f2_local4.bottom,
|
|
left = f2_local4.left,
|
|
right = f2_local4.right,
|
|
scale = f2_arg0.card_scale or 0,
|
|
alpha = 1
|
|
} )
|
|
charWindow:animateToState( "default" )
|
|
self:addElement( charWindow )
|
|
end
|
|
self.close = function ()
|
|
LUI.UISquadMemberWindow.Shutdown( self, event )
|
|
LUI.UIElement.close( self )
|
|
end
|
|
|
|
self.closeTree = function ()
|
|
LUI.UISquadMemberWindow.Shutdown( self, event )
|
|
LUI.UIElement.closeTree( self )
|
|
end
|
|
|
|
if self.squadMemberIndex and (f2_arg0.use_playercard or f2_arg0.use_3d_model) then
|
|
self:updateSquadMember( self.controller, self.squadMemberIndex )
|
|
end
|
|
return self
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.InitCharacterWindow = function ( f17_arg0, f17_arg1 )
|
|
if not CharacterScene.IsReady() then
|
|
return
|
|
end
|
|
local f17_local0 = f17_arg0:getParent()
|
|
f17_local0:processEvent( {
|
|
name = "close_loading_character_scene"
|
|
} )
|
|
f17_arg0:closeChildren()
|
|
if f17_arg0.handle then
|
|
CharacterScene.FreeCharacter( f17_arg0.handle )
|
|
end
|
|
f17_local0 = f17_arg0:getParent()
|
|
if not f17_local0 then
|
|
return
|
|
end
|
|
local f17_local1 = "iw6_kriss_mp"
|
|
local f17_local2 = "iw6_pp19_mp"
|
|
local f17_local3 = Cac.GetDefaultBodyModel( f17_local0.controller )
|
|
local f17_local4 = Cac.GetDefaultHeadModel( f17_local0.controller )
|
|
local f17_local5 = f17_arg0.storedCharacterData or {}
|
|
if f17_local0.squadMemberIndex then
|
|
f17_local5 = GetCharDataForSquadMember( f17_local0, f17_local0.controller, f17_local0.squadMemberIndex )
|
|
end
|
|
f17_local1 = f17_local5.primaryWeaponName or f17_local1
|
|
f17_local2 = f17_local5.secondaryWeaponName or f17_local2
|
|
f17_local3 = f17_local5.bodyModel or f17_local3
|
|
f17_local4 = f17_local5.headModel or f17_local4
|
|
local f17_local6 = f17_local0.properties
|
|
local f17_local7 = f17_local6.charHandle
|
|
if not f17_local7 then
|
|
f17_local7 = f17_local0.id .. "_character_render"
|
|
end
|
|
local f17_local8 = CharacterScene.CreateCharacter( f17_local7, f17_local3, f17_local4, f17_local1 )
|
|
CharacterScene.SetVisionSet( "mp_character_room" )
|
|
CharacterScene.SetFOV( 43 )
|
|
CharacterScene.SetAmbient( 0, 0, 0 )
|
|
CharacterScene.SetSpin( f17_local8, 0, 0, 0 )
|
|
if f17_local6 then
|
|
CharacterScene.SetCharacterUVs( f17_local8, f17_local6.uv_values[1], f17_local6.uv_values[2], f17_local6.uv_values[3], f17_local6.uv_values[4] )
|
|
CharacterScene.PositionRelativeToCamera( f17_local8, f17_local6.character_pos[1], f17_local6.character_pos[2], f17_local6.character_pos[3] )
|
|
if f17_local6.character_rot then
|
|
CharacterScene.SetBlendedRotation( f17_local8, f17_local6.character_rot[1], f17_local6.character_rot[2], f17_local6.character_rot[3], 0 )
|
|
end
|
|
end
|
|
f17_local0.handle = f17_local8
|
|
f17_local0.current_weapon = f17_local1
|
|
f17_arg0:setCharacterHandle( f17_local8 )
|
|
if f17_local0.storedCharacterData then
|
|
f17_local0:updateCharacter( f17_local0.storedCharacterData )
|
|
elseif f17_local0.squadMemberIndex then
|
|
f17_local0:updateSquadMember( f17_local0.controller, f17_local0.squadMemberIndex )
|
|
end
|
|
local self = LUI.UIElement.new()
|
|
self.id = "anim_handling_elem"
|
|
self:registerAnimationState( "default", {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = 0,
|
|
bottom = 1,
|
|
left = 0,
|
|
right = 1,
|
|
red = 1,
|
|
green = 1,
|
|
blue = 1,
|
|
alpha = 0
|
|
} )
|
|
self:registerAnimationState( "weapon_change_start", {
|
|
alpha = 1
|
|
} )
|
|
self:animateToState( "default" )
|
|
self:registerEventHandler( "weapon_change_start", LUI.UISquadMemberWindow.WeaponChangeStart )
|
|
self:registerEventHandler( "transition_complete_weapon_change_start", function ( element, event )
|
|
if not event.interrupted then
|
|
local f18_local0 = element:getParent()
|
|
f18_local0:processEvent( {
|
|
name = "weapon_changed",
|
|
new_weapon = element.new_weapon,
|
|
prev_weapon = element.prev_weapon,
|
|
offline_weapon = element.offline_weapon
|
|
} )
|
|
end
|
|
end )
|
|
f17_arg0:addElement( self )
|
|
f17_arg0.anim_states = {}
|
|
f17_arg0.anim_states[1] = {
|
|
anim_state = "idle",
|
|
anim_name = Cac.GetRandomIdleAnim( f17_local0.current_weapon ),
|
|
weapon_name = f17_local0.current_weapon
|
|
}
|
|
LUI.UISquadMemberWindow.SetAnimation( f17_arg0:getParent(), f17_arg0.anim_states[1].anim_name, 0.2 )
|
|
f17_local0:processEvent( {
|
|
name = "character_init_complete"
|
|
} )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.MoveTo = function ( f19_arg0, f19_arg1, f19_arg2 )
|
|
if not CharacterScene.IsReady() then
|
|
return
|
|
elseif f19_arg0.handle then
|
|
CharacterScene.SetMovement( f19_arg0.handle, f19_arg1.Position[1], f19_arg1.Position[2], f19_arg1.Position[3], f19_arg2 or 0 )
|
|
CharacterScene.SetBlendedRotation( f19_arg0.handle, f19_arg1.Rotation[1], f19_arg1.Rotation[2], f19_arg1.Rotation[3], f19_arg2 or 0 )
|
|
end
|
|
end
|
|
|
|
function GetCharDataForSquadMember( f20_arg0, f20_arg1, f20_arg2 )
|
|
local f20_local0 = {
|
|
bodyModel = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetSavedModel( f20_arg1, f20_arg0.squadLocation, f20_arg2 ),
|
|
headModel = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head].GetSavedModel( f20_arg1, f20_arg0.squadLocation, f20_arg2 )
|
|
}
|
|
if not Engine.IsAliensMode() then
|
|
f20_local0.primaryWeaponName = Cac.BuildPrimaryWeaponName( f20_arg1, f20_arg0.squadLocation, f20_arg2, "loadouts", f20_arg0.loadoutSlot or 0 )
|
|
f20_local0.secondaryWeaponName = Cac.BuildSecondaryWeaponName( f20_arg1, f20_arg0.squadLocation, f20_arg2, "loadouts", f20_arg0.loadoutSlot or 0 )
|
|
f20_local0.experience = Engine.GetPlayerDataEx( f20_arg1, CoD.GetStatsGroupForGameMode(), f20_arg0.squadLocation, f20_arg2, "squadMemXP" )
|
|
f20_local0.rank = Lobby.GetRankForXP( f20_local0.experience )
|
|
f20_local0.prestige = Cac.GetPrestigeLevel( f20_arg1, f20_arg0.squadLocation )
|
|
else
|
|
f20_local0.primaryWeaponName = "iw6_" .. string.sub( LUI.mp_menus.Aliens.GetAlienPerk( f20_arg1, 1 ), string.len( "perk_pistol_" ) + 1 ) .. "_mp"
|
|
f20_local0.experience = LUI.mp_menus.Aliens.getAliensExperience( f20_arg1 )
|
|
f20_local0.rank = Lobby.GetAlienRankForXP( f20_local0.experience )
|
|
f20_local0.prestige = LUI.mp_menus.Aliens.getAliensPrestigeLevel( f20_arg1 )
|
|
end
|
|
f20_local0.background = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].GetSavedRef( f20_arg1, f20_arg0.squadLocation, f20_arg2 )
|
|
f20_local0.patch = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetSavedRef( f20_arg1, f20_arg0.squadLocation, f20_arg2 )
|
|
f20_local0.clanTag = Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag].GetSavedRef( f20_arg1 )
|
|
return f20_local0
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.UpdateSavedCharacterWindow = function ( f21_arg0, f21_arg1, f21_arg2 )
|
|
f21_arg0.squadMemberIndex = f21_arg2
|
|
f21_arg0:updateCharacter( GetCharDataForSquadMember( f21_arg0, f21_arg1, f21_arg2 ) )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.UpdateCharacterWindow = function ( f22_arg0, f22_arg1 )
|
|
if f22_arg1.background then
|
|
Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].PreviewFunction( controller, f22_arg0, nil, f22_arg1.background )
|
|
end
|
|
if f22_arg1.patch then
|
|
Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].InitFunction( controller, f22_arg0, nil, f22_arg1.patch )
|
|
end
|
|
if f22_arg1.clanTag then
|
|
Cac.Customization.Fields[Cac.Customization.FieldIndexes.ClanTag].PreviewFunction( controller, f22_arg0, nil, f22_arg1.clanTag )
|
|
end
|
|
f22_arg0:processEvent( {
|
|
name = "update_playercard",
|
|
experience = f22_arg1.experience,
|
|
rank = f22_arg1.rank,
|
|
prestige = f22_arg1.prestige
|
|
} )
|
|
if not f22_arg0.handle then
|
|
f22_arg0.storedCharacterData = f22_arg1
|
|
return
|
|
elseif f22_arg1.bodyModel then
|
|
if f22_arg1.patch then
|
|
CharacterScene.ChangeBody( f22_arg0.handle, f22_arg1.bodyModel, f22_arg1.patch )
|
|
else
|
|
CharacterScene.ChangeBody( f22_arg0.handle, f22_arg1.bodyModel )
|
|
end
|
|
end
|
|
if f22_arg1.headModel then
|
|
CharacterScene.ChangeHead( f22_arg0.handle, f22_arg1.headModel )
|
|
end
|
|
if f22_arg1.primaryWeaponName then
|
|
CharacterScene.ChangeWeapon( f22_arg0.handle, f22_arg1.primaryWeaponName and "iw6_knifeonlymenu_mp" or f22_arg1.primaryWeaponName )
|
|
LUI.UISquadMemberWindow.IdleChangeAnim( f22_arg0.charWindow, {
|
|
name = "idle_changed",
|
|
new_weapon = f22_arg1.primaryWeaponName
|
|
} )
|
|
f22_arg0.current_weapon = f22_arg1.primaryWeaponName
|
|
end
|
|
if f22_arg1.secondaryWeaponName then
|
|
CharacterScene.ChangeStowedWeapon( f22_arg0.handle, f22_arg1.secondaryWeaponName )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.Shutdown = function ( f23_arg0, f23_arg1 )
|
|
if f23_arg0.handle then
|
|
CharacterScene.FreeCharacter( f23_arg0.handle )
|
|
f23_arg0.handle = nil
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.SetDisplayName = function ( f24_arg0, f24_arg1 )
|
|
if f24_arg0.displayName then
|
|
f24_arg0.displayName:setText( f24_arg1 )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.SetPrestigeIcon = function ( f25_arg0, f25_arg1 )
|
|
if f25_arg0.prestigeIcon then
|
|
f25_arg0.prestigeIcon:setImage( f25_arg1 )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.SetAnimation = function ( f26_arg0, f26_arg1, f26_arg2 )
|
|
if not CharacterScene.IsReady() then
|
|
return
|
|
elseif f26_arg0.handle then
|
|
f26_arg0.playing_anim = f26_arg1
|
|
if not f26_arg2 then
|
|
CharacterScene.PlayAnim( f26_arg0.handle, f26_arg1 )
|
|
else
|
|
CharacterScene.PlayAnim( f26_arg0.handle, f26_arg1, f26_arg2 )
|
|
end
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.SetBackground = function ( f27_arg0, f27_arg1 )
|
|
if f27_arg0.background then
|
|
if f27_arg1 == nil or f27_arg1 == "" then
|
|
f27_arg0.background:animateToState( "hidden", 0 )
|
|
else
|
|
f27_arg0.background:setImage( RegisterMaterial( f27_arg1 ) )
|
|
f27_arg0.background:animateToState( "default", 0 )
|
|
end
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.AddMemberName = function ( f28_arg0 )
|
|
local f28_local0 = -15
|
|
local self = LUI.UIElement.new( {
|
|
top = -60,
|
|
bottom = 0,
|
|
left = 1,
|
|
right = -1,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true
|
|
} )
|
|
self.id = "member_window_name_container_id"
|
|
local f28_local2 = LUI.UIImage.new( {
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
red = Colors.black.r,
|
|
green = Colors.black.g,
|
|
blue = Colors.black.g,
|
|
alpha = 0.5,
|
|
material = RegisterMaterial( "gradient_bottom" )
|
|
} )
|
|
f28_local2.id = "member_window_text_bg_id"
|
|
self:addElement( f28_local2 )
|
|
f28_arg0.displayName = LUI.UIMarqueeText.new()
|
|
f28_arg0.displayName.id = "member_window_name_id"
|
|
f28_arg0.displayName:registerAnimationState( "default", {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
top = -CoD.TextSettings.ExtraBigFont.Height + f28_local0,
|
|
right = 0,
|
|
bottom = f28_local0,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
alignment = LUI.Alignment.Center,
|
|
red = Colors.primary_text_color.r,
|
|
green = Colors.primary_text_color.g,
|
|
blue = Colors.primary_text_color.b
|
|
} )
|
|
f28_arg0.displayName:animateToState( "default" )
|
|
self:addElement( f28_arg0.displayName )
|
|
local f28_local3 = nil
|
|
f28_local3 = LUI.UIHorizontalList.new()
|
|
f28_local3.id = "member_window_unlock_text"
|
|
f28_local3:registerAnimationState( "default", {
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
bottom = 0,
|
|
alpha = 1,
|
|
alignment = LUI.Alignment.Center,
|
|
spacing = 2
|
|
} )
|
|
f28_local3:registerAnimationState( "hidden", {
|
|
alpha = 0
|
|
} )
|
|
f28_local3:animateToState( "default" )
|
|
f28_local3:registerEventHandler( "show_unlock_text", function ( element, event )
|
|
element:animateToState( "default" )
|
|
end )
|
|
f28_local3:registerEventHandler( "hide_unlock_text", function ( element, event )
|
|
element:animateToState( "hidden" )
|
|
end )
|
|
local f28_local4 = LUI.UIImage.new( {
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
height = 32,
|
|
left = 0,
|
|
right = 32,
|
|
material = RegisterMaterial( "icon_unlock_token_32" )
|
|
} )
|
|
local f28_local5 = Engine.Localize( "@LUA_MENU_SQUAD_MEMBER_UNLOCK_COST", Cac.MemberCost[1] )
|
|
local f28_local6, f28_local7, f28_local8, f28_local9 = GetTextDimensions( f28_local5, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
|
|
local f28_local10 = LUI.UIText.new( {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
right = f28_local8 + 1,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left,
|
|
red = Colors.primary_text_color.r,
|
|
green = Colors.primary_text_color.g,
|
|
blue = Colors.primary_text_color.b
|
|
} )
|
|
f28_local10:setText( f28_local5 )
|
|
f28_local3:addElement( f28_local4 )
|
|
f28_local3:addElement( f28_local10 )
|
|
self:addElement( f28_local3 )
|
|
f28_arg0:addElement( self )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.AddLoadingWidget = function ( f31_arg0, f31_arg1 )
|
|
local f31_local0 = f31_arg1.mask_pos_data
|
|
if not f31_local0 then
|
|
f31_local0 = {
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
bottom = 0
|
|
}
|
|
end
|
|
local f31_local1 = f31_arg1.mask_dims_data
|
|
if not f31_local1 then
|
|
f31_local1 = {
|
|
width = 512,
|
|
height = 512
|
|
}
|
|
end
|
|
local self = LUI.UIElement.new( {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
top = f31_local0.top,
|
|
left = f31_local0.left,
|
|
width = f31_local1.width,
|
|
height = f31_local1.height
|
|
} )
|
|
self:registerEventHandler( "close_loading_character_scene", function ( element, event )
|
|
element:close()
|
|
end )
|
|
f31_arg0:addElement( self )
|
|
local f31_local3 = LUI.MenuBuilder.buildItems( {
|
|
type = "live_dialog_text_box",
|
|
id = "loading_widget_id",
|
|
properties = {
|
|
message = Engine.Localize( "@MENU_LOADING_DOTS" ),
|
|
overlay_alpha = 0
|
|
}
|
|
}, {}, f31_arg0 )
|
|
f31_local3:processEvent( {
|
|
name = "hide_popup_background"
|
|
} )
|
|
self:addElement( f31_local3 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.RightStickSpin = function ( f33_arg0, f33_arg1 )
|
|
if Engine.IsGamepadEnabled() ~= 1 then
|
|
return
|
|
end
|
|
local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 )
|
|
if f33_local0 and f33_local0.exclusiveController and f33_arg1.controller and f33_local0.exclusiveController ~= f33_arg1.controller then
|
|
return
|
|
end
|
|
local f33_local1 = f33_arg1.rightStickDirection
|
|
local f33_local2 = f33_arg1.rightStickMagnitude
|
|
local f33_local3 = f33_arg0:getParent()
|
|
f33_local3 = f33_local3.handle
|
|
if f33_local2 > 0.1 then
|
|
if f33_local1 < 35 and f33_local1 > -35 then
|
|
CharacterScene.SetSpin( f33_local3, 0, f33_local2 * 3, 0 )
|
|
elseif not (f33_local1 >= -145 or f33_local1 < -180) or f33_local1 <= 180 and f33_local1 > 145 then
|
|
CharacterScene.SetSpin( f33_local3, 0, -f33_local2 * 3, 0 )
|
|
else
|
|
CharacterScene.SetSpin( f33_local3, 0, 0, 0 )
|
|
end
|
|
else
|
|
CharacterScene.SetSpin( f33_local3, 0, 0, 0 )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.PCSpin = function ( f34_arg0, f34_arg1 )
|
|
if Engine.IsGamepadEnabled() == 1 then
|
|
return
|
|
end
|
|
local f34_local0 = f34_arg0:getParent()
|
|
f34_local0 = f34_local0.handle
|
|
if not f34_arg0.m_leftMouseDown or not f34_arg1.x then
|
|
CharacterScene.SetSpin( f34_local0, 0, 0, 0 )
|
|
return
|
|
end
|
|
local f34_local1 = LUI.clamp( ((f34_arg0.mouse_last_x or 0) - f34_arg1.x) * -100, -10, 10 )
|
|
if f34_local1 ~= 0 then
|
|
CharacterScene.SetSpin( f34_local0, 0, f34_local1, 0 )
|
|
else
|
|
CharacterScene.SetSpin( f34_local0, 0, 0, 0 )
|
|
end
|
|
f34_arg0.mouse_last_x = f34_arg1.x
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.ChangeAnimOnLoopedEnd = function ( f35_arg0, f35_arg1 )
|
|
LUI.UISquadMemberWindow.DoAnimChange( f35_arg0, f35_arg1 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.ChangeAnimOnEnd = function ( f36_arg0, f36_arg1 )
|
|
LUI.UISquadMemberWindow.DoAnimChange( f36_arg0, f36_arg1 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.WeaponChangeStowed = function ( f37_arg0, f37_arg1 )
|
|
local f37_local0 = f37_arg0:getParent()
|
|
if f37_local0.handle then
|
|
f37_local0 = f37_arg1.weapon
|
|
if not f37_local0 then
|
|
f37_local0 = Cac.BuildWeaponName( f37_arg1.weapon )
|
|
end
|
|
local f37_local1 = CharacterScene.ChangeStowedWeapon
|
|
local f37_local2 = f37_arg0:getParent()
|
|
f37_local1( f37_local2.handle, f37_local0 )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.WeaponChangeStart = function ( f38_arg0, f38_arg1 )
|
|
f38_arg0.new_weapon = f38_arg1.new_weapon
|
|
f38_arg0.prev_weapon = f38_arg1.prev_weapon
|
|
f38_arg0.offline_weapon = f38_arg1.offline_weapon
|
|
f38_arg0:cancelAnimateToState()
|
|
f38_arg0:animateToState( "weapon_change_start", 400 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.IdleChangeAnim = function ( f39_arg0, f39_arg1 )
|
|
local f39_local0 = f39_arg0:getParent()
|
|
local f39_local1 = f39_local0.handle
|
|
local f39_local2 = string.find( f39_arg1.new_weapon, "riotshield" )
|
|
local f39_local3 = string.find( f39_arg1.new_weapon, "knifeonly" )
|
|
local f39_local4 = Cac.Customization.Animations.idles.normal[math.random( 1, #Cac.Customization.Animations.idles.normal )]
|
|
if f39_local2 then
|
|
f39_local4 = Cac.Customization.Animations.idles.riotshield[math.random( 1, #Cac.Customization.Animations.idles.riotshield )]
|
|
elseif f39_local3 then
|
|
f39_local4 = Cac.Customization.Animations.idles.knifeonly[math.random( 1, #Cac.Customization.Animations.idles.knifeonly )]
|
|
end
|
|
if not f39_local0.current_weapon then
|
|
LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 )
|
|
else
|
|
local f39_local5 = string.find( f39_local0.current_weapon, "riotshield" )
|
|
local f39_local6 = string.find( f39_local0.current_weapon, "knifeonly" )
|
|
if not (not f39_local2 or f39_local5) or f39_local3 and not f39_local6 then
|
|
LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 )
|
|
elseif not (f39_local2 or not f39_local5) or not f39_local3 and f39_local6 then
|
|
LUI.UISquadMemberWindow.SetAnimation( f39_local0, f39_local4, 0 )
|
|
end
|
|
end
|
|
f39_local0.current_weapon = f39_arg1.new_weapon
|
|
if not f39_arg0.anim_states then
|
|
f39_arg0.anim_states = {}
|
|
end
|
|
f39_arg0.anim_states[1] = {
|
|
anim_state = "idle",
|
|
anim_name = f39_local4,
|
|
weapon_name = f39_local0.current_weapon
|
|
}
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.AnimateToFirst = function ( f40_arg0, f40_arg1 )
|
|
local f40_local0 = f40_arg0:getParent()
|
|
local f40_local1 = f40_arg0.anim_states[1]
|
|
if f40_local1.anim_state == "grab" then
|
|
CharacterScene.ChangeWeapon( f40_local0.handle, f40_local1.weapon_name and "iw6_knifeonlymenu_mp" or f40_local1.weapon_name )
|
|
f40_local0.current_weapon = f40_local1.weapon_name
|
|
local f40_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f40_local0 )
|
|
if f40_local2.slot then
|
|
local f40_local3 = Cac.BuildPrimaryWeaponName( f40_local2.controller or f40_local2.exclusiveController, f40_local2.squadLocation, f40_local2.squadMemberIndex, f40_local2.classLocation, f40_local2.slot )
|
|
if f40_local3 ~= f40_local1.weapon_name then
|
|
f40_arg0:processEvent( {
|
|
name = "weapon_change_start",
|
|
new_weapon = f40_local3,
|
|
prev_weapon = f40_local1.weapon_name
|
|
} )
|
|
end
|
|
end
|
|
end
|
|
LUI.UISquadMemberWindow.SetAnimation( f40_local0, f40_local1.anim_name, 0.2 )
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.DoAnimChange = function ( f41_arg0, f41_arg1 )
|
|
local f41_local0 = f41_arg0:getParent()
|
|
if f41_arg0.anim_states[1].anim_state == "idle" then
|
|
local f41_local1 = f41_arg0.anim_states[1]
|
|
f41_local1.anim_name = Cac.GetRandomIdleAnim( f41_local1.weapon_name, f41_local1.anim_name )
|
|
LUI.UISquadMemberWindow.SetAnimation( f41_local0, f41_local1.anim_name, 0.2 )
|
|
else
|
|
local f41_local1 = f41_local0.handle
|
|
if #f41_arg0.anim_states > 1 then
|
|
for f41_local2 = 1, #f41_arg0.anim_states, 1 do
|
|
f41_arg0.anim_states[f41_local2] = f41_arg0.anim_states[f41_local2 + 1]
|
|
end
|
|
end
|
|
LUI.UISquadMemberWindow.AnimateToFirst( f41_arg0, f41_arg1 )
|
|
end
|
|
end
|
|
|
|
LUI.UISquadMemberWindow.WeaponChangeAnim = function ( f42_arg0, f42_arg1 )
|
|
local f42_local0 = f42_arg0:getParent()
|
|
local f42_local1 = f42_local0.current_weapon
|
|
local f42_local2 = nil
|
|
if f42_arg1.offline_weapon then
|
|
f42_local2 = f42_arg1.offline_weapon
|
|
else
|
|
f42_local2 = f42_arg1.new_weapon
|
|
end
|
|
if f42_local1 == f42_local2 then
|
|
return
|
|
end
|
|
local f42_local3, f42_local4 = nil
|
|
if f42_local1 and string.find( f42_local1, "riotshield" ) then
|
|
f42_local3 = Cac.Customization.Animations.weapon_grabs.riotshield[1]
|
|
elseif f42_local1 and string.find( f42_local1, "knifeonly" ) then
|
|
f42_local3 = Cac.Customization.Animations.weapon_grabs.knifeonly[1]
|
|
elseif math.random( 1, 2 ) == 1 then
|
|
f42_local3 = Cac.Customization.Animations.weapon_grabs.normal_1[1]
|
|
else
|
|
f42_local3 = Cac.Customization.Animations.weapon_grabs.normal_2[1]
|
|
end
|
|
if string.find( f42_local2, "riotshield" ) then
|
|
f42_local4 = Cac.Customization.Animations.weapon_grabs.riotshield[2]
|
|
elseif string.find( f42_local2, "knifeonly" ) then
|
|
f42_local4 = Cac.Customization.Animations.weapon_grabs.knifeonly[2]
|
|
elseif math.random( 1, 2 ) == 1 then
|
|
f42_local4 = Cac.Customization.Animations.weapon_grabs.normal_1[2]
|
|
else
|
|
f42_local4 = Cac.Customization.Animations.weapon_grabs.normal_2[2]
|
|
end
|
|
if f42_arg0.anim_states[1].anim_state == "idle" then
|
|
f42_arg0.anim_states[1] = {
|
|
anim_state = "toss",
|
|
anim_name = f42_local3,
|
|
weapon_name = f42_local1
|
|
}
|
|
f42_arg0.anim_states[2] = {
|
|
anim_state = "grab",
|
|
anim_name = f42_local4,
|
|
weapon_name = f42_local2
|
|
}
|
|
f42_arg0.anim_states[3] = {
|
|
anim_state = "idle",
|
|
anim_name = Cac.GetRandomIdleAnim( f42_local2 ),
|
|
weapon_name = f42_local2
|
|
}
|
|
LUI.UISquadMemberWindow.AnimateToFirst( f42_arg0, f42_arg1 )
|
|
elseif f42_arg0.anim_states[1].anim_state == "toss" then
|
|
f42_arg0.anim_states[2] = {
|
|
anim_state = "grab",
|
|
anim_name = f42_local4,
|
|
weapon_name = f42_local2
|
|
}
|
|
f42_arg0.anim_states[3] = {
|
|
anim_state = "idle",
|
|
anim_name = Cac.GetRandomIdleAnim( f42_local2 ),
|
|
weapon_name = f42_local2
|
|
}
|
|
elseif f42_arg0.anim_states[1].anim_state == "grab" then
|
|
f42_arg0.anim_states[2] = {
|
|
anim_state = "toss",
|
|
anim_name = f42_local3,
|
|
weapon_name = f42_local1
|
|
}
|
|
f42_arg0.anim_states[3] = {
|
|
anim_state = "grab",
|
|
anim_name = f42_local4,
|
|
weapon_name = f42_local2
|
|
}
|
|
f42_arg0.anim_states[4] = {
|
|
anim_state = "idle",
|
|
anim_name = Cac.GetRandomIdleAnim( f42_local2 ),
|
|
weapon_name = f42_local2
|
|
}
|
|
end
|
|
end
|
|
|
|
LUI.MenuBuilder.registerType( "UISquadMemberWindow", LUI.UISquadMemberWindow.build )
|