621 lines
15 KiB
Lua
621 lines
15 KiB
Lua
local f0_local0 = module
|
|
local f0_local1, f0_local2 = ...
|
|
f0_local0( f0_local1, package.seeall )
|
|
CoD.PrintModuleLoad( _NAME )
|
|
ClanInvites = {
|
|
leftPadding = 28
|
|
}
|
|
function OnCreate( f1_arg0, f1_arg1 )
|
|
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
|
|
f1_local0.inviteCount = Clan.GetNumProposals( f1_arg1.controller )
|
|
f1_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton )
|
|
end
|
|
|
|
function AcceptClanInvite( f2_arg0, f2_arg1 )
|
|
Clan.AcceptClanProposal( f2_arg1.controller, f2_arg0.properties.index )
|
|
LUI.FlowManager.RequestLeaveMenu( f2_arg0 )
|
|
f2_arg0:dispatchEventToRoot( {
|
|
name = "leave_clan_invites",
|
|
immediate = true
|
|
} )
|
|
end
|
|
|
|
function DeclineClanInvite( f3_arg0, f3_arg1 )
|
|
local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "clan_invites" )
|
|
Clan.DeclineClanProposal( f3_arg1.controller, f3_arg0.properties.index )
|
|
LUI.FlowManager.RequestLeaveMenu( f3_arg0 )
|
|
f3_local0.inviteCount = f3_local0.inviteCount - 1
|
|
if f3_local0.inviteCount == 0 then
|
|
f3_arg0:dispatchEventToRoot( {
|
|
name = "leave_clan_invites",
|
|
immediate = true
|
|
} )
|
|
end
|
|
end
|
|
|
|
function ClanInviteDecisionFeeder( f4_arg0, f4_arg1 )
|
|
local f4_local0 = {
|
|
[#f4_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "invite",
|
|
properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
|
|
button_text = Engine.Localize( "@LUA_MENU_CLAN_ACCEPT_INVITATION" ),
|
|
index = f4_arg0.index,
|
|
button_action_func = AcceptClanInvite
|
|
}
|
|
},
|
|
[#f4_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "join",
|
|
properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
|
|
button_text = Engine.Localize( "@LUA_MENU_CLAN_DECLINE_INVITATION" ),
|
|
index = f4_arg0.index,
|
|
button_action_func = DeclineClanInvite
|
|
}
|
|
}
|
|
}
|
|
return f4_local0
|
|
end
|
|
|
|
function popup_invite_decision()
|
|
return {
|
|
type = "generic_selectionList_popup",
|
|
id = "popup_invite_decision",
|
|
properties = {
|
|
popup_title = Engine.Localize( "@LUA_MENU_CLAN_INVITE_CAPS" ),
|
|
popup_childfeeder = ClanInviteDecisionFeeder
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function InviteDecision( f6_arg0, f6_arg1 )
|
|
LUI.FlowManager.RequestPopupMenu( f6_arg0, "popup_invite_decision", true, f6_arg1.controller, false, {
|
|
index = f6_arg0.properties.index
|
|
} )
|
|
end
|
|
|
|
function ClanInviteFeeder( f7_arg0 )
|
|
local f7_local0 = {}
|
|
local f7_local1 = Clan.GetNumProposals( f7_arg0.exclusiveController )
|
|
for f7_local2 = 0, f7_local1 - 1, 1 do
|
|
local f7_local5 = {
|
|
type = "UIGenericButton",
|
|
id = "clan_invite_button_" .. f7_local2
|
|
}
|
|
local f7_local6 = {
|
|
button_text = Engine.Localize( "PATCH_MENU_INVITE_NUMBER", f7_local2 + 1 ),
|
|
index = f7_local2,
|
|
button_action_func = InviteDecision
|
|
}
|
|
local f7_local7 = MBh.DoMultiple
|
|
local f7_local8 = {}
|
|
local f7_local9 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_name",
|
|
newName = Clan.GetProposalClanName( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
local f7_local10 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_level",
|
|
newLevel = Clan.GetProposalClanLevel( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
local f7_local11 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_leader",
|
|
newLeader = Clan.GetProposalClanLeaderName( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
local f7_local12 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_kd",
|
|
newKD = Clan.GetProposalClanKD( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
local f7_local13 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_member_count",
|
|
newMemberCount = Clan.GetProposalClanMemberCount( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
local f7_local14 = MBh.EmitEventToRoot( {
|
|
name = "update_clan_message",
|
|
newMessage = Clan.GetProposalMessage( f7_arg0.exclusiveController, f7_local2 ),
|
|
immediate = true
|
|
} )
|
|
f7_local6.button_over_func = f7_local7( f7_local9 )
|
|
f7_local5.properties = f7_local6
|
|
f7_local0[#f7_local0 + 1] = f7_local5
|
|
end
|
|
return f7_local0
|
|
end
|
|
|
|
function clan_invite_vlist()
|
|
return {
|
|
type = "UIVerticalList",
|
|
focusable = true,
|
|
states = {
|
|
default = {
|
|
alignment = LUI.Alignment.Top,
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = GenericMenuDims.menu_left,
|
|
right = GenericMenuDims.menu_right,
|
|
top = GenericMenuDims.menu_top,
|
|
bottom = GenericMenuDims.menu_bottom
|
|
}
|
|
},
|
|
handlers = {
|
|
close_actions = function ( f9_arg0, f9_arg1 )
|
|
f9_arg0:closeChildren()
|
|
f9_arg0:dispatchEventToRoot( {
|
|
name = "menu_refresh",
|
|
immediate = true
|
|
} )
|
|
f9_arg0:processEvent( {
|
|
name = "gain_focus"
|
|
} )
|
|
end
|
|
|
|
}
|
|
}
|
|
end
|
|
|
|
function LeaveClanInviteMenu( f10_arg0, f10_arg1 )
|
|
LUI.FlowManager.RequestLeaveMenu( f10_arg0 )
|
|
end
|
|
|
|
function UpdateClanName( f11_arg0, f11_arg1 )
|
|
assert( f11_arg1.newName )
|
|
f11_arg0:setText( f11_arg1.newName )
|
|
end
|
|
|
|
function UpdateClanLevel( f12_arg0, f12_arg1 )
|
|
assert( f12_arg1.newLevel )
|
|
f12_arg0:setText( f12_arg1.newLevel )
|
|
end
|
|
|
|
function UpdateClanLeader( f13_arg0, f13_arg1 )
|
|
assert( f13_arg1.newLeader )
|
|
f13_arg0:setText( f13_arg1.newLeader )
|
|
end
|
|
|
|
function UpdateClanKD( f14_arg0, f14_arg1 )
|
|
assert( f14_arg1.newKD )
|
|
f14_arg0:processEvent( {
|
|
name = "update_stat_text",
|
|
newStatText = f14_arg1.newKD
|
|
} )
|
|
end
|
|
|
|
function UpdateClanMemberCount( f15_arg0, f15_arg1 )
|
|
assert( f15_arg1.newMemberCount )
|
|
f15_arg0:processEvent( {
|
|
name = "update_stat_text",
|
|
newStatText = f15_arg1.newMemberCount
|
|
} )
|
|
end
|
|
|
|
function UpdateClanMessage( f16_arg0, f16_arg1 )
|
|
assert( f16_arg1.newMessage )
|
|
f16_arg0:setText( f16_arg1.newMessage )
|
|
end
|
|
|
|
function ClanInvitesInfoFeeder( f17_arg0 )
|
|
local f17_local0 = {
|
|
[#f17_local0 + 1] = {
|
|
type = "UIMarqueeText",
|
|
id = "clan_name",
|
|
properties = {
|
|
text = "",
|
|
defaultAnimationState = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding,
|
|
top = 0,
|
|
right = -28,
|
|
height = CoD.TextSettings.ExtraBigFont.Height,
|
|
font = CoD.TextSettings.ExtraBigFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
}
|
|
},
|
|
handlers = {
|
|
update_clan_name = UpdateClanName
|
|
}
|
|
},
|
|
[#f17_local0 + 1] = {
|
|
type = "UIElement",
|
|
id = "clan_level_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
bottom = CoD.TextSettings.NormalFont.Height
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "clan_level_text",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.grey_5, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding,
|
|
top = 0,
|
|
right = 0,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "PATCH_MENU_CLAN_LEVEL_COLON_CAPS" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "clan_level_icon_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = ClanInvites.leftPadding + 110,
|
|
top = 0,
|
|
right = ClanInvites.leftPadding + 154,
|
|
bottom = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIImage",
|
|
id = "clan_level_icon",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
top = -10,
|
|
right = 0,
|
|
height = 44,
|
|
material = RegisterMaterial( "icon_clan_level_bg" )
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIText",
|
|
id = "clan_level_number",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.black, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Center
|
|
} )
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_clan_level = UpdateClanLevel
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
[#f17_local0 + 1] = {
|
|
type = "UIElement",
|
|
id = "clan_leader_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
bottom = CoD.TextSettings.NormalFont.Height
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIMarqueeText",
|
|
id = "clan_leader_text",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.grey_5, {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding,
|
|
top = 0,
|
|
right = 170,
|
|
height = CoD.TextSettings.BoldFont.Height,
|
|
font = CoD.TextSettings.BoldFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
},
|
|
properties = {
|
|
text = Engine.Localize( "PATCH_MENU_CLAN_LEADER_COLON_CAPS" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIMarqueeText",
|
|
id = "clan_leader_name",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.frontend_hilite, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding + 142,
|
|
top = 0,
|
|
right = -28,
|
|
bottom = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_clan_leader = UpdateClanLeader
|
|
}
|
|
}
|
|
}
|
|
},
|
|
[#f17_local0 + 1] = {
|
|
type = "UIElement",
|
|
id = "clan_stats_container",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding - 10,
|
|
top = 0,
|
|
right = -28,
|
|
bottom = 50
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "aar_stats_widget",
|
|
id = "kd_stats_widget",
|
|
properties = {
|
|
label_text = Engine.Localize( "@LUA_MENU_CLAN_KD_RATIO" ),
|
|
stat_text = "",
|
|
stat_text_r = Colors.white.r,
|
|
stat_text_g = Colors.white.g,
|
|
stat_text_b = Colors.white.b,
|
|
label_text_r = Colors.white.r,
|
|
label_text_g = Colors.white.g,
|
|
label_text_b = Colors.white.b,
|
|
stat_text_indent = 235
|
|
},
|
|
handlers = {
|
|
update_clan_kd = UpdateClanKD
|
|
}
|
|
},
|
|
{
|
|
type = "aar_stats_widget",
|
|
id = "members_stats_widget",
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
right = 0,
|
|
top = 26,
|
|
bottom = 50
|
|
}
|
|
},
|
|
properties = {
|
|
label_text = Engine.Localize( "@PATCH_MENU_MEMBERS" ),
|
|
stat_text = "",
|
|
stat_text_r = Colors.white.r,
|
|
stat_text_g = Colors.white.g,
|
|
stat_text_b = Colors.white.b,
|
|
label_text_r = Colors.white.r,
|
|
label_text_g = Colors.white.g,
|
|
label_text_b = Colors.white.b,
|
|
stat_text_indent = 235
|
|
},
|
|
handlers = {
|
|
update_clan_member_count = UpdateClanMemberCount
|
|
}
|
|
}
|
|
}
|
|
},
|
|
[#f17_local0 + 1] = {
|
|
type = "UIStencil",
|
|
id = "clan_message_stencil",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.white, {
|
|
leftAnchor = true,
|
|
rightAnchor = false,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = ClanInvites.leftPadding,
|
|
top = 0,
|
|
right = 412,
|
|
height = CoD.TextSettings.NormalFont.Height * 8
|
|
} )
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIMarqueeText",
|
|
id = "clan_message",
|
|
states = {
|
|
default = CoD.ColorizeState( Colors.white, {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
left = 0,
|
|
top = 0,
|
|
right = 0,
|
|
height = CoD.TextSettings.NormalFont.Height,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
alignment = LUI.Alignment.Left
|
|
} )
|
|
},
|
|
properties = {
|
|
text = ""
|
|
},
|
|
handlers = {
|
|
update_clan_message = UpdateClanMessage
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return f17_local0
|
|
end
|
|
|
|
function clan_invites()
|
|
return {
|
|
type = "UIElement",
|
|
id = "clan_invites",
|
|
handlers = {
|
|
menu_create = OnCreate,
|
|
leave_clan_invites = MBh.LeaveMenu()
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_menu_title",
|
|
id = "clan_invites_title_id",
|
|
properties = {
|
|
menu_title = Engine.Localize( "@LUA_MENU_CLAN_CLAN_INVITES_CAPS" )
|
|
}
|
|
},
|
|
{
|
|
type = "UIElement",
|
|
id = "clan_invites_info_container",
|
|
states = {
|
|
default = {
|
|
left = -100,
|
|
top = -250,
|
|
width = 440,
|
|
height = 536
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_menu_titlebar",
|
|
id = "clan_invites_title",
|
|
properties = {
|
|
font = CoD.TextSettings.BoldFont,
|
|
title_bar_text = Engine.Localize( "CLANS_CLAN_DETAILS_CAPS" ),
|
|
title_bar_text_indent = GenericTitleBarDims.TitleBarLCapWidth,
|
|
title_bar_alignment = LUI.Alignment.Left
|
|
}
|
|
},
|
|
{
|
|
type = "generic_menu_background_withfade",
|
|
id = "clan_invites_background",
|
|
properties = {
|
|
shadow_alpha = 0.6,
|
|
fill_alpha = 0.8
|
|
}
|
|
},
|
|
{
|
|
type = "UIVerticalList",
|
|
id = "clan_invites_content",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = GenericTitleBarDims.TitleBarHeight + 5,
|
|
bottom = 0,
|
|
left = 1,
|
|
right = -1,
|
|
spacing = 20
|
|
}
|
|
},
|
|
childrenFeeder = ClanInvitesInfoFeeder
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "clan_invite_vlist",
|
|
id = "clan_invite_list",
|
|
childrenFeeder = ClanInviteFeeder
|
|
},
|
|
{
|
|
type = "button_helper_text_main",
|
|
id = "clans_button_helper_text_id"
|
|
},
|
|
{
|
|
type = "online_friends_widget",
|
|
id = "online_friends_widget_id"
|
|
},
|
|
{
|
|
type = "UIBindButton",
|
|
id = "squad_results_back_id",
|
|
handlers = {
|
|
button_secondary = LeaveClanInviteMenu
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "clan_invites", clan_invites )
|
|
LUI.MenuBuilder.registerDef( "clan_invite_vlist", clan_invite_vlist )
|
|
LUI.MenuBuilder.registerDef( "popup_invite_decision", popup_invite_decision )
|
|
LockTable( _M )
|