From 7aaf002fcb08960d4927884a708a44f341ccb1b9 Mon Sep 17 00:00:00 2001 From: "born a rick, raised a morty, died a jerry" Date: Sat, 24 Nov 2018 17:28:27 -0500 Subject: [PATCH] added possibly templateable mouse select for profile screen the whole screen should probably be rewritten though --- .../ScreenSelectProfile overlay.lua | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Themes/Til Death/BGAnimations/ScreenSelectProfile overlay.lua b/Themes/Til Death/BGAnimations/ScreenSelectProfile overlay.lua index 5c8c0c10ab..190eb14252 100644 --- a/Themes/Til Death/BGAnimations/ScreenSelectProfile overlay.lua +++ b/Themes/Til Death/BGAnimations/ScreenSelectProfile overlay.lua @@ -1,4 +1,30 @@ ---Commenting out the Player 2 stuff so if someone is attempting to use this theme for versus or 2P side, it's not going to work. Go use Prim's original spawnhack theme for that. -Misterkister +local function selectprofile(self) + if isOver(self) then + SCREENMAN:GetTopScreen():SetProfileIndex(PLAYER_1, self:GetParent():GetName() + 1) + SCREENMAN:GetTopScreen():Finish() + end +end +local function genericHighlight(self, highlight, base, clickaction) + self:SetUpdateFunction(function(self) + self:RunCommandsOnChildren( + function(self) + if isOver(self) then + self:diffusealpha(highlight) + else + self:diffusealpha(base) + end + end + ) + end) + self:SetUpdateRate(0.5) + if clickaction then + self:RunCommandsOnChildren( + function(self) + self:addcommand("LeftClickMessage", clickaction) + end + ) + end +end function GetLocalProfiles() local t = {} @@ -8,11 +34,15 @@ function GetLocalProfiles() local profile = PROFILEMAN:GetLocalProfileFromIndex(p) local ProfileCard = Def.ActorFrame { + Name = p, + InitCommand = function(self) + genericHighlight(self, 0.75, 1, selectprofile) + end, LoadFont("Common Large") .. { Text = string.format("%s: %.2f", profile:GetDisplayName(), profile:GetPlayerRating()), InitCommand = function(self) - self:xy(34 / 2, -10):zoom(0.4):ztest(true, maxwidth, (200 - 34 - 4) / 0.4) + self:xy(34 / 2, -10):zoom(0.4):ztest(true, maxwidth, (200 - 34 - 4) / 0.4) end }, LoadFont("Common Normal") ..