Show achievement rarity

This commit is contained in:
fed 2023-04-11 03:20:27 +02:00
parent 4fb7c18992
commit 82df572862
32 changed files with 449 additions and 36 deletions

View File

@ -57,7 +57,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
end end
for i = 0, achievements.count() - 1 do for i = 0, achievements.count() - 1 do
local trophyimage = LUI.UIImage.new({ local btnbg = LUI.UIImage.new({
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
width = menuwidth, width = menuwidth,
@ -65,38 +65,45 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
material = RegisterMaterial("h2_btn_unfocused") material = RegisterMaterial("h2_btn_unfocused")
}) })
trophyimage:setup9SliceImage() btnbg:setup9SliceImage()
trophyimage:registerAnimationState("locked", { btnbg:registerAnimationState("locked", {
material = RegisterMaterial("h2_btn_unfocused_locked") material = RegisterMaterial("h2_btn_unfocused_locked")
}) })
local stroke = LUI.UIImage.new({ local raritynames = {
"common",
"rare",
"legendary",
"epic",
}
local rarityname = raritynames[achievements.getrarity(i) + 1]
local raritystrip = LUI.UIImage.new({
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
width = menuwidth, width = 10,
height = itemwidth, height = itemwidth,
material = RegisterMaterial("h2_btn_focused_stroke") material = RegisterMaterial("depot_button_rarity_strip_" .. rarityname)
}) })
stroke:registerAnimationState("hide", { raritystrip:registerAnimationState("hide", {
alpha = 0 alpha = 0
}) })
stroke:registerAnimationState("show", { raritystrip:registerAnimationState("show", {
alpha = 1 alpha = 1
}) })
stroke:setup9SliceImage() raritystrip:setup9SliceImage()
local glow = LUI.UIImage.new({ local glow = LUI.UIImage.new({
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
left = -20, width = menuwidth,
top = -20, height = itemwidth,
width = menuwidth + 40, material = RegisterMaterial("depot_button_rarity_glow_" .. rarityname)
height = itemwidth + 40,
material = RegisterMaterial("h2_btn_focused_outerglow")
}) })
glow:registerAnimationState("hide", { glow:registerAnimationState("hide", {
@ -107,27 +114,24 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
alpha = 1 alpha = 1
}) })
glow:setup9SliceImage() local glow2 = LUI.UIImage.new({
local pattern = LUI.UIImage.new({
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
width = menuwidth, width = menuwidth,
height = itemwidth, height = itemwidth,
material = RegisterMaterial("h2_btn_dot_pattern") material = RegisterMaterial("depot_button_rarity_glow_" .. rarityname)
}) })
pattern:registerAnimationState("hide", { glow2:registerAnimationState("hide", {
alpha = 0 alpha = 0
}) })
pattern:registerAnimationState("show", { glow2:registerAnimationState("show", {
alpha = 1 alpha = 1
}) })
stroke:animateToState("hide")
pattern:animateToState("hide")
glow:animateToState("hide") glow:animateToState("hide")
glow2:animateToState("hide")
local achievementcontainer = LUI.UIElement.new({ local achievementcontainer = LUI.UIElement.new({
topAnchor = true, topAnchor = true,
@ -140,7 +144,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
top = itemspacing / 2, top = itemspacing / 2,
left = itemspacing / 2, left = itemspacing / 2 + 10,
width = itemwidth - itemspacing, width = itemwidth - itemspacing,
height = itemwidth - itemspacing, height = itemwidth - itemspacing,
material = RegisterMaterial("trophy_" .. i) material = RegisterMaterial("trophy_" .. i)
@ -150,7 +154,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
top = itemspacing / 2 + 15, top = itemspacing / 2 + 15,
left = itemspacing / 2 + 15, left = itemspacing / 2 + 15 + 10,
width = itemwidth - itemspacing - 30, width = itemwidth - itemspacing - 30,
height = itemwidth - itemspacing - 30, height = itemwidth - itemspacing - 30,
material = RegisterMaterial("icon_lock_mini") material = RegisterMaterial("icon_lock_mini")
@ -161,7 +165,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
top = itemspacing + 5, top = itemspacing + 5,
left = itemwidth + 5, left = itemwidth + 5 + 10,
color = { color = {
r = 0.7, r = 0.7,
g = 0.7, g = 0.7,
@ -176,7 +180,7 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
topAnchor = true, topAnchor = true,
leftAnchor = true, leftAnchor = true,
top = itemspacing + CoD.TextSettings.Font23.Height + 10, top = itemspacing + CoD.TextSettings.Font23.Height + 10,
left = itemwidth + 5, left = itemwidth + 5 + 10,
width = textwidth, width = textwidth,
alignment = LUI.Alignment.Left, alignment = LUI.Alignment.Left,
color = { color = {
@ -200,41 +204,44 @@ LUI.MenuBuilder.registerType("achievements_menu", function(root, controller)
achievementcontainer:setHandleMouse(true) achievementcontainer:setHandleMouse(true)
local locked = not achievementtable[i] local locked = not achievementtable[i]
if (locked) then
raritystrip:animateToState("hide")
end
achievementcontainer:registerEventHandler("mouseenter", function() achievementcontainer:registerEventHandler("mouseenter", function()
Engine.PlaySound(CoD.SFX.MouseOver) Engine.PlaySound(CoD.SFX.MouseOver)
if (locked) then if (locked) then
trophyimage:setImage(RegisterMaterial("h2_btn_focused_locked")) btnbg:setImage(RegisterMaterial("h2_btn_focused_locked"))
else else
stroke:animateToState("show") raritystrip:animateToState("show")
pattern:animateToState("show")
title:animateToState("focused") title:animateToState("focused")
desc:animateToState("focused") desc:animateToState("focused")
glow:animateToState("show") glow:animateToState("show")
glow2:animateToState("show")
end end
end) end)
achievementcontainer:registerEventHandler("mouseleave", function() achievementcontainer:registerEventHandler("mouseleave", function()
if (locked) then if (locked) then
trophyimage:setImage(RegisterMaterial("h2_btn_unfocused_locked")) btnbg:setImage(RegisterMaterial("h2_btn_unfocused_locked"))
else else
stroke:animateToState("hide")
pattern:animateToState("hide")
title:animateToState("default") title:animateToState("default")
desc:animateToState("default") desc:animateToState("default")
glow:animateToState("hide") glow:animateToState("hide")
glow2:animateToState("hide")
end end
end) end)
achievementcontainer:addElement(trophyimage) achievementcontainer:addElement(btnbg)
achievementcontainer:addElement(pattern)
achievementcontainer:addElement(glow) achievementcontainer:addElement(glow)
achievementcontainer:addElement(stroke) achievementcontainer:addElement(glow2)
achievementcontainer:addElement(raritystrip)
achievementcontainer:addElement(image) achievementcontainer:addElement(image)
achievementcontainer:addElement(title) achievementcontainer:addElement(title)
achievementcontainer:addElement(desc) achievementcontainer:addElement(desc)
if (locked) then if (locked) then
trophyimage:animateToState("locked") btnbg:animateToState("locked")
image:animateToState("locked") image:animateToState("locked")
desc:setText("") desc:setText("")
end end

View File

@ -20,6 +20,22 @@ material,featured_panel_thumbnail_7
material,featured_panel_thumbnail_8 material,featured_panel_thumbnail_8
material,motd_image material,motd_image
material,depot_button_rarity_corner_common
material,depot_button_rarity_corner_epic
material,depot_button_rarity_corner_legendary
material,depot_button_rarity_corner_rare
material,depot_button_rarity_corner_reward
material,depot_button_rarity_glow_common
material,depot_button_rarity_glow_epic
material,depot_button_rarity_glow_legendary
material,depot_button_rarity_glow_rare
material,depot_button_rarity_glow_reward
material,depot_button_rarity_strip_common
material,depot_button_rarity_strip_epic
material,depot_button_rarity_strip_legendary
material,depot_button_rarity_strip_rare
material,depot_button_rarity_strip_reward
material,trophy_border material,trophy_border
material,trophy_0 material,trophy_0
material,trophy_1 material,trophy_1

1 material h2_ui_featured_pip_focused
20 material featured_panel_thumbnail_8
21 material motd_image
22 material trophy_border depot_button_rarity_corner_common
23 material depot_button_rarity_corner_epic
24 material depot_button_rarity_corner_legendary
25 material depot_button_rarity_corner_rare
26 material depot_button_rarity_corner_reward
27 material depot_button_rarity_glow_common
28 material depot_button_rarity_glow_epic
29 material depot_button_rarity_glow_legendary
30 material depot_button_rarity_glow_rare
31 material depot_button_rarity_glow_reward
32 material depot_button_rarity_strip_common
33 material depot_button_rarity_strip_epic
34 material depot_button_rarity_strip_legendary
35 material depot_button_rarity_strip_rare
36 material depot_button_rarity_strip_reward
37 material trophy_border
38 material trophy_0
39 material trophy_0 trophy_1
40 material trophy_1 trophy_2
41 material trophy_2 trophy_3

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_corner_common",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_activecorner_common",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_corner_epic",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_activecorner_epic",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_corner_legendary",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_activecorner_legendary",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_corner_rare",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_activecorner_rare",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_corner_reward",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_activecorner_reward",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_glow_common",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_bggradient_common",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_glow_epic",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_bggradient_epic",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_glow_legendary",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_bggradient_legendary",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_glow_rare",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_bggradient_rare",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_glow_reward",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_bggradient_reward",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_strip_common",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_leftstrip_common",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_strip_epic",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_leftstrip_epic",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_strip_legendary",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_leftstrip_legendary",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_strip_rare",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_leftstrip_rare",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}

View File

@ -0,0 +1,26 @@
{
"name": "depot_button_rarity_strip_reward",
"techniqueSet->name": "2d",
"gameFlags": 0,
"sortKey": 61,
"renderFlags": 0,
"textureAtlasRowCount": 1,
"textureAtlasColumnCount": 1,
"textureAtlasFrameBlend": 0,
"textureAtlasAsArray": 0,
"surfaceTypeBits": 0,
"cameraRegion": 14,
"materialType": 0,
"assetFlags": 0,
"constantTable": null,
"textureTable": [
{
"image": "h1_depot_rarity_leftstrip_reward",
"semantic": 0,
"samplerState": 226,
"lastCharacter": 112,
"firstCharacter": 99,
"typeHash": 2695565377
}
]
}