Thread: Fading Textures
View Single Post
08-17-18, 07:58 AM   #21
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Okay, this is the barest minimum I needed to get it to work. The fading code used is simply due to its simplicity. I am personally using animation fading in my big project so I'll leave any changes you require up to you.

<YourAddonName>.TOC
Code:
## Interface: 80000
## Title: <YourAddOnName>
## Notes: Shows a Splash Window
## Version: 1.0.7
## Author: Whoever wants to use it honest
## eMail: contactme@myemailaddress
## DefaultState: Enabled
## RequiredDeps: 
## LoadOnDemand: 0
## SavedVariables: 
## SavedVariablesPerCharacter:  PawDB

<YourAddOnName>.lua

<YourAddOnName>.lua
Lua Code:
  1. local addonName, addonData = ...
  2.  
  3. -- Create a new table if it is empty
  4. addonData = addonData or {}
  5.  
  6. -- Get this version of the addon
  7. addonData.version = GetAddOnMetadata(addonName, "Version")
  8.  
  9. -- Force initialisation in case there are no saved variables yet
  10. -- These should get overriden when the saved variables are loaded
  11. PawDB = {}
  12. PawDB.version = nil
  13.  
  14. -- Create the frame and set up its visual details, I've just created a white background
  15. -- By Default it will show so FadeOut immediately via the method you choose
  16. local InstallerLogo = CreateFrame("Frame", addonName.."ILogo", UIParent);
  17. InstallerLogo.Background = InstallerLogo:CreateTexture( "$parentBackground", "BACKGROUND" );
  18.  
  19. -- Create UI Elements
  20. InstallerLogo.Background:SetAllPoints()
  21.  
  22. -- Customize the Elements
  23. InstallerLogo.Background:SetColorTexture(1,1,1,1)
  24.  
  25. -- Fade Out the screen as we don't want to see it by default
  26. UIFrameFadeOut(InstallerLogo,1,1,0)
  27.  
  28. -- Event function
  29. local function OnEvent(self,event,...)
  30.    
  31.     -- if this is the first time entering the world
  32.     if event == "PLAYER_ENTERING_WORLD" then
  33.         local login,reload = ...
  34.        
  35.         -- Displays the two values in the chat frame so you can see what is being tested
  36.         --print(addonData.version, PawDB.version)
  37.  
  38.         -- Only process this block if this is the first time logging in and the version numbers are different
  39.         -- Addons will only know about a TOC change if the change was made before you logged into the game ( character screen is not enough, log right out to the beginning)
  40.         if login == true and addonData.version ~= PawDB.version then
  41.  
  42.             -- Set up the Splash Screens UI with its required data and any other changes not already made
  43.             InstallerLogo:SetSize(850, 480); -- the size of the splash
  44.             InstallerLogo:SetPoint("CENTER"); -- its position on the screen            
  45.  
  46.             -- Then fade it into view using your preferred method
  47.             UIFrameFadeIn(InstallerLogo,1,0,1);
  48.  
  49.             -- Then Update the saved variable table for the character with the new version
  50.             PawDB.version = addonData.version
  51.        end
  52.     end
  53.  end
  54.  
  55.  
  56. -- Create the frame that will monitor events and tell the other frames what to do
  57. local EventWatcher = CreateFrame("Frame")
  58. EventWatcher:RegisterEvent("PLAYER_ENTERING_WORLD");
  59. EventWatcher:SetScript("OnEvent", OnEvent)
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote