Better override strategy
This commit is contained in:
parent
336cea2047
commit
783e2c2a9f
@ -1,65 +1,14 @@
|
|||||||
CoD.playlistCategoryMatchSettingsInfo = InheritFrom( LUI.UIElement )
|
if not CoD.playlistCategoryMatchSettingsInfo then
|
||||||
CoD.playlistCategoryMatchSettingsInfo.new = function ( menu, controller )
|
return
|
||||||
local self = LUI.UIElement.new()
|
end
|
||||||
|
|
||||||
if PreLoadFunc then
|
local oldPlaylistCategoryMatchSettingsInfo = CoD.playlistCategoryMatchSettingsInfo.new
|
||||||
PreLoadFunc( self, controller )
|
function CoD.playlistCategoryMatchSettingsInfo.new(menu, controller)
|
||||||
end
|
local self = oldPlaylistCategoryMatchSettingsInfo(menu, controller)
|
||||||
|
|
||||||
self:setUseStencil( false )
|
-- Hide the playlist count text
|
||||||
self:setClass( CoD.playlistCategoryMatchSettingsInfo )
|
if self.playlistCount then
|
||||||
self.id = "playlistCategoryMatchSettingsInfo"
|
self.playlistCount:setAlpha(0)
|
||||||
self.soundSet = "default"
|
|
||||||
self:setLeftRight( true, false, 0, 450 )
|
|
||||||
self:setTopBottom( true, false, 0, 550 )
|
|
||||||
self.anyChildUsesUpdateState = true
|
|
||||||
|
|
||||||
local categoryInfo = CoD.matchSettingsInfo.new( menu, controller )
|
|
||||||
categoryInfo:setLeftRight( true, false, 0, 450 )
|
|
||||||
categoryInfo:setTopBottom( true, false, 0, 550 )
|
|
||||||
categoryInfo.FRBestTime.BestTimeValueText:setText( Engine.Localize( "--:--:--" ) )
|
|
||||||
categoryInfo:linkToElementModel( self, nil, false, function ( model )
|
|
||||||
categoryInfo:setModel( model, controller )
|
|
||||||
end )
|
|
||||||
categoryInfo:mergeStateConditions( {
|
|
||||||
{
|
|
||||||
stateName = "AspectRatio_1x1",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return AlwaysTrue()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
self:addElement( categoryInfo )
|
|
||||||
self.categoryInfo = categoryInfo
|
|
||||||
|
|
||||||
-- local playlistCount = LUI.UITightText.new()
|
|
||||||
-- playlistCount:setLeftRight( true, false, 1, 446 )
|
|
||||||
-- playlistCount:setTopBottom( true, false, -22, -2 )
|
|
||||||
-- playlistCount:setTTF( "fonts/RefrigeratorDeluxe-Regular.ttf" )
|
|
||||||
-- playlistCount:linkToElementModel( self, "playlistCount", true, function ( model )
|
|
||||||
-- local _playlistCount = Engine.GetModelValue( model )
|
|
||||||
-- if _playlistCount then
|
|
||||||
-- playlistCount:setText( Engine.Localize( _playlistCount ) )
|
|
||||||
-- end
|
|
||||||
-- end )
|
|
||||||
-- self:addElement( playlistCount )
|
|
||||||
-- self.playlistCount = playlistCount
|
|
||||||
|
|
||||||
self.clipsPerState = {
|
|
||||||
DefaultState = {
|
|
||||||
DefaultClip = function ()
|
|
||||||
self:setupElementClipCounter( 0 )
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LUI.OverrideFunction_CallOriginalSecond( self, "close", function ( element )
|
|
||||||
element.categoryInfo:close()
|
|
||||||
-- element.playlistCount:close()
|
|
||||||
end )
|
|
||||||
|
|
||||||
if PostLoadFunc then
|
|
||||||
PostLoadFunc( self, controller, menu )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
@ -1,139 +1,14 @@
|
|||||||
CoD.playlistMatchSettingsInfo = InheritFrom( LUI.UIElement )
|
if not CoD.playlistMatchSettingsInfo then
|
||||||
CoD.playlistMatchSettingsInfo.new = function ( menu, controller )
|
return
|
||||||
local self = LUI.UIElement.new()
|
end
|
||||||
|
|
||||||
if PreLoadFunc then
|
local oldPlaylistMatchSettingsInfo = CoD.playlistMatchSettingsInfo.new
|
||||||
PreLoadFunc( self, controller )
|
function CoD.playlistMatchSettingsInfo.new(menu, controller)
|
||||||
end
|
local self = oldPlaylistMatchSettingsInfo(menu, controller)
|
||||||
|
|
||||||
self:setUseStencil( false )
|
-- Hide the playlist count text
|
||||||
self:setClass( CoD.playlistMatchSettingsInfo )
|
if self.playlistCount then
|
||||||
self.id = "playlistMatchSettingsInfo"
|
self.playlistCount:setAlpha(0)
|
||||||
self.soundSet = "default"
|
|
||||||
self:setLeftRight( true, false, 0, 450 )
|
|
||||||
self:setTopBottom( true, false, 0, 550 )
|
|
||||||
self.anyChildUsesUpdateState = true
|
|
||||||
|
|
||||||
local gameModeInfo = CoD.matchSettingsInfo.new( menu, controller )
|
|
||||||
gameModeInfo:setLeftRight( true, false, 0, 446 )
|
|
||||||
gameModeInfo:setTopBottom( true, false, 0, 550 )
|
|
||||||
gameModeInfo.FRBestTime.BestTimeValueText:setText( Engine.Localize( "--:--:--" ) )
|
|
||||||
gameModeInfo:linkToElementModel( self, nil, false, function ( model )
|
|
||||||
gameModeInfo:setModel( model, controller )
|
|
||||||
end )
|
|
||||||
gameModeInfo:mergeStateConditions( {
|
|
||||||
{
|
|
||||||
stateName = "AspectRatio_1x1",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return AlwaysTrue()
|
|
||||||
end
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
self:addElement( gameModeInfo )
|
|
||||||
self.gameModeInfo = gameModeInfo
|
|
||||||
|
|
||||||
-- local playlistCount = LUI.UIText.new()
|
|
||||||
-- playlistCount:setLeftRight( true, false, 1, 446 )
|
|
||||||
-- playlistCount:setTopBottom( true, false, -22, -2 )
|
|
||||||
-- playlistCount:setTTF( "fonts/RefrigeratorDeluxe-Regular.ttf" )
|
|
||||||
-- playlistCount:setAlignment( Enum.LUIAlignment.LUI_ALIGNMENT_LEFT )
|
|
||||||
-- playlistCount:setAlignment( Enum.LUIAlignment.LUI_ALIGNMENT_TOP )
|
|
||||||
-- playlistCount:linkToElementModel( self, "playlistCount", true, function ( model )
|
|
||||||
-- local _playlistCount = Engine.GetModelValue( model )
|
|
||||||
-- if _playlistCount then
|
|
||||||
-- playlistCount:setText( Engine.Localize( _playlistCount ) )
|
|
||||||
-- end
|
|
||||||
-- end )
|
|
||||||
-- self:addElement( playlistCount )
|
|
||||||
-- self.playlistCount = playlistCount
|
|
||||||
|
|
||||||
local PlaylistSpecialEventWidget = CoD.Playlist_SpecialEventWidget.new( menu, controller )
|
|
||||||
PlaylistSpecialEventWidget:setLeftRight( true, false, 8.55, 408.55 )
|
|
||||||
PlaylistSpecialEventWidget:setTopBottom( true, false, 277, 307 )
|
|
||||||
PlaylistSpecialEventWidget:linkToElementModel( self, nil, false, function ( model )
|
|
||||||
PlaylistSpecialEventWidget:setModel( model, controller )
|
|
||||||
end )
|
|
||||||
PlaylistSpecialEventWidget:mergeStateConditions( {
|
|
||||||
{
|
|
||||||
stateName = "DoubleXPWeaponXP",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleXP", true ) and IsSelfModelValueEqualTo( element, controller, "hasDoubleWeaponXP", true )
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stateName = "DoubleXPDoubleCryptokeys",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleXP", true ) and IsSelfModelValueEqualTo( element, controller, "hasDoubleCryptokeys", true )
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stateName = "WeaponXPDoubleCryptokeysCopy",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleWeaponXP", true ) and IsSelfModelValueEqualTo( element, controller, "hasDoubleCryptokeys", true )
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stateName = "DoubleXP",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleXP", true )
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stateName = "DoubleWeaponXP",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleWeaponXP", true )
|
|
||||||
end
|
|
||||||
},
|
|
||||||
{
|
|
||||||
stateName = "DoubleCryptokeys",
|
|
||||||
condition = function ( menu, element, event )
|
|
||||||
return IsSelfModelValueEqualTo( element, controller, "hasDoubleCryptokeys", true )
|
|
||||||
end
|
|
||||||
}
|
|
||||||
} )
|
|
||||||
PlaylistSpecialEventWidget:linkToElementModel( PlaylistSpecialEventWidget, "hasDoubleXP", true, function ( model )
|
|
||||||
menu:updateElementState( PlaylistSpecialEventWidget, {
|
|
||||||
name = "model_validation",
|
|
||||||
menu = menu,
|
|
||||||
modelValue = Engine.GetModelValue( model ),
|
|
||||||
modelName = "hasDoubleXP"
|
|
||||||
} )
|
|
||||||
end )
|
|
||||||
PlaylistSpecialEventWidget:linkToElementModel( PlaylistSpecialEventWidget, "hasDoubleWeaponXP", true, function ( model )
|
|
||||||
menu:updateElementState( PlaylistSpecialEventWidget, {
|
|
||||||
name = "model_validation",
|
|
||||||
menu = menu,
|
|
||||||
modelValue = Engine.GetModelValue( model ),
|
|
||||||
modelName = "hasDoubleWeaponXP"
|
|
||||||
} )
|
|
||||||
end )
|
|
||||||
PlaylistSpecialEventWidget:linkToElementModel( PlaylistSpecialEventWidget, "hasDoubleCryptokeys", true, function ( model )
|
|
||||||
menu:updateElementState( PlaylistSpecialEventWidget, {
|
|
||||||
name = "model_validation",
|
|
||||||
menu = menu,
|
|
||||||
modelValue = Engine.GetModelValue( model ),
|
|
||||||
modelName = "hasDoubleCryptokeys"
|
|
||||||
} )
|
|
||||||
end )
|
|
||||||
self:addElement( PlaylistSpecialEventWidget )
|
|
||||||
self.PlaylistSpecialEventWidget = PlaylistSpecialEventWidget
|
|
||||||
|
|
||||||
self.clipsPerState = {
|
|
||||||
DefaultState = {
|
|
||||||
DefaultClip = function ()
|
|
||||||
self:setupElementClipCounter( 0 )
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LUI.OverrideFunction_CallOriginalSecond( self, "close", function ( element )
|
|
||||||
element.gameModeInfo:close()
|
|
||||||
element.PlaylistSpecialEventWidget:close()
|
|
||||||
-- element.playlistCount:close()
|
|
||||||
end )
|
|
||||||
|
|
||||||
if PostLoadFunc then
|
|
||||||
PostLoadFunc( self, controller, menu )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user